Skip to content
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 2 additions & 2 deletions src/Constraints/NotInPasswordCommonListValidator.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,7 +30,7 @@ public function validate($value, Constraint $constraint): void
return;
}

if (! \is_scalar($value) && ! (\is_object($value) && method_exists($value, '__toString'))) {
if (! \is_scalar($value) && ! $value instanceof \Stringable) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP 8 implicitly implements Stringable for all classes with __toString method.

throw new UnexpectedValueException($value, 'string');
}

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

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

if (! file_exists($passwordFile)) {
if (! is_file($passwordFile)) {
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

is_file is faster because of caching.

return;
}

Expand Down
Loading