Skip to content

Commit e615780

Browse files
authored
refactor #8 Code improvements (gharlan)
This PR was merged into the 1.0-dev branch. Discussion ---------- | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Fixed tickets | | License | MIT <!-- - Please fill in this template according to the PR you're about to submit. Provide additional information in your description, not the questioner table. - Replace this comment by a description of what your PR is solving. - Bug fixes must be submitted against the lowest maintained branch where they apply (lowest branches are regularly merged to upper ones so they get the fixes too.) --> Commits ------- 779a8c1 Code improvements
2 parents 86729e2 + 779a8c1 commit e615780

File tree

1 file changed

+2
-2
lines changed

1 file changed

+2
-2
lines changed

src/Constraints/NotInPasswordCommonListValidator.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -30,7 +30,7 @@ public function validate($value, Constraint $constraint): void
3030
return;
3131
}
3232

33-
if (! \is_scalar($value) && ! (\is_object($value) && method_exists($value, '__toString'))) {
33+
if (! \is_scalar($value) && ! $value instanceof \Stringable) {
3434
throw new UnexpectedValueException($value, 'string');
3535
}
3636

@@ -39,7 +39,7 @@ public function validate($value, Constraint $constraint): void
3939

4040
$passwordFile = __DIR__ . '/../../Resources/common_lists/list-' . mb_strlen($value) . '.php';
4141

42-
if (! file_exists($passwordFile)) {
42+
if (! is_file($passwordFile)) {
4343
return;
4444
}
4545

0 commit comments

Comments
 (0)