Problem
When the compiler hits an unsupported construct, lib/Compiler.php throws opaque errors at compile time:
LogicException: Unknown Stmt Type: Stmt\While
LogicException: Unsupported expression: ...
Developers discover gaps only at runtime of phpc run / phpc build, not with file/line context. #192, #53, #99, #114, and #136 are common hits for web apps.
Goal
phpc lint <file> (or bin/vm.php -l) prints a structured, line-accurate list of unsupported syntax in a project entry file and its includes (best-effort).
Scope
Acceptance criteria
./phpc lint examples/003-MiniWebApp/public/index.php
# reports: line 42: unsupported Stmt\While (see #192)
Exit code 1 when issues exist; 0 when compiles.
Verification
Local only:
./script/ci-local.sh --filter ExamplesCompileTest
./phpc lint -r 'for ($i=0;$i<3;$i++) echo $i;'
Non-goals
- Full PHPStan-level analysis
- Auto-fix or polyfill generation
Related
Problem
When the compiler hits an unsupported construct,
lib/Compiler.phpthrows opaque errors at compile time:Developers discover gaps only at runtime of
phpc run/phpc build, not with file/line context. #192, #53, #99, #114, and #136 are common hits for web apps.Goal
phpc lint <file>(orbin/vm.php -l) prints a structured, line-accurate list of unsupported syntax in a project entry file and its includes (best-effort).Scope
Compiler::compileStmt/compileExprcatches to attach source line from php-cfg / nikic parser--jsonoutput for tooling??Language: Null coalescing operator (??) in compiler pipeline #99, etc.)ExamplesCompileTestas optional strict gateAcceptance criteria
./phpc lint examples/003-MiniWebApp/public/index.php # reports: line 42: unsupported Stmt\While (see #192)Exit code 1 when issues exist; 0 when compiles.
Verification
Local only:
./script/ci-local.sh --filter ExamplesCompileTest ./phpc lint -r 'for ($i=0;$i<3;$i++) echo $i;'Non-goals
Related