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:----MhxTqltOkdpKhmPcRgF3QUlCHUSf7fYelxWMA+CbfGG1lmmGqFwrpo9mkrHnZZelfLmpodoAGQMbrjumOKou3TA7rRSVQ8evqVh/h8UTedFuj8yCZhSFyjz3bw9dYolLGlMigWGvTxT2NxIw3p+Zb3V2PFTcipZYHM+wbgTCvlXLSUcy2rZfPACABqlDV67+fNy1TucY85BIntcPOZ1rISOJTtApGOr23wUvk3zA1dMwHRNWZX7SwfsDbQmRI6dPM6kSLQap4DRijRhrrLqvi+QumqyWv3qry/93byXD/tlVEjbU1LYhNIMj5d9bO3ZjF3J0QIPXZnKhyWBE6uaU2HO55SjR1SKZfBM2puHJzH7faciJY2pJEON3scEMYcp2VFQeBrH9jSXO8aM15FfUBh8+HXxImdIYP7LFqZpoI5SM9+Opkv3S+6B/bNNzl4MSgh4PhOAbAtesFs3St/2X5qh6Mr1QDW1vPgSFdzA7wXLms16+WUAu1XUMkkdCuEZo6YNWp8DWlHpBCWzSn4ogl6DL4EPJJeHcLlD8auGXUFgviGd1YqxkrHkOJt7pjfAkBsq9IkzxzRB++lEUjTVItqHpK6kMv+X+a5ei3NHh5g+eRElXpklSDrzZkV0TujRfvVyAYK7RDd8yTylCBWA9X6q1gb1jahxtpuGv5LqbyEM=----ATTACHMENT:----MzAyMjk4MTk1MDIwNzY5NCA4OTY1NDc4ODYxOTc0ODcyIDc0NzYwMjQ5MDM3Mjk3NTQ=