-
Notifications
You must be signed in to change notification settings - Fork 660
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
UnusedMethod for private constructor #4656
Comments
I found these snippets: https://psalm.dev/r/9641f1dbd6<?php
final class Foo {
private function __construct() {}
public static function doSomething(): void { /* ... */ }
}
Foo::doSomething();
|
I've separated this out into a separate issue that can be suppressed if you need |
👌
…On Sun 22 Nov 2020 at 17:48, Matthew Brown ***@***.***> wrote:
a private constructor also make the class non-instantiable by
"conventional" means
I've separated this out into a separate issue that can be suppressed if
you need
—
You are receiving this because you authored the thread.
Reply to this email directly, view it on GitHub
<#4656 (comment)>, or
unsubscribe
<https://github.com/notifications/unsubscribe-auth/ABHPVAIT6JYTCTG5NS6PGDLSRE6HPANCNFSM4T6MNFFA>
.
|
danog
pushed a commit
to danog/psalm
that referenced
this issue
Jan 29, 2021
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
If you have the following class:
Then Psalm will detect
UnusedMethod - 4:20 - Cannot find any calls to private method Foo::__construct
(see https://psalm.dev/r/9641f1dbd6).IMO this is a false-positive. Unlike a regular private method which if unused is dead code, a private constructor also make the class non-instantiable by "conventional" means, hence even if unused is not dead code.
The text was updated successfully, but these errors were encountered: