AdvancedCustomFields / acf

Advanced Custom Fields
http://advancedcustomfields.com/
823 stars 168 forks source link

Fix PHPDoc return types of `get_fields()` and `get_field_objects()` #902

Closed herndlm closed 3 months ago

herndlm commented 3 months ago

Before 6.2.5 and 6.2.6 these were something like @return (array) <description> and static analysis tools were ignoring the invalid (array) PHPDoc and basically falling back to mixed. But then they were changed to @return array and the PHPDoc was picked up and started to cause false-positive reports via PHPStan in my case since the functions can in reality return false.

There would be many more places to adapt I guess, but I wanted to only touch what was causing issues for me.

lgladdy commented 3 months ago

Cheers for the PR here. You're right we fixed a significant chunk of badly formatted phpdoc comments in recent releases, so that's why you're being warned of the issues now.

Our intention is as we edit files containing malformed or incorrect phpdoc comments we'll fix them up so we're constantly improving them until every one is correct, but we'll get these two fixed up for you in either 6.2.8 or 6.3.

I'll close this PR here though, as we don't pull from this repo into our development repo, and I'll raise a PR in that one to get it released.

Thanks! Liam