Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

PHPStan 1.4.0 #5178

Merged
merged 1 commit into from
Jan 17, 2022
Merged
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: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -41,7 +41,7 @@
"require-dev": {
"doctrine/coding-standard": "9.0.0",
"jetbrains/phpstorm-stubs": "2021.1",
"phpstan/phpstan": "1.3.0",
"phpstan/phpstan": "1.4.0",
"phpunit/phpunit": "^7.5.20|^8.5|9.5.11",
"psalm/plugin-phpunit": "0.16.1",
"squizlabs/php_codesniffer": "3.6.2",
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/DBAL/Types/Type.php
Original file line number Diff line number Diff line change
Expand Up @@ -296,7 +296,7 @@ public function getBindingType()
* Gets the types array map which holds all registered types and the corresponding
* type class
*
* @return string[]
* @return array<string, string>
*/
public static function getTypesMap()
{
Expand Down
18 changes: 12 additions & 6 deletions phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -75,12 +75,6 @@ parameters:
paths:
- lib/Doctrine/DBAL/Portability/Connection.php

# Unlike Psalm, PHPStan doesn't understand the shape of the parse_str() return value
-
message: '~^Parameter #1 \$scheme of static method Doctrine\\DBAL\\DriverManager::parseDatabaseUrlScheme\(\) expects string\|null, int\|string\|null given\.$~'
paths:
- lib/Doctrine/DBAL/DriverManager.php

# Until 3.x, $_conn does accept PDO
-
message: '~^Property Doctrine\\DBAL\\Connection::\$_conn \(Doctrine\\DBAL\\Driver\\Connection\|null\) does not accept PDO\.$~'
Expand Down Expand Up @@ -115,7 +109,19 @@ parameters:
paths:
- lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php

# This is a new requirement for PHP7's oci8 extension that prevents bound values from being garbage collected.
Copy link
Member

@morozov morozov Jan 16, 2022

Choose a reason for hiding this comment

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

IIRC, I checked it recently and it's not true. Why isn't this change necessary in #5179?

Copy link
Member Author

Choose a reason for hiding this comment

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

I don't know enough about Oracle and its PHP drivers to answer this question. PHPStan emitted this error, I looked up the code that caused it and found this comment there, so I just copied it over to this file.

Copy link
Member

Choose a reason for hiding this comment

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

Indeed, this code doesn't exist in 3.2.x as of #4957:

Additionally, it removes the $boundValues property. It might be necessary in the early PHP 7 days but doesn't seem necessary now (besides PHP 7.4 on CI, tested locally with PHP 7.3.32).

Keeping this error suppressed in 2.13.x looks right.

-
message: '~^Property Doctrine\\DBAL\\Driver\\OCI8\\OCI8Statement\:\:\$boundValues is never read, only written\.$~'
paths:
- lib/Doctrine/DBAL/Driver/OCI8/OCI8Statement.php

-
message: '~Method Doctrine\\DBAL\\Driver\\Mysqli\\MysqliStatement::rowCount\(\) should return int but returns int\|string\.~'
paths:
- lib/Doctrine/DBAL/Driver/Mysqli/MysqliStatement.php

# TODO: This class is deprecaed, remove this rule on 3.x
-
message: '~^Parameter #2 \$code of class RuntimeException constructor expects int, string given\.$~'
paths:
- lib/Doctrine/DBAL/Tools/Console/Command/ImportCommand.php