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 __construct() in BoolReturnTypeFromStrictScalarReturnsRector #5133

Merged
merged 3 commits into from Oct 6, 2023

Conversation

staabm
Copy link
Contributor

@staabm staabm commented Oct 6, 2023

No description provided.

@staabm staabm changed the title Create skip_construct.php.inc Skip __construct() in BoolReturnTypeFromStrictScalarReturnsRector Oct 6, 2023
{
public function __construct()
{
return true;
Copy link
Contributor Author

@staabm staabm Oct 6, 2023

Choose a reason for hiding this comment

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

I am aware that having a __construct method and returning something in it does not actually make sense, but I stumbled over such a case today, and rector was adding a :bool return type on said method - which leads to a fatal error at runtime

@staabm staabm marked this pull request as ready for review October 6, 2023 09:18
@samsonasik
Copy link
Member

You can use ClassMethodReturnTypeOverrideGuard like other rule

@staabm
Copy link
Contributor Author

staabm commented Oct 6, 2023

great catch, thanks

@samsonasik samsonasik merged commit caf08c4 into rectorphp:main Oct 6, 2023
39 checks passed
@samsonasik
Copy link
Member

Thank you @staabm

@staabm staabm deleted the patch-1 branch October 6, 2023 09:48
@TomasVotruba
Copy link
Member

Thanks 👏

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
3 participants