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

Implement phpstan doc parsing #51

Draft
wants to merge 8 commits into
base: main
Choose a base branch
from
Draft

Conversation

@williamdes williamdes self-assigned this Nov 12, 2022
@williamdes williamdes added the enhancement New feature or request label Nov 12, 2022
@williamdes williamdes force-pushed the phpstan-doc-support branch 3 times, most recently from 12f419d to 62592fa Compare November 12, 2022 10:59
@williamdes williamdes mentioned this pull request Nov 29, 2022
@tillkruss
Copy link
Contributor

Nice, looking forward to this!

@jaapio
Copy link

jaapio commented Mar 20, 2024

Finally found the time to address the last reported issues on reflection-docblock. If you have time to update and rerun your test suite that would be very welcome!

@williamdes
Copy link
Member Author

Finally found the time to address the last reported issues on reflection-docblock. If you have time to update and rerun your test suite that would be very welcome!

Thank you so much !

Here is the test errors

There were 2 failures:

1) Doctum\Tests\Parser\NodeVisitorTest::testUpdateMethodParametersFromInvalidTags
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
 Array &0 (
     0 => 'The "param2" parameter of the method "fun1" is missing a @param tag'
     1 => 'The method "fun1" has "6" @param tags but only "2" where expected.'
-    2 => 'The method "fun1" has "1" invalid @param tags.'
-    3 => 'Invalid @param tag on "fun1": "array[\Illuminate\Notifications\Channels\Notification]  $notification"'
 )

/mnt/Dev/@code-lts/doctum/tests/Parser/NodeVisitorTest.php:471

2) Doctum\Tests\Parser\NodeVisitorTest::testUpdateMethodParametersFromInvalidTagsReport
Failed asserting that two arrays are identical.
--- Expected
+++ Actual
@@ @@
-Array &0 (
-    0 => 'The "notification" parameter of the method "fun1" is missing a @param tag'
-    1 => 'The method "fun1" has "1" invalid @param tags.'
-    2 => 'Invalid @param tag on "fun1": "array[\Illuminate\Notifications\Channels\Notification]  $notification"'
-)
+Array &0 ()

/mnt/Dev/@code-lts/doctum/tests/Parser/NodeVisitorTest.php:509

Do you think * @param array[\Illuminate\Notifications\Channels\Notification] $notification should be reported as invalid ?

it seems like it I change the test case to @param array\Illuminate\Notifications\Channels\Notification] $notification it still does not get reported. Is there a mistake in my implementation or is it missing in the phpdocumentor library ?

@jaapio
Copy link

jaapio commented Mar 21, 2024

I do not recognize those as valid notations. Array[] cannot have any content. Array<> can

@williamdes
Copy link
Member Author

Okay, so they should be reported as invalid.
This one should definitely be reported @param array\Illuminate\Notifications\Channels\Notification> $notification

@williamdes
Copy link
Member Author

How does your library handle Invalid tags?

@jaapio
Copy link

jaapio commented Mar 22, 2024

We will return an InvalidTag object, so people can see what is wrong and the parsing continues.

@williamdes
Copy link
Member Author

We will return an InvalidTag object, so people can see what is wrong and the parsing continues.

Awesome, let me know when it is pushed

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Development

Successfully merging this pull request may close these issues.

3 participants