From 5928721397be528db02c7d2f1d17e1e132db2917 Mon Sep 17 00:00:00 2001 From: Michael Kopinsky Date: Tue, 19 Nov 2024 19:50:33 -0500 Subject: [PATCH] This actually needs to use `new static` --- phpstan-baseline.neon | 7 +++++++ phpstan.neon | 3 +++ src/Matchers/DictionaryMatch.php | 2 +- 3 files changed, 11 insertions(+), 1 deletion(-) create mode 100644 phpstan-baseline.neon diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon new file mode 100644 index 0000000..7df3b82 --- /dev/null +++ b/phpstan-baseline.neon @@ -0,0 +1,7 @@ +parameters: + ignoreErrors: + - + message: '#^Unsafe usage of new static\(\)\.$#' + identifier: new.static + count: 1 + path: src/Matchers/DictionaryMatch.php diff --git a/phpstan.neon b/phpstan.neon index ac41719..2b8bf25 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,3 +1,6 @@ +includes: + - phpstan-baseline.neon + parameters: level: 0 paths: diff --git a/src/Matchers/DictionaryMatch.php b/src/Matchers/DictionaryMatch.php index 2d44960..334ac90 100644 --- a/src/Matchers/DictionaryMatch.php +++ b/src/Matchers/DictionaryMatch.php @@ -62,7 +62,7 @@ public static function match(string $password, array $userInputs = [], array $ra $results = static::dictionaryMatch($password, $dict); foreach ($results as $result) { $result['dictionary_name'] = $name; - $matches[] = new DictionaryMatch($password, $result['begin'], $result['end'], $result['token'], $result); + $matches[] = new static($password, $result['begin'], $result['end'], $result['token'], $result); } } Matcher::usortStable($matches, [Matcher::class, 'compareMatches']);