Skip to content

Commit

Permalink
cs fixer: adjust to latest cs fixer rules
Browse files Browse the repository at this point in the history
  • Loading branch information
dbu committed Aug 30, 2023
1 parent 6714879 commit f0640a0
Show file tree
Hide file tree
Showing 32 changed files with 40 additions and 76 deletions.
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/ChildrenCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ class ChildrenCollection extends PersistentCollection
* @param int $fetchDepth Optional fetch depth, -1 to not override
* @param string|null $locale The locale to use during the loading of this collection
*/
public function __construct(DocumentManagerInterface $dm, object $document, $filter = null, int $fetchDepth = -1, ?string $locale = null)
public function __construct(DocumentManagerInterface $dm, object $document, $filter = null, int $fetchDepth = -1, string $locale = null)
{
$this->dm = $dm;
$this->document = $document;
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/PHPCR/Decorator/DocumentManagerDecorator.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,7 @@ public function createPhpcrQueryBuilder(): PhpcrQueryBuilder
return $this->wrapped->createPhpcrQueryBuilder();
}

public function getDocumentsByPhpcrQuery(QueryInterface $query, ?string $className = null, ?string $primarySelector = null): Collection
public function getDocumentsByPhpcrQuery(QueryInterface $query, string $className = null, string $primarySelector = null): Collection
{
return $this->wrapped->getDocumentsByPhpcrQuery($query, $className, $primarySelector);
}
Expand Down Expand Up @@ -163,12 +163,12 @@ public function reorder(object $document, string $srcName, string $targetName, b
$this->wrapped->reorder($document, $srcName, $targetName, $before);
}

public function getChildren(object $document, $filter = null, int $fetchDepth = -1, ?string $locale = null): ChildrenCollection
public function getChildren(object $document, $filter = null, int $fetchDepth = -1, string $locale = null): ChildrenCollection
{
return $this->wrapped->getChildren($document, $filter, $fetchDepth, $locale);
}

public function getReferrers(object $document, ?string $type = null, ?string $name = null, ?string $locale = null, ?string $refClass = null): ReferrersCollection
public function getReferrers(object $document, string $type = null, string $name = null, string $locale = null, string $refClass = null): ReferrersCollection
{
return $this->wrapped->getReferrers($document, $type, $name, $locale, $refClass);
}
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/DocumentClassMapperInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ interface DocumentClassMapperInterface
* @throws ClassMismatchException if $node represents a class that is not
* a descendant of $className
*/
public function getClassName(DocumentManagerInterface $dm, NodeInterface $node, ?string $className = null): string;
public function getClassName(DocumentManagerInterface $dm, NodeInterface $node, string $className = null): string;

/**
* Write any relevant meta data into the node to be able to map back to a class name later.
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -359,7 +359,7 @@ public function createPhpcrQueryBuilder(): PhpcrQueryBuilder
return new PhpcrQueryBuilder($qm->getQOMFactory());
}

public function getDocumentsByPhpcrQuery(QueryInterface $query, ?string $className = null, ?string $primarySelector = null): Collection
public function getDocumentsByPhpcrQuery(QueryInterface $query, string $className = null, string $primarySelector = null): Collection
{
$this->errorIfClosed();

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/PHPCR/DocumentManagerInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -215,7 +215,7 @@ public function createPhpcrQueryBuilder(): PhpcrQueryBuilder;
* @param string|null $className document class
* @param string|null $primarySelector name of the selector for the document to return in case of a join query
*/
public function getDocumentsByPhpcrQuery(QueryInterface $query, ?string $className = null, ?string $primarySelector = null): Collection;
public function getDocumentsByPhpcrQuery(QueryInterface $query, string $className = null, string $primarySelector = null): Collection;

/**
* Bind the translatable fields of the document in the specified locale.
Expand Down Expand Up @@ -310,7 +310,7 @@ public function reorder(object $document, string $srcName, string $targetName, b
*
* @throws InvalidArgumentException if $document is not an object
*/
public function getChildren(object $document, $filter = null, int $fetchDepth = -1, ?string $locale = null): ChildrenCollection;
public function getChildren(object $document, $filter = null, int $fetchDepth = -1, string $locale = null): ChildrenCollection;

/**
* Get the documents that refer a given document using an optional name.
Expand All @@ -332,7 +332,7 @@ public function getChildren(object $document, $filter = null, int $fetchDepth =
*
* @throws InvalidArgumentException if $document is not an object
*/
public function getReferrers(object $document, ?string $type = null, ?string $name = null, ?string $locale = null, ?string $refClass = null): ReferrersCollection;
public function getReferrers(object $document, string $type = null, string $name = null, string $locale = null, string $refClass = null): ReferrersCollection;

/**
* Gets a reference to the document identified by the given type and identifier
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/Id/IdException.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public static function parentIdCouldNotBeDetermined(object $document, string $pa
return new self($message);
}

public static function illegalName(object $document, string $fieldName, string $nodeName, ?\Throwable $previous = null): self
public static function illegalName(object $document, string $fieldName, string $nodeName, \Throwable $previous = null): self
{
$message = sprintf(
'Nodename property "%s" of document "%s" contains the illegal PHPCR value "%s".',
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/Id/IdGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,5 +44,5 @@ public static function create(int $generatorType): IdGenerator
/**
* Generate the actual id, to be overwritten by extending classes.
*/
abstract public function generate(object $document, ClassMetadata $class, DocumentManagerInterface $dm, ?object $parent = null): string;
abstract public function generate(object $document, ClassMetadata $class, DocumentManagerInterface $dm, object $parent = null): string;
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/Id/RepositoryIdInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,5 +7,5 @@
*/
interface RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string;
public function generateId(object $document, object $parent = null): string;
}
6 changes: 2 additions & 4 deletions lib/Doctrine/ODM/PHPCR/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -874,8 +874,8 @@ protected function validateAndCompleteFieldMapping(array $mapping, self $inherit
$mapping['property'] = $mapping['fieldName'];
}

