-
-
Notifications
You must be signed in to change notification settings - Fork 638
Support @method static int foo()
syntax for magic methods
#1855
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
Support @method static int foo()
syntax for magic methods
#1855
Conversation
Do this reading isStatic() from ReflectionDocBlock This was added to ReflectionDocBlock before the docblock 2.0.0 release, so it should be safe to assume that it's available (excluding beta versions) For issue phpDocumentor#822 This was tested locally with the following snippet: /** * @method static int fooStatic() implicitly a void */ class MyClass{}
Not sure how to indicate the first version where phpdocumentor supports it.
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thanks for this contribution! Only a small update is required before merging this. When done we can release this with the next release!
@@ -377,6 +377,7 @@ public function testGetMagicMethods() | |||
$methodMock->shouldReceive('getDescription')->andReturn($description); | |||
$methodMock->shouldReceive('getResponse')->andReturn($response); | |||
$methodMock->shouldReceive('getArguments')->andReturn($arguments); | |||
$methodMock->shouldReceive('isStatic')->andReturn(true); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Please do add this to a new test. It is unclear to me now if the original behavior was not changed unintended.
It looks like is't ok, but I want to be sure.
@@ -101,6 +101,7 @@ public function testMagicMethodsReturnsExpectedCollectionWithTags() | |||
{ | |||
$mockMethodDescriptor = m::mock('phpDocumentor\Descriptor\Tag\MethodDescriptor'); | |||
$mockMethodDescriptor->shouldReceive('getMethodName')->andReturn('Sample'); | |||
$mockMethodDescriptor->shouldReceive('isStatic')->andReturn(false); |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Same applies here, please add a new testcase.
Thanks for the quick response. |
After this change, phpdoc API documentation generated from
@method
tags will indicate that the method is static the phpdoc tag was of the form@method static Type foo()
Do this by reading isStatic() from ReflectionDocBlock
so it should be safe to assume that it's available (excluding beta versions of ReflectionDocBlock)
This was tested locally with the following snippet
(verified generated HTML API documentation was correct and static):
Add a draft of updating the docs for static method support.
For issue #822