Skip to content

[Draft] Adding a migration for 3.0#31

Open
mamazu wants to merge 10 commits intosulu:mainfrom
mamazu:request_parameter_rector
Open

[Draft] Adding a migration for 3.0#31
mamazu wants to merge 10 commits intosulu:mainfrom
mamazu:request_parameter_rector

Conversation

@mamazu
Copy link
Copy Markdown

@mamazu mamazu commented Apr 2, 2025

Method Renames

Adding method renames to the 2.6 version, as this can already be done in the old version. Otherwise they would be part of the UP_TO_2_6 migration.

RequestParameterTrait

I've added a rector to refactor this. Mostly cause I wanted to try to use rector but also to help the upgrade that people want to make. The generated code is not the most optimal (as we can't determine the parameter is from) but it works the same as before.

Seeing that the MissingParameterException is also deprecated it has now been replaced with an InvalidArgumentException which will result in a 500 error code.

Related: sulu/sulu#7815

Replacing deprecated ListRepresentation

Now it automatically refactors it to the PaginatedVersion with additional int casts in case of defective types.

Adding Sulu Level 3.0

(stolen from #18)

TODO

  • Adding the class renames after moving bundles to the core.

@mamazu mamazu changed the title Request parameter rector [Draft] Adding a migration for 3.0 Apr 2, 2025
@mamazu mamazu force-pushed the request_parameter_rector branch 2 times, most recently from 6b6aa60 to 61cec13 Compare April 2, 2025 17:25
@mamazu mamazu force-pushed the request_parameter_rector branch from 61cec13 to 919cc9c Compare April 2, 2025 17:29
@mamazu mamazu force-pushed the request_parameter_rector branch from 919cc9c to afce6b0 Compare April 2, 2025 17:51
@mamazu mamazu force-pushed the request_parameter_rector branch from efedb3c to 4778757 Compare April 4, 2025 08:43
@mamazu mamazu mentioned this pull request Apr 4, 2025
4 tasks
@mamazu mamazu force-pushed the request_parameter_rector branch from 5f77b48 to f3fdce1 Compare April 4, 2025 08:58
@mamazu mamazu force-pushed the request_parameter_rector branch from f3fdce1 to bd64618 Compare April 4, 2025 09:00
@mamazu
Copy link
Copy Markdown
Author

mamazu commented Apr 17, 2025

I'm pretty sure that those refactorings can also be done with 2.6 since we're not relying on classes that have been added. In fact in 3.0 some of the classes have been removed.

@alexander-schranz Maybe we even should put it into the Upgrade.md to run the rector. But we can discuss that tomorrow.

@mamazu mamazu force-pushed the request_parameter_rector branch from c66d021 to 21da203 Compare April 27, 2025 13:50
Comment on lines +58 to +60
if (!$this->nodeTypeResolver->isMethodStaticCallOrClassMethodObjectType($node, $objectType)) {
return null;
}
Copy link
Copy Markdown
Author

Choose a reason for hiding this comment

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

Does this not need a check if it's an "whereNot" call?

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.

1 participant