Fixed some inspection issues.

This commit is contained in:
Jan Böhmer 2022-08-14 19:32:53 +02:00
parent eef26f7ae6
commit 639829f5c5
97 changed files with 305 additions and 185 deletions

View file

@ -47,6 +47,9 @@ use Symfony\Component\Validator\Constraints\UrlValidator;
use Symfony\Component\Validator\Exception\UnexpectedTypeException;
use Symfony\Component\Validator\Exception\UnexpectedValueException;
use function in_array;
use function is_object;
/**
* The validator for UrlOrBuiltin.
* It checks if the value is either a builtin ressource or a valid url.
@ -63,7 +66,7 @@ class UrlOrBuiltinValidator extends UrlValidator
if (null === $value || '' === $value) {
return;
}
if (!is_scalar($value) && !(\is_object($value) && method_exists($value, '__toString'))) {
if (!is_scalar($value) && !(is_object($value) && method_exists($value, '__toString'))) {
throw new UnexpectedValueException($value, 'string');
}
$value = (string) $value;
@ -74,7 +77,7 @@ class UrlOrBuiltinValidator extends UrlValidator
//After the %PLACEHOLDER% comes a slash, so we can check if we have a placholder via explode
$tmp = explode('/', $value);
//Builtins must have a %PLACEHOLDER% construction
if (\in_array($tmp[0], $constraint->allowed_placeholders, false)) {
if (in_array($tmp[0], $constraint->allowed_placeholders, false)) {
return;
}