diff --git a/classes/controllers/FrmAppController.php b/classes/controllers/FrmAppController.php index 85acdb14da..14fc773e93 100644 --- a/classes/controllers/FrmAppController.php +++ b/classes/controllers/FrmAppController.php @@ -1630,8 +1630,7 @@ private static function is_our_callback_array( $callback ) { private static function add_missing_tables() { FrmAppHelper::permission_check( 'frm_view_forms' ); - $inbox = new FrmInbox(); - $error = $inbox->check_for_error(); + $error = FrmInbox::check_for_error(); if ( ! $error || 'failed-to-create-tables' !== $error['key'] ) { // Confirm the inbox item with this CTA exists. diff --git a/classes/controllers/FrmFormsController.php b/classes/controllers/FrmFormsController.php index 5f660b8102..910d578012 100644 --- a/classes/controllers/FrmFormsController.php +++ b/classes/controllers/FrmFormsController.php @@ -1212,8 +1212,7 @@ public static function display_forms_list( $params = array(), $message = '', $er die(); } - $inbox = new FrmInbox(); - $error = $inbox->check_for_error(); + $error = FrmInbox::check_for_error(); if ( $error ) { $show_messages = array( $error['subject'] . '. ' . $error['message'] ); diff --git a/classes/models/FrmInbox.php b/classes/models/FrmInbox.php index 77372f2604..61915033e4 100644 --- a/classes/models/FrmInbox.php +++ b/classes/models/FrmInbox.php @@ -597,6 +597,7 @@ public static function check_for_error() { return $message; } } + return false; } } diff --git a/composer.json b/composer.json index 91ea72c682..48922e3189 100644 --- a/composer.json +++ b/composer.json @@ -39,7 +39,8 @@ "phpstan/extension-installer": "^1.3", "slevomat/coding-standard": "~8.0", "friendsofphp/php-cs-fixer": "^3.54", - "rector/rector": "^2.2.14" + "rector/rector": "^2.2.14", + "phpstan/phpstan-strict-rules": "^2.0" }, "config": { "allow-plugins": { diff --git a/phpstan.neon b/phpstan.neon index 02a1477ca9..e98bb9be35 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -273,6 +273,31 @@ parameters: - message: '#function array_map expects#' - message: '#expects resource#' - message: '#might not be defined#' - - message: '#expects false, string given#' - message: '#array given#' - message: '#Cannot use \+\+ on int\|false#' + - message: '#Only booleans are allowed in an (elseif|if) condition#' + - message: '#Only booleans are allowed in a negated boolean#' + - message: '#Only booleans are allowed in a ternary operator condition#' + - message: '#Loose comparison via "(!=|==)" is not allowed#' + - message: '#Variable property access on#' + - message: '#does not call parent constructor#' + - message: '#Only booleans are allowed in (&&|\|\|)#' + - message: '#Variable method call on#' + - message: '#requires parameter \#[\d]* to be set#' + - message: '#array_filter\(\) requires parameter \#2 to be passed to avoid loose comparison semantics.#' + - message: '#Static call to __construct\(\) is only allowed on a parent class in the constructor#' + - message: '#Variable static method call on#' + - + message: '#should be contravariant with#' + paths: + - classes/helpers/FrmFormsListHelper.php + - classes/models/FrmInstallerSkin.php + - '#Construct empty\(\) is not allowed. Use more strict comparison#' + - + message: '#Foreach overwrites \$ip with its value variable.#' + path: classes/helpers/FrmAppHelper.php + - + message: '#Only numeric types are allowed#' + paths: + - classes/helpers/FrmCSVExportHelper.php + - classes/models/FrmStyle.php