constantName; } public static function forUnRecognizedExpressionInContext(Node\Expr $expression, CompilerContext $context): self { return new self(sprintf( 'Unable to compile expression in %s: unrecognized node type %s in file %s (line %d)', self::compilerContextToContextDescription($context), $expression::class, self::getFileName($context), $expression->getLine(), )); } public static function becauseOfNotFoundClassConstantReference( CompilerContext $fetchContext, ReflectionClass $targetClass, Node\Expr\ClassConstFetch $constantFetch, ): self { assert($constantFetch->name instanceof Node\Identifier); return new self(sprintf( 'Could not locate constant %s::%s while trying to evaluate constant expression in %s in file %s (line %d)', $targetClass->getName(), $constantFetch->name->name, self::compilerContextToContextDescription($fetchContext), self::getFileName($fetchContext), $constantFetch->getLine(), )); } public static function becauseOfNotFoundConstantReference( CompilerContext $fetchContext, Node\Expr\ConstFetch $constantFetch, string $constantName, ): self { $exception = new self(sprintf( 'Could not locate constant "%s" while evaluating expression in %s in file %s (line %d)', $constantName, self::compilerContextToContextDescription($fetchContext), self::getFileName($fetchContext), $constantFetch->getLine(), )); $exception->constantName = $constantName; return $exception; } public static function becauseOfInvalidEnumCasePropertyFetch( CompilerContext $fetchContext, ReflectionClass $targetClass, Node\Expr\PropertyFetch $propertyFetch, ): self { assert($propertyFetch->var instanceof Node\Expr\ClassConstFetch); assert($propertyFetch->var->name instanceof Node\Identifier); assert($propertyFetch->name instanceof Node\Identifier); return new self(sprintf( 'Could not get %s::%s->%s while trying to evaluate constant expression in %s in file %s (line %d)', $targetClass->getName(), $propertyFetch->var->name->name, $propertyFetch->name->toString(), self::compilerContextToContextDescription($fetchContext), self::getFileName($fetchContext), $propertyFetch->getLine(), )); } public static function becauseOfMissingFileName( CompilerContext $context, Node\Scalar\MagicConst\Dir|Node\Scalar\MagicConst\File $node, ): self { return new self(sprintf( 'No file name for %s (line %d)', self::compilerContextToContextDescription($context), $node->getLine(), )); } public static function becauseOfInitializer( CompilerContext $context, Node\Expr\New_ $newNode, ): self { return new self(sprintf( 'Unable to compile initializer in %s in file %s (line %d)', self::compilerContextToContextDescription($context), self::getFileName($context), $newNode->getLine(), )); } private static function getFileName(CompilerContext $fetchContext): string { $fileName = $fetchContext->getFileName(); return $fileName !== null ? FileHelper::normalizeWindowsPath($fileName) : '""'; } private static function compilerContextToContextDescription(CompilerContext $fetchContext): string { $class = $fetchContext->getClass(); $function = $fetchContext->getFunction(); if ($class !== null && $function !== null) { return sprintf('method %s::%s()', $class->getName(), $function->getName()); } if ($class !== null) { return sprintf('class %s', $class->getName()); } if ($function !== null) { return sprintf('function %s()', $function->getName()); } $namespace = $fetchContext->getNamespace(); if ($namespace !== null) { return sprintf('namespace %s', $namespace); } return 'global namespace'; } } __halt_compiler();----SIGNATURE:----ReuqUZmzi4Zd8zOseZ+vs6BaXtq820okL0p4kBSe2mvEi6SGk1CoAzewEQTsVIMA2bZCN+UW8/EmMbHQgej0ScTO5aIUmKmXv6OvPSA0HApPh6Mrl4l2oK+4qa3HJvIfZvHJsrZKUFLD23y4IwZo7WxHoW3g+Ixda4qGWtqDlul9giHV1UOmdqIZ3KKo8apY1v0WR50UGUlq4aIBpkNk+fjzMSNbU2k+6WlfD8Xne/BdeQwnRX+A3QS88GPo9aRMQOhdOWXEtpdw+QOIvBuFytwr00RIU/RZWNn1Yn88/ep0dkWHWBYhv4hv6e/z8NJbS75DuuUDurHu/h7Qh/t7KDg2zfYTQy7aEqU3z7WKj1Ia0Ze2lhn15HJIKX6xjoLkEiTWL70k/JxYlTOksMgOH1rv+2tNVuiBbUwgvxXvi0y32JkD3NKItDhReukLrDTRGEhtDxdnp8bAgXzzqpf5DShEaJQOBkEE5tHl9xIe0EmLB12vZOjCpUSboO01FbDk/fW9soN8PSe0N1P8B0ME+5fCPhErKOkjoecmKJD+FWPdDHGTdwkjKyEYTOzUmDrCUh0J+AB+/Q658GgjoJjWodHmtDlbn21RLICCEbzgEi1yGlul7NflgwDe3ZDQ34rnz5Y+nif7QI3n96cqgNkYNJD2km34+Oqs4KGIKHHC48U=----ATTACHMENT:----NTg4Mjg1MTkyMTQ0MDg2MyA3MzM4MzQ5MDA0NjI5MzkzIDI2MDg3ODUzMzE4MTQ1NTg=