Skip to content

Commit

Permalink
Upgrading phpstan version to 1.11.3 (#364)
Browse files Browse the repository at this point in the history
  • Loading branch information
jaydiablo committed Jun 5, 2024
1 parent 0376417 commit 104aec6
Show file tree
Hide file tree
Showing 3 changed files with 20 additions and 30 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@
"require-dev": {
"phpunit/php-code-coverage": "^9.1.10",
"friendsofphp/php-cs-fixer": "^3.51.0",
"phpstan/phpstan": "1.10.14",
"phpstan/phpstan": "1.11.3",
"vimeo/psalm": "5.23.1"
},
"scripts": {
Expand Down
25 changes: 0 additions & 25 deletions phpstan-baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -226,11 +226,6 @@
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Connection/Mssql.php',
);
$ignoreErrors[] = array(
'message' => '#^Offset string does not exist on array\\<int\\<0, max\\>, mixed\\>\\.$#',
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Connection/Mssql.php',
);
$ignoreErrors[] = array(
'message' => '#^Parameter \\#3 \\$subject of function preg_replace expects array\\|string, string\\|null given\\.$#',
'count' => 1,
Expand Down Expand Up @@ -486,11 +481,6 @@
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Manager.php',
);
$ignoreErrors[] = array(
'message' => '#^Cannot access offset \'dsn\'\\|\'fragment\'\\|\'host\'\\|\'pass\'\\|\'path\'\\|\'port\'\\|\'query\'\\|\'scheme\'\\|\'user\' on array\\<\'dsn\'\\|\'fragment\'\\|\'host\'\\|\'pass\'\\|\'path\'\\|\'port\'\\|\'query\'\\|\'scheme\'\\|\'user\', int\\<0, 65535\\>\\|string\\|null\\>\\|false\\.$#',
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Manager.php',
);
$ignoreErrors[] = array(
'message' => '#^Parameter \\#1 \\$url of function parse_url expects string, string\\|null given\\.$#',
'count' => 1,
Expand All @@ -506,16 +496,6 @@
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Migration.php',
);
$ignoreErrors[] = array(
'message' => '#^Parameter \\#1 \\$tableName of method Doctrine_Migration_Builder\\:\\:buildCreateForeignKey\\(\\) expects string, int\\|string given\\.$#',
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Migration/Builder.php',
);
$ignoreErrors[] = array(
'message' => '#^Parameter \\#1 \\$tableName of method Doctrine_Migration_Builder\\:\\:buildDropForeignKey\\(\\) expects string, int\\|string given\\.$#',
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Migration/Builder.php',
);
$ignoreErrors[] = array(
'message' => '#^Binary operation "\\." between array\\|string and string results in an error\\.$#',
'count' => 1,
Expand All @@ -541,11 +521,6 @@
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Node/NestedSet.php',
);
$ignoreErrors[] = array(
'message' => '#^Cannot cast string\\|void to string\\.$#',
'count' => 1,
'path' => __DIR__ . '/lib/Doctrine/Pager/Layout.php',
);
$ignoreErrors[] = array(
'message' => '#^Method Doctrine_Parser\\:\\:doLoad\\(\\) should return string but returns string\\|false\\.$#',
'count' => 1,
Expand Down
23 changes: 19 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -4,14 +4,16 @@ includes:
- ./phpstan-php8.php
- ./phpstan-php82.php
parameters:
checkMissingIterableValueType: false
checkGenericClassInNonGenericObjectType: false
inferPrivatePropertyTypeFromConstructor: true
treatPhpDocTypesAsCertain: false
level: 8
paths:
- ./lib
ignoreErrors:
-
identifier: missingType.generics
-
identifier: missingType.iterableValue
#########
# Level 0
#########
Expand Down Expand Up @@ -237,8 +239,10 @@ parameters:
# The Doctrine_Record::state method will return an int if it's not given any parameters ($state param == null), otherwise it returns nothing (void)
# I checked that in all of the cases that phpstan complains about this method and returns from it, that they're being used properly (assigning
# a value when no params are passed, not expecting a value when a param is passed)
- '#Parameter \#1 \$state of method Doctrine_Record::state\(\) expects int\|string\|null, int\|void given\.#'
- '#Parameter \#1 \$state of static method Doctrine_Lib::getRecordStateAsString\(\) expects int, int\|void given\.#'
-
message: '#Parameter \#1 \$state of static method Doctrine_Lib::getRecordStateAsString\(\) expects int, int\|null given\.#'
count: 1
path: lib/Doctrine/Lib.php
# Probably change the else condition of the ternary here to an empty string instead of null, Doctrine_Query:1043
- '#Parameter \#1 \$alias of method Doctrine_Query::_processPendingJoinConditions\(\) expects string, string\|null given\.#'
# Same with this one, default for $alias should probably be an empty string, Doctrine_Table:1120
Expand All @@ -251,6 +255,17 @@ parameters:
# function encounters an error, which would cause $query to be null. Not sure what do do in this error situation.
- '#Parameter \#1 \$query of method Doctrine_Connection::execute\(\) expects string, string\|null given\.#'
- '#Parameter \#1 \$query of method Doctrine_Connection::exec\(\) expects string, string\|null given\.#'
# These methods shouldn't return anything because it's a PHP magic method which is defined as a void return
# but we don't want to alter the behavior here in case anyone is actually using this method directly and expecting
# its return value
-
message: '#Method Doctrine_Event::__set\(\) with return type void returns \$this\(Doctrine_Event\) but should not return anything\.#'
count: 1
path: lib/Doctrine/Event.php
-
message: '#Method Doctrine_Validator_Driver::__set\(\) with return type void returns \$this\(Doctrine_Validator_Driver\) but should not return anything\.#'
count: 1
path: lib/Doctrine/Validator/Driver.php

################################################################################################################
# These are from the baseline generated by phpstan, but modified, so moved here so they don't change
Expand Down

0 comments on commit 104aec6

Please sign in to comment.