Code improvements (#1649)
* use global namespace for faster lookups * phpstan level 5
This commit is contained in:
@@ -28,7 +28,7 @@ class ProjectValidator extends ConstraintValidator
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Project');
|
||||
}
|
||||
|
||||
if (!is_object($value) || !($value instanceof Project)) {
|
||||
if (!\is_object($value) || !($value instanceof Project)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -37,7 +37,7 @@ class RoleValidator extends ConstraintValidator
|
||||
|
||||
$roles = $value;
|
||||
|
||||
if (!is_array($roles)) {
|
||||
if (!\is_array($roles)) {
|
||||
$roles = [$roles];
|
||||
}
|
||||
|
||||
@@ -45,7 +45,7 @@ class RoleValidator extends ConstraintValidator
|
||||
$allowedRoles = array_map('strtoupper', $this->service->getAvailableNames());
|
||||
|
||||
foreach ($roles as $role) {
|
||||
if (!is_string($role) || !in_array($role, $allowedRoles)) {
|
||||
if (!\is_string($role) || !\in_array($role, $allowedRoles)) {
|
||||
$this->context->buildViolation($constraint->message)
|
||||
->setParameter('{{ value }}', $this->formatValue($role))
|
||||
->setCode(Role::ROLE_ERROR)
|
||||
|
||||
@@ -28,7 +28,7 @@ final class TimesheetMultiUpdateValidator extends ConstraintValidator
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\TimesheetMultiUpdate');
|
||||
}
|
||||
|
||||
if (!is_object($value) || !($value instanceof TimesheetMultiUpdateDTO)) {
|
||||
if (!\is_object($value) || !($value instanceof TimesheetMultiUpdateDTO)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
@@ -55,7 +55,7 @@ class TimesheetValidator extends ConstraintValidator
|
||||
throw new UnexpectedTypeException($constraint, __NAMESPACE__ . '\Timesheet');
|
||||
}
|
||||
|
||||
if (!is_object($value) || !($value instanceof TimesheetEntity)) {
|
||||
if (!\is_object($value) || !($value instanceof TimesheetEntity)) {
|
||||
return;
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user