Category
language · php-src-strict
Problem
First-class callable syntax on enum case instance methods (E::A->f(...)) must compile and invoke the case method. This compiler crashes during type reconstruction with Call to undefined method PHPTypes\Type::array() when the receiver is an enum case.
Related runtime gap: #5721 (Closure::fromCallable([enumCase, method])).
php-src reference
Repro
test/repro/maintainer_enum_case_first_class_callable.php:
enum E {
case A;
public function f(): string { return 'a'; }
}
$c = E::A->f(...);
echo $c(), "\n"; // Zend: a
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php test/repro/maintainer_enum_case_first_class_callable.php # TypeReconstructor crash
php test/repro/maintainer_enum_case_first_class_callable.php # a
'
Expected
Compile succeeds; runtime prints a.
Actual
parseAndCompile failure: Call to undefined method PHPTypes\Type::array() in TypeReconstructor.php.
Implementation hints (PHP-in-PHP)
Verification
Category
language· php-src-strictProblem
First-class callable syntax on enum case instance methods (
E::A->f(...)) must compile and invoke the case method. This compiler crashes during type reconstruction withCall to undefined method PHPTypes\Type::array()when the receiver is an enum case.Related runtime gap: #5721 (
Closure::fromCallable([enumCase, method])).php-src reference
Zend/zend_compile.c— first-class callable loweringZend/zend_closures.c— enum case method bindingRepro
test/repro/maintainer_enum_case_first_class_callable.php:Expected
Compile succeeds; runtime prints
a.Actual
parseAndCompile failure: Call to undefined method PHPTypes\Type::array()inTypeReconstructor.php.Implementation hints (PHP-in-PHP)
lib/Runtime.php, php-types integration).Verification