Skip to content

Stdlib: ReflectionFunction location/namespace API (#22144) - #22186

Merged
PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-22144-reflection-function-location
Jul 22, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/advanced-stdlib-22144-reflection-function-location

Conversation

@PurHur

@PurHur PurHur commented Jul 22, 2026

Copy link
Copy Markdown
Owner

Summary

  • Persist Func\PHP::$sourceLocation on TYPE_FUNCDEF / TYPE_CLOSURE and expose ReflectionFunction::{getFileName,getStartLine,getEndLine,getDocComment,getNamespaceName,getShortName,inNamespace} (php-src ext/reflection/php_reflection.c).
  • Compliance .phpt + issue repro; JIT skips VM-only case; spine/inventory + gen-0 fingerprint restamp.

Closes #22144

php-src reference

  • ext/reflection/php_reflection.stub.php — ReflectionFunctionAbstract
  • ext/reflection/php_reflection.c — zim_ReflectionFunctionAbstract_getFileName et al.

PHP implementation

  • lib/Func/PHP.php, lib/VM.php, lib/VM/ReflectionSupport.php
  • lib/VM/Builtin/ReflectionFunctionGet*.php / InNamespace.php + BuiltinClasses registration

Test plan

  • Issue repro (Zend == VM)
  • vendor/bin/phpunit --filter reflection_function_location_namespace
  • php script/check-selfhost-spine-coverage-sync.php / bootstrap-inventory.php --check
  • ./script/check-generated-docs.sh
  • make north-star5-verify-fast

Verification transcript

./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_reflection_function_location.php'
# matches Zend: file/start/end/doc/ns/short/inNs + internal false/''/'strlen'/false

vendor/bin/phpunit --filter reflection_function_location_namespace
# OK (1 test, 1 assertion)

php script/check-selfhost-spine-coverage-sync.php  # OK 6372
php script/bootstrap-inventory.php --check         # OK 6372/6372
./script/check-generated-docs.sh                   # OK
make north-star5-verify-fast                       # OK (fast)

Made with Cursor

Persist Func\PHP sourceLocation on FUNCDEF/CLOSURE and expose getFileName,
getStartLine, getEndLine, getDocComment, getNamespaceName, getShortName, and
inNamespace to match php-src ReflectionFunctionAbstract.

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: ReflectionFunction location/namespace API missing — getFileName/getStartLine/getDocComment/getShortName (ext/reflection/php_reflection.c)

1 participant