-
Notifications
You must be signed in to change notification settings - Fork 666
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
Purity of @methods in phpdocs #3180
Comments
I found these snippets: https://psalm.dev/r/6da6503a47<?php
/**
* @method static void test()
*/
final class Impure
{
public static function __callStatic(string $name, array $arguments)
{
}
}
/**
* @psalm-pure
*/
function testImpure(): void
{
Impure::__callStatic('', []); // this is correct
Impure::test(); // this should also give ImpureMethodCall
}
/**
* @method static void test()
*/
final class Pure
{
/**
* @psalm-pure
*/
public static function __callStatic(string $name, array $arguments)
{
}
}
/**
* @psalm-pure
*/
function testPure(): void
{
Pure::__callStatic('', []); // this is correct
Pure::test(); // this is also correct
}
|
Not on purpose
I think that's probably sane? But it's also a weird area where there's no obvious correct solution. |
I personally don't care much about But today I was fixing an issue in |
@vudaltsov there is a relevant webmozarts/assert#126 that I'm trying to get done (not as fast as me and anyone else wanted, but my work + family require my attention too, so my apologies for that :-) ) |
Psalm currently considers
@method static
to be pure by default. Is it on purpose? Seems to be an error.Also I think that if
__callStatic
is@pure
, then all@method static
should be considered pure.Same for dynamic methods.
https://psalm.dev/r/6da6503a47
The text was updated successfully, but these errors were encountered: