headstartwp icon indicating copy to clipboard operation
headstartwp copied to clipboard

Types are not set for parameters or return values in the WordPress plugin

Open claytoncollie opened this issue 1 year ago • 5 comments

Is your enhancement related to a problem? Please describe.

As I was looking through the codebase, I was impressed with how much time and effort was put into defining all of the parameter and return types in JavaScript. The work is very organized. Bravo! But then when I looked at the WordPress plugin, I thought there could be a bit more effort put into this codebase to bring it up to the same standard. Most of the time we are defining the types in a docblock which is good but should be taken a step further and codified as well such as function get_something( string $param ): string { return 'something'; }.

I think a good first step is to all parameter and return types to each method and function in the WordPress plugin ( including void for functions that do not return a value) and then, as a second step, introduce PHPstan and a GitHub action to help future contributors adhere to the standard. We have an open pull request in the wp-scaffold repo that would be easy to copy from to introduce this functionality.

I am happy to make a pull request for one or both of these ideas.

Designs

No response

Describe alternatives you've considered

No response

Code of Conduct

  • [X] I agree to follow this project's Code of Conduct

claytoncollie avatar Oct 20 '23 16:10 claytoncollie