Skip to content

DevEx: phpc lint reports unsupported Stmt/Expr before LogicException #236

Description

@PurHur

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

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions