Summary
Parenthesized intersection-only DNF types such as (I1&I2) $param and function f(): (I1&I2) are accepted and executed on this compiler. The project’s Zend 8.2.31 docker reference rejects them at parse time (unexpected variable "$o", expecting "|").
PHP 8.3+ php-src allows these forms; PHP 8.2 does not. Today lib/Ast/DnfParenTypeRewriter.php unwraps them for php-parser 4.x compatibility (#9733) without gating on language profile.
php-src reference
Zend/zend_compile.c — zend_compile_type() / DNF normalization (PHP 8.3+ parenthesized intersection leaves)
- Compare
lib/ExitFunctionSyntaxRejector.php — precedent for rejecting 8.4-only syntax on 8.2 profile
PHP implementation target
lib/Ast/DnfParenTypeRewriter.php — gate unwrap behind language version / reference profile, or
lib/Compiler.php + lib/VM/DnfCheck.php / lib/JIT/DnfParamCheck.php — enforce runtime DNF constraints only when syntax is legal for active profile
- Do not regress unparenthesized
I1&I2 $param (valid on 8.2)
Repro
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_dnf_paren_intersection_param.php
# Zend 8.2: parse error
# VM: ok
./script/docker-exec.sh -- php bin/vm.php test/repro/maintainer_gap_dnf_paren_intersection_return.php
# Zend 8.2: parse error
# VM: true
Done when (php-src-strict)
Notes
- If the project intentionally targets 8.3+ syntax ahead of docker reference, document in issue fix +
docs/capabilities.md and add profile gate flag — default CI must stay php-src-strict on 8.2 docker.
Summary
Parenthesized intersection-only DNF types such as
(I1&I2) $paramandfunction f(): (I1&I2)are accepted and executed on this compiler. The project’s Zend 8.2.31 docker reference rejects them at parse time (unexpected variable "$o", expecting "|").PHP 8.3+ php-src allows these forms; PHP 8.2 does not. Today
lib/Ast/DnfParenTypeRewriter.phpunwraps them for php-parser 4.x compatibility (#9733) without gating on language profile.php-src reference
Zend/zend_compile.c—zend_compile_type()/ DNF normalization (PHP 8.3+ parenthesized intersection leaves)lib/ExitFunctionSyntaxRejector.php— precedent for rejecting 8.4-only syntax on 8.2 profilePHP implementation target
lib/Ast/DnfParenTypeRewriter.php— gate unwrap behind language version / reference profile, orlib/Compiler.php+lib/VM/DnfCheck.php/lib/JIT/DnfParamCheck.php— enforce runtime DNF constraints only when syntax is legal for active profileI1&I2 $param(valid on 8.2)Repro
Done when (php-src-strict)
(I1&I2) $paramandfunction f(): (I1&I2)are compile-time parse errors matching Zend output classinstanceof/return checks succeedphpc.jsonlanguage version) undertest/compliance/cases/language/Notes
docs/capabilities.mdand add profile gate flag — default CI must stay php-src-strict on 8.2 docker.