mirror of
https://github.com/pmmp/PocketMine-MP.git
synced 2025-06-30 23:29:54 +00:00
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:
parent
b4e1871899
commit
0a5b146189
@ -503,9 +503,6 @@ final class Utils{
|
|||||||
*/
|
*/
|
||||||
public static function parseDocComment(string $docComment) : array{
|
public static function parseDocComment(string $docComment) : array{
|
||||||
$rawDocComment = substr($docComment, 3, -2); //remove the opening and closing markers
|
$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);
|
preg_match_all('/(*ANYCRLF)^[\t ]*(?:\* )?@([a-zA-Z\-]+)(?:[\t ]+(.+?))?[\t ]*$/m', $rawDocComment, $matches);
|
||||||
|
|
||||||
return array_combine($matches[1], $matches[2]);
|
return array_combine($matches[1], $matches[2]);
|
||||||
|
@ -35,11 +35,6 @@ parameters:
|
|||||||
count: 1
|
count: 1
|
||||||
path: ../../../src/plugin/ScriptPluginLoader.php
|
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\\.$#"
|
message: "#^Call to function is_resource\\(\\) with resource will always evaluate to true\\.$#"
|
||||||
count: 2
|
count: 2
|
||||||
|
Loading…
x
Reference in New Issue
Block a user