Skip to content

Commit

Permalink
This actually needs to use new static
Browse files Browse the repository at this point in the history
  • Loading branch information
mkopinsky committed Nov 20, 2024
1 parent 70bab44 commit 5928721
Show file tree
Hide file tree
Showing 3 changed files with 11 additions and 1 deletion.
7 changes: 7 additions & 0 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
parameters:
ignoreErrors:
-
message: '#^Unsafe usage of new static\(\)\.$#'
identifier: new.static
count: 1
path: src/Matchers/DictionaryMatch.php
3 changes: 3 additions & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,3 +1,6 @@
includes:
- phpstan-baseline.neon

parameters:
level: 0
paths:
Expand Down
2 changes: 1 addition & 1 deletion src/Matchers/DictionaryMatch.php
Original file line number Diff line number Diff line change
Expand Up @@ -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']);
Expand Down

0 comments on commit 5928721

Please sign in to comment.