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

[Bug]: Fatal Error when using PHPStan\dumpType #1200

Open
aymanrady opened this issue Aug 5, 2024 · 0 comments
Open

[Bug]: Fatal Error when using PHPStan\dumpType #1200

aymanrady opened this issue Aug 5, 2024 · 0 comments
Labels

Comments

@aymanrady
Copy link

What Happened

arch('arch')
    ->expect('App\PestPHPStanConflict')
    ->toBeClasses();
PHP Fatal error:  Cannot redeclare PHPStan\dumpType() (previously declared in phar://p/vendor/phpstan/phpstan/phpstan.phar/src/dumpType.php:13) in phar://p/vendor/phpstan/phpstan/phpstan.phar/src/dumpType.php on line 15
PHP Stack trace:
PHP   1. {main}() p/vendor/bin/pest:0
PHP   2. include() p/vendor/bin/pest:119
PHP   3. {closure:p/vendor/pestphp/pest/bin/pest:12-99}() p/vendor/pestphp/pest/bin/pest:99
PHP   4. Pest\Kernel->handle($originalArguments = [0 => 'vendor/bin/pest'], $arguments = [0 => 'vendor/bin/pest']) p/vendor/pestphp/pest/bin/pest:91
PHP   5. PHPUnit\TextUI\Application->run($argv = [0 => 'vendor/bin/pest', 1 => '--cache-directory', 2 => 'p/vendor/pestphp/pest/.temp', 3 => '--cache-result', 4 => '--no-output']) p/vendor/pestphp/pest/src/Kernel.php:103
PHP   6. PHPUnit\TextUI\TestRunner->run($configuration = class PHPUnit\TextUI\Configuration\Configuration { private readonly array $cliArguments = []; private readonly ?string $configurationFile = 'p/phpunit.xml'; private readonly ?string $bootstrap = 'p/vendor/autoload.php'; private readonly bool $cacheResult = TRUE; private readonly ?string $cacheDirectory = 'p/vendor/pestphp/pest/.temp'; private readonly ?string $coverageCacheDirectory = 'p/vendor/pestphp/pest/.temp/code-coverage'; private readonly PHPUnit\TextUI\Configuration\Source $source = class PHPUnit\TextUI\Configuration\Source { private readonly ?string $baseline = NULL; private readonly bool $ignoreBaseline = FALSE; private readonly PHPUnit\TextUI\Configuration\FilterDirectoryCollection $includeDirectories = class PHPUnit\TextUI\Configuration\FilterDirectoryCollection { ... }; private readonly PHPUnit\TextUI\Configuration\FileCollection $includeFiles = class PHPUnit\TextUI\Configuration\FileCollection { ... }; private readonly PHPUnit\TextUI\Configuration\FilterDirectoryCollection $excludeDirectories = class PHPUnit\TextUI\Configuration\FilterDirectoryCollection { ... }; private readonly PHPUnit\TextUI\Configuration\FileCollection $excludeFiles = class PHPUnit\TextUI\Configuration\FileCollection { ... }; private readonly bool $restrictDeprecations = FALSE; private readonly bool $restrictNotices = FALSE; private readonly bool $restrictWarnings = FALSE; private readonly bool $ignoreSuppressionOfDeprecations = FALSE; private readonly bool $ignoreSuppressionOfPhpDeprecations = FALSE; private readonly bool $ignoreSuppressionOfErrors = FALSE; private readonly bool $ignoreSuppressionOfNotices = FALSE; private readonly bool $ignoreSuppressionOfPhpNotices = FALSE; private readonly bool $ignoreSuppressionOfWarnings = FALSE; private readonly bool $ignoreSuppressionOfPhpWarnings = FALSE }; private readonly bool $pathCoverage = FALSE; private readonly ?string $coverageClover = NULL; private readonly ?string $coverageCobertura = NULL; private readonly ?string $coverageCrap4j = NULL; private readonly int $coverageCrap4jThreshold = 30; private readonly ?string $coverageHtml = NULL; private readonly int $coverageHtmlLowUpperBound = 50; private readonly int $coverageHtmlHighLowerBound = 90; private readonly string $coverageHtmlColorSuccessLow = '#dff0d8'; private readonly string $coverageHtmlColorSuccessMedium = '#c3e3b5'; private readonly string $coverageHtmlColorSuccessHigh = '#99cb84'; private readonly string $coverageHtmlColorWarning = '#fcf8e3'; private readonly string $coverageHtmlColorDanger = '#f2dede'; private readonly ?string $coverageHtmlCustomCssFile = NULL; private readonly ?string $coveragePhp = NULL; private readonly ?string $coverageText = NULL; private readonly bool $coverageTextShowUncoveredFiles = FALSE; private readonly bool $coverageTextShowOnlySummary = FALSE; private readonly ?string $coverageXml = NULL; private readonly string $testResultCacheFile = 'p/vendor/pestphp/pest/.temp/test-results'; private readonly bool $ignoreDeprecatedCodeUnitsFromCodeCoverage = FALSE; private readonly bool $disableCodeCoverageIgnore = FALSE; private readonly bool $failOnDeprecation = FALSE; private readonly bool $failOnEmptyTestSuite = FALSE; private readonly bool $failOnIncomplete = FALSE; private readonly bool $failOnNotice = FALSE; private readonly bool $failOnRisky = FALSE; private readonly bool $failOnSkipped = FALSE; private readonly bool $failOnWarning = FALSE; private readonly bool $stopOnDefect = FALSE; private readonly bool $stopOnDeprecation = FALSE; private readonly bool $stopOnError = FALSE; private readonly bool $stopOnFailure = FALSE; private readonly bool $stopOnIncomplete = FALSE; private readonly bool $stopOnNotice = FALSE; private readonly bool $stopOnRisky = FALSE; private readonly bool $stopOnSkipped = FALSE; private readonly bool $stopOnWarning = FALSE; private readonly bool $outputToStandardErrorStream = FALSE; private readonly int $columns = 80; private readonly bool $noExtensions = FALSE; private readonly ?string $pharExtensionDirectory = NULL; private readonly array $extensionBootstrappers = []; private readonly bool $backupGlobals = FALSE; private readonly bool $backupStaticProperties = FALSE; private readonly bool $beStrictAboutChangesToGlobalState = FALSE; private readonly bool $colors = TRUE; private readonly bool $processIsolation = FALSE; private readonly bool $enforceTimeLimit = FALSE; private readonly int $defaultTimeLimit = 1; private readonly int $timeoutForSmallTests = 1; private readonly int $timeoutForMediumTests = 10; private readonly int $timeoutForLargeTests = 60; private readonly bool $reportUselessTests = TRUE; private readonly bool $strictCoverage = FALSE; private readonly bool $disallowTestOutput = FALSE; private readonly bool $displayDetailsOnIncompleteTests = FALSE; private readonly bool $displayDetailsOnSkippedTests = FALSE; private readonly bool $displayDetailsOnTestsThatTriggerDeprecations = FALSE; private readonly bool $displayDetailsOnTestsThatTriggerErrors = FALSE; private readonly bool $displayDetailsOnTestsThatTriggerNotices = FALSE; private readonly bool $displayDetailsOnTestsThatTriggerWarnings = FALSE; private readonly bool $reverseDefectList = FALSE; private readonly bool $requireCoverageMetadata = FALSE; private readonly bool $registerMockObjectsFromTestArgumentsRecursively = FALSE; private readonly bool $noProgress = FALSE; private readonly bool $noResults = FALSE; private readonly bool $noOutput = TRUE; private readonly int $executionOrder = 0; private readonly int $executionOrderDefects = 0; private readonly bool $resolveDependencies = TRUE; private readonly ?string $logfileTeamcity = NULL; private readonly ?string $logfileJunit = NULL; private readonly ?string $logfileTestdoxHtml = NULL; private readonly ?string $logfileTestdoxText = NULL; private readonly ?string $logEventsText = NULL; private readonly ?string $logEventsVerboseText = NULL; private readonly ?array $testsCovering = NULL; private readonly ?array $testsUsing = NULL; private readonly bool $teamCityOutput = FALSE; private readonly bool $testDoxOutput = FALSE; private readonly ?string $filter = NULL; private readonly ?array $groups = []; private readonly ?array $excludeGroups = []; private readonly int $randomOrderSeed = 1722853000; private readonly bool $includeUncoveredFiles = TRUE; private readonly PHPUnit\TextUI\Configuration\TestSuiteCollection $testSuite = class PHPUnit\TextUI\Configuration\TestSuiteCollection { private readonly array $testSuites = [...] }; private readonly string $includeTestSuite = ''; private readonly string $excludeTestSuite = ''; private readonly ?string $defaultTestSuite = NULL; private readonly array $testSuffixes = [0 => 'Test.php', 1 => '.phpt']; private readonly PHPUnit\TextUI\Configuration\Php $php = class PHPUnit\TextUI\Configuration\Php { private readonly PHPUnit\TextUI\Configuration\DirectoryCollection $includePaths = class PHPUnit\TextUI\Configuration\DirectoryCollection { ... }; private readonly PHPUnit\TextUI\Configuration\IniSettingCollection $iniSettings = class PHPUnit\TextUI\Configuration\IniSettingCollection { ... }; private readonly PHPUnit\TextUI\Configuration\ConstantCollection $constants = class PHPUnit\TextUI\Configuration\ConstantCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $globalVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $envVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $postVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $getVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $cookieVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $serverVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $filesVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... }; private readonly PHPUnit\TextUI\Configuration\VariableCollection $requestVariables = class PHPUnit\TextUI\Configuration\VariableCollection { ... } }; private readonly bool $controlGarbageCollector = FALSE; private readonly int $numberOfTestsBeforeGarbageCollection = 100; private readonly ?string $generateBaseline = NULL; private readonly bool $debug = FALSE }, $resultCache = class PHPUnit\Runner\ResultCache\DefaultResultCache { private readonly string $cacheFilename = 'p/vendor/pestphp/pest/.temp/test-results'; private array $defects = []; private array $currentDefects = []; private array $times = ['P\\Tests\\ArchTest::__pest_evaluable_arch' => 0.028] }, $suite = class PHPUnit\Framework\TestSuite { private string $name = 'p/phpunit.xml'; private array $groups = ['arch' => [...]]; private ?array $requiredTests = NULL; private array $tests = [0 => class PHPUnit\Framework\TestSuite { ... }]; private ?array $providedTests = NULL; private ?PHPUnit\Runner\Filter\Factory $iteratorFilter = NULL }) p/vendor/phpunit/phpunit/src/TextUI/Application.php:198
PHP   7. PHPUnit\Framework\TestSuite->run() p/vendor/phpunit/phpunit/src/TextUI/TestRunner.php:62
PHP   8. PHPUnit\Framework\TestSuite->run() p/vendor/phpunit/phpunit/src/Framework/TestSuite.php:349
PHP   9. PHPUnit\Framework\TestSuite->run() p/vendor/phpunit/phpunit/src/Framework/TestSuite.php:349
PHP  10. PHPUnit\Framework\TestCase->run() p/vendor/phpunit/phpunit/src/Framework/TestSuite.php:349
PHP  11. PHPUnit\Framework\TestRunner->run($test = class P\Tests\ArchTest { private ?bool ${PHPUnit\Framework\TestCase}backupGlobals = FALSE; private array ${PHPUnit\Framework\TestCase}backupGlobalsExcludeList = []; private ?bool ${PHPUnit\Framework\TestCase}backupStaticProperties = FALSE; private array ${PHPUnit\Framework\TestCase}backupStaticPropertiesExcludeList = []; private ?SebastianBergmann\GlobalState\Snapshot ${PHPUnit\Framework\TestCase}snapshot = NULL; private ?bool ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ?bool ${PHPUnit\Framework\TestCase}runTestInSeparateProcess = NULL; private bool ${PHPUnit\Framework\TestCase}preserveGlobalState = FALSE; private bool ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ?string ${PHPUnit\Framework\TestCase}expectedException = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private string|int|null ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private array ${PHPUnit\Framework\TestCase}providedTests = [0 => class PHPUnit\Framework\ExecutionOrderDependency { ... }]; private array ${PHPUnit\Framework\TestCase}data = []; private string|int ${PHPUnit\Framework\TestCase}dataName = ''; private string ${PHPUnit\Framework\TestCase}name = '__pest_evaluable_arch'; private array ${PHPUnit\Framework\TestCase}groups = [0 => 'arch']; private array ${PHPUnit\Framework\TestCase}dependencies = []; private array ${PHPUnit\Framework\TestCase}dependencyInput = []; private array ${PHPUnit\Framework\TestCase}iniSettings = []; private array ${PHPUnit\Framework\TestCase}locale = []; private array ${PHPUnit\Framework\TestCase}mockObjects = []; private bool ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private PHPUnit\Framework\TestStatus\TestStatus ${PHPUnit\Framework\TestCase}status = class PHPUnit\Framework\TestStatus\Unknown { private readonly string ${PHPUnit\Framework\TestStatus\TestStatus}message = '' }; private int ${PHPUnit\Framework\TestCase}numberOfAssertionsPerformed = 0; private mixed ${PHPUnit\Framework\TestCase}testResult = NULL; private string ${PHPUnit\Framework\TestCase}output = ''; private ?string ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ?string ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private bool ${PHPUnit\Framework\TestCase}outputBufferingActive = TRUE; private int ${PHPUnit\Framework\TestCase}outputBufferingLevel = 2; private bool ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private bool ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private array ${PHPUnit\Framework\TestCase}customComparators = []; private ?PHPUnit\Event\Code\TestMethod ${PHPUnit\Framework\TestCase}testValueObjectForEvents = class PHPUnit\Event\Code\TestMethod { private readonly string ${PHPUnit\Event\Code\Test}file = 'p/vendor/pestphp/pest/src/Factories/TestCaseFactory.php(196) : eval()\'d code'; private readonly string $className = 'P\\Tests\\ArchTest'; private readonly string $methodName = '__pest_evaluable_arch'; private readonly int $line = 23; private readonly PHPUnit\Event\Code\TestDox $testDox = class PHPUnit\Event\Code\TestDox { ... }; private readonly PHPUnit\Metadata\MetadataCollection $metadata = class PHPUnit\Metadata\MetadataCollection { ... }; private readonly PHPUnit\Event\TestData\TestDataCollection $testData = class PHPUnit\Event\TestData\TestDataCollection { ... } }; private bool ${PHPUnit\Framework\TestCase}wasPrepared = TRUE; private array ${PHPUnit\Framework\TestCase}failureTypes = []; private string $__description = 'arch'; public ?string $__describing = NULL; private Closure $__test = class Closure { public $static = [...]; public $this = class Pest\Factories\TestCaseMethodFactory { ... } }; private ?Closure $__beforeEach = NULL; private ?Closure $__afterEach = NULL; private array $__snapshotChanges = []; private ?Pest\Arch\Options\TestCaseOptions $options = class Pest\Arch\Options\TestCaseOptions { public array $ignore = [...] } }) p/vendor/phpunit/phpunit/src/Framework/TestCase.php:488
PHP  12. PHPUnit\Framework\TestCase->runBare() p/vendor/phpunit/phpunit/src/Framework/TestRunner.php:105
PHP  13. PHPUnit\Framework\TestCase->runTest() p/vendor/phpunit/phpunit/src/Framework/TestCase.php:654
PHP  14. P\Tests\ArchTest->__pest_evaluable_arch() p/vendor/phpunit/phpunit/src/Framework/TestCase.php:1122
PHP  15. P\Tests\ArchTest->__runTest($closure = class Closure { public $static = ['testCase' => class Pest\Factories\TestCaseFactory { ... }, 'method' => class Pest\Factories\TestCaseMethodFactory { ... }, 'closure' => class Closure { ... }]; public $this = class Pest\Factories\TestCaseMethodFactory { public ?string $describing = NULL; public int $repetitions = 1; public bool $todo = FALSE; public array $datasets = [...]; public array $depends = [...]; public array $groups = [...]; public array $covers = [...]; public string $filename = 'p/tests/ArchTest.php'; public ?string $description = 'arch'; public ?Closure $closure = class Closure { ... }; public Pest\Support\HigherOrderMessageCollection $chains = class Pest\Support\HigherOrderMessageCollection { ... }; public Pest\Support\HigherOrderMessageCollection $factoryProxies = class Pest\Support\HigherOrderMessageCollection { ... }; public Pest\Support\HigherOrderMessageCollection $proxies = class Pest\Support\HigherOrderMessageCollection { ... } } }) p/vendor/pestphp/pest/src/Factories/TestCaseFactory.php(196) : eval()'d code:27
PHP  16. P\Tests\ArchTest->__callClosure($closure = class Closure { public $static = ['testCase' => class Pest\Factories\TestCaseFactory { ... }, 'method' => class Pest\Factories\TestCaseMethodFactory { ... }, 'closure' => class Closure { ... }]; public $this = class Pest\Factories\TestCaseMethodFactory { public ?string $describing = NULL; public int $repetitions = 1; public bool $todo = FALSE; public array $datasets = [...]; public array $depends = [...]; public array $groups = [...]; public array $covers = [...]; public string $filename = 'p/tests/ArchTest.php'; public ?string $description = 'arch'; public ?Closure $closure = class Closure { ... }; public Pest\Support\HigherOrderMessageCollection $chains = class Pest\Support\HigherOrderMessageCollection { ... }; public Pest\Support\HigherOrderMessageCollection $factoryProxies = class Pest\Support\HigherOrderMessageCollection { ... }; public Pest\Support\HigherOrderMessageCollection $proxies = class Pest\Support\HigherOrderMessageCollection { ... } } }, $arguments = []) p/vendor/pestphp/pest/src/Concerns/Testable.php:254
PHP  17. Pest\Support\ExceptionTrace::ensure($closure = class Closure { public $static = ['closure' => class Closure { ... }, 'arguments' => [...]]; public $this = class P\Tests\ArchTest { private ?bool ${PHPUnit\Framework\TestCase}backupGlobals = FALSE; private array ${PHPUnit\Framework\TestCase}backupGlobalsExcludeList = [...]; private ?bool ${PHPUnit\Framework\TestCase}backupStaticProperties = FALSE; private array ${PHPUnit\Framework\TestCase}backupStaticPropertiesExcludeList = [...]; private ?SebastianBergmann\GlobalState\Snapshot ${PHPUnit\Framework\TestCase}snapshot = NULL; private ?bool ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ?bool ${PHPUnit\Framework\TestCase}runTestInSeparateProcess = NULL; private bool ${PHPUnit\Framework\TestCase}preserveGlobalState = FALSE; private bool ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ?string ${PHPUnit\Framework\TestCase}expectedException = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private string|int|null ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private array ${PHPUnit\Framework\TestCase}providedTests = [...]; private array ${PHPUnit\Framework\TestCase}data = [...]; private string|int ${PHPUnit\Framework\TestCase}dataName = ''; private string ${PHPUnit\Framework\TestCase}name = '__pest_evaluable_arch'; private array ${PHPUnit\Framework\TestCase}groups = [...]; private array ${PHPUnit\Framework\TestCase}dependencies = [...]; private array ${PHPUnit\Framework\TestCase}dependencyInput = [...]; private array ${PHPUnit\Framework\TestCase}iniSettings = [...]; private array ${PHPUnit\Framework\TestCase}locale = [...]; private array ${PHPUnit\Framework\TestCase}mockObjects = [...]; private bool ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private PHPUnit\Framework\TestStatus\TestStatus ${PHPUnit\Framework\TestCase}status = class PHPUnit\Framework\TestStatus\Unknown { ... }; private int ${PHPUnit\Framework\TestCase}numberOfAssertionsPerformed = 0; private mixed ${PHPUnit\Framework\TestCase}testResult = NULL; private string ${PHPUnit\Framework\TestCase}output = ''; private ?string ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ?string ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private bool ${PHPUnit\Framework\TestCase}outputBufferingActive = TRUE; private int ${PHPUnit\Framework\TestCase}outputBufferingLevel = 2; private bool ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private bool ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private array ${PHPUnit\Framework\TestCase}customComparators = [...]; private ?PHPUnit\Event\Code\TestMethod ${PHPUnit\Framework\TestCase}testValueObjectForEvents = class PHPUnit\Event\Code\TestMethod { ... }; private bool ${PHPUnit\Framework\TestCase}wasPrepared = TRUE; private array ${PHPUnit\Framework\TestCase}failureTypes = [...]; private string $__description = 'arch'; public ?string $__describing = NULL; private Closure $__test = class Closure { ... }; private ?Closure $__beforeEach = NULL; private ?Closure $__afterEach = NULL; private array $__snapshotChanges = [...]; private ?Pest\Arch\Options\TestCaseOptions $options = class Pest\Arch\Options\TestCaseOptions { ... } } }) p/vendor/pestphp/pest/src/Concerns/Testable.php:337
PHP  18. P\Tests\ArchTest->Pest\Concerns\{closure:p/vendor/pestphp/pest/src/Concerns/Testable.php:337-337}() p/vendor/pestphp/pest/src/Support/ExceptionTrace.php:26
PHP  19. call_user_func_array:{p/vendor/pestphp/pest/src/Concerns/Testable.php:337}($callback = class Closure { public $static = ['testCase' => class Pest\Factories\TestCaseFactory { ... }, 'method' => class Pest\Factories\TestCaseMethodFactory { ... }, 'closure' => class Closure { ... }]; public $this = class P\Tests\ArchTest { private ?bool ${PHPUnit\Framework\TestCase}backupGlobals = FALSE; private array ${PHPUnit\Framework\TestCase}backupGlobalsExcludeList = [...]; private ?bool ${PHPUnit\Framework\TestCase}backupStaticProperties = FALSE; private array ${PHPUnit\Framework\TestCase}backupStaticPropertiesExcludeList = [...]; private ?SebastianBergmann\GlobalState\Snapshot ${PHPUnit\Framework\TestCase}snapshot = NULL; private ?bool ${PHPUnit\Framework\TestCase}runClassInSeparateProcess = NULL; private ?bool ${PHPUnit\Framework\TestCase}runTestInSeparateProcess = NULL; private bool ${PHPUnit\Framework\TestCase}preserveGlobalState = FALSE; private bool ${PHPUnit\Framework\TestCase}inIsolation = FALSE; private ?string ${PHPUnit\Framework\TestCase}expectedException = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessage = NULL; private ?string ${PHPUnit\Framework\TestCase}expectedExceptionMessageRegExp = NULL; private string|int|null ${PHPUnit\Framework\TestCase}expectedExceptionCode = NULL; private array ${PHPUnit\Framework\TestCase}providedTests = [...]; private array ${PHPUnit\Framework\TestCase}data = [...]; private string|int ${PHPUnit\Framework\TestCase}dataName = ''; private string ${PHPUnit\Framework\TestCase}name = '__pest_evaluable_arch'; private array ${PHPUnit\Framework\TestCase}groups = [...]; private array ${PHPUnit\Framework\TestCase}dependencies = [...]; private array ${PHPUnit\Framework\TestCase}dependencyInput = [...]; private array ${PHPUnit\Framework\TestCase}iniSettings = [...]; private array ${PHPUnit\Framework\TestCase}locale = [...]; private array ${PHPUnit\Framework\TestCase}mockObjects = [...]; private bool ${PHPUnit\Framework\TestCase}registerMockObjectsFromTestArgumentsRecursively = FALSE; private PHPUnit\Framework\TestStatus\TestStatus ${PHPUnit\Framework\TestCase}status = class PHPUnit\Framework\TestStatus\Unknown { ... }; private int ${PHPUnit\Framework\TestCase}numberOfAssertionsPerformed = 0; private mixed ${PHPUnit\Framework\TestCase}testResult = NULL; private string ${PHPUnit\Framework\TestCase}output = ''; private ?string ${PHPUnit\Framework\TestCase}outputExpectedRegex = NULL; private ?string ${PHPUnit\Framework\TestCase}outputExpectedString = NULL; private bool ${PHPUnit\Framework\TestCase}outputBufferingActive = TRUE; private int ${PHPUnit\Framework\TestCase}outputBufferingLevel = 2; private bool ${PHPUnit\Framework\TestCase}outputRetrievedForAssertion = FALSE; private bool ${PHPUnit\Framework\TestCase}doesNotPerformAssertions = FALSE; private array ${PHPUnit\Framework\TestCase}customComparators = [...]; private ?PHPUnit\Event\Code\TestMethod ${PHPUnit\Framework\TestCase}testValueObjectForEvents = class PHPUnit\Event\Code\TestMethod { ... }; private bool ${PHPUnit\Framework\TestCase}wasPrepared = TRUE; private array ${PHPUnit\Framework\TestCase}failureTypes = [...]; private string $__description = 'arch'; public ?string $__describing = NULL; private Closure $__test = class Closure { ... }; private ?Closure $__beforeEach = NULL; private ?Closure $__afterEach = NULL; private array $__snapshotChanges = [...]; private ?Pest\Arch\Options\TestCaseOptions $options = class Pest\Arch\Options\TestCaseOptions { ... } } }, $args = []) p/vendor/pestphp/pest/src/Concerns/Testable.php:337
PHP  20. P\Tests\ArchTest->Pest\Factories\{closure:p/vendor/pestphp/pest/src/Factories/TestCaseMethodFactory.php:102-111}() p/vendor/pestphp/pest/src/Concerns/Testable.php:337
PHP  21. Pest\Arch\SingleArchExpectation->__destruct() p/vendor/pestphp/pest/src/Factories/TestCaseMethodFactory.php:108
PHP  22. Pest\Arch\SingleArchExpectation->ensureLazyExpectationIsVerified() p/vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:140
PHP  23. Pest\Arch\Expectations\Targeted::Pest\Arch\Expectations\{closure:p/vendor/pestphp/pest-plugin-arch/src/Expectations/Targeted.php:39-53}($options = class Pest\Arch\Options\LayerOptions { public readonly array $exclude = []; public readonly array $excludeCallbacks = [] }) p/vendor/pestphp/pest-plugin-arch/src/SingleArchExpectation.php:156
PHP  24. Pest\Arch\Blueprint->targeted($callback = class Closure { public $this = class Pest\Expectation { public mixed $value = 'App\\PestPHPStanConflict' }; public $parameter = ['$object' => '<required>'] }, $options = class Pest\Arch\Options\LayerOptions { public readonly array $exclude = []; public readonly array $excludeCallbacks = [] }, $failure = class Closure { public $static = ['what' => 'to be class']; public $parameter = ['$violation' => '<required>'] }, $lineFinder = class Closure { public $static = ['callback' => class Closure { ... }]; public $parameter = ['$path' => '<required>'] }) p/vendor/pestphp/pest-plugin-arch/src/Expectations/Targeted.php:40
PHP  25. Pest\Arch\Factories\LayerFactory->make($options = class Pest\Arch\Options\LayerOptions { public readonly array $exclude = []; public readonly array $excludeCallbacks = [] }, $name = 'App\\PestPHPStanConflict', $onlyUserDefinedUses = *uninitialized*) p/vendor/pestphp/pest-plugin-arch/src/Blueprint.php:98
PHP  26. Pest\Arch\Repositories\ObjectsRepository->allByNamespace($namespace = 'App\\PestPHPStanConflict', $onlyUserDefinedUses = TRUE) p/vendor/pestphp/pest-plugin-arch/src/Factories/LayerFactory.php:61
PHP  27. array_reduce($array = [0 => 'p/vendor/composer/../../src/'], $callback = class Closure { public $static = ['onlyUserDefinedUses' => TRUE]; public $this = class Pest\Arch\Repositories\ObjectsRepository { private array $cachedObjectsPerPrefix = [...]; private readonly array $prefixes = [...] }; public $parameter = ['$files' => '<required>', '$fileOrDirectory' => '<required>'] }, $initial = []) p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104
PHP  28. Pest\Arch\Repositories\ObjectsRepository->Pest\Arch\Repositories\{closure:p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104-107}($files = [], $fileOrDirectory = 'p/vendor/composer/../../src/') p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104
PHP  29. array_map($callback = class Closure { public $static = ['onlyUserDefinedUses' => TRUE]; public $parameter = ['$file' => '<required>'] }, $array = ['p/vendor/composer/../../src/SomeClass.php' => class Symfony\Component\Finder\SplFileInfo { private $relativePath = ''; private $relativePathname = 'SomeClass.php'; private ${SplFileInfo}pathName = 'p/vendor/composer/../../src/SomeClass.php'; private ${SplFileInfo}fileName = 'SomeClass.php' }]) p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104
PHP  30. Pest\Arch\Repositories\ObjectsRepository::Pest\Arch\Repositories\{closure:p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:105-105}($file = class Symfony\Component\Finder\SplFileInfo { private $relativePath = ''; private $relativePathname = 'SomeClass.php'; private ${SplFileInfo}pathName = 'p/vendor/composer/../../src/SomeClass.php'; private ${SplFileInfo}fileName = 'SomeClass.php' }) p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:104
PHP  31. Pest\Arch\Factories\ObjectDescriptionFactory::make($filename = 'p/vendor/composer/../../src/SomeClass.php', $onlyUserDefinedUses = TRUE) p/vendor/pestphp/pest-plugin-arch/src/Repositories/ObjectsRepository.php:105
PHP  32. Pest\Arch\Objects\ObjectDescription::make($path = 'p/vendor/composer/../../src/SomeClass.php') p/vendor/pestphp/pest-plugin-arch/src/Factories/ObjectDescriptionFactory.php:40
PHP  33. PHPUnit\Architecture\Asserts\Properties\ObjectPropertiesDescription::make($path = 'p/vendor/composer/../../src/SomeClass.php') p/vendor/pestphp/pest-plugin-arch/src/Objects/ObjectDescription.php:23
PHP  34. PHPUnit\Architecture\Asserts\Methods\ObjectMethodsDescription::make($path = 'p/vendor/composer/../../src/SomeClass.php') p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Properties/ObjectPropertiesDescription.php:26
PHP  35. PHPUnit\Architecture\Asserts\Inheritance\ObjectInheritanceDescription::make($path = 'p/vendor/composer/../../src/SomeClass.php') p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Methods/ObjectMethodsDescription.php:24
PHP  36. PHPUnit\Architecture\Asserts\Dependencies\ObjectDependenciesDescription::make($path = 'p/vendor/composer/../../src/SomeClass.php') p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Inheritance/ObjectInheritanceDescription.php:33
PHP  37. array_filter($array = [0 => class PhpParser\Node\Name { protected array $attributes = [...]; public string $name = 'App\\PestPHPStanConflict' }, 1 => class PhpParser\Node\Name { protected array $attributes = [...]; public string $name = 'PHPStan\\dumpType' }], $callback = class Closure { public $parameter = ['$name' => '<required>'] }) p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Dependencies/ObjectDependenciesDescription.php:38
PHP  38. PHPUnit\Architecture\Asserts\Dependencies\ObjectDependenciesDescription::PHPUnit\Architecture\Asserts\Dependencies\{closure:p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Dependencies/ObjectDependenciesDescription.php:38-54}($name = class PhpParser\Node\Name { protected array $attributes = ['startLine' => 7, 'startTokenPos' => 19, 'startFilePos' => 82, 'endLine' => 7, 'endTokenPos' => 19, 'endFilePos' => 97]; public string $name = 'PHPStan\\dumpType' }) p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Dependencies/ObjectDependenciesDescription.php:38
PHP  39. class_exists($class = 'PHPStan\\dumpType') p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Dependencies/ObjectDependenciesDescription.php:45
PHP  40. PHPStan\PharAutoloader::loadClass($class = 'PHPStan\\dumpType') p/vendor/ta-tikoma/phpunit-architecture-test/src/Asserts/Dependencies/ObjectDependenciesDescription.php:45

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 function PHPStan\dumpType;

class SomeClass {}
EOF
cat > tests/ArchTest.php <<EOF
<?php
arch('arch')
    ->expect('App')
    ->toBeClasses();
EOF
vendor/bin/pest

Sample Repository

No response

Pest Version

2.35.0

PHP Version

8.2.21

Operation System

Linux

Notes

Removing the use function PHPStan\dumpType resolves the issue

@aymanrady aymanrady added the bug label Aug 5, 2024
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

1 participant