Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Use PHP 7.4 for phpcs #2503

Merged
merged 1 commit into from
Feb 6, 2023
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion benchmark/BaseBench.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function initDocumentManager(): void
$client = new Client(
getenv('DOCTRINE_MONGODB_SERVER') ?: self::DEFAULT_MONGODB_SERVER,
[],
['typeMap' => ['root' => 'array', 'document' => 'array']]
['typeMap' => ['root' => 'array', 'document' => 'array']],
);

self::$documentManager = DocumentManager::create($client, $config);
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php
Original file line number Diff line number Diff line change
Expand Up @@ -174,7 +174,7 @@ public function execute(array $options = []): Iterator
'2.2',
'Using "%s" is deprecated. Please use "%s::getAggregation()" instead.',
__METHOD__,
self::class
self::class,
);

return $this->getAggregation($options)->getIterator();
Expand Down Expand Up @@ -262,13 +262,13 @@ public function getPipeline(/* bool $applyFilters = true */): array
throw new TypeError(sprintf(
'Argument 1 passed to %s must be of the type bool, %s given',
__METHOD__,
gettype($applyFilters)
gettype($applyFilters),
));
}

$pipeline = array_map(
static fn (Stage $stage) => $stage->getExpression(),
$this->stages
$this->stages,
);

if ($this->getStage(0) instanceof Stage\IndexStats) {
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Aggregation/Stage.php
Original file line number Diff line number Diff line change
Expand Up @@ -45,7 +45,7 @@ public function execute(array $options = []): Iterator
'2.2',
'Using "%s" is deprecated, use "%s::getAggregation()" instead.',
__METHOD__,
self::class
self::class,
);

return $this->builder->execute($options);
Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/ODM/MongoDB/Configuration.php
Original file line number Diff line number Diff line change
Expand Up @@ -140,7 +140,7 @@ public function getDocumentNamespace(string $documentNamespaceAlias): string
'doctrine/mongodb-odm',
'2.3',
'Document short namespace aliases such as "%s" are deprecated, use ::class constant instead.',
$documentNamespaceAlias
$documentNamespaceAlias,
);

if (! isset($this->attributes['documentNamespaces'][$documentNamespaceAlias])) {
Expand Down Expand Up @@ -208,7 +208,7 @@ public function getMetadataCacheImpl(): ?Cache
'2.2',
'Using "%s" is deprecated. Please use "%s::getMetadataCache" instead.',
__METHOD__,
self::class
self::class,
);

return $this->attributes['metadataCacheImpl'] ?? null;
Expand All @@ -221,7 +221,7 @@ public function setMetadataCacheImpl(Cache $cacheImpl): void
'2.2',
'Using "%s" is deprecated. Please use "%s::setMetadataCache" instead.',
__METHOD__,
self::class
self::class,
);

$this->attributes['metadataCacheImpl'] = $cacheImpl;
Expand Down Expand Up @@ -285,7 +285,7 @@ public function setAutoGenerateProxyClasses(int $mode): void
switch ($mode) {
case self::AUTOGENERATE_FILE_NOT_EXISTS:
$proxyManagerConfig->setGeneratorStrategy(new FileWriterGeneratorStrategy(
new FileLocator($proxyManagerConfig->getProxiesTargetDir())
new FileLocator($proxyManagerConfig->getProxiesTargetDir()),
));

break;
Expand Down Expand Up @@ -557,7 +557,7 @@ public function getPersistentCollectionGenerator(): PersistentCollectionGenerato

$this->attributes['persistentCollectionGenerator'] = new DefaultPersistentCollectionGenerator(
$this->getPersistentCollectionDir(),
$this->getPersistentCollectionNamespace()
$this->getPersistentCollectionNamespace(),
);
}

Expand Down
8 changes: 4 additions & 4 deletions lib/Doctrine/ODM/MongoDB/DocumentManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ protected function __construct(?Client $client = null, ?Configuration $config =
'name' => 'doctrine-odm',
'version' => self::getVersion(),
],
]
],
);

$metadataFactoryClassName = $this->config->getClassMetadataFactoryName();
Expand All @@ -172,7 +172,7 @@ protected function __construct(?Client $client = null, ?Configuration $config =
$this->eventManager,
$hydratorDir,
$hydratorNs,
$this->config->getAutoGenerateHydratorClasses()
$this->config->getAutoGenerateHydratorClasses(),
);

$this->unitOfWork = new UnitOfWork($this, $this->eventManager, $this->hydratorFactory);
Expand Down Expand Up @@ -689,7 +689,7 @@ public function clear($objectName = null)
'doctrine/mongodb-odm',
'2.4',
'Calling %s() with any arguments to clear specific documents is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
__METHOD__,
);
}

