Skip to content

[ErrorHandler] Fix patch return type #58549

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

Closed
wants to merge 1 commit into from

Conversation

mtarld
Copy link
Contributor

@mtarld mtarld commented Oct 12, 2024

Q A
Branch? 7.2
Bug fix? yes
New feature? no
Deprecations? no
Issues
License MIT

When trying to patch return types, the following

/**
 * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT>
 */
public function getTargets(): string|array
{
    // ...
}

becomes

/**
 * @return self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT|array<self::CLASS_CONSTRAINT|self::PROPERTY_CONSTRAINT>
 */
public function getTargets(): array
{
    // ...
}

because self::XXX constants are considered invalid. And therefore only the array is kept.
But this behavior is wrong, so this PR prevents the return type from changing if a constant is detected.

@mtarld mtarld requested a review from yceruto as a code owner October 12, 2024 16:36
@carsonbot carsonbot changed the title [ErrorHandler] Fix patch return type Fix patch return type Oct 12, 2024
@carsonbot carsonbot added this to the 7.2 milestone Oct 12, 2024
@carsonbot carsonbot changed the title Fix patch return type [ErrorHandler] Fix patch return type Oct 12, 2024
@mtarld mtarld force-pushed the fix/ci-patch-return-type branch from 1557d9f to 8bf2766 Compare October 12, 2024 16:38
@xabbuh
Copy link
Member

xabbuh commented Oct 12, 2024

see #58536

@mtarld
Copy link
Contributor Author

mtarld commented Oct 12, 2024

This much better, thanks!

@mtarld mtarld closed this Oct 12, 2024
@mtarld mtarld deleted the fix/ci-patch-return-type branch November 15, 2024 10:40
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

3 participants