-
-
Notifications
You must be signed in to change notification settings - Fork 396
[Autocomplete][Turbo] Remove BC layers for methods and parameters #3186
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
base: 3.x
Are you sure you want to change the base?
Conversation
bda8eb8 to
a5cea09
Compare
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Pull request overview
This PR removes backward compatibility (BC) layers for the Turbo and Autocomplete packages as part of the preparation for Symfony UX 3.0. The changes make previously optional method parameters mandatory and remove deprecated interfaces that were used to maintain backward compatibility.
Key Changes:
- Made
$eventSourceOptionsparameter mandatory inTurboStreamListenRendererInterface::renderTurboStreamListen() - Made
getAttributes()andgetGroupBy()methods mandatory inEntityAutocompleterInterface - Removed the
TurboStreamListenRendererWithOptionsInterfacemarker interface
Reviewed changes
Copilot reviewed 11 out of 11 changed files in this pull request and generated 2 comments.
Show a summary per file
| File | Description |
|---|---|
src/Turbo/src/Twig/TurboStreamListenRendererInterface.php |
Added mandatory $eventSourceOptions parameter with type hint and PHPDoc |
src/Turbo/src/Twig/TurboStreamListenRendererWithOptionsInterface.php |
Removed deprecated marker interface that extended the base interface |
src/Turbo/src/Twig/TurboRuntime.php |
Removed BC layer checking for TurboStreamListenRendererWithOptionsInterface |
src/Turbo/src/Bridge/Mercure/TurboStreamListenRenderer.php |
Updated implementation to use standard parameter instead of func_get_arg() |
src/Turbo/tests/Twig/TurboRuntimeTest.php |
Updated test mock to use base interface instead of deprecated one |
src/Autocomplete/src/EntityAutocompleterInterface.php |
Uncommented getAttributes() and getGroupBy() method declarations |
src/Autocomplete/src/Form/WrappedEntityTypeAutocompleter.php |
Added getAttributes() implementation and removed BC layer for form option lookup |
src/Autocomplete/src/AutocompleteResultsExecutor.php |
Removed method_exists() checks for getAttributes() and getGroupBy() |
src/Autocomplete/src/Form/BaseEntityAutocompleteType.php |
Added additional_attributes form option with type validation |
src/Turbo/CHANGELOG.md |
Documented removal of BC layer for $eventSourceOptions parameter |
src/Autocomplete/CHANGELOG.md |
Documented removal of BC layers for interface methods |
💡 Add Copilot custom instructions for smarter, more guided reviews. Learn how to get started.
| */ | ||
| public function isGranted(Security $security): bool; | ||
|
|
||
| /* |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getGroupBy() method should use PHPDoc comment syntax (/** and */) instead of block comment syntax (/* and */) to maintain consistency with other methods in the interface and to allow proper documentation generation.
| /* | |
| /** |
| return $attributesOption($entity); | ||
| } | ||
|
|
||
| return $attributesOption; |
Copilot
AI
Nov 22, 2025
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
The getAttributes() method declares a return type of array (as per the interface), but this code path returns $attributesOption as-is when it's not null, not an array, and not callable. This could potentially return a non-array value, causing a type error. Consider either:
- Removing this fallback return and throwing an exception for invalid types, or
- Casting the value to an array (e.g.,
return (array) $attributesOption;)
| return $attributesOption; | |
| return (array) $attributesOption; |
a5cea09 to
0eb4a4c
Compare
Forgotten from #2754
EDIT: failing checks PHPStan & Turbo tests will be fixed in #3185