Category
language · php-src-strict · traits · compile-time error text
Problem
Diamond trait graphs that require insteadof to pick a single DA::m provider should fail at compile time with Zend's "Required Trait DA wasn't added to DD" when the resolution is invalid. This compiler reports Could not find trait DA, hiding the real conflict reason.
| Repro |
Zend 8.2+ |
VM/JIT compile (2026-08-18 @ 2f0c85a98d) |
trait DA{}; trait DB{use DA;}; trait DC{use DA;}; class DD{use DB,DC{DA::m insteadof DB,DC;}} |
Fatal: Required Trait DA wasn't added to DD |
Could not find trait DA |
Distinct from #32129 (parent class in insteadof); same error-reporting subsystem.
php-src reference
PHP implementation target
lib/ trait alias registration — surface Zend required-trait message when alias names a method provider not directly used on the class
- PHP compile path only; shrink misleading generic trait lookup errors
Repro
./script/docker-exec.sh -- bash -lc 'php bin/vm.php test/repro/maintainer_gap_trait_diamond_insteadof.php 2>&1 | head -1'
./script/docker-exec.sh -- bash -lc 'php bin/jit.php test/repro/maintainer_gap_trait_diamond_insteadof.php 2>&1 | head -1'
Done when
Category
language· php-src-strict · traits · compile-time error textProblem
Diamond trait graphs that require
insteadofto pick a singleDA::mprovider should fail at compile time with Zend's "Required Trait DA wasn't added to DD" when the resolution is invalid. This compiler reportsCould not find trait DA, hiding the real conflict reason.2f0c85a98d)trait DA{}; trait DB{use DA;}; trait DC{use DA;}; class DD{use DB,DC{DA::m insteadof DB,DC;}}Distinct from #32129 (parent class in
insteadof); same error-reporting subsystem.php-src reference
Zend/zend_compile.c— trait precedence / alias registration (zend_register_trait_aliases, required-trait checks)PHP implementation target
lib/trait alias registration — surface Zend required-trait message when alias names a method provider not directlyused on the classRepro
Done when
Required Trait DA wasn't addedon VM and JIT.phptguard undertest/compliance/cases/language/trait_diamond_insteadof*.phpt