Skip to content

Commit

Permalink
[cs] apply php71 set
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Dec 9, 2019
1 parent 33d5c2c commit 9103106
Show file tree
Hide file tree
Showing 44 changed files with 145 additions and 145 deletions.
2 changes: 1 addition & 1 deletion ecs.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@ parameters:
sets:
- 'psr12'
- 'php70'
# - 'php71'
- 'php71'
# - 'symplify'
# - 'common'
# - 'clean-code'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@ class DoctrineBehaviorsExtension extends Extension
/**
* {@inheritDoc}
*/
public function load(array $configs, ContainerBuilder $container)
public function load(array $configs, ContainerBuilder $container): void
{
$loader = new YamlFileLoader($container, new FileLocator(__DIR__ . '/../../../config'));
$loader->load('orm-services.yml');
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Geocodable/GeocodableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ public function getLocation()
*
* @return $this
*/
public function setLocation(Point $location = null)
public function setLocation(?Point $location = null)
{
$this->location = $location;

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Sluggable/SluggableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ private function generateSlugValue($values)
/**
* Generates and sets the entity's slug. Called prePersist and preUpdate
*/
public function generateSlug()
public function generateSlug(): void
{
if ($this->getRegenerateSlugOnUpdate() || empty($this->slug)) {
$fields = $this->getSluggableFields();
Expand Down
6 changes: 3 additions & 3 deletions src/Model/SoftDeletable/SoftDeletableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,15 +23,15 @@ trait SoftDeletableMethods
/**
* Marks entity as deleted.
*/
public function delete()
public function delete(): void
{
$this->deletedAt = $this->currentDateTime();
}

/**
* Restore entity by undeleting it
*/
public function restore()
public function restore(): void
{
$this->deletedAt = null;
}
Expand All @@ -55,7 +55,7 @@ public function isDeleted()
*
* @return Boolean
*/
public function willBeDeleted(\DateTime $at = null)
public function willBeDeleted(?\DateTime $at = null)
{
if ($this->deletedAt === null) {
return false;
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Timestampable/TimestampableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ public function setUpdatedAt(\DateTime $updatedAt)
/**
* Updates createdAt and updatedAt timestamps.
*/
public function updateTimestamps()
public function updateTimestamps(): void
{
// Create a datetime with microseconds
$dateTime = \DateTime::createFromFormat('U.u', sprintf('%.6F', microtime(true)));
Expand Down
8 changes: 4 additions & 4 deletions src/Model/Translatable/TranslatableMethods.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ public function addTranslation($translation)
*
* @param Translation $translation The translation
*/
public function removeTranslation($translation)
public function removeTranslation($translation): void
{
$this->getTranslations()->removeElement($translation);
}
Expand Down Expand Up @@ -129,7 +129,7 @@ protected function doTranslate($locale = null, $fallbackToDefault = true)
/**
* Merges newly created translations into persisted translations.
*/
public function mergeNewTranslations()
public function mergeNewTranslations(): void
{
foreach ($this->getNewTranslations() as $newTranslation) {
if (!$this->getTranslations()->contains($newTranslation) && !$newTranslation->isEmpty()) {
Expand All @@ -142,7 +142,7 @@ public function mergeNewTranslations()
/**
* @param mixed $locale the current locale
*/
public function setCurrentLocale($locale)
public function setCurrentLocale($locale): void
{
$this->currentLocale = $locale;
}
Expand All @@ -158,7 +158,7 @@ public function getCurrentLocale()
/**
* @param mixed $locale the default locale
*/
public function setDefaultLocale($locale)
public function setDefaultLocale($locale): void
{
$this->defaultLocale = $locale;
}
Expand Down
16 changes: 8 additions & 8 deletions src/Model/Tree/Node.php
Original file line number Diff line number Diff line change
Expand Up @@ -90,7 +90,7 @@ public function getParentMaterializedPath()
/**
* {@inheritdoc}
**/
public function setParentMaterializedPath($path)
public function setParentMaterializedPath($path): void
{
$this->parentNodePath = $path;
}
Expand Down Expand Up @@ -134,7 +134,7 @@ public function getChildNodes()
/**
* {@inheritdoc}
**/
public function addChildNode(NodeInterface $node)
public function addChildNode(NodeInterface $node): void
{
$this->getChildNodes()->add($node);
}
Expand All @@ -159,7 +159,7 @@ public function isChildNodeOf(NodeInterface $node)
/**
* {@inheritdoc}
**/
public function setChildNodeOf(NodeInterface $node = null)
public function setChildNodeOf(?NodeInterface $node = null)
{
$id = $this->getNodeId();
if (empty($id)) {
Expand Down Expand Up @@ -224,7 +224,7 @@ public function getRootNode()
/**
* {@inheritdoc}
**/
public function buildTree(array $results)
public function buildTree(array $results): void
{
$this->getChildNodes()->clear();
foreach ($results as $i => $node) {
Expand All @@ -240,7 +240,7 @@ public function buildTree(array $results)
*
* @return string the json representation of the hierarchical result
**/
public function toJson(\Closure $prepare = null)
public function toJson(?\Closure $prepare = null)
{
$tree = $this->toArray($prepare);

Expand All @@ -253,7 +253,7 @@ public function toJson(\Closure $prepare = null)
*
* @return array the hierarchical result
**/
public function toArray(\Closure $prepare = null, array &$tree = null)
public function toArray(?\Closure $prepare = null, ?array &$tree = null)
{
if (null === $prepare) {
$prepare = function (NodeInterface $node) {
Expand All @@ -278,7 +278,7 @@ public function toArray(\Closure $prepare = null, array &$tree = null)
*
* @return array the flatten result
**/
public function toFlatArray(\Closure $prepare = null, array &$tree = null)
public function toFlatArray(?\Closure $prepare = null, ?array &$tree = null)
{
if (null === $prepare) {
$prepare = function (NodeInterface $node) {
Expand Down Expand Up @@ -311,7 +311,7 @@ public function offsetExists($offset)
return isset($this->getChildNodes()[$offset]);
}

public function offsetUnset($offset)
public function offsetUnset($offset): void
{
unset($this->getChildNodes()[$offset]);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Tree/NodeInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -67,7 +67,7 @@ public function setMaterializedPath($path);
*
* @return NodeInterface $this Fluent interface
**/
public function setChildNodeOf(NodeInterface $node = null);
public function setChildNodeOf(?NodeInterface $node = null);

/**
* @param NodeInterface $node the node to append to the children collection
Expand Down Expand Up @@ -115,5 +115,5 @@ public function getNodeLevel();
*
* @return void
**/
public function buildTree(array $nodes);
public function buildTree(array $nodes): void;
}
20 changes: 10 additions & 10 deletions src/ORM/Blameable/BlameableSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ class BlameableSubscriber extends AbstractSubscriber
* @param callable
* @param string $userEntity
*/
public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, $blameableTrait, callable $userCallable = null, $userEntity = null)
public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, $blameableTrait, ?callable $userCallable = null, $userEntity = null)
{
parent::__construct($classAnalyzer, $isRecursive);

Expand All @@ -67,7 +67,7 @@ public function __construct(ClassAnalyzer $classAnalyzer, $isRecursive, $blameab
*
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
{
$classMetadata = $eventArgs->getClassMetadata();

Expand All @@ -80,7 +80,7 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
}
}

private function mapEntity(ClassMetadata $classMetadata)
private function mapEntity(ClassMetadata $classMetadata): void
{
if ($this->userEntity) {
$this->mapManyToOneUser($classMetadata);
Expand All @@ -89,7 +89,7 @@ private function mapEntity(ClassMetadata $classMetadata)
}
}

private function mapStringUser(ClassMetadata $classMetadata)
private function mapStringUser(ClassMetadata $classMetadata): void
{
if (!$classMetadata->hasField('createdBy')) {
$classMetadata->mapField([
Expand All @@ -116,7 +116,7 @@ private function mapStringUser(ClassMetadata $classMetadata)
}
}

private function mapManyToOneUser(classMetadata $classMetadata)
private function mapManyToOneUser(classMetadata $classMetadata): void
{
if (!$classMetadata->hasAssociation('createdBy')) {
$classMetadata->mapManyToOne([
Expand Down Expand Up @@ -152,7 +152,7 @@ private function mapManyToOneUser(classMetadata $classMetadata)
*
* @param LifecycleEventArgs $eventArgs
*/
public function prePersist(LifecycleEventArgs $eventArgs)
public function prePersist(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
Expand Down Expand Up @@ -206,7 +206,7 @@ private function isValidUser($user)
*
* @param LifecycleEventArgs $eventArgs
*/
public function preUpdate(LifecycleEventArgs $eventArgs)
public function preUpdate(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
Expand Down Expand Up @@ -235,7 +235,7 @@ public function preUpdate(LifecycleEventArgs $eventArgs)
*
* @param LifecycleEventArgs $eventArgs
*/
public function preRemove(LifecycleEventArgs $eventArgs)
public function preRemove(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
Expand Down Expand Up @@ -264,7 +264,7 @@ public function preRemove(LifecycleEventArgs $eventArgs)
*
* @param mixed $user
*/
public function setUser($user)
public function setUser($user): void
{
$this->user = $user;
}
Expand Down Expand Up @@ -300,7 +300,7 @@ public function getSubscribedEvents()
return $events;
}

public function setUserCallable(callable $callable)
public function setUserCallable(callable $callable): void
{
$this->userCallable = $callable;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ORM/Filterable/FilterableRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,7 +65,7 @@ abstract public function getInFilterColumns();
* @param \Doctrine\ORM\QueryBuilder
* @return \Doctrine\ORM\QueryBuilder
*/
public function filterBy(array $filters, QueryBuilder $qb = null)
public function filterBy(array $filters, ?QueryBuilder $qb = null)
{
$filters = array_filter($filters, function ($filter) {
return !empty($filter);
Expand Down
12 changes: 6 additions & 6 deletions src/ORM/Geocodable/GeocodableSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -53,7 +53,7 @@ public function __construct(
ClassAnalyzer $classAnalyzer,
$isRecursive,
$geocodableTrait,
callable $geolocationCallable = null
?callable $geolocationCallable = null
) {
parent::__construct($classAnalyzer, $isRecursive);

Expand All @@ -66,7 +66,7 @@ public function __construct(
*
* @param LoadClassMetadataEventArgs $eventArgs
*/
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs): void
{
$classMetadata = $eventArgs->getClassMetadata();

Expand Down Expand Up @@ -114,7 +114,7 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $eventArgs)
/**
* @param LifecycleEventArgs $eventArgs
*/
private function updateLocation(LifecycleEventArgs $eventArgs, $override = false)
private function updateLocation(LifecycleEventArgs $eventArgs, $override = false): void
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
Expand All @@ -141,12 +141,12 @@ private function updateLocation(LifecycleEventArgs $eventArgs, $override = false
}
}

public function prePersist(LifecycleEventArgs $eventArgs)
public function prePersist(LifecycleEventArgs $eventArgs): void
{
$this->updateLocation($eventArgs, false);
}

public function preUpdate(LifecycleEventArgs $eventArgs)
public function preUpdate(LifecycleEventArgs $eventArgs): void
{
$this->updateLocation($eventArgs, true);
}
Expand Down Expand Up @@ -190,7 +190,7 @@ public function getSubscribedEvents()
];
}

public function setGeolocationCallable(callable $callable)
public function setGeolocationCallable(callable $callable): void
{
$this->geolocationCallable = $callable;
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function getSql(SqlWalker $sqlWalker)
*
* @param Parser $parser
*/
public function parse(Parser $parser)
public function parse(Parser $parser): void
{
$parser->match(Lexer::T_IDENTIFIER);
$parser->match(Lexer::T_OPEN_PARENTHESIS);
Expand Down
4 changes: 2 additions & 2 deletions src/ORM/Joinable/JoinableRepository.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
*/
trait JoinableRepository
{
public function getJoinAllQueryBuilder($alias = null, QueryBuilder $qb = null)
public function getJoinAllQueryBuilder($alias = null, ?QueryBuilder $qb = null)
{
if (null === $alias) {
$alias = $this->getAlias($this->getClassName());
Expand All @@ -39,7 +39,7 @@ public function getJoinAllQueryBuilder($alias = null, QueryBuilder $qb = null)
return $qb;
}

private function addJoinsToQueryBuilder($alias, QueryBuilder $qb, $className, $recursive = true)
private function addJoinsToQueryBuilder($alias, QueryBuilder $qb, $className, $recursive = true): void
{
foreach ($this->getEntityManager()->getClassMetadata($className)->getAssociationMappings() as $assoc) {
if (in_array($assoc['targetEntity'], $qb->getRootEntities()) || $className === $assoc['targetEntity']) {
Expand Down
6 changes: 3 additions & 3 deletions src/ORM/Loggable/LoggableSubscriber.php
Original file line number Diff line number Diff line change
Expand Up @@ -68,7 +68,7 @@ public function postUpdate(LifecycleEventArgs $eventArgs)
*
* @param LifecycleEventArgs $eventArgs
*/
public function logChangeSet(LifecycleEventArgs $eventArgs)
public function logChangeSet(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$uow = $em->getUnitOfWork();
Expand All @@ -85,7 +85,7 @@ public function logChangeSet(LifecycleEventArgs $eventArgs)
}
}

public function preRemove(LifecycleEventArgs $eventArgs)
public function preRemove(LifecycleEventArgs $eventArgs): void
{
$em = $eventArgs->getEntityManager();
$entity = $eventArgs->getEntity();
Expand All @@ -98,7 +98,7 @@ public function preRemove(LifecycleEventArgs $eventArgs)
}
}

public function setLoggerCallable(callable $callable)
public function setLoggerCallable(callable $callable): void
{
$this->loggerCallable = $callable;
}
Expand Down
Loading

0 comments on commit 9103106

Please sign in to comment.