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

Prevent allowing direct call to __construct #118

Closed
DaveLiddament opened this issue Mar 15, 2020 · 6 comments
Closed

Prevent allowing direct call to __construct #118

DaveLiddament opened this issue Mar 15, 2020 · 6 comments

Comments

@DaveLiddament
Copy link

Feature request

I don't think code should be allowed to call __construct method.

E.g. $bob->__construct("Jane");

https://phpstan.org/r/e261ee44-70c1-486b-958e-dc8abc1231d9

@DaveLiddament
Copy link
Author

I'm happy to give this a go at providing an implementation in the next few days.

@mavimo
Copy link

mavimo commented Mar 15, 2020

@DaveLiddament shouldn't be detected by conding-standard checker than static-analyzer?

@ondrejmirtes
Copy link
Member

@mavimo If you’re concerned about semantics and not code formatting, it’s always easier to write the rule using PHPStan’s AST and type inference.

I’d consider this for phpstan-strict-rules, thank you.

@ondrejmirtes ondrejmirtes transferred this issue from phpstan/phpstan Nov 22, 2020
@canvural
Copy link

I guess this is now in PHPStan itself with this PR.

https://phpstan.org/r/dd092672-9545-4e8c-804f-131178e27fb7

@ondrejmirtes
Copy link
Member

Yes. It's gonna be in bleedingEdge in 1.6.0. Based on feedback I might move it to phpstan-strict-rules before 2.0 comes out.

@github-actions
Copy link

This thread has been automatically locked since there has not been any recent activity after it was closed. Please open a new issue for related bugs.

@github-actions github-actions bot locked as resolved and limited conversation to collaborators May 21, 2022
Sign up for free to subscribe to this conversation on GitHub. Already have an account? Sign in.
Labels
None yet
Projects
None yet
Development

No branches or pull requests

4 participants