Expand Down Expand Up @@ -754,7 +754,7 @@ public function createReference(object $document, array $referenceMapping)

if ($id === null) {
throw new RuntimeException(
sprintf('Cannot create a DBRef for class %s without an identifier. Have you forgotten to persist/merge the document first?', $class->name)
sprintf('Cannot create a DBRef for class %s without an identifier. Have you forgotten to persist/merge the document first?', $class->name),
);
}

Expand Down
10 changes: 5 additions & 5 deletions lib/Doctrine/ODM/MongoDB/Event/OnClearEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ public function __construct($objectManager, $entityClass = null)
'2.4',
'Passing $entityClass argument to %s::%s() is deprecated and will not be supported in Doctrine ODM 3.0.',
self::class,
__METHOD__
__METHOD__,
);
}

Expand All @@ -63,7 +63,7 @@ public function getDocumentClass(): ?string
'doctrine/mongodb-odm',
'2.4',
'Calling %s() is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
__METHOD__,
);

return $this->entityClass;
Expand All @@ -80,7 +80,7 @@ public function clearsAllDocuments(): bool
'doctrine/mongodb-odm',
'2.4',
'Calling %s() is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
__METHOD__,
);

return $this->entityClass !== null;
Expand All @@ -97,7 +97,7 @@ public function clearsAllEntities(): bool
'doctrine/mongodb-odm',
'2.4',
'Calling %s() is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
__METHOD__,
);

return $this->entityClass !== null;
Expand All @@ -118,7 +118,7 @@ public function getEntityClass(): ?string
'doctrine/mongodb-odm',
'2.4',
'Calling %s() is deprecated and will not be supported in Doctrine ODM 3.0.',
__METHOD__
__METHOD__,
);

return $this->entityClass;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Event/PreUpdateEventArgs.php
Original file line number Diff line number Diff line change
Expand Up @@ -88,7 +88,7 @@ private function assertValidField(string $field): void
throw new InvalidArgumentException(sprintf(
'Field "%s" is not a valid field of the document "%s" in PreUpdateEventArgs.',
$field,
get_class($this->getDocument())
get_class($this->getDocument()),
));
}
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Hydrator/HydratorException.php
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public static function associationTypeMismatch(string $className, string $fieldN
$fieldName,
$className,
$expectedType,
$actualType
$actualType,
));
}

Expand All @@ -48,7 +48,7 @@ public static function associationItemTypeMismatch(string $className, string $fi
$fieldName,
$className,
$expectedType,
$actualType
$actualType,
));
}
}
18 changes: 9 additions & 9 deletions lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -190,7 +190,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla

EOF
,
$mapping['name']
$mapping['name'],
);
}
}
Expand All @@ -211,7 +211,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
Type::getType($mapping['type'])->closureToPHP()
Type::getType($mapping['type'])->closureToPHP(),
);
} elseif (! isset($mapping['association'])) {
$code .= sprintf(
Expand All @@ -234,7 +234,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
Type::getType($mapping['type'])->closureToPHP()
Type::getType($mapping['type'])->closureToPHP(),
);
} elseif ($mapping['association'] === ClassMetadata::REFERENCE_ONE && $mapping['isOwningSide']) {
$code .= sprintf(
Expand Down Expand Up @@ -263,7 +263,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
$class->getName()
$class->getName(),
);
} elseif ($mapping['association'] === ClassMetadata::REFERENCE_ONE && $mapping['isInverseSide']) {
if (isset($mapping['repositoryMethod']) && $mapping['repositoryMethod']) {
Expand All @@ -279,7 +279,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
$mapping['repositoryMethod']
$mapping['repositoryMethod'],
);
} else {
$code .= sprintf(
Expand All @@ -302,7 +302,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
EOF
,
$mapping['name'],
$mapping['fieldName']
$mapping['fieldName'],
);
}
} elseif ($mapping['association'] === ClassMetadata::REFERENCE_MANY || $mapping['association'] === ClassMetadata::EMBED_MANY) {
Expand Down Expand Up @@ -330,7 +330,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
$class->getName()
$class->getName(),
);
} elseif ($mapping['association'] === ClassMetadata::EMBED_ONE) {
$code .= sprintf(
Expand Down Expand Up @@ -368,7 +368,7 @@ private function generateHydratorClass(ClassMetadata $class, string $hydratorCla
,
$mapping['name'],
$mapping['fieldName'],
$class->getName()
$class->getName(),
);
}
}
Expand Down Expand Up @@ -411,7 +411,7 @@ public function hydrate(object \$document, array \$data, array \$hints = array()
}
EOF
,
$code
$code,
);

