Skip to content
Closed
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions classes/helpers/FrmAppHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -1167,6 +1167,8 @@ private static function allowed_html( $allowed ) {

/**
* @since 2.05.03
*
* @return array
*/
private static function safe_html() {
$allow_class = array(
Expand Down
3 changes: 3 additions & 0 deletions classes/helpers/FrmEntriesListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,9 @@ class FrmEntriesListHelper extends FrmListHelper {
*/
public $total_items = 0;

/**
* @param array $args
*/
public function __construct( $args ) {
parent::__construct( $args );
$this->screen->set_screen_reader_content(
Expand Down
3 changes: 3 additions & 0 deletions classes/helpers/FrmFormsListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@ class FrmFormsListHelper extends FrmListHelper {

public $total_items = 0;

/**
* @param array $args
*/
public function __construct( $args ) {
$this->status = self::get_param( array( 'param' => 'form_type' ) );

Expand Down
3 changes: 3 additions & 0 deletions classes/helpers/FrmListHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,6 +162,9 @@ public function ajax_user_can() {
return current_user_can( 'administrator' );
}

/**
* @return array
*/
public function get_columns() {
return array();
}
Expand Down
3 changes: 3 additions & 0 deletions classes/models/FrmOnSubmitAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,9 @@ public function form( $instance, $args = array() ) {
include FrmAppHelper::plugin_path() . '/classes/views/frm-form-actions/on_submit_settings.php';
}

/**
* @return array
*/
public function get_defaults() {
return array(
'success_action' => FrmOnSubmitHelper::get_default_action_type(),
Expand Down
4 changes: 4 additions & 0 deletions classes/models/fields/FrmFieldCheckbox.php
Original file line number Diff line number Diff line change
Expand Up @@ -116,6 +116,10 @@ protected function show_readonly_hidden() {
return true;
}

/**
* @param array $atts
* @param mixed $value
*/
protected function prepare_import_value( $value, $atts ) {
return $this->get_multi_opts_for_import( $value );
}
Comment on lines +119 to 125
Copy link
Copy Markdown
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Parameter order in docblock doesn't match method signature.

The method signature is prepare_import_value( $value, $atts ), but the docblock lists @param array $atts before @param mixed $value. The parameters should be documented in the same order as they appear in the method signature.

Suggested fix
 	/**
-	 * `@param` array $atts
 	 * `@param` mixed $value
+	 * `@param` array $atts
 	 */
 	protected function prepare_import_value( $value, $atts ) {
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
/**
* @param array $atts
* @param mixed $value
*/
protected function prepare_import_value( $value, $atts ) {
return $this->get_multi_opts_for_import( $value );
}
/**
* `@param` mixed $value
* `@param` array $atts
*/
protected function prepare_import_value( $value, $atts ) {
return $this->get_multi_opts_for_import( $value );
}
🧰 Tools
🪛 PHPMD (2.15.0)

123-123: Avoid unused parameters such as '$atts'. (undefined)

(UnusedFormalParameter)

🤖 Prompt for AI Agents
In `@classes/models/fields/FrmFieldCheckbox.php` around lines 119 - 125, The
docblock for prepare_import_value in FrmFieldCheckbox.php lists `@param` array
$atts before `@param` mixed $value which is opposite the method signature
prepare_import_value($value, $atts); update the docblock so parameters are
documented in the same order as the signature (first `@param` mixed $value, then
`@param` array $atts) and ensure the types and descriptions match the actual
parameters used by get_multi_opts_for_import.

Expand Down
3 changes: 3 additions & 0 deletions classes/models/fields/FrmFieldNumber.php
Original file line number Diff line number Diff line change
Expand Up @@ -59,6 +59,9 @@ protected function add_extra_html_atts( $args, &$input_html ) {
$this->add_min_max( $args, $input_html );
}

/**
* @param array $args
*/
public function validate( $args ) {
$errors = array();

Expand Down
4 changes: 4 additions & 0 deletions classes/models/fields/FrmFieldSelect.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,6 +91,10 @@ protected function show_readonly_hidden() {
return true;
}

/**
* @param array $atts
* @param mixed $value
*/
protected function prepare_import_value( $value, $atts ) {
if ( FrmField::is_option_true( $this->field, 'multiple' ) ) {
$value = $this->get_multi_opts_for_import( $value );
Expand Down
3 changes: 3 additions & 0 deletions classes/models/fields/FrmFieldText.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,6 +39,9 @@ protected function field_settings_for_type() {
);
}

/**
* @param array $args
*/
public function validate( $args ) {
$errors = parent::validate( $args );
$max_length = intval( FrmField::get_option( $this->field, 'max' ) );
Expand Down
4 changes: 4 additions & 0 deletions classes/models/fields/FrmFieldTextarea.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public function show_on_form_builder( $name = '' ) {
echo '</textarea>';
}

/**
* @param array $atts
* @param mixed $value
*/
protected function prepare_display_value( $value, $atts ) {
FrmFieldsHelper::run_wpautop( $atts, $value );
return $value;
Expand Down
7 changes: 7 additions & 0 deletions classes/models/fields/FrmFieldUrl.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,6 +65,9 @@
}
}

/**
* @param array $args
*/
public function validate( $args ) {
$value = $args['value'];

Expand All @@ -89,9 +92,13 @@
return $errors;
}

/**
* @param array $atts
* @param mixed $value
*/
protected function prepare_display_value( $value, $atts ) {
if ( ! $atts['html'] ) {
return $value;

Check failure on line 101 in classes/models/fields/FrmFieldUrl.php

View workflow job for this annotation

GitHub Actions / PHPStan

Method FrmFieldUrl::prepare_display_value() should return array|string but returns mixed.
}

$images = '';
Expand Down
8 changes: 8 additions & 0 deletions classes/models/fields/FrmFieldUserID.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,6 +48,9 @@ protected function include_form_builder_file() {
return FrmAppHelper::plugin_path() . '/classes/views/frm-fields/back-end/field-user-id.php';
}

/**
* @param array $args
*/
public function prepare_field_html( $args ) {
$args = $this->fill_display_field_values( $args );
$value = $this->get_field_value( $args );
Expand All @@ -71,6 +74,11 @@ protected function get_field_value( $args ) {
return is_numeric( $this->field['value'] ) || $posted_value || $updating ? $this->field['value'] : $user_ID;
}

/**
* @param array $args
*
* @return array
*/
public function validate( $args ) {
// phpcs:ignore Universal.Operators.StrictComparisons
if ( '' == $args['value'] ) {
Expand Down
Loading
Loading