Code improvements (#1649)
* use global namespace for faster lookups * phpstan level 5
This commit is contained in:
@@ -110,7 +110,7 @@ class ActivityController extends BaseApiController
|
||||
}
|
||||
|
||||
if (!empty($projects = $paramFetcher->get('projects'))) {
|
||||
if (!is_array($projects)) {
|
||||
if (!\is_array($projects)) {
|
||||
$projects = explode(',', $projects);
|
||||
}
|
||||
if (!empty($projects)) {
|
||||
|
||||
@@ -116,7 +116,7 @@ class ProjectController extends BaseApiController
|
||||
}
|
||||
|
||||
if (!empty($customers = $paramFetcher->get('customers'))) {
|
||||
if (!is_array($customers)) {
|
||||
if (!\is_array($customers)) {
|
||||
$customers = explode(',', $customers);
|
||||
}
|
||||
if (!empty($customers)) {
|
||||
@@ -134,7 +134,7 @@ class ProjectController extends BaseApiController
|
||||
|
||||
$ignoreDates = false;
|
||||
if (null !== $paramFetcher->get('ignoreDates')) {
|
||||
$ignoreDates = intval($paramFetcher->get('ignoreDates')) === 1;
|
||||
$ignoreDates = \intval($paramFetcher->get('ignoreDates')) === 1;
|
||||
}
|
||||
|
||||
if (!$ignoreDates) {
|
||||
|
||||
@@ -164,7 +164,7 @@ class TimesheetController extends BaseApiController
|
||||
}
|
||||
|
||||
if (!empty($customers = $paramFetcher->get('customers'))) {
|
||||
if (!is_array($customers)) {
|
||||
if (!\is_array($customers)) {
|
||||
$customers = explode(',', $customers);
|
||||
}
|
||||
if (!empty($customers)) {
|
||||
@@ -177,7 +177,7 @@ class TimesheetController extends BaseApiController
|
||||
}
|
||||
|
||||
if (!empty($projects = $paramFetcher->get('projects'))) {
|
||||
if (!is_array($projects)) {
|
||||
if (!\is_array($projects)) {
|
||||
$projects = explode(',', $projects);
|
||||
}
|
||||
if (!empty($projects)) {
|
||||
@@ -190,7 +190,7 @@ class TimesheetController extends BaseApiController
|
||||
}
|
||||
|
||||
if (!empty($activities = $paramFetcher->get('activities'))) {
|
||||
if (!is_array($activities)) {
|
||||
if (!\is_array($activities)) {
|
||||
$activities = explode(',', $activities);
|
||||
}
|
||||
if (!empty($activities)) {
|
||||
@@ -212,7 +212,7 @@ class TimesheetController extends BaseApiController
|
||||
|
||||
if (null !== ($tags = $paramFetcher->get('tags'))) {
|
||||
$ids = $this->tagRepository->findIdsByTagNameList($tags);
|
||||
if ($ids !== null && sizeof($ids) > 0) {
|
||||
if ($ids !== null && \count($ids) > 0) {
|
||||
$query->setTags(new ArrayCollection($ids));
|
||||
}
|
||||
}
|
||||
@@ -650,22 +650,22 @@ class TimesheetController extends BaseApiController
|
||||
$this->roundingService->roundBegin($copyTimesheet);
|
||||
|
||||
if (null !== ($copy = $paramFetcher->get('copy'))) {
|
||||
if (in_array($copy, ['rates', 'all'])) {
|
||||
if (\in_array($copy, ['rates', 'all'])) {
|
||||
$copyTimesheet->setHourlyRate($timesheet->getHourlyRate());
|
||||
$copyTimesheet->setFixedRate($timesheet->getFixedRate());
|
||||
}
|
||||
|
||||
if (in_array($copy, ['description', 'all'])) {
|
||||
if (\in_array($copy, ['description', 'all'])) {
|
||||
$copyTimesheet->setDescription($timesheet->getDescription());
|
||||
}
|
||||
|
||||
if (in_array($copy, ['tags', 'all'])) {
|
||||
if (\in_array($copy, ['tags', 'all'])) {
|
||||
foreach ($timesheet->getTags() as $tag) {
|
||||
$copyTimesheet->addTag($tag);
|
||||
}
|
||||
}
|
||||
|
||||
if (in_array($copy, ['meta', 'all'])) {
|
||||
if (\in_array($copy, ['meta', 'all'])) {
|
||||
foreach ($timesheet->getMetaFields() as $metaField) {
|
||||
$metaNew = clone $metaField;
|
||||
$copyTimesheet->setMetaField($metaNew);
|
||||
@@ -675,7 +675,7 @@ class TimesheetController extends BaseApiController
|
||||
|
||||
$errors = $validator->validate($copyTimesheet);
|
||||
|
||||
if (count($errors) > 0) {
|
||||
if (\count($errors) > 0) {
|
||||
throw new BadRequestHttpException($errors[0]->getPropertyPath() . ' = ' . $errors[0]->getMessage());
|
||||
}
|
||||
|
||||
|
||||
Reference in New Issue
Block a user