if ($fileName === null) {
Expand Down
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Id/UuidGenerator.php
Original file line number Diff line number Diff line change
Expand Up @@ -94,7 +94,7 @@ public function generateV4(): string
// 48 bits for "node"
random_int(0, 0xffff),
random_int(0, 0xffff),
random_int(0, 0xffff)
random_int(0, 0xffff),
);
}

Expand Down Expand Up @@ -137,7 +137,7 @@ public function generateV5(string $namespace, string $salt): string
// two most significant bits holds zero and one for variant DCE1.1
(hexdec(substr($hash, 16, 4)) & 0x3fff) | 0x8000,
// 48 bits for "node"
substr($hash, 20, 12)
substr($hash, 20, 12),
);
}
}
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Iterator/UnrewindableIterator.php
Original file line number Diff line number Diff line change
Expand Up @@ -103,7 +103,7 @@ private function preventRewinding(string $method): void
if ($this->iteratorAdvanced) {
throw new LogicException(sprintf(
'Cannot call %s for iterator that already yielded results',
$method
$method,
));
}
}
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -35,7 +35,7 @@ public function __construct(
true,
$sparse,
$options,
$partialFilterExpression
$partialFilterExpression,
);
}
}
4 changes: 2 additions & 2 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php
Original file line number Diff line number Diff line change
Expand Up @@ -2278,7 +2278,7 @@ public function mapField(array $mapping): array
'2.2',
'Mapping both "targetDocument" and "discriminatorMap" on field "%s" in class "%s" is deprecated. Only one of them can be used at a time',
$mapping['fieldName'],
$this->name
$this->name,
);
}

Expand Down Expand Up @@ -2358,7 +2358,7 @@ public function mapField(array $mapping): array
'2.1',
'The "%s" mapping type is deprecated. Use "%s" instead.',
$mapping['type'],
$deprecatedTypes[$mapping['type']]
$deprecatedTypes[$mapping['type']],
);
}

Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -200,7 +200,7 @@ protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonS

$this->evm->dispatchEvent(
Events::loadClassMetadata,
new LoadClassMetadataEventArgs($class, $this->dm)
new LoadClassMetadataEventArgs($class, $this->dm),
);

// phpcs:ignore SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed
Expand All @@ -209,7 +209,7 @@ protected function doLoadMetadata($class, $parent, $rootEntityFound, array $nonS
'doctrine/mongodb-odm',
'2.4',
'NOTIFY tracking policy used in class "%s" is deprecated. Please use DEFERRED_EXPLICIT instead.',
$class->name
$class->name,
);
}
}
Expand Down Expand Up @@ -373,7 +373,7 @@ private function setInheritedShardKey(ClassMetadata $subClass, ClassMetadata $pa

$subClass->setShardKey(
$parentClass->shardKey['keys'],
$parentClass->shardKey['options']
$parentClass->shardKey['options'],
);
}
}
Expand Down
6 changes: 3 additions & 3 deletions lib/Doctrine/ODM/MongoDB/Mapping/Driver/AnnotationDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -102,7 +102,7 @@ public function loadMetadataForClass($className, \Doctrine\Persistence\Mapping\C
'doctrine/mongodb-odm',
'2.2',
'The "@Indexes" annotation used in class "%s" is deprecated. Specify all "@Index" and "@UniqueIndex" annotations on the class.',
$className
$className,
);
$value = $annot->value;
foreach (is_array($value) ? $value : [$value] as $index) {
Expand Down Expand Up @@ -205,7 +205,7 @@ public function loadMetadataForClass($className, \Doctrine\Persistence\Mapping\C
'2.2',
'The "indexes" parameter in the "%s" annotation for class "%s" is deprecated. Specify all "@Index" and "@UniqueIndex" annotations on the class.',
$className,
get_class($documentAnnot)
get_class($documentAnnot),
);

foreach ($documentAnnot->indexes as $index) {
Expand Down Expand Up @@ -371,7 +371,7 @@ public function getReader()
'doctrine/mongodb-odm',
'2.4',
'%s is deprecated with no replacement',
__METHOD__
__METHOD__,
);

return $this->reader;
Expand Down
2 changes: 1 addition & 1 deletion lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ public function loadMetadataForClass($className, \Doctrine\Persistence\Mapping\C
}
} elseif ($xmlRoot->getName() === 'mapped-superclass') {
$metadata->setCustomRepositoryClass(
isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null
isset($xmlRoot['repository-class']) ? (string) $xmlRoot['repository-class'] : null,
);
$metadata->isMappedSuperclass = true;
} elseif ($xmlRoot->getName() === 'embedded-document') {
Expand Down
Loading