-
-
Notifications
You must be signed in to change notification settings - Fork 934
Closed
Labels
Milestone
Description
Bug report
The following error is cause by the following code in my file /photos/holiday/app/object.Validate.php using phpstan v.1.12.11:
public const CR_DELIMITER = '$'; // Code replacement delimiter
...
if(defined(Settings::CR_DELIMITER)) {
...
}
...Result cache cleared from directory:
/tmp/phpstan
-- -----------------------------------------------------------------------------------------------------------------------------------------------------------
Error
-- -----------------------------------------------------------------------------------------------------------------------------------------------------------
Internal error: Invalid identifier name "$" while analysing file /photos/holiday/app/object.Validate.php
Post the following stack trace to https://github.com/phpstan/phpstan/issues/new?template=Bug_report.yaml:
## phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Identifier/Exception/InvalidIdentifierName.php(12)
#0 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Identifier/Identifier.php(34):
PHPStan\BetterReflection\Identifier\Exception\InvalidIdentifierName::fromInvalidName()
#1 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/ondrejmirtes/better-reflection/src/Reflector/DefaultReflector.php(83):
PHPStan\BetterReflection\Identifier\Identifier->__construct()
#2 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/Reflector/MemoizingReflector.php(61):
PHPStan\BetterReflection\Reflector\DefaultReflector->reflectConstant()
#3 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php(381):
PHPStan\Reflection\BetterReflection\Reflector\MemoizingReflector->reflectConstant()
#4 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php(403):
PHPStan\Reflection\BetterReflection\BetterReflectionProvider->PHPStan\Reflection\BetterReflection\{closure}()
#5 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php(379):
PHPStan\Reflection\BetterReflection\BetterReflectionProvider->resolveName()
#6 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/BetterReflection/BetterReflectionProvider.php(339):
PHPStan\Reflection\BetterReflection\BetterReflectionProvider->resolveConstantName()
#7 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Reflection/ReflectionProvider/MemoizingReflectionProvider.php(75):
PHPStan\Reflection\BetterReflection\BetterReflectionProvider->hasConstant()
#8 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/ConstantResolver.php(50):
PHPStan\Reflection\ReflectionProvider\MemoizingReflectionProvider->hasConstant()
#9 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(1566): PHPStan\Analyser\ConstantResolver->resolveConstant()
#10 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(622): PHPStan\Analyser\MutatingScope->resolveType()
#11 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/TypeSpecifier.php(1096): PHPStan\Analyser\MutatingScope->getType()
#12 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/TypeSpecifier.php(1083): PHPStan\Analyser\TypeSpecifier->createForExpr()
#13 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Type/Php/DefinedConstantTypeSpecifyingExtension.php(49):
PHPStan\Analyser\TypeSpecifier->create()
#14 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/TypeSpecifier.php(329):
PHPStan\Type\Php\DefinedConstantTypeSpecifyingExtension->specifyTypes()
#15 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(3038):
PHPStan\Analyser\TypeSpecifier->specifyTypesInCondition()
#16 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(2958):
PHPStan\Analyser\MutatingScope->filterByTruthyValue()
#17 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/ExpressionResult.php(82):
PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()
#18 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(738): PHPStan\Analyser\ExpressionResult->getTruthyScope()
#19 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(622): PHPStan\Analyser\MutatingScope->resolveType()
#20 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/MutatingScope.php(2002): PHPStan\Analyser\MutatingScope->getType()
#21 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Rules/Comparison/UnreachableIfBranchesRule.php(50):
PHPStan\Analyser\MutatingScope->getNativeType()
#22 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(120):
PHPStan\Rules\Comparison\UnreachableIfBranchesRule->processNode()
#23 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Node/ClassStatementsGatherer.php(119):
PHPStan\Analyser\FileAnalyser->PHPStan\Analyser\{closure}()
#24 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(654): PHPStan\Node\ClassStatementsGatherer->__invoke()
#25 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(535):
PHPStan\Analyser\NodeScopeResolver::PHPStan\Analyser\{closure}()
#26 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(465):
PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#27 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(653):
PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#28 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(465):
PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#29 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(790):
PHPStan\Analyser\NodeScopeResolver->processStmtNodes()
#30 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/NodeScopeResolver.php(430):
PHPStan\Analyser\NodeScopeResolver->processStmtNode()
#31 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Analyser/FileAnalyser.php(179): PHPStan\Analyser\NodeScopeResolver->processNodes()
#32 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(139): PHPStan\Analyser\FileAnalyser->analyseFile()
#33 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111):
PHPStan\Command\WorkerCommand::PHPStan\Command\{closure}()
#34 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/clue/ndjson-react/src/Decoder.php(117):
_PHPStan_09f7c00bc\Evenement\EventEmitter->emit()
#35 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111):
_PHPStan_09f7c00bc\Clue\React\NDJson\Decoder->handleData()
#36 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/Util.php(62): _PHPStan_09f7c00bc\Evenement\EventEmitter->emit()
#37 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/evenement/evenement/src/EventEmitterTrait.php(111):
_PHPStan_09f7c00bc\React\Stream\Util::_PHPStan_09f7c00bc\React\Stream\{closure}()
#38 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/react/stream/src/DuplexResourceStream.php(168):
_PHPStan_09f7c00bc\Evenement\EventEmitter->emit()
#39 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(201):
_PHPStan_09f7c00bc\React\Stream\DuplexResourceStream->handleData()
#40 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/react/event-loop/src/StreamSelectLoop.php(173):
_PHPStan_09f7c00bc\React\EventLoop\StreamSelectLoop->waitForStreamActivity()
#41 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/src/Command/WorkerCommand.php(99): _PHPStan_09f7c00bc\React\EventLoop\StreamSelectLoop->run()
#42 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Command/Command.php(259): PHPStan\Command\WorkerCommand->execute()
#43 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(870):
_PHPStan_09f7c00bc\Symfony\Component\Console\Command\Command->run()
#44 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(261):
_PHPStan_09f7c00bc\Symfony\Component\Console\Application->doRunCommand()
#45 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/vendor/symfony/console/Application.php(157):
_PHPStan_09f7c00bc\Symfony\Component\Console\Application->doRun()
#46 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/bin/phpstan(127): _PHPStan_09f7c00bc\Symfony\Component\Console\Application->run()
#47 phar:///photos/holiday/pkg/phpstan/phpstan/phpstan.phar/bin/phpstan(128): _PHPStan_09f7c00bc\{closure}()
#48 /photos/holiday/pkg/phpstan/phpstan/phpstan(8): require('...')
#49 /photos/holiday/pkg/bin/phpstan(119): include('...')
#50 {main}
-- -----------------------------------------------------------------------------------------------------------------------------------------------------------
[ERROR] Found 1 error