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

Skip symfony response in ReturnTypeFromReturnNewRector #6202

Merged
merged 1 commit into from
Jul 30, 2024

Conversation

TomasVotruba
Copy link
Member

@TomasVotruba TomasVotruba commented Jul 30, 2024

Symfony Response is already handled exclusively by ResponseReturnTypeControllerActionRector,
to keep each rule more robuts and separated 👍

Also easier to review and add type coverage in a project ugprade :)

@TomasVotruba TomasVotruba enabled auto-merge (squash) July 30, 2024 12:13
@TomasVotruba TomasVotruba merged commit b0e4e23 into main Jul 30, 2024
34 checks passed
@TomasVotruba TomasVotruba deleted the tv-skip-controller branch July 30, 2024 12:13
@@ -183,6 +184,12 @@ private function refactorDirectReturnNew(

$returnType = $this->typeFactory->createMixedPassedOrUnionType($newTypes);

// skip in case of response, as handled by another rule earlier
/** @see ResponseReturnTypeControllerActionRector */
if ($returnType instanceof ObjectType && $returnType->isInstanceOf(ResponseClass::BASIC)->yes()) {
Copy link
Member

Choose a reason for hiding this comment

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

The ResponseReturnTypeControllerActionRector only works on inside controller, if not, eg: a factory class, this seems still should be executed

Copy link
Member Author

Choose a reason for hiding this comment

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

Indeed. I'll add the check

Copy link
Member Author

Choose a reason for hiding this comment

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

There you go :)
#6204

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.

2 participants