if ($phpcrLabel &&
(!array_key_exists($phpcrLabel, $mapping) || empty($mapping[$phpcrLabel]))
if ($phpcrLabel
&& (!array_key_exists($phpcrLabel, $mapping) || empty($mapping[$phpcrLabel]))
) {
$mapping[$phpcrLabel] = $mapping['fieldName'];
}
Expand Down Expand Up @@ -1592,8 +1592,6 @@ public function getIdentifierValues($document): array

/**
* Sets the specified field to the specified value on the given document.
*
* @param mixed $value
*/
public function setFieldValue(object $document, string $field, $value): void
{
Expand Down
2 changes: 0 additions & 2 deletions lib/Doctrine/ODM/PHPCR/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,8 +24,6 @@ public function __construct($locator, $fileExtension = self::DEFAULT_FILE_EXTENS
}

/**
* {@inheritdoc}
*
* @param PhpcrClassMetadata $class
*/
public function loadMetadataForClass($className, ClassMetadata $class): void
Expand Down
4 changes: 0 additions & 4 deletions lib/Doctrine/ODM/PHPCR/Query/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,8 +193,6 @@ public function getPhpcrNodeResult()
/**
* Get exactly one result or null.
*
* @return mixed
*
* @throws QueryException if more than one result found
*/
public function getOneOrNullResult(int $hydrationMode = null)
Expand All @@ -219,8 +217,6 @@ public function getOneOrNullResult(int $hydrationMode = null)
* If the result is not unique, a NonUniqueResultException is thrown.
* If there is no result, a NoResultException is thrown.
*
* @return mixed
*
* @throws QueryException if no result or more than one result found
*/
public function getSingleResult(int $hydrationMode = null)
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/PHPCR/ReferenceManyCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ class ReferenceManyCollection extends PersistentCollection
* @param string|null $locale The locale to use during the loading of this collection
* @param string $referenceType Identifiers used for reference nodes in this collection, either path or default uuid
*/
public function __construct(DocumentManagerInterface $dm, object $document, string $property, array $referencedNodes, ?string $targetDocument, ?string $locale = null, string $referenceType = self::REFERENCE_TYPE_UUID)
public function __construct(DocumentManagerInterface $dm, object $document, string $property, array $referencedNodes, ?string $targetDocument, string $locale = null, string $referenceType = self::REFERENCE_TYPE_UUID)
{
parent::__construct($dm);
$this->document = $document;
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/PHPCR/ReferrersCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ class ReferrersCollection extends PersistentCollection
* @param string|null $locale the locale to use
* @param string|null $refClass class the referrer document must be instanceof
*/
public function __construct(DocumentManagerInterface $dm, object $document, ?string $type = null, ?string $name = null, ?string $locale = null, ?string $refClass = null)
public function __construct(DocumentManagerInterface $dm, object $document, string $type = null, string $name = null, string $locale = null, string $refClass = null)
{
parent::__construct($dm);
$this->document = $document;
Expand All @@ -51,7 +51,7 @@ public function __construct(DocumentManagerInterface $dm, object $document, ?str
* @param string|null $refClass class the referrer document must be instanceof
* @param bool $forceOverwrite If to force the database to be forced to the state of the collection
*/
public static function createFromCollection(DocumentManagerInterface $dm, object $document, $collection, ?string $type = null, ?string $name = null, ?string $refClass = null, bool $forceOverwrite = false): self
public static function createFromCollection(DocumentManagerInterface $dm, object $document, $collection, string $type = null, string $name = null, string $refClass = null, bool $forceOverwrite = false): self
{
$referrerCollection = new self($dm, $document, $type, $name, null, $refClass);
$referrerCollection->initializeFromCollection($collection, $forceOverwrite);
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/PHPCR/Tools/Helper/PrefetchHelper.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ class PrefetchHelper
/**
* @param NodeInterface[] $nodes
*/
public function prefetch(DocumentManagerInterface $dm, iterable $nodes, ?string $locale = null): void
public function prefetch(DocumentManagerInterface $dm, iterable $nodes, string $locale = null): void
{
if (0 === count($nodes)) {
return;
Expand Down Expand Up @@ -112,7 +112,7 @@ public function collectPrefetchReferences(ClassMetadata $class, NodeInterface $n
*
* @return string[] list of absolute paths to nodes that should be prefetched
*/
public function collectPrefetchHierarchy(ClassMetadata $class, NodeInterface $node, ?string $locale = null): array
public function collectPrefetchHierarchy(ClassMetadata $class, NodeInterface $node, string $locale = null): array
{
$prefetch = [];
if ($class->parentMapping && $node->getDepth() > 0) {
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -110,8 +110,6 @@ public function getLocale(): string
}

/**
* {@inheritdoc}
*
* @throws MissingTranslationException if the specified locale is not defined in the $localePreference array
*/
public function setLocale(string $locale): void
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function setFallbackLocales(string $locale, array $order, bool $replace):
*
* @throws MissingTranslationException
*/
public function getFallbackLocales(?object $document, ClassMetadata $metadata, ?string $forLocale = null): array;
public function getFallbackLocales(?object $document, ClassMetadata $metadata, string $forLocale = null): array;

/**
* Get the locale of the current session.
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -21,8 +21,6 @@ interface TranslationNodesWarmer
*
* @param NodeInterface[] $nodes
* @param string[] $locales
*
* @return mixed
*/
public function getTranslationsForNodes(iterable $nodes, array $locales, SessionInterface $session);
}
14 changes: 7 additions & 7 deletions lib/Doctrine/ODM/PHPCR/UnitOfWork.php
Original file line number Diff line number Diff line change
Expand Up @@ -550,7 +550,7 @@ public function getOrCreateDocuments(?string $className, iterable $nodes, array
/**
* Get the existing document or proxy or create a new one for this PHPCR Node.
*/
public function getOrCreateProxyFromNode(NodeInterface $node, ?string $locale = null): object
public function getOrCreateProxyFromNode(NodeInterface $node, string $locale = null): object
{
$targetId = $node->getPath();
$className = $this->documentClassMapper->getClassName($this->dm, $node);
Expand All @@ -562,7 +562,7 @@ public function getOrCreateProxyFromNode(NodeInterface $node, ?string $locale =
* Get the existing document or proxy for this id of this class, or create
* a new one.
*/
public function getOrCreateProxy(string $targetId, string $className, ?string $locale = null): object
public function getOrCreateProxy(string $targetId, string $className, string $locale = null): object
{
$document = $this->getDocumentById($targetId);

Expand Down Expand Up @@ -1511,7 +1511,7 @@ public function computeChangeSet(ClassMetadata $class, object $document): void
*
* @return object the child instance (if we are replacing a child this can be a different instance than was originally provided)
*/
private function computeChildChanges(array $mapping, object $child, string $parentId, string $nodename, ?object $parent = null): object
private function computeChildChanges(array $mapping, object $child, string $parentId, string $nodename, object $parent = null): object
{
$targetClass = $this->dm->getClassMetadata(get_class($child));
$state = $this->getDocumentState($child);
Expand Down Expand Up @@ -1605,7 +1605,7 @@ private function computeReferrerChanges(array $mapping, object $referrer): void
*
* @param int|null $overrideIdGenerator type of the id generator if not the default
*/
public function persistNew(ClassMetadata $class, object $document, ?int $overrideIdGenerator = null, ?object $parent = null): void
public function persistNew(ClassMetadata $class, object $document, int $overrideIdGenerator = null, object $parent = null): void
{
if ($invoke = $this->eventListenersInvoker->getSubscribedSystems($class, Event::prePersist)) {
$this->eventListenersInvoker->invoke(
Expand Down Expand Up @@ -1707,7 +1707,7 @@ private function cascadeMergeCollection(Collection $managedCol, array $mapping):
/**
* @param array|null $assoc Information for association when necessary
*/
private function doMerge(object $document, array &$visited, ?object $prevManagedCopy = null, ?array $assoc = null): object
private function doMerge(object $document, array &$visited, object $prevManagedCopy = null, array $assoc = null): object
{
$oid = \spl_object_hash($document);
if (array_key_exists($oid, $visited)) {
Expand Down Expand Up @@ -3180,7 +3180,7 @@ protected function doLoadDatabaseTranslation(object $document, ClassMetadata $me
* If the document is not translatable, this method returns immediately
* and without error.
*/
public function doLoadTranslation(object $document, ClassMetadata $metadata, ?string $locale = null, bool $fallback = false, bool $refresh = false): void
public function doLoadTranslation(object $document, ClassMetadata $metadata, string $locale = null, bool $fallback = false, bool $refresh = false): void
{
if (!$this->isDocumentTranslatable($metadata)) {
return;
Expand Down Expand Up @@ -3545,7 +3545,7 @@ private function getReferenceManyCollectionTypeFromMetadata(array $referenceFiel
*
* @return int previous fetch depth value
*/
public function setFetchDepth(?int $fetchDepth = null): int
public function setFetchDepth(int $fetchDepth = null): int
{
if (!$this->useFetchDepth
|| !method_exists($this->session, 'getSessionOption')
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsAddress.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ public function setUser(CmsUser $user)

class CmsAddressRepository extends DocumentRepository implements RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string
public function generateId(object $document, object $parent = null): string
{
return '/functional/'.$document->city.'_'.$document->zip;
}
Expand Down
6 changes: 0 additions & 6 deletions tests/Doctrine/Tests/Models/CMS/CmsArticle.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,17 +45,11 @@ public function addPerson(CmsArticlePerson $person)
$this->persons->add($person);
}

/**
* @param mixed $persons
*/
public function setPersons($persons)
{
$this->persons = $persons;
}

/**
* @return mixed
*/
public function getPersons()
{
return $this->persons;
Expand Down
20 changes: 1 addition & 19 deletions tests/Doctrine/Tests/Models/CMS/CmsArticlePerson.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,49 +26,31 @@ public function __construct()
$this->articlesReferrers = new ArrayCollection();
}

/**
* @param mixed $articlesReferrers
*/
public function setArticlesReferrers($articlesReferrers)
{
$this->articlesReferrers = $articlesReferrers;
}

/**
* @return mixed
*/
public function getArticlesReferrers()
{
return $this->articlesReferrers;
}

/**
* @param mixed $id
*/
public function setId($id)
{
$this->id = $id;
}

/**
* @return mixed
*/
public function getId()
{
return $this->id;
}

/**
* @param mixed $name
*/
public function setName($name)
{
$this->name = $name;
}

/**
* @return mixed
*/
public function getName()
{
return $this->name;
Expand All @@ -77,7 +59,7 @@ public function getName()

class CmsArticlePersonRepository extends DocumentRepository implements RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string
public function generateId(object $document, object $parent = null): string
{
return '/functional/'.$document->name;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,7 +55,7 @@ public function getName()

class CmsItemRepository extends DocumentRepository implements RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string
public function generateId(object $document, object $parent = null): string
{
return '/functional/'.$document->name;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsPage.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,7 +84,7 @@ public function removeItem($item)

class CmsPageRepository extends DocumentRepository implements RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string
public function generateId(object $document, object $parent = null): string
{
return '/functional/'.$document->title;
}
Expand Down
2 changes: 1 addition & 1 deletion tests/Doctrine/Tests/Models/CMS/CmsPageTranslatable.php
Original file line number Diff line number Diff line change
Expand Up @@ -109,7 +109,7 @@ public function getLocale()

class CmsPageTranslatableRepository extends DocumentRepository implements RepositoryIdInterface
{
public function generateId(object $document, ?object $parent = null): string
public function generateId(object $document, object $parent = null): string
{
return '/functional/'.$document->title;
}
Expand Down
Loading

0 comments on commit f0640a0

Please sign in to comment.