Skip to content

Language: DNF parameter (I1&I2)|C compiles — Op\Type\Intersection in TypeReconstructor (#4956) - #6391

Merged
PurHur merged 1 commit into
masterfrom
agent/issue-4956-dnf-param-intersection
Jun 5, 2026
Merged

PurHur merged 1 commit into
masterfrom
agent/issue-4956-dnf-param-intersection

Conversation

@PurHur

@PurHur PurHur commented Jun 5, 2026

Copy link
Copy Markdown
Owner

Summary

  • Fix apply-patches.sh so php-types-intersection-type overlay also lowers Op\Type\Intersection in TypeReconstructor::resolveOpType() (previously only Type.php was patched; Union_ without Intersection caused compile failure on (I1&I2)|C parameters).
  • Update bootstrap-vendor SSOT TypeReconstructor.php with the Intersection handler.
  • Preserve original class name casing in DNF type labels ((I1&I2)|C not (I1&I2)|c) for Zend-matching TypeError messages.
  • Add repro + compliance PHPTs for intersection+class DNF parameter arms.

Closes #4956

php-src reference

  • Zend/zend_compile.c — zend_compile_type, DNF normalization
  • Zend/zend_type.h — parameter zend_type DNF lists

PHP implementation: script/apply-patches.sh (vendor overlay), lib/DnfType.php (label formatting), existing lib/VM/DnfCheck.php runtime checks.

Verification

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && php bin/vm.php test/repro-maintainer/repro_dnf_param.php'
# C

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter dnf_param test/compliance/VMTest.php'
# OK (4 tests, 4 assertions) — includes new dnf_param_intersection_class* cases + existing #3094 cases

./script/docker-exec.sh -- bash -lc 'source script/php-env.sh && ./vendor/bin/phpunit --filter testPhpTypesUnionTypeReconstructorOverlayApplied test/unit/ApplyPatchesTest.php'
# OK — verifies Union_ + Intersection handlers present in vendor TypeReconstructor

Made with Cursor

Ensure php-types overlays lower Op\Type\Intersection in TypeReconstructor
so (I1&I2)|C parameters compile, and preserve class casing in DNF labels.

Co-authored-by: Cursor <cursoragent@cursor.com>
@PurHur
PurHur merged commit 7d99d17 into master Jun 5, 2026
@PurHur
PurHur deleted the agent/issue-4956-dnf-param-intersection branch June 5, 2026 20:54
PurHur added a commit that referenced this pull request Jun 6, 2026
The compile fix landed in #6391 (#4956); add the maintainer repro script
from the issue spec and PHPUnit coverage so the regression stays guarded.

Co-authored-by: PurHur <PurHur@users.noreply.github.com>
Co-authored-by: Cursor <cursoragent@cursor.com>
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

Language: DNF parameter types (I1&I2)|C — compile fails on Intersection in TypeReconstructor (phase 2 of #3094)

1 participant