From cfcc179f33134e48e8c1d851dfcf71927fc0f896 Mon Sep 17 00:00:00 2001 From: TomasVotruba Date: Mon, 9 Dec 2019 18:58:18 +0100 Subject: [PATCH] [cs] apply clean-code set --- ecs.yaml | 2 +- .../DoctrineBehaviorsExtension.php | 1 - src/Model/Blameable/BlameableMethods.php | 6 +-- src/Model/Geocodable/Geocodable.php | 2 - src/Model/Geocodable/GeocodableProperties.php | 2 - src/Model/Sluggable/SluggableMethods.php | 8 ++-- src/Model/Tree/Node.php | 13 ++---- src/ORM/Blameable/BlameableSubscriber.php | 9 +--- src/ORM/Blameable/UserCallable.php | 2 +- src/ORM/Filterable/FilterableRepository.php | 2 +- src/ORM/Geocodable/GeocodableSubscriber.php | 3 -- .../Query/AST/Functions/DistanceFunction.php | 1 - src/ORM/Joinable/JoinableRepository.php | 4 +- src/ORM/Loggable/LoggableSubscriber.php | 9 +--- src/ORM/Sluggable/SluggableSubscriber.php | 1 - .../SoftDeletable/SoftDeletableSubscriber.php | 2 - .../Translatable/CurrentLocaleCallable.php | 1 - .../Translatable/DefaultLocaleCallable.php | 2 - .../Translatable/TranslatableSubscriber.php | 2 +- src/Reflection/ClassAnalyzer.php | 2 - .../DoctrineBehaviors/ORM/GeocodableTest.php | 4 +- .../ORM/TranslatableTest.php | 4 +- .../DoctrineBehaviors/ORM/Tree/NodeTest.php | 4 +- .../BehaviorFixtures/ORM/BlameableEntity.php | 23 +++------- .../BehaviorFixtures/ORM/FilterableEntity.php | 4 +- .../BehaviorFixtures/ORM/GeocodableEntity.php | 23 +++------- .../BehaviorFixtures/ORM/LoggableEntity.php | 45 +++---------------- .../ORM/TimestampableEntity.php | 23 +++------- .../BehaviorFixtures/ORM/TreeNodeEntity.php | 4 +- .../BehaviorFixtures/ORM/UserEntity.php | 5 +++ 30 files changed, 54 insertions(+), 159 deletions(-) diff --git a/ecs.yaml b/ecs.yaml index 2a7ad7fd..60f08070 100644 --- a/ecs.yaml +++ b/ecs.yaml @@ -5,7 +5,7 @@ parameters: - 'php71' # - 'symplify' # - 'common' -# - 'clean-code' + - 'clean-code' skip: PhpCsFixer\Fixer\Operator\UnaryOperatorSpacesFixer: null diff --git a/src/Bundle/DependencyInjection/DoctrineBehaviorsExtension.php b/src/Bundle/DependencyInjection/DoctrineBehaviorsExtension.php index 655d7bfc..25758d0a 100644 --- a/src/Bundle/DependencyInjection/DoctrineBehaviorsExtension.php +++ b/src/Bundle/DependencyInjection/DoctrineBehaviorsExtension.php @@ -5,7 +5,6 @@ namespace Knp\DoctrineBehaviors\Bundle\DependencyInjection; use Symfony\Component\Config\FileLocator; -use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; use Symfony\Component\DependencyInjection\ContainerBuilder; use Symfony\Component\DependencyInjection\Extension\Extension; use Symfony\Component\DependencyInjection\Loader\YamlFileLoader; diff --git a/src/Model/Blameable/BlameableMethods.php b/src/Model/Blameable/BlameableMethods.php index 620ae8b8..2e539e19 100644 --- a/src/Model/Blameable/BlameableMethods.php +++ b/src/Model/Blameable/BlameableMethods.php @@ -21,7 +21,7 @@ trait BlameableMethods { /** - * @param mixed the user representation + * @param mixed $user the user representation * @return $this */ public function setCreatedBy($user) @@ -32,7 +32,7 @@ public function setCreatedBy($user) } /** - * @param mixed the user representation + * @param mixed $user the user representation * @return $this */ public function setUpdatedBy($user) @@ -43,7 +43,7 @@ public function setUpdatedBy($user) } /** - * @param mixed the user representation + * @param mixed $user the user representation * @return $this */ public function setDeletedBy($user) diff --git a/src/Model/Geocodable/Geocodable.php b/src/Model/Geocodable/Geocodable.php index cac56bc8..ed883ac4 100644 --- a/src/Model/Geocodable/Geocodable.php +++ b/src/Model/Geocodable/Geocodable.php @@ -13,8 +13,6 @@ namespace Knp\DoctrineBehaviors\Model\Geocodable; -use Knp\DoctrineBehaviors\ORM\Geocodable\Type\Point; - /** * Geocodable trait. * diff --git a/src/Model/Geocodable/GeocodableProperties.php b/src/Model/Geocodable/GeocodableProperties.php index 0bfe0487..0e2df031 100644 --- a/src/Model/Geocodable/GeocodableProperties.php +++ b/src/Model/Geocodable/GeocodableProperties.php @@ -13,8 +13,6 @@ namespace Knp\DoctrineBehaviors\Model\Geocodable; -use Knp\DoctrineBehaviors\ORM\Geocodable\Type\Point; - /** * Geocodable trait. * diff --git a/src/Model/Sluggable/SluggableMethods.php b/src/Model/Sluggable/SluggableMethods.php index 048efd2b..0eaf0111 100644 --- a/src/Model/Sluggable/SluggableMethods.php +++ b/src/Model/Sluggable/SluggableMethods.php @@ -56,7 +56,7 @@ public function setSlug($slug) return $this; } - + /** * Returns the entity's slug. * @@ -74,7 +74,7 @@ public function getSlug() private function generateSlugValue($values) { $usableValues = []; - foreach ($values as $fieldName => $fieldValue) { + foreach ($values as $fieldValue) { if (!empty($fieldValue)) { $usableValues[] = $fieldValue; } @@ -93,9 +93,7 @@ private function generateSlugValue($values) $sluggableText = $transliterator->transliterate($sluggableText, $this->getSlugDelimiter()); $urlized = strtolower(trim(preg_replace("/[^a-zA-Z0-9\/_|+ -]/", '', $sluggableText), $this->getSlugDelimiter())); - $urlized = preg_replace("/[\/_|+ -]+/", $this->getSlugDelimiter(), $urlized); - - return $urlized; + return preg_replace("/[\/_|+ -]+/", $this->getSlugDelimiter(), $urlized); } /** diff --git a/src/Model/Tree/Node.php b/src/Model/Tree/Node.php index 8cb4f179..2e432cc6 100644 --- a/src/Model/Tree/Node.php +++ b/src/Model/Tree/Node.php @@ -15,21 +15,18 @@ use Doctrine\Common\Collections\ArrayCollection; -use Doctrine\Common\Collections\Collection; -use Knp\DoctrineBehaviors\Model\Tree\NodeInterface; - /* * @author Florian Klein */ trait Node { /** - * @var ArrayCollection $childNodes the children in the tree + * @var ArrayCollection the children in the tree */ private $childNodes; /** - * @var NodeInterface $parentNode the parent in the tree + * @var NodeInterface the parent in the tree */ private $parentNode; @@ -82,9 +79,7 @@ public function getParentMaterializedPath() $path = $this->getExplodedPath(); array_pop($path); - $parentPath = static::getMaterializedPathSeparator() . implode(static::getMaterializedPathSeparator(), $path); - - return $parentPath; + return static::getMaterializedPathSeparator() . implode(static::getMaterializedPathSeparator(), $path); } /** @@ -227,7 +222,7 @@ public function getRootNode() public function buildTree(array $results): void { $this->getChildNodes()->clear(); - foreach ($results as $i => $node) { + foreach ($results as $node) { if ($node->getMaterializedPath() === $this->getRealMaterializedPath()) { $node->setParentNode($this); $node->buildTree($results); diff --git a/src/ORM/Blameable/BlameableSubscriber.php b/src/ORM/Blameable/BlameableSubscriber.php index 75323ee3..8359c406 100644 --- a/src/ORM/Blameable/BlameableSubscriber.php +++ b/src/ORM/Blameable/BlameableSubscriber.php @@ -13,13 +13,10 @@ namespace Knp\DoctrineBehaviors\ORM\Blameable; -use Doctrine\Common\EventSubscriber; - use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\LoadClassMetadataEventArgs; -use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Events, Knp\DoctrineBehaviors\ORM\AbstractSubscriber, @@ -50,7 +47,7 @@ class BlameableSubscriber extends AbstractSubscriber private $blameableTrait; /** - * @param callable + * @param callable $classAnalyzer * @param string $userEntity */ public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, $blameableTrait, ?callable $userCallable = null, $userEntity = null) @@ -290,14 +287,12 @@ public function getUser() public function getSubscribedEvents() { - $events = [ + return [ Events::prePersist, Events::preUpdate, Events::preRemove, Events::loadClassMetadata, ]; - - return $events; } public function setUserCallable(callable $callable): void diff --git a/src/ORM/Blameable/UserCallable.php b/src/ORM/Blameable/UserCallable.php index 858e311c..f39c1055 100644 --- a/src/ORM/Blameable/UserCallable.php +++ b/src/ORM/Blameable/UserCallable.php @@ -26,7 +26,7 @@ class UserCallable private $container; /** - * @param callable + * @param callable $container * @param string $userEntity */ public function __construct(Container $container) diff --git a/src/ORM/Filterable/FilterableRepository.php b/src/ORM/Filterable/FilterableRepository.php index c1dab70a..e8fc202e 100644 --- a/src/ORM/Filterable/FilterableRepository.php +++ b/src/ORM/Filterable/FilterableRepository.php @@ -62,7 +62,7 @@ abstract public function getInFilterColumns(); * Filter values * * @param array $filters - array like ['e:name' => 'nameValue'] where "e" is entity alias query, so we can filter using joins. - * @param \Doctrine\ORM\QueryBuilder + * @param \Doctrine\ORM\QueryBuilder $qb * @return \Doctrine\ORM\QueryBuilder */ public function filterBy(array $filters, ?QueryBuilder $qb = null) diff --git a/src/ORM/Geocodable/GeocodableSubscriber.php b/src/ORM/Geocodable/GeocodableSubscriber.php index 23c3dd33..8181b756 100644 --- a/src/ORM/Geocodable/GeocodableSubscriber.php +++ b/src/ORM/Geocodable/GeocodableSubscriber.php @@ -13,8 +13,6 @@ namespace Knp\DoctrineBehaviors\ORM\Geocodable; -use Doctrine\Common\EventSubscriber; - use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\DBAL\Platforms\MySqlPlatform; @@ -23,7 +21,6 @@ use Doctrine\DBAL\Types\Type; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\LoadClassMetadataEventArgs; -use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Events; use Knp\DoctrineBehaviors\ORM\AbstractSubscriber, diff --git a/src/ORM/Geocodable/Query/AST/Functions/DistanceFunction.php b/src/ORM/Geocodable/Query/AST/Functions/DistanceFunction.php index 5031d645..4ec677a9 100644 --- a/src/ORM/Geocodable/Query/AST/Functions/DistanceFunction.php +++ b/src/ORM/Geocodable/Query/AST/Functions/DistanceFunction.php @@ -5,7 +5,6 @@ namespace Knp\DoctrineBehaviors\ORM\Geocodable\Query\AST\Functions; use Doctrine\ORM\Query\AST\Functions\FunctionNode; -use Doctrine\ORM\Query\AST\PathExpression; use Doctrine\ORM\Query\Lexer; use Doctrine\ORM\Query\Parser; use Doctrine\ORM\Query\SqlWalker; diff --git a/src/ORM/Joinable/JoinableRepository.php b/src/ORM/Joinable/JoinableRepository.php index 08b931ac..d5baa405 100644 --- a/src/ORM/Joinable/JoinableRepository.php +++ b/src/ORM/Joinable/JoinableRepository.php @@ -60,9 +60,7 @@ private function addJoinsToQueryBuilder($alias, QueryBuilder $qb, $className, $r private function getAlias($className) { $shortName = $this->getEntityManager()->getClassMetadata($className)->reflClass->getShortName(); - $alias = strtolower(substr($shortName, 0, 1)); - - return $alias; + return strtolower(substr($shortName, 0, 1)); } private function getUniqueAlias($className, QueryBuilder $qb) diff --git a/src/ORM/Loggable/LoggableSubscriber.php b/src/ORM/Loggable/LoggableSubscriber.php index 3458b6dd..47367cc0 100644 --- a/src/ORM/Loggable/LoggableSubscriber.php +++ b/src/ORM/Loggable/LoggableSubscriber.php @@ -13,11 +13,8 @@ namespace Knp\DoctrineBehaviors\ORM\Loggable; -use Doctrine\Common\EventSubscriber; - use Doctrine\ORM\Event\LifecycleEventArgs; -use Doctrine\ORM\Event\OnFlushEventArgs; use Doctrine\ORM\Events, Knp\DoctrineBehaviors\ORM\AbstractSubscriber, @@ -35,7 +32,7 @@ class LoggableSubscriber extends AbstractSubscriber private $loggerCallable; /** - * @param callable + * @param callable $classAnalyzer */ public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, callable $loggerCallable) { @@ -116,12 +113,10 @@ protected function isEntitySupported(\ReflectionClass $reflClass) public function getSubscribedEvents() { - $events = [ + return [ Events::postPersist, Events::postUpdate, Events::preRemove, ]; - - return $events; } } diff --git a/src/ORM/Sluggable/SluggableSubscriber.php b/src/ORM/Sluggable/SluggableSubscriber.php index 3c3ca399..d44277d6 100644 --- a/src/ORM/Sluggable/SluggableSubscriber.php +++ b/src/ORM/Sluggable/SluggableSubscriber.php @@ -9,7 +9,6 @@ namespace Knp\DoctrineBehaviors\ORM\Sluggable; -use Doctrine\Common\EventSubscriber; use Doctrine\ORM\Event\LifecycleEventArgs; use Doctrine\ORM\Event\LoadClassMetadataEventArgs; diff --git a/src/ORM/SoftDeletable/SoftDeletableSubscriber.php b/src/ORM/SoftDeletable/SoftDeletableSubscriber.php index 665a7f43..d8e8dd86 100644 --- a/src/ORM/SoftDeletable/SoftDeletableSubscriber.php +++ b/src/ORM/SoftDeletable/SoftDeletableSubscriber.php @@ -13,8 +13,6 @@ namespace Knp\DoctrineBehaviors\ORM\SoftDeletable; -use Doctrine\Common\EventSubscriber; - use Doctrine\Common\Persistence\Mapping\ClassMetadata; use Doctrine\ORM\Event\LoadClassMetadataEventArgs, diff --git a/src/ORM/Translatable/CurrentLocaleCallable.php b/src/ORM/Translatable/CurrentLocaleCallable.php index cd52964a..1ced41fb 100644 --- a/src/ORM/Translatable/CurrentLocaleCallable.php +++ b/src/ORM/Translatable/CurrentLocaleCallable.php @@ -5,7 +5,6 @@ namespace Knp\DoctrineBehaviors\ORM\Translatable; use Symfony\Component\DependencyInjection\Container; -use Symfony\Component\HttpFoundation\Request; /** * @author Florian Klein diff --git a/src/ORM/Translatable/DefaultLocaleCallable.php b/src/ORM/Translatable/DefaultLocaleCallable.php index acdca94e..fd191e2f 100644 --- a/src/ORM/Translatable/DefaultLocaleCallable.php +++ b/src/ORM/Translatable/DefaultLocaleCallable.php @@ -4,8 +4,6 @@ namespace Knp\DoctrineBehaviors\ORM\Translatable; -use Symfony\Component\DependencyInjection\Container; - /** * @author Jérôme Fix */ diff --git a/src/ORM/Translatable/TranslatableSubscriber.php b/src/ORM/Translatable/TranslatableSubscriber.php index a81ec4ed..613b9edc 100644 --- a/src/ORM/Translatable/TranslatableSubscriber.php +++ b/src/ORM/Translatable/TranslatableSubscriber.php @@ -139,7 +139,7 @@ private function mapId(ClassMetadata $class, EntityManager $em): void $sequenceName = $em->getConfiguration()->getQuoteStrategy()->getSequenceName($definition, $class, $platform); } - $generator = ($fieldName && $class->fieldMappings[$fieldName]['type'] === 'bigint') + $generator = $fieldName && $class->fieldMappings[$fieldName]['type'] === 'bigint' ? new BigIntegerIdentityGenerator($sequenceName) : new IdentityGenerator($sequenceName); diff --git a/src/Reflection/ClassAnalyzer.php b/src/Reflection/ClassAnalyzer.php index 8a582474..cce90fb2 100644 --- a/src/Reflection/ClassAnalyzer.php +++ b/src/Reflection/ClassAnalyzer.php @@ -13,8 +13,6 @@ namespace Knp\DoctrineBehaviors\Reflection; -use Doctrine\Common\EventSubscriber; - class ClassAnalyzer { /** diff --git a/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php b/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php index 96202721..ecea2bb0 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/GeocodableTest.php @@ -16,7 +16,7 @@ class GeocodableTest extends \PHPUnit_Framework_TestCase use EntityManagerProvider; /** - * @var callable $callable + * @var callable */ private $callable; @@ -73,7 +73,7 @@ public function setUp(): void $entity = new GeocodableEntity($city[1][0], $city[1][1]); $entity->setTitle($city[0]); $em->persist($entity); - }; + } $em->flush(); } diff --git a/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php b/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php index 4bfa3f08..239c60d1 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/TranslatableTest.php @@ -187,7 +187,7 @@ public function should_update_and_add_new_translations(): void */ public function translate_method_should_always_return_translation_object(): void { - $em = $this->getEntityManager(); + $this->getEntityManager(); $entity = new \BehaviorFixtures\ORM\TranslatableEntity(); @@ -269,7 +269,7 @@ public function should_have_oneToMany_relation_when_translation_class_name_is_cu */ public function should_create_only_one_time_the_same_translation(): void { - $em = $this->getEntityManager(); + $this->getEntityManager(); $entity = new \BehaviorFixtures\ORM\TranslatableEntity(); $translation = $entity->translate('fr'); diff --git a/tests/Knp/DoctrineBehaviors/ORM/Tree/NodeTest.php b/tests/Knp/DoctrineBehaviors/ORM/Tree/NodeTest.php index 73e03339..2c4fc2bb 100644 --- a/tests/Knp/DoctrineBehaviors/ORM/Tree/NodeTest.php +++ b/tests/Knp/DoctrineBehaviors/ORM/Tree/NodeTest.php @@ -158,7 +158,7 @@ public function provideisChildNodeOf() public function provideToArray() { - $expected = [ + return [ 1 => [ 'node' => '', @@ -195,8 +195,6 @@ public function provideToArray() ], ], ]; - - return $expected; } public function testToArray(): void diff --git a/tests/fixtures/BehaviorFixtures/ORM/BlameableEntity.php b/tests/fixtures/BehaviorFixtures/ORM/BlameableEntity.php index d5dc62f4..3875897b 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/BlameableEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/BlameableEntity.php @@ -18,40 +18,27 @@ class BlameableEntity * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @var int */ private $id; /** * @ORM\Column(type="string", nullable=true) + * @var string */ private $title; - /** - * Returns object id. - * - * @return integer - */ - public function getId() + public function getId(): int { return $this->id; } - /** - * Get title. - * - * @return title. - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * Set title. - * - * @param title the value to set. - */ - public function setTitle($title): void + public function setTitle(string $title): void { $this->title = $title; } diff --git a/tests/fixtures/BehaviorFixtures/ORM/FilterableEntity.php b/tests/fixtures/BehaviorFixtures/ORM/FilterableEntity.php index a9e66d67..63c74e76 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/FilterableEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/FilterableEntity.php @@ -51,7 +51,7 @@ public function getName() /** * Set name. * - * @param name the value to set. + * @param the $name value to set. */ public function setName($name): void { @@ -71,7 +71,7 @@ public function getCode() /** * Set code. * - * @param integer code the value to set. + * @param integer $code the value to set. */ public function setCode($code): void { diff --git a/tests/fixtures/BehaviorFixtures/ORM/GeocodableEntity.php b/tests/fixtures/BehaviorFixtures/ORM/GeocodableEntity.php index 7f77efa7..b7056e99 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/GeocodableEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/GeocodableEntity.php @@ -19,11 +19,13 @@ class GeocodableEntity * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @var int */ private $id; /** * @ORM\Column(type="string", nullable=true) + * @var string|null */ private $title; @@ -32,32 +34,17 @@ public function __construct($latitude = 0, $longitude = 0) $this->setLocation(new Point($latitude, $longitude)); } - /** - * Returns object id. - * - * @return integer - */ - public function getId() + public function getId(): int { return $this->id; } - /** - * Get title. - * - * @return title. - */ - public function getTitle() + public function getTitle(): ?string { return $this->title; } - /** - * Set title. - * - * @param title the value to set. - */ - public function setTitle($title): void + public function setTitle(string $title): void { $this->title = $title; } diff --git a/tests/fixtures/BehaviorFixtures/ORM/LoggableEntity.php b/tests/fixtures/BehaviorFixtures/ORM/LoggableEntity.php index b11abb5c..07e8472b 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/LoggableEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/LoggableEntity.php @@ -18,11 +18,13 @@ class LoggableEntity * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @var int */ private $id; /** * @ORM\Column(type="string", nullable=true) + * @var string */ private $title; @@ -36,12 +38,7 @@ class LoggableEntity */ private $date; - /** - * Returns object id. - * - * @return integer - */ - public function getId() + public function getId(): int { return $this->id; } @@ -56,19 +53,12 @@ public function getTitle() return $this->title; } - /** - * Set title. - * - * @param $title the value to set. - */ - public function setTitle($title): void + public function setTitle(string $title): void { $this->title = $title; } /** - * Get Roles - * * @return mixed */ public function getRoles() @@ -76,41 +66,18 @@ public function getRoles() return $this->roles; } - /** - * Set roles - * - * @param array $roles - * - * @return $this; - */ - public function setRoles(?array $roles = null) + public function setRoles(?array $roles = null): void { $this->roles = $roles; - - return $this; } - /** - * Get date - * - * @return mixed - */ public function getDate() { return $this->date; } - /** - * Set date - * - * @param mixed $date - * - * @return $this; - */ - public function setDate($date) + public function setDate($date): void { $this->date = $date; - - return $this; } } diff --git a/tests/fixtures/BehaviorFixtures/ORM/TimestampableEntity.php b/tests/fixtures/BehaviorFixtures/ORM/TimestampableEntity.php index f7525a1b..5005788c 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/TimestampableEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/TimestampableEntity.php @@ -18,40 +18,27 @@ class TimestampableEntity * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") + * @var int */ private $id; /** * @ORM\Column(type="string", nullable=true) + * @var string */ private $title; - /** - * Returns object id. - * - * @return integer - */ - public function getId() + public function getId(): int { return $this->id; } - /** - * Get title. - * - * @return title. - */ - public function getTitle() + public function getTitle(): string { return $this->title; } - /** - * Set title. - * - * @param title the value to set. - */ - public function setTitle($title): void + public function setTitle(string $title): void { $this->title = $title; } diff --git a/tests/fixtures/BehaviorFixtures/ORM/TreeNodeEntity.php b/tests/fixtures/BehaviorFixtures/ORM/TreeNodeEntity.php index 542dd6e2..64ff077d 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/TreeNodeEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/TreeNodeEntity.php @@ -50,7 +50,7 @@ public function getId() } /** - * @param string + * @param string $id * @return null */ public function setId($id) @@ -67,7 +67,7 @@ public function getName() } /** - * @param string + * @param string $name * @return null */ public function setName($name) diff --git a/tests/fixtures/BehaviorFixtures/ORM/UserEntity.php b/tests/fixtures/BehaviorFixtures/ORM/UserEntity.php index 0e397077..9fb7394a 100644 --- a/tests/fixtures/BehaviorFixtures/ORM/UserEntity.php +++ b/tests/fixtures/BehaviorFixtures/ORM/UserEntity.php @@ -23,6 +23,11 @@ class UserEntity */ private $username; + public function getId() + { + return $this->id; + } + public function getUsername() { return $this->username;