Category
language
Problem
PHP 8.4 allows property hooks in interface declarations, e.g. public string $label { get; }. A implementing class may satisfy the get hook with an ordinary typed property (public string $label = 'hi';) without declaring an explicit hook body.
This compiler parses the interface, but rejects valid implementations:
Class C contains 1 abstract method and must therefore be declared abstract or implement the remaining methods (C::$label::get)
php-src reference
Repro (failure today)
<?php
interface I {
public string $label { get; }
}
class C implements I {
public string $label = 'hi';
}
$c = new C();
echo $c->label, "\n";
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh
php bin/vm.php repro.php
# Compare on PHP 8.4+ reference build when available
'
Observed (VM): compile-time abstract-method fatal for C::$label::get.
Expected (php-src 8.4): compiles; prints hi.
Implementation hints (PHP-in-PHP)
- Teach interface/class compatibility in compiler + PHPCfg: a concrete typed property with matching visibility/type satisfies an interface
{ get; } (and { set; } where applicable) without an explicit hook body.
- Align with existing property hook lowering in
lib/SourcePreprocessor/PropertyHooks.php and VM dispatch in lib/VM.php.
- Compliance:
test/compliance/cases/language/interface_property_hooks.phpt.
Pairs
Done when
Verification
./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && vendor/bin/phpunit --filter interface_property_hooks'
php bin/vm.php test/repro/maintainer_interface_property_hooks.php
php bin/vm.php test/repro/maintainer-interface_property_hooks.php 2>/dev/null || true
Strictness
php-src-strict — default CI/compliance must match PHP 8.4 Zend interface hook satisfaction rules.
Category
languageProblem
PHP 8.4 allows property hooks in interface declarations, e.g.
public string $label { get; }. A implementing class may satisfy the get hook with an ordinary typed property (public string $label = 'hi';) without declaring an explicit hook body.This compiler parses the interface, but rejects valid implementations:
php-src reference
Zend/zend_compile.c— interface property hooks / abstract hook validationZend/zend_property_hooks.cRepro (failure today)
Observed (VM): compile-time abstract-method fatal for
C::$label::get.Expected (php-src 8.4): compiles; prints
hi.Implementation hints (PHP-in-PHP)
{ get; }(and{ set; }where applicable) without an explicit hook body.lib/SourcePreprocessor/PropertyHooks.phpand VM dispatch inlib/VM.php.test/compliance/cases/language/interface_property_hooks.phpt.Pairs
Done when
hi(no abstract-method fatal forC::$label::get){ get; set; }and implementing class with matching typed property + implicit hooks still works./script/ci-fast.sh --filter interface_property_hooksgreenVerification
Strictness
php-src-strict — default CI/compliance must match PHP 8.4 Zend interface hook satisfaction rules.