-
-
Notifications
You must be signed in to change notification settings - Fork 80
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
Annotation for magic static methods available with __callStatic #22
Comments
Since there's no magic way of defining static class members, |
PhpStorm support @method static returnType name ... |
/**
* Class Example
*
* @method bool foo()
* @method static bool bar()
*/ That's for example above. |
@lisachenko what about static class members? /**
* Class Example
*
* @property static boolean $isTest
* @method bool foo()
* @method static bool bar()
*/ |
@samdark PHP doesn't support magic static properties, so there is no need to declare such things. But I agree with your example, because it's more general and will allow static properties declaration (if we will have __getStatic() magic method for that). Usage of |
IMO having PhpStorm users adopted this convention since 2011 http://youtrack.jetbrains.com/issue/WI-4051 |
I agree with @neuro159; I prefer adding static as the first keyword in an @method tag as well. This is because static has multiple meanings (static methods vs. late static binding) and hence a tag @static would be potentially confusing AND This PSR explicitly omits |
Hm. Static and object-scope methods are completely different cans of worms in PHP. Due to that, I dislike the optional However, because there is a fundamental differentiation, it does not have to stay that way. The "alias" (wrapper) may diverge from The same applies to A clean separation should allow IDEs to offer autocomplete options at an earlier point in time already. Just typing At the same time, Example: /**
* Class Example
*
* @property bool $isOverloadedProperty
* @property-static bool $isOverloadedStaticProperty
*
* @method bool overloadedMethod()
* @method-static bool overloadedStaticMethod()
*/ |
Can you explain what you mean? I can see how |
|
It's been almost two years, and no solution has been selected. Can we implement one of those solutions in the PSR please? |
Why did the above commit close this ticket? I believe this issue should still be open. |
Currently there is no clear way to declare a magic static methods available for a class that uses
__callStatic()
. Traditional@method
annotation is parsed by IDE and listed as dynamic method, so when I trigger the autocompletion for$this->
IDE can suggest me the name of magic method that is handled with__call()
. When I use magic static methods there is not any help from the IDE because it can not understand that method is magic and static and doesn't list it forself::
orstatic::
.My proposal is to add an extension for that via
@static
or@static-method
. Look at the following example:Autocompletion for dynamic methods is nice, but the method
bar
is listed too:For static methods there is nothing:
The text was updated successfully, but these errors were encountered: