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

Clone of a subclass with uncloneable parent isn't detected #8569

Closed
danog opened this issue Oct 11, 2022 · 3 comments
Closed

Clone of a subclass with uncloneable parent isn't detected #8569

danog opened this issue Oct 11, 2022 · 3 comments

Comments

@danog
Copy link
Collaborator

danog commented Oct 11, 2022

https://psalm.dev/r/e70fe01aff

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/e70fe01aff
<?php
class a { private function __clone() {} }
class b extends a {}

clone new a;
clone new b;
Psalm output (using commit 028ac7f):

ERROR: InvalidClone - 5:1 - Cannot clone a

@orklah
Copy link
Collaborator

orklah commented Oct 11, 2022

Interestingly, it works fine with __construct: https://psalm.dev/r/705945b4f6

I guess it's just missing a few checks somewhere

@psalm-github-bot
Copy link

I found these snippets:

https://psalm.dev/r/705945b4f6
<?php
class a { private function __construct() {} }
class b extends a {}

new a;
new b;
Psalm output (using commit eb6a347):

ERROR: InaccessibleMethod - 5:1 - Cannot access private method a::__construct from context 

ERROR: InaccessibleMethod - 6:1 - Cannot access private method a::__construct from context 

danog added a commit to nicelocal/psalm that referenced this issue Oct 12, 2022
orklah added a commit that referenced this issue Oct 12, 2022
@orklah orklah closed this as completed Oct 12, 2022
danog added a commit to nicelocal/psalm that referenced this issue Oct 14, 2022
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

No branches or pull requests

2 participants