Skip to content

Commit c7fbd21

Browse files
authored
Merge pull request #891 from samsonasik/str-needles
[Rector] Apply StringifyStrNeedlesRector
2 parents 36a41fd + 6fb9594 commit c7fbd21

3 files changed

Lines changed: 5 additions & 4 deletions

File tree

rector.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -31,7 +31,6 @@
3131
use Rector\EarlyReturn\Rector\Return_\PreparedValueToEarlyReturnRector;
3232
use Rector\Php55\Rector\String_\StringClassNameToClassConstantRector;
3333
use Rector\Php73\Rector\FuncCall\JsonThrowOnErrorRector;
34-
use Rector\Php73\Rector\FuncCall\StringifyStrNeedlesRector;
3534
use Rector\PHPUnit\AnnotationsToAttributes\Rector\Class_\AnnotationWithValueToAttributeRector;
3635
use Rector\PHPUnit\CodeQuality\Rector\Class_\YieldDataProviderRector;
3736
use Rector\PHPUnit\Set\PHPUnitSetList;
@@ -82,7 +81,6 @@
8281
__DIR__ . '/src/Views',
8382

8483
JsonThrowOnErrorRector::class,
85-
StringifyStrNeedlesRector::class,
8684
YieldDataProviderRector::class,
8785

8886
// Note: requires php 8

src/Authentication/Passwords/NothingPersonalValidator.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -79,7 +79,7 @@ protected function isNotPersonal(string $password, ?User $user): bool
7979
if (! empty($domain)) {
8080
$emailParts[] = $domain;
8181
}
82-
$needles = array_merge($needles, $emailParts);
82+
$needles = [...$needles, ...$emailParts];
8383

8484
// Get any other "personal" fields defined in config
8585
$personalFields = $this->config->personalFields;
@@ -183,6 +183,8 @@ protected function isNotSimilar(string $password, ?User $user): bool
183183
*
184184
* Replaces all non-word characters and underscores in $str with a space.
185185
* Then it explodes that result using the space for a delimiter.
186+
*
187+
* @return array<int, string>
186188
*/
187189
protected function strip_explode(string $str): array
188190
{

src/Authentication/Passwords/PwnedValidator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,8 @@ public function check(string $password, ?User $user = null): Result
3535
{
3636
$hashedPword = strtoupper(sha1($password));
3737
$rangeHash = substr($hashedPword, 0, 5);
38-
$searchHash = substr($hashedPword, 5);
38+
/** @var string $searchHash */
39+
$searchHash = substr($hashedPword, 5);
3940

4041
try {
4142
$client = Services::curlrequest([

0 commit comments

Comments
 (0)