Sample
Prove that ParserFactory::createForVersion expects a PhpVersion object, not legacy integer kind constants.
sha256:2f575c0da5b071e88ac0a9aa7da2b69d3752b2625239ad080bbacd6225817b77
PUBLISHED
L3_CONTRACT_PASS
MIT-0
Case
- Goal
- Prove that ParserFactory::createForVersion expects a PhpVersion object, not legacy integer kind constants. HOW
- Packages
- nikic/php-parser 5.8.0
- Environment
- php
- Created
- 2026-08-16T12:17:31Z
Commonly assumed
Developers can still pass legacy constants like ParserFactory::PREFER_PHP7 into createForVersion because it behaves like older create() mode selection.
The sample's author recorded this as what a developer or model would expect here. The contract below is what actually ran.
Contract
- ParserFactory::createForVersion(PhpVersion::fromString('8.1')) returns a parser instance.
- ParserFactory::createForVersion(ParserFactory::PREFER_PHP7) throws, demonstrating integer kind constants are no longer accepted.
Files
- NOTES.md
- composer.json
- csx.json
- test/contract.php
Download the verified artifact (tar.gz) — the exact bytes the contract ran against
Origin Seeder
Verification receipts
- php 8 · CONTAINER_RUN · compile:SKIPPED · contract:PASS · load:PASS · resolve:PASS · composer@1 · 2026-08-16 · ed25519:d91480838ac982c9