Skip to content

php-in-php: arrow-function overlay + enum parity compliance PHPTs - #8557

Merged
PurHur merged 1 commit into
masterfrom
agent/runtime-php-arrow-function-overlay
Jun 14, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/runtime-php-arrow-function-overlay

Conversation

@PurHur

@PurHur PurHur commented Jun 14, 2026

Copy link
Copy Markdown
Owner

Summary

  • Add apply_php_types_arrow_function_overlay() and invoke it early in script/apply-patches.sh so resolveOp_Expr_ArrowFunction lands even when later php-types patches fail (unblocks fn() in compiled PHP — array_find family, closure callbacks).
  • Register overlay in apply_patch() dispatch + verify_critical_language_patches guard.
  • Add php-src-strict compliance PHPTs locking already-green enum guards: lcfirst, fwrite data, filter_var FILTER_VALIDATE_INT.

php-src reference

  • vendor/ircmaxell/php-types TypeReconstructor — arrow-function op typing (pairs php-cfg parseExpr_ArrowFunction)
  • Enum guards: ext/standard/string.c (lcfirst), ext/standard/streamsfuncs.c (fwrite), ext/filter/filter.c (filter_var)

C runtime shrink

No runtime/ changes (only lib/AOT/runtime/phpc_progress.c remains per #5211).

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter BootstrapPhpTypesArrowFunctionPatchTest'
# OK (1 test)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter array_find'
# OK (11 tests, 11 assertions)

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter "lcfirst_enum|fwrite_enum|filter_var_enum"'
# OK (6 tests)

# Overlay re-apply smoke (remove block then):
python3 -c "from pathlib import Path; p=Path('vendor/ircmaxell/php-types/lib/PHPTypes/TypeReconstructor.php'); t=p.read_text(); b='    protected function resolveOp_Expr_ArrowFunction'; i=t.find(b); e=t.find('    protected function resolveOp_Expr_FuncCall', i); p.write_text(t[:i]+t[e:]) if i>=0 else None"
./script/apply-patches.sh 2>&1 | grep arrow-function
# Applied php-types-arrow-function.patch (overlay)

Closes #6003 (compliance coverage). Related: #5945, #5796 (PHPTs added; behavior already green).

Made with Cursor

Early overlay for resolveOp_Expr_ArrowFunction unblocks fn() callbacks in
compiled PHP (array_find family JIT/VM) when later php-types patches fail.
Add php-src-strict compliance PHPTs for lcfirst/fwrite/filter_var enum guards.

Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Stdlib: lcfirst() — enum case operand must TypeError not silent coerce (ext/standard/string.c, php-src-strict)

1 participant