Skip to content

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

Merged
GromNaN merged 1 commit into
symfony:1.xfrom
Amoifr:fix/php84-property-hooks
May 11, 2026
Merged

[make:entity] Fix PHP 8.4 property hooks support#1793
GromNaN merged 1 commit into
symfony:1.xfrom
Amoifr:fix/php84-property-hooks

Conversation

@Amoifr
Copy link
Copy Markdown
Contributor

@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

@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
Comment thread tests/Util/fixtures/source/User_property_hooks.php Outdated
Comment thread tests/Util/ClassSourceManipulatorTest.php
@GromNaN GromNaN force-pushed the fix/php84-property-hooks branch from 5635b67 to a29f35c Compare May 11, 2026 11:41
@GromNaN
Copy link
Copy Markdown
Member

GromNaN commented May 11, 2026

Thank you @Amoifr.

@GromNaN GromNaN merged commit ebfdbd1 into symfony:1.x May 11, 2026
3 of 10 checks passed
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