PHPStan level 9

This commit is contained in:
Pascal Birchler 2025-07-04 10:46:17 +02:00
parent aa2d899159
commit 1dc0d16a35
No known key found for this signature in database
GPG key ID: 0DECE73DD74E8B2F
2 changed files with 15 additions and 2 deletions

13
phpstan.neon.dist Normal file
View file

@ -0,0 +1,13 @@
parameters:
level: 9
paths:
- src
- scaffold-command.php
scanDirectories:
- vendor/wp-cli/wp-cli/php
scanFiles:
- vendor/php-stubs/wordpress-stubs/wordpress-stubs.php
treatPhpDocTypesAsCertain: false
ignoreErrors:
- identifier: missingType.parameter
- identifier: missingType.return

View file

@ -875,7 +875,7 @@ class Scaffold_Command extends WP_CLI_Command {
$wp_versions_to_test = [];
// Parse plugin readme.txt
if ( file_exists( "{$target_dir}/readme.txt" ) ) {
$readme_content = file_get_contents( "{$target_dir}/readme.txt" );
$readme_content = (string) file_get_contents( "{$target_dir}/readme.txt" );
preg_match( '/Requires at least\:(.*)\n/m', $readme_content, $matches );
if ( isset( $matches[1] ) && $matches[1] ) {
@ -1045,7 +1045,7 @@ class Scaffold_Command extends WP_CLI_Command {
/**
* Extracts dashicon name when provided or return null otherwise.
*
* @param array $assoc_args
* @param array{dashicon?: string} $assoc_args
* @return string|null
*/
private function extract_dashicon( $assoc_args ) {