diff --git a/bin/generate.php b/bin/generate.php index eb0565f..b0e6a4a 100644 --- a/bin/generate.php +++ b/bin/generate.php @@ -144,11 +144,12 @@ unset( $desc[0] ); $desc = array_map( function( string $string ) : array { - return (array) preg_split( '#\s+#', $string, 3 ); + $parts = preg_split( '#\s+#', $string, 3 ); + return $parts !== false ? $parts : []; }, $desc ); $desc = array_map( function( array $item ) : string { - $description = preg_replace( '#\n\s+#', ' ', (string) $item[2] ); + $description = preg_replace( '#\n\s+#', ' ', $item[2] ); $type = $item[0]; $name = $item[1]; diff --git a/bin/shapes.php b/bin/shapes.php index 033572f..e0a8605 100644 --- a/bin/shapes.php +++ b/bin/shapes.php @@ -153,7 +153,8 @@ function test_shape( array $options ): void { if ( preg_match( '#^(.+?)\s+(\$\S+)#', $string, $matches ) === 1 ) { return [ trim( $matches[1] ), $matches[2] ]; } - return (array) preg_split( '#\s+#', $string, 3 ); + $parts = preg_split( '#\s+#', $string, 3 ); + return $parts !== false ? $parts : []; }, $desc ); usort( $desc, function( $a, $b ): int { diff --git a/composer.json b/composer.json index b92da71..1372479 100644 --- a/composer.json +++ b/composer.json @@ -323,13 +323,13 @@ "humanmade/coding-standards": "1.2.1", "johnbillion/falsey-assertequals-detector": "^3", "phpdocumentor/reflection": "~4.0 || ~5.0", - "phpstan/phpstan": "1.12.12", - "phpstan/phpstan-phpunit": "1.4.1", - "phpstan/phpstan-strict-rules": "1.6.1", + "phpstan/phpstan": "2.1.37", + "phpstan/phpstan-phpunit": "2.0.12", + "phpstan/phpstan-strict-rules": "2.0.8", "phpunit/phpunit": "^9.0", "roots/wordpress-core-installer": "1.100.0", "roots/wordpress-full": "6.9", - "szepeviktor/phpstan-wordpress": "1.3.5" + "szepeviktor/phpstan-wordpress": "2.0.3" }, "funding": [ { diff --git a/src/Arrayable/ProvidesFromArray.php b/src/Arrayable/ProvidesFromArray.php index 49f5761..af621bf 100644 --- a/src/Arrayable/ProvidesFromArray.php +++ b/src/Arrayable/ProvidesFromArray.php @@ -13,6 +13,7 @@ trait ProvidesFromArray { * @return static */ final public static function fromArray( array $args ) : self { + /** @phpstan-ignore new.staticInAbstractClassStaticMethod */ $class = new static(); foreach ( $args as $key => $value ) {