It would be useful to add PHPStan static analysis support to this package and improve the code quality throughout the code base. This way the individual commands don't all have to set it up themselves and cause repetition.
After landing the initial implementation and working on improving some of the main packages, here are a couple of observations / enhancement suggestions for stronger typing:
It would be useful to add PHPStan static analysis support to this package and improve the code quality throughout the code base. This way the individual commands don't all have to set it up themselves and cause repetition.
After landing the initial implementation and working on improving some of the main packages, here are a couple of observations / enhancement suggestions for stronger typing:
\WP_CLI\Utils\parse_url()Such an extension already exists for
\parse_url()in PHPStan itself and\wp_parse_url()in theszepeviktor/phpstan-wordpresspackage (which is licensed under MIT, like WP-CLI).$argsand$assoc_argsbased on the command's docblock.I think this would be really powerful and would make docblock maintenance easier. Not sure it's possible though, see Changing method parameter types based on PHPDoc contents phpstan/phpstan#13058
\WP_CLI\Utils\get_flag_value(), which currently returnsmixed.phpstan/phpstan-strict-rulesphpstan/phpstan-deprecation-rulesswissspidy/phpstan-no-privatephpstan/phpstan-phpunit\WP_CLI\Utils\iterator_mapShould use generics
\WP_CLI::runcommand()