Code improvements (#1649)

* use global namespace for faster lookups
* phpstan level 5
This commit is contained in:
Kevin Papst
2020-04-19 14:37:14 +02:00
committed by GitHub
parent 7b25e9acaf
commit 0f3fa8fdbe
183 changed files with 604 additions and 574 deletions

View File

@@ -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;
}

View File

@@ -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)

View File

@@ -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;
}

View File

@@ -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;
}