We read every piece of feedback, and take your input very seriously.
To see all available qualifiers, see our documentation.
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
new class { public const VERSION = 1.0; function __construct() { print(self::VERSION); } };
На JPHP данный код, в отличие от PHP ⩾ 7.1, работает некорректно. Не удается обратиться к константе в анонимном классе.
> jppm start -> win -> app:run -> install Fatal error: Uncaught exception 'php\lang\JavaException' with message 'java.lang.NullPointerException' in Unknown on line 0, position 0 Stack Trace: #0 {main} thrown in Unknown on line 0 JVM Stack Trace: org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator$2.<init>(SimpleExprGenerator.java:608) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processStaticAccess(SimpleExprGenerator.java:607) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processSimpleToken(SimpleExprGenerator.java:1182) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1635) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1402) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getNextExpression(SimpleExprGenerator.java:1390) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getNextExpression(SimpleExprGenerator.java:1384) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processPrint(SimpleExprGenerator.java:572) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processSimpleToken(SimpleExprGenerator.java:1046) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1635) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1402) org.develnext.jphp.core.syntax.generators.ExprGenerator.processSimpleExpr(ExprGenerator.java:580) org.develnext.jphp.core.syntax.generators.ExprGenerator.getToken(ExprGenerator.java:731) org.develnext.jphp.core.syntax.generators.manually.BodyGenerator.getToken(BodyGenerator.java:46) org.develnext.jphp.core.syntax.generators.manually.BodyGenerator.getToken(BodyGenerator.java:33) org.develnext.jphp.core.syntax.generators.manually.BodyGenerator.getToken(BodyGenerator.java:27) org.develnext.jphp.core.syntax.generators.manually.BodyGenerator.getToken(BodyGenerator.java:103) org.develnext.jphp.core.syntax.generators.FunctionGenerator.processBody(FunctionGenerator.java:277) org.develnext.jphp.core.syntax.generators.FunctionGenerator.getToken(FunctionGenerator.java:348) org.develnext.jphp.core.syntax.generators.FunctionGenerator.getToken(FunctionGenerator.java:427) org.develnext.jphp.core.syntax.generators.ClassGenerator.processBody(ClassGenerator.java:482) org.develnext.jphp.core.syntax.generators.ClassGenerator.getToken(ClassGenerator.java:641) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processNew(SimpleExprGenerator.java:846) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.processSimpleToken(SimpleExprGenerator.java:1050) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1635) org.develnext.jphp.core.syntax.generators.manually.SimpleExprGenerator.getToken(SimpleExprGenerator.java:1402) org.develnext.jphp.core.syntax.generators.ExprGenerator.processSimpleExpr(ExprGenerator.java:580) org.develnext.jphp.core.syntax.generators.ExprGenerator.getToken(ExprGenerator.java:731) org.develnext.jphp.core.syntax.generators.ExprGenerator.getToken(ExprGenerator.java:763) org.develnext.jphp.core.syntax.generators.ExprGenerator.getToken(ExprGenerator.java:26) org.develnext.jphp.core.syntax.SyntaxAnalyzer.generateToken(SyntaxAnalyzer.java:346) org.develnext.jphp.core.syntax.SyntaxAnalyzer.processNext(SyntaxAnalyzer.java:258) org.develnext.jphp.core.syntax.SyntaxAnalyzer.process(SyntaxAnalyzer.java:233) org.develnext.jphp.core.syntax.SyntaxAnalyzer.process(SyntaxAnalyzer.java:218) org.develnext.jphp.core.syntax.SyntaxAnalyzer.<init>(SyntaxAnalyzer.java:127) org.develnext.jphp.core.syntax.SyntaxAnalyzer.<init>(SyntaxAnalyzer.java:54) org.develnext.jphp.core.compiler.jvm.JvmCompiler.<init>(JvmCompiler.java:44) java.lang.reflect.Constructor.newInstance(Constructor.java:423) php.runtime.env.CompileScope$1.getCompiler(CompileScope.java:192) php.runtime.env.CompileScope.createCompiler(CompileScope.java:231) php.runtime.env.Environment.importModule(Environment.java:1250) php.runtime.env.ConcurrentEnvironment.importModule(ConcurrentEnvironment.java:175) php.runtime.env.ModuleManager.fetchTemporaryModule(ModuleManager.java:71) php.runtime.env.ModuleManager.fetchModule(ModuleManager.java:41) php.runtime.env.ModuleManager.fetchModule(ModuleManager.java:27) php.runtime.launcher.Launcher.loadFrom(Launcher.java:121) php.runtime.launcher.Launcher.run(Launcher.java:309) php.runtime.launcher.Launcher.run(Launcher.java:248) php.runtime.launcher.Launcher.run(Launcher.java:244) php.runtime.launcher.Launcher.main(Launcher.java:426)
В именованных классах всё нормально:
Результат работы на sandbox.onlinephpfunctions.com:
The text was updated successfully, but these errors were encountered:
No branches or pull requests
На JPHP данный код, в отличие от PHP ⩾ 7.1, работает некорректно. Не удается обратиться к константе в анонимном классе.
В именованных классах всё нормально:

Результат работы на sandbox.onlinephpfunctions.com:
The text was updated successfully, but these errors were encountered: