mirror of
https://github.com/Part-DB/Part-DB-server.git
synced 2025-07-12 03:14:32 +02:00
Fixed some inspection issues.
This commit is contained in:
parent
eef26f7ae6
commit
639829f5c5
97 changed files with 305 additions and 185 deletions
|
@ -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;
|
||||
}
|
||||
|
||||
|
|
Loading…
Add table
Add a link
Reference in a new issue