-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
phpstan/phpstan-src
#4275Description
Bug report
Since version 2.1.18 (and up to 2.1.22) I get an autoload error because a class seems to be loaded double. With phpstan 2.1.17 it runs fine.
PHP Fatal error: Cannot declare class Hoa\Protocol\Wrapper, because the name is already in use in /projects/phpstan-repro/vendor/hoa/protocol/Wrapper.php on line 48
I've created a minimal reproducer composer.json
{
"require": {
"hoa/protocol": "^1.17"
},
"require-dev": {
"phpstan/phpstan": "2.1.18"
}
}
After installation and when running the phpstan command I get the autoload error
→ vendor/bin/phpstan
PHP Fatal error: Cannot declare class Hoa\Protocol\Wrapper, because the name is already in use in /projects/phpstan-repro/vendor/hoa/protocol/Wrapper.php on line 48
PHP Stack trace:
PHP 1. {main}() /projects/phpstan-repro/vendor/bin/phpstan:0
PHP 2. include() /projects/phpstan-repro/vendor/bin/phpstan:119
PHP 3. require() /projects/phpstan-repro/vendor/phpstan/phpstan/phpstan:8
PHP 4. _PHPStan_5878035a0\{closure:phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:14-94}() phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:94
PHP 5. require_once() phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:34
PHP 6. ComposerAutoloaderInit0732fbc55041d1001b981f15116e825f::getLoader() /projects/phpstan-repro/vendor/autoload.php:25
PHP 7. {closure:/projects/phpstan-repro/vendor/composer/autoload_real.php:37-43}($fileIdentifier = '3e76f7f02b41af8cea96018933f6b7e3', $file = '/projects/phpstan-repro/vendor/composer/../hoa/protocol/Wrapper.php') /projects/phpstan-repro/vendor/composer/autoload_real.php:45
PHP 8. require() /projects/phpstan-repro/vendor/composer/autoload_real.php:41
Fatal error: Cannot declare class Hoa\Protocol\Wrapper, because the name is already in use in /projects/phpstan-repro/vendor/hoa/protocol/Wrapper.php on line 48
Call Stack:
0.0004 653584 1. {main}() /projects/phpstan-repro/vendor/bin/phpstan:0
0.0004 654680 2. include('/projects/phpstan-repro/vendor/phpstan/phpstan/phpstan') /projects/phpstan-repro/vendor/bin/phpstan:119
0.0716 3688736 3. require('phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan') /projects/phpstan-repro/vendor/phpstan/phpstan/phpstan:8
0.0717 3689120 4. _PHPStan_5878035a0\{closure:phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:14-94}() phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:94
0.1867 41890128 5. require_once('/projects/phpstan-repro/vendor/autoload.php') phar:///projects/phpstan-repro/vendor/phpstan/phpstan/phpstan.phar/bin/phpstan:34
0.1867 41896640 6. ComposerAutoloaderInit0732fbc55041d1001b981f15116e825f::getLoader() /projects/phpstan-repro/vendor/autoload.php:25
0.1868 41904864 7. {closure:/projects/phpstan-repro/vendor/composer/autoload_real.php:37-43}($fileIdentifier = '3e76f7f02b41af8cea96018933f6b7e3', $file = '/projects/phpstan-repro/vendor/composer/../hoa/protocol/Wrapper.php') /projects/phpstan-repro/vendor/composer/autoload_real.php:45
0.1878 41949088 8. require('/projects/phpstan-repro/vendor/hoa/protocol/Wrapper.php') /projects/phpstan-repro/vendor/composer/autoload_real.php:41
Code snippet that reproduces the problem
No response
Expected output
In this case it is an empty reproducer app, so the expected output is
→ vendor/bin/phpstan
At least one path must be specified to analyse.
Did PHPStan help you today? Did it make you happy in any way?
PHPStan keeps our codebase much healthier, of a higher quality and makes us catch bugs earlier in the process 👌
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels