Skip to content
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

Moving deprecated code handling for stimulus_ functions into Twig extension #189

Merged

Conversation

weaverryan
Copy link
Member

Hi!

This follows up on @jmsche continued work with the Stimulus functions. Basically:

A) The only deprecated should be in the Twig extension: we deprecated passing certain args as an array there. And so, the code to "normalize" the deprecated arguments should live there.

B) This allows the DTO classes to be "pure" classes that are not encumbered by any deprecation later.

Cheers!

*/
public function addAction($controllerName, string $actionName = null, string $eventName = null, array $parameters = []): void
public function addAction(string $controllerName, string $actionName, string $eventName = null, array $parameters = []): void
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

The addition of the string argument type (which i also added to the other Dto classes) is technically a BC break if you're using version 1.15.0 exactly. However, to have code that would trigger that break, you would have needed to start using these classes directly in 1.15.0 and pass the array argument... which would have triggered deprecations immediately (you don't see it here because it's already moved, but in 1.15.0 a deprecation is triggered in this method if you pass an array to $controllerName). So, I think it's not a problem.


$this->values['data-'.$controllerName.'-'.$key.'-value'] = $value;
}
$this->values['data-'.$controllerName.'-'.$key.'-value'] = $value;
Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

All of this is covered by tests for controllers, actions and targets (I double-checked).

Copy link
Collaborator

@jrushlow jrushlow left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Looks good!

src/Asset/EntrypointLookup.php Outdated Show resolved Hide resolved
@weaverryan weaverryan force-pushed the stricter_args_new_stimulus_functions branch from ae90895 to 19ea5e8 Compare July 13, 2022 17:04
@weaverryan weaverryan merged commit e1dd900 into symfony:main Jul 13, 2022
@weaverryan weaverryan added the Bug Bug Fix label Jul 13, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Bug Bug Fix
Projects
None yet
Development

Successfully merging this pull request may close these issues.

2 participants