Skip to content

Stdlib: ReflectionMethod namespace/isClosure/__toString API missing — sibling #22144 (ext/reflection/php_reflection.c) #22173

Closed

Description

@PurHur

Category

stdlib · php-src-strict

Problem

#22144 tracks ReflectionFunction location/namespace helpers. ReflectionMethod is missing the parallel ReflectionFunctionAbstract surface for namespace naming, closure predicate, and string casting even though Zend exposes them on methods.

Method Zend 8.2+ on ReflectionMethod VM (2026-07-22)
getShortName() method name (e.g. m) missing
getNamespaceName() / inNamespace() '' / false for class methods missing
isClosure() false for ordinary methods missing
__toString / (string)$rm reflection dump missing / convert Error

Do not duplicate #22144 (function location: getFileName/getStartLine/getDocComment). This issue is method-specific naming/predicate/__toString.

php-src reference

PHP implementation target

  • ext/standard/VmReflection.php — wire method reflection objects to the same abstract helpers used for functions where applicable; isClosure() false for methods; __toString matching Zend format is nice-to-have in the same PR if cheap

Repro

./script/docker-exec.sh -- bash -lc 'cat > /tmp/rf_method_ns.php <<'"'"'P'"'"'
<?php
namespace App;
class C { public function m() {} }
$r = new \ReflectionMethod(C::class, "m");
foreach (["getNamespaceName","getShortName","inNamespace","isClosure"] as $m) {
  echo $m, ":", method_exists($r, $m) ? "yes" : "no", "\n";
}
if (method_exists($r, "getShortName")) echo "short=", $r->getShortName(), "\n";
P
php /tmp/rf_method_ns.php; echo ---; php bin/vm.php /tmp/rf_method_ns.php'

Done when

  • getShortName / getNamespaceName / inNamespace / isClosure exist on ReflectionMethod and match Zend for a namespaced class method
  • Compliance .phpt under test/compliance/cases/
  • php-src-strict; no php-compiler-strict shortcut

Activity

  1. added
    bugSomething isn't working
    phase-4:stdlibPhase 4 – stdlib for web apps
    area:vmVirtual machine
    implementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claim
    on Jul 22, 2026
  2. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Triage note: getNamespaceName / getShortName / inNamespace overlap #22167. Prefer implementing those three on #22167; keep this issue for the remaining isClosure() / __toString() surface (or retitle after #22167 lands).

  3. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — batch (issues #22144, #22170, #22171, #22166, #22167, #22169, #22173; sequential PRs)

    Queued after #22144.

  4. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    claim: PHP Compiler STD Lib Advanced — starting #22173 (after merged #22169 / PR #22237)

    Note: getShortName/getNamespaceName/inNamespace already shipped in #22167 / PR #22236. This PR covers isClosure + __toString.

  5. PurHur commented on Jul 22, 2026

    @PurHur
    OwnerAuthor

    Merged #22240 (or see PR link above)

    isClosure + __toString on ReflectionMethod; namespace helpers were #22167.

    Reflection batch complete: #22166, #22167, #22169, #22173.

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

    area:vmVirtual machinebugSomething isn't workingimplementation-readySpec complete: repro, php-src ref, done-when — safe for workers to claimphase-4:stdlibPhase 4 – stdlib for web appsstdlib

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions