Skip to content

[make:entity] Fix PHP 8.4 property hooks support#1793

Open
Amoifr wants to merge 2 commits intosymfony:1.xfrom
Amoifr:fix/php84-property-hooks
Open

[make:entity] Fix PHP 8.4 property hooks support#1793
Amoifr wants to merge 2 commits intosymfony:1.xfrom
Amoifr:fix/php84-property-hooks

Conversation

@Amoifr
Copy link
Copy Markdown

@Amoifr Amoifr commented Apr 7, 2026

Summary

This PR fixes the PhpParser\Error that occurs when using make:entity on classes that contain PHP 8.4 property hooks (e.g., private(set), get/set hooks).

  • Uses ParserFactory::createForHostVersion() instead of hardcoded PHP 8.1 parser
  • Automatically detects and uses the appropriate PHP version for parsing
  • Adds tests for PHP 8.4 property hooks

Test plan

  • Existing tests pass (59 tests)
  • New tests for PHP 8.4 property hooks pass
  • Manual testing with entity using property hooks

Fixes #1716

Use ParserFactory::createForHostVersion() instead of hardcoded PHP 8.1
parser to automatically detect and use the appropriate PHP version.

This fixes the PhpParser\Error when parsing entities that use PHP 8.4
property hooks (e.g. private(set), get/set hooks).

Fixes symfony#1716
@Amoifr Amoifr changed the title Fix PHP 8.4 property hooks support in ClassSourceManipulator [make:entity] Fix PHP 8.4 property hooks support Apr 7, 2026
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.

make:entity ManyToOne breaks if entities use Property Hooks

2 participants