-
-
Notifications
You must be signed in to change notification settings - Fork 946
Closed
Description
Bug report
From version 0.12.26 phpstan has an internal error when defining a constant based on __FILE__ or __DIR__ magic constants.
Code snippet that reproduces the problem
<?php
define('fizz', __DIR__);
also: https://phpstan.org/r/3dae66e1-c2b1-4a82-8c5d-7bfd5829a0b4
Expected output
[OK] No errors
Actual output
Internal error: The current context does not have a class for self
Run PHPStan with --debug option and post the stack trace to:
https://github.com/phpstan/phpstan/issues/new
Stack trace
/Users/csaba/temp/ttt.php
PHP Fatal error: Uncaught RuntimeException: The current context does not have a class for self in phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php:38
Stack trace:
#0 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php(48): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompilerContext->getSelf()
#1 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompileNodeToValue.php(50): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompilerContext->getFileName()
#2 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php(130): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompileNodeToValue->_HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\{closure}(Object(PhpParser\Node\Scalar\MagicConst\File))
#3 phar:///usr/local/Cellar/ph in phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php on line 38
Fatal error: Uncaught RuntimeException: The current context does not have a class for self in phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php:38
Stack trace:
#0 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php(48): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompilerContext->getSelf()
#1 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompileNodeToValue.php(50): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompilerContext->getFileName()
#2 phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/nikic/php-parser/lib/PhpParser/ConstExprEvaluator.php(130): _HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\CompileNodeToValue->_HumbugBox2376040b7d58\Roave\BetterReflection\NodeCompiler\{closure}(Object(PhpParser\Node\Scalar\MagicConst\File))
#3 phar:///usr/local/Cellar/ph in phar:///usr/local/Cellar/phpstan/0.12.27/bin/phpstan/vendor/ondrejmirtes/better-reflection/src/NodeCompiler/CompilerContext.php on line 38
Reactions are currently unavailable
Metadata
Metadata
Assignees
Labels
No labels