nette / utils

🛠 Lightweight utilities for string & array manipulation, image handling, safe JSON encoding/decoding, validation, slug or strong password generating etc.
https://doc.nette.org/utils
Other
1.98k stars 147 forks source link

annotation @method not correctly parsed #278

Closed ncou closed 2 years ago

ncou commented 2 years ago

Hi,

Nice piece of code. I think there is a problem when reading the @method annotation. https://github.com/nette/utils/blob/a828903f85bb513e51ba664b44b61f20d812cf20/src/Utils/ObjectHelpers.php#L78

the format of the annotation can be of 2 type (static method or not) as documented here : https://doc.nette.org/en/contributing/coding-standard#toc-documentation-blocks-phpdoc

But the parsing is not correct if there is a "static" word instead of the return type.

Here is an example using the nette regex : https://sandbox.onlinephpfunctions.com/code/d381c1f6eefc80b3dd84292a514ff935eddf3e13

As you can see the array is only filed with the first method. If you remove the "static" word the array will be filled with the 2 methods name.

I hope i am clear enough.

Keep up the good work.

dg commented 2 years ago

Thanks, fixed