diff --git a/composer.json b/composer.json index 9ea0a3df89e..ef85a1e816c 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,6 @@ "phpstan/extension-installer": "^1.1", "phpstan/phpstan": "^1.2", "phpstan/phpstan-deprecation-rules": "^1.0", - "phpstan/phpstan-strict-rules": "^1.3", "phpunit/phpunit": "^9.6", "roundcube/acl": "*", "roundcube/additional_message_headers": "*", diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon deleted file mode 100644 index 86f7713ad14..00000000000 --- a/phpstan-baseline.neon +++ /dev/null @@ -1,36 +0,0 @@ -parameters: - ignoreErrors: - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\App\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/App.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\Dialog\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/Dialog.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\HtmlEditor\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/HtmlEditor.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\Popupmenu\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/Popupmenu.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\RecipientInput\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/RecipientInput.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\Taskmenu\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/Taskmenu.php - - - - message: "#^Parameter \\#1 \\$browser \\(Tests\\\\Browser\\\\Browser\\) of method Tests\\\\Browser\\\\Components\\\\Toolbarmenu\\:\\:assert\\(\\) should be contravariant with parameter \\$browser \\(Laravel\\\\Dusk\\\\Browser\\) of method Laravel\\\\Dusk\\\\Component\\:\\:assert\\(\\)$#" - count: 1 - path: tests/Browser/Components/Toolbarmenu.php diff --git a/phpstan.neon.dist b/phpstan.neon.dist index b33308384ed..083ee24050c 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -1,6 +1,5 @@ includes: - phar://phpstan.phar/conf/bleedingEdge.neon - - phpstan-baseline.neon parameters: level: 4 @@ -10,21 +9,6 @@ parameters: - vendor ignoreErrors: - # relax strict rules - - '~^Only booleans are allowed in .+, .+ given( on the (left|right) side)?\.~' - - '~^Variable (static )?(property access|method call) on .+\.~' - - '~^Variable variables are not allowed.~' - - '~^Variable .* might not be defined\.~' - - '~Call to function array_filter\(\) requires parameter #2 to be passed to avoid loose comparison semantics.~' - # relax strict rules - move to phpstan baseline once almost all l6 errors are fixed - - '~^Dynamic call to static method .+\.~' # TODO in https://github.com/roundcube/roundcubemail/pull/9314 - - '~^Construct empty\(\) is not allowed\. Use more strict comparison\.~' - - '~^Loose comparison via "[=!]=" is not allowed\.~' - - '~^Casting to .+ something that''s already .+\.~' - - '~^Short ternary operator is not allowed\. Use null coalesce operator if applicable or consider using long ternary\.~' - - '~^Call to function (array_search|in_array)\(\) requires parameter #3 to be set\.~' - - '~^Call to function base64_decode\(\) requires parameter #2 to be (set|true).~' - # https://github.com/php/pecl-authentication-krb5 - path: 'program/lib/Roundcube/rcube_imap_generic.php' diff --git a/plugins/managesieve/managesieve.php b/plugins/managesieve/managesieve.php index 28933e87fac..b6f320a2e4b 100644 --- a/plugins/managesieve/managesieve.php +++ b/plugins/managesieve/managesieve.php @@ -59,8 +59,8 @@ public function init() $this->register_action('plugin.managesieve-save', [$this, 'managesieve_save']); $this->register_action('plugin.managesieve-saveraw', [$this, 'managesieve_saveraw']); - $task = $this->rc->task ?? null; // @phpstan-ignore-line - $action = $this->rc->action ?? null; // @phpstan-ignore-line + $task = $this->rc->task ?? null; + $action = $this->rc->action ?? null; if ($task == 'settings') { $this->add_hook('settings_actions', [$this, 'settings_actions']); diff --git a/program/actions/contacts/delete.php b/program/actions/contacts/delete.php index 9cea7492166..6dc254b7ed7 100644 --- a/program/actions/contacts/delete.php +++ b/program/actions/contacts/delete.php @@ -40,7 +40,6 @@ public function run($args = []) foreach ($cids as $source => $cid) { $CONTACTS = self::contact_source($source); - // @phpstan-ignore-next-line if ($CONTACTS->readonly && empty($CONTACTS->deletable)) { // more sources? do nothing, probably we have search results from // more than one source, some of these sources can be readonly diff --git a/program/actions/contacts/move.php b/program/actions/contacts/move.php index 881a31eb822..fe563dc4824 100644 --- a/program/actions/contacts/move.php +++ b/program/actions/contacts/move.php @@ -62,7 +62,6 @@ public function run($args = []) break; } - // @phpstan-ignore-next-line if (!$CONTACTS || !$CONTACTS->ready || ($CONTACTS->readonly && empty($CONTACTS->deletable))) { continue; } diff --git a/program/actions/contacts/save.php b/program/actions/contacts/save.php index f5c3f5d9667..d6f9f276f0e 100644 --- a/program/actions/contacts/save.php +++ b/program/actions/contacts/save.php @@ -244,7 +244,6 @@ public static function process_input() foreach ($subtypes as $i => $subtype) { $suffix = $subtype ? ":{$subtype}" : ''; - // @phpstan-ignore-next-line if (!empty($values[$i])) { $record[$col . $suffix][] = $values[$i]; } diff --git a/program/actions/mail/compose.php b/program/actions/mail/compose.php index e1a4d591920..d0087a4e412 100644 --- a/program/actions/mail/compose.php +++ b/program/actions/mail/compose.php @@ -1654,7 +1654,7 @@ public static function save_attachment($message, $pid, $compose_id, $params = [] $filename = !empty($params['filename']) ? $params['filename'] : self::attachment_name($part); } elseif ($message instanceof rcube_message) { // the whole message requested - $size = $message->size ?? null; // @phpstan-ignore-line + $size = $message->size ?? null; $mimetype = 'message/rfc822'; $filename = !empty($params['filename']) ? $params['filename'] : 'message_rfc822.eml'; } elseif (is_string($message)) { diff --git a/program/include/rcmail.php b/program/include/rcmail.php index 895d8f816a8..ad24efa5c45 100644 --- a/program/include/rcmail.php +++ b/program/include/rcmail.php @@ -56,7 +56,7 @@ class rcmail extends rcube public $oauth; /** @var rcmail_output_cli|rcmail_output_html|rcmail_output_json|null Output handler */ - public $output; // @phpstan-ignore-line + public $output; private $address_books = []; private $action_args = []; diff --git a/program/include/rcmail_sendmail.php b/program/include/rcmail_sendmail.php index d7cf27e902d..699ab043f97 100644 --- a/program/include/rcmail_sendmail.php +++ b/program/include/rcmail_sendmail.php @@ -457,7 +457,6 @@ public function deliver_message($message, $disconnect = true) return false; } - // @phpstan-ignore-next-line if ($mailbody_file) { $this->temp_files[$message->headers()['Message-ID']] = $mailbody_file; } diff --git a/program/lib/Roundcube/rcube.php b/program/lib/Roundcube/rcube.php index 2d1bbd8544e..58ed30f9b11 100644 --- a/program/lib/Roundcube/rcube.php +++ b/program/lib/Roundcube/rcube.php @@ -659,7 +659,6 @@ public function text_exists($name, $domain = null, &$ref_domain = null) // any of loaded domains (plugins) if ($domain == '*') { - // @phpstan-ignore-next-line foreach ($this->plugins->loaded_plugins() as $domain) { if (isset($this->texts[$domain . '.' . $name])) { $ref_domain = $domain;