pest
pest copied to clipboard
[Bug]: PHPStan namespace is not discoverable by plugin-arch
What Happened
arch('arch')
->expect('App')
->toOnlyUse('PHPStan');
FAILED Tests\ArchTest > arch
Expecting 'App' to only use 'PHPStan'. However, it also uses 'PHPStan\Analyser\Scope'.
How to Reproduce
cat > composer.json <<EOF
{
"autoload": {
"psr-4": {
"App\\\\": "src/"
}
}
}
EOF
composer require --dev pestphp/pest phpstan/phpstan
vendor/bin/pest --init
mkdir src
cat > src/SomeClass.php <<EOF
<?php
namespace App;
use PHPStan\Analyser\Scope;
class SomeClass {}
EOF
cat > tests/ArchTest.php <<EOF
<?php
arch('arch')
->expect('App')
->toOnlyUse('PHPStan');
EOF
vendor/bin/pest tests/ArchTest.php
Sample Repository
No response
Pest Version
2.35.0
PHP Version
8.2.21
Operation System
Linux
Notes
PHPStan doesn't register its namespace with composer relying on a bootstrap file with a custom autoloader.