From 85352e0599f9085f53379cbe550d54a5c2f11ff7 Mon Sep 17 00:00:00 2001 From: Christian Gripp Date: Mon, 20 Nov 2017 16:43:36 +0000 Subject: [PATCH] Apply fixes from StyleCI --- src/EventListener/ORM/AbstractListener.php | 2 +- src/EventListener/ORM/ConfirmableListener.php | 2 +- src/EventListener/ORM/DeletableListener.php | 2 +- src/EventListener/ORM/LifecycleDateListener.php | 2 +- src/EventListener/ORM/SortableListener.php | 6 +++--- src/Manager/BaseQueryTrait.php | 3 ++- src/Manager/SearchQueryTrait.php | 2 +- src/Model/ConfirmableInterface.php | 2 +- src/Model/DeletableInterface.php | 2 +- src/Model/LifecycleDateTimeInterface.php | 2 +- src/Model/PositionAwareInterface.php | 2 +- src/Model/Traits/ConfirmableTrait.php | 4 ++-- src/Model/Traits/DeleteableTrait.php | 4 ++-- src/Model/Traits/LifecycleDateTimeTrait.php | 4 ++-- src/Model/Traits/SortableTrait.php | 4 ++-- 15 files changed, 22 insertions(+), 21 deletions(-) diff --git a/src/EventListener/ORM/AbstractListener.php b/src/EventListener/ORM/AbstractListener.php index 76a7243a..56b98ac8 100644 --- a/src/EventListener/ORM/AbstractListener.php +++ b/src/EventListener/ORM/AbstractListener.php @@ -20,7 +20,7 @@ abstract class AbstractListener implements EventSubscriber * * @return bool */ - final protected function containsTrait(ReflectionClass $reflection, string $class):bool + final protected function containsTrait(ReflectionClass $reflection, string $class): bool { do { $traits = $reflection->getTraitNames(); diff --git a/src/EventListener/ORM/ConfirmableListener.php b/src/EventListener/ORM/ConfirmableListener.php index 014e5ece..dd1a720b 100644 --- a/src/EventListener/ORM/ConfirmableListener.php +++ b/src/EventListener/ORM/ConfirmableListener.php @@ -32,7 +32,7 @@ public function getSubscribedEvents() * * @throws MappingException */ - public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) : void + public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void { $meta = $eventArgs->getClassMetadata(); diff --git a/src/EventListener/ORM/DeletableListener.php b/src/EventListener/ORM/DeletableListener.php index aa3da093..3359dda7 100644 --- a/src/EventListener/ORM/DeletableListener.php +++ b/src/EventListener/ORM/DeletableListener.php @@ -32,7 +32,7 @@ public function getSubscribedEvents() * * @throws MappingException */ - public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) : void + public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void { $meta = $eventArgs->getClassMetadata(); diff --git a/src/EventListener/ORM/LifecycleDateListener.php b/src/EventListener/ORM/LifecycleDateListener.php index bdec5695..ed741cc1 100644 --- a/src/EventListener/ORM/LifecycleDateListener.php +++ b/src/EventListener/ORM/LifecycleDateListener.php @@ -65,7 +65,7 @@ public function preUpdate(LifecycleEventArgs $args): void * * @throws MappingException */ - public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) : void + public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void { $meta = $eventArgs->getClassMetadata(); diff --git a/src/EventListener/ORM/SortableListener.php b/src/EventListener/ORM/SortableListener.php index b912dc61..aea80cf4 100644 --- a/src/EventListener/ORM/SortableListener.php +++ b/src/EventListener/ORM/SortableListener.php @@ -79,7 +79,7 @@ public function preRemove(LifecycleEventArgs $args): void * * @throws MappingException */ - public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) : void + public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void { $meta = $eventArgs->getClassMetadata(); @@ -103,7 +103,7 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs) : void * @param LifecycleEventArgs $args * @param int|null $oldPosition */ - private function uniquePosition(LifecycleEventArgs $args, ? int $oldPosition = null) : void + private function uniquePosition(LifecycleEventArgs $args, ? int $oldPosition = null): void { $entity = $args->getEntity(); @@ -177,7 +177,7 @@ private function getNextPosition(EntityManager $em, PositionAwareInterface $enti $qb->andWhere('e.'.$field.' = :'.$field)->setParameter($field, $value); } - /** @var PositionAwareInterface $result */ + /* @var PositionAwareInterface $result */ try { $result = $qb->getQuery()->getOneOrNullResult(); } catch (NonUniqueResultException $ignored) { diff --git a/src/Manager/BaseQueryTrait.php b/src/Manager/BaseQueryTrait.php index 2f64994d..e17794f9 100644 --- a/src/Manager/BaseQueryTrait.php +++ b/src/Manager/BaseQueryTrait.php @@ -62,11 +62,12 @@ public function addOrder(QueryBuilder $builder, array $sort, string $defaultEnti $table = $defaultEntity; // Map entity to table name - if (count($fieldSpl) === 2) { + if (2 === count($fieldSpl)) { foreach ($aliasMapping as $k => $v) { if ($fieldSpl[0] === $k) { $table = $v; $field = $fieldSpl[1]; + break; } } diff --git a/src/Manager/SearchQueryTrait.php b/src/Manager/SearchQueryTrait.php index 1d44a3ef..3356294d 100644 --- a/src/Manager/SearchQueryTrait.php +++ b/src/Manager/SearchQueryTrait.php @@ -47,7 +47,7 @@ public function searchWhere(QueryBuilder $qb, string $field, array $values, bool * @param string $word * @param int $index */ - private function buildLikeExpressions(QueryBuilder $qb, Orx $orx, string $field, string $word, int $index) : void + private function buildLikeExpressions(QueryBuilder $qb, Orx $orx, string $field, string $word, int $index): void { $orx->add(sprintf('%s LIKE :name'.$index.'_any', $field)); $orx->add(sprintf('%s LIKE :name'.$index.'_pre', $field)); diff --git a/src/Model/ConfirmableInterface.php b/src/Model/ConfirmableInterface.php index fc799494..4f3541c6 100755 --- a/src/Model/ConfirmableInterface.php +++ b/src/Model/ConfirmableInterface.php @@ -41,5 +41,5 @@ public function setConfirmed(bool $confirmed); * * @return bool */ - public function isConfirmed() : bool; + public function isConfirmed(): bool; } diff --git a/src/Model/DeletableInterface.php b/src/Model/DeletableInterface.php index 66fb7ae1..ac910280 100755 --- a/src/Model/DeletableInterface.php +++ b/src/Model/DeletableInterface.php @@ -41,5 +41,5 @@ public function setDeleted(bool $deleted); * * @return bool */ - public function isDeleted() : bool; + public function isDeleted(): bool; } diff --git a/src/Model/LifecycleDateTimeInterface.php b/src/Model/LifecycleDateTimeInterface.php index 5f64764e..da064378 100755 --- a/src/Model/LifecycleDateTimeInterface.php +++ b/src/Model/LifecycleDateTimeInterface.php @@ -23,7 +23,7 @@ public function getCreatedAt(): ? \DateTime; * * @return \DateTime|null */ - public function getUpdatedAt() : ? \DateTime; + public function getUpdatedAt(): ? \DateTime; /** * Set createdAt. diff --git a/src/Model/PositionAwareInterface.php b/src/Model/PositionAwareInterface.php index 2f38d0af..d6595de4 100644 --- a/src/Model/PositionAwareInterface.php +++ b/src/Model/PositionAwareInterface.php @@ -32,5 +32,5 @@ public function setPosition(? int $position); * * @return string[] */ - public function getPositionGroup() : array; + public function getPositionGroup(): array; } diff --git a/src/Model/Traits/ConfirmableTrait.php b/src/Model/Traits/ConfirmableTrait.php index 7cffa079..b8e1f911 100755 --- a/src/Model/Traits/ConfirmableTrait.php +++ b/src/Model/Traits/ConfirmableTrait.php @@ -63,8 +63,8 @@ public function setConfirmed(bool $confirmed) * * @return bool */ - public function isConfirmed() : bool + public function isConfirmed(): bool { - return $this->confirmedAt !== null; + return null !== $this->confirmedAt; } } diff --git a/src/Model/Traits/DeleteableTrait.php b/src/Model/Traits/DeleteableTrait.php index 3a4faea9..9794817d 100755 --- a/src/Model/Traits/DeleteableTrait.php +++ b/src/Model/Traits/DeleteableTrait.php @@ -63,8 +63,8 @@ public function setDeleted(bool $deleted) * * @return bool */ - public function isDeleted() : bool + public function isDeleted(): bool { - return $this->deletedAt !== null; + return null !== $this->deletedAt; } } diff --git a/src/Model/Traits/LifecycleDateTimeTrait.php b/src/Model/Traits/LifecycleDateTimeTrait.php index 66648b93..b3098732 100755 --- a/src/Model/Traits/LifecycleDateTimeTrait.php +++ b/src/Model/Traits/LifecycleDateTimeTrait.php @@ -40,7 +40,7 @@ public function setCreatedAt(? \DateTime $createdAt) * * @return \DateTime|null */ - public function getCreatedAt() : ? \DateTime + public function getCreatedAt(): ? \DateTime { return $this->createdAt; } @@ -64,7 +64,7 @@ public function setUpdatedAt(? \DateTime $updatedAt) * * @return \DateTime|null */ - public function getUpdatedAt() : ? \DateTime + public function getUpdatedAt(): ? \DateTime { return $this->updatedAt; } diff --git a/src/Model/Traits/SortableTrait.php b/src/Model/Traits/SortableTrait.php index ea61f728..35ea3aa7 100644 --- a/src/Model/Traits/SortableTrait.php +++ b/src/Model/Traits/SortableTrait.php @@ -31,7 +31,7 @@ public function setPosition(? int $position) /** * @return int|null */ - public function getPosition() : int + public function getPosition(): int { return $this->position; } @@ -39,7 +39,7 @@ public function getPosition() : int /** * @return array */ - public function getPositionGroup() : array + public function getPositionGroup(): array { return array(); }