webmozarts / assert

Assertions to validate method input/output with nice error messages.

Geek Repo:Geek Repo

Github PK Tool:Github PK Tool

Add PHPDoc method hints for allNullOrIs*

gskema opened this issue · comments

E.g. I used a Assert::allNullOrIsInstanceOf(...) in a __construct(), it's a valid function, but without a method PHPDoc. Is this intentional or should it be added?

The 'downside' of the current implementation is that the all and nullOr can be chained for however long the user wishes. e.g. nullOrAllNullOrInstanceOf would also be valid. So that means there is technically an infinite number of methods to support.

And if we document allNullOr...then nullOrAll... should be documented as well

The reasons for having the @method anotations are IDE auto completion, and static analysis tools. I'd personally like to solve those through some kind of annotation on the __callStatic method, but i don't think there is anything like that atm.

For now this isn't something i'm to keen on fixing as it doubles the work for most things related to this project.

BTW there was a PR proposed last year: #68

I understand, do whatever you think is appropriate. I just found these methods useful and wish they were documented (not seen as "undefined"). You can close this.

This will be closed after #126 is completed and merged.

Shouldn't this be closed as #126 is merged?