substr() returns an empty string instead of false in 8.0

an empty string will pass through preg_match_all() without any harmful effects, so we don't need to check for it.
This commit is contained in:
Dylan K. Taylor 2022-01-07 22:38:00 +00:00
parent b4e1871899
commit 0a5b146189
No known key found for this signature in database
GPG Key ID: 8927471A91CAFD3D
2 changed files with 0 additions and 8 deletions

View File

@ -503,9 +503,6 @@ final class Utils{
*/
public static function parseDocComment(string $docComment) : array{
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
if($rawDocComment === false){ //usually empty doc comment, but this is safer and statically analysable
return [];
}
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z\-]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
return array_combine($matches[1], $matches[2]);

View File

@ -35,11 +35,6 @@ parameters:
count: 1
path: ../../../src/plugin/ScriptPluginLoader.php
-
message: "#^Strict comparison using \\=\\=\\= between string and false will always evaluate to false\\.$#"
count: 1
path: ../../../src/utils/Utils.php
-
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
count: 2