-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
PHPStan version 0.12.26 and 0.12.27 seem to think some functions defined in composer packages used by phpstan (or it's dependencies). eg. symfony/polyfill-php80 defines str_contains, and phpstan would show it requires 0 parameters instead the correct amount (2).
This seems to happen only when phpstan is run using the distributed phar file.
Code snippet that reproduces the problem
~ $ mkdir phpstan-str-contains
~ $ cd phpstan-str-contains
~/phpstan-str-contains $ echo -e '<?php\ndeclare(strict_types=1);\nrequire "vendor/autoload.php";\nvar_dump(str_contains("test", "t"));' > test.php
~/phpstan-str-contains $ echo '{"require": {"symfony/polyfill-php80": "^1.0"},"require-dev":{"phpstan/phpstan":"=0.12.27"}}' > composer.json
~/phpstan-str-contains $ composer install
Loading composer repositories with package information
Updating dependencies (including require-dev)
Package operations: 2 installs, 0 updates, 0 removals
- Installing phpstan/phpstan (0.12.27): Loading from cache
- Installing symfony/polyfill-php80 (v1.17.0): Loading from cache
Writing lock file
Generating autoload files
2 packages you are using are looking for funding.
Use the `composer fund` command to find out more!
~/phpstan-str-contains $ vendor/bin/phpstan analyse --level max test.php
1/1 [▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓▓] 100%
------ --------------------------------------------------------------
Line test.php
------ --------------------------------------------------------------
4 Function str_contains invoked with 2 parameters, 0 required.
------ --------------------------------------------------------------
[ERROR] Found 1 error
Expected output
No error
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels