diff --git a/lib/Doctrine/ODM/MongoDB/Event/OnClassMetadataNotFoundEventArgs.php b/lib/Doctrine/ODM/MongoDB/Event/OnClassMetadataNotFoundEventArgs.php index f90f2079ba..ae0112b149 100644 --- a/lib/Doctrine/ODM/MongoDB/Event/OnClassMetadataNotFoundEventArgs.php +++ b/lib/Doctrine/ODM/MongoDB/Event/OnClassMetadataNotFoundEventArgs.php @@ -15,7 +15,6 @@ */ final class OnClassMetadataNotFoundEventArgs extends ManagerEventArgs { - /** @var ClassMetadata|null */ private ?ClassMetadata $foundMetadata = null; /** @param class-string $className */ @@ -24,13 +23,11 @@ public function __construct(private string $className, DocumentManager $dm) parent::__construct($dm); } - /** @param ClassMetadata|null $classMetadata */ public function setFoundMetadata(?ClassMetadata $classMetadata = null): void { $this->foundMetadata = $classMetadata; } - /** @return ClassMetadata|null */ public function getFoundMetadata(): ?ClassMetadata { return $this->foundMetadata; diff --git a/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php b/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php index e5ac3ce7fc..e9542f5b46 100644 --- a/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php +++ b/lib/Doctrine/ODM/MongoDB/Hydrator/HydratorFactory.php @@ -157,7 +157,6 @@ public function generateHydratorClasses(array $classes, ?string $toDir = null): } } - /** @param ClassMetadata $class */ private function generateHydratorClass(ClassMetadata $class, string $hydratorClassName, ?string $fileName): void { $code = ''; diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php index d6a3cdacf0..5db0d3f6ed 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/AttributeDriver.php @@ -347,10 +347,7 @@ public function loadMetadataForClass($className, PersistenceClassMetadata $metad } } - /** - * @param ClassMetadata $class - * @param array $keys - */ + /** @param array $keys */ private function addIndex(ClassMetadata $class, AbstractIndex $index, array $keys = []): void { $keys = array_merge($keys, $index->keys); @@ -372,7 +369,6 @@ private function addIndex(ClassMetadata $class, AbstractIndex $index, array $key $class->addIndex($keys, $options); } - /** @param ClassMetadata $class */ private function addSearchIndex(ClassMetadata $class, ODM\SearchIndex $index): void { $definition = []; @@ -392,7 +388,6 @@ private function addSearchIndex(ClassMetadata $class, ODM\SearchIndex $index): v $class->addSearchIndex($definition, $index->name ?? null, 'search'); } - /** @param ClassMetadata $class */ private function addVectorSearchIndex(ClassMetadata $class, ODM\VectorSearchIndex $index): void { $definition = [ @@ -402,11 +397,6 @@ private function addVectorSearchIndex(ClassMetadata $class, ODM\VectorSearchInde $class->addSearchIndex($definition, $index->name ?? null, 'vectorSearch'); } - /** - * @param ClassMetadata $class - * - * @throws MappingException - */ private function setShardKey(ClassMetadata $class, ODM\ShardKey $shardKey): void { $options = []; diff --git a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php index e068887e08..2655649fa5 100644 --- a/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ODM/MongoDB/Mapping/Driver/XmlDriver.php @@ -386,10 +386,7 @@ public function loadMetadataForClass($className, \Doctrine\Persistence\Mapping\C // phpcs:enable SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed - /** - * @param ClassMetadata $class - * @phpstan-param FieldMappingConfig $mapping - */ + /** @phpstan-param FieldMappingConfig $mapping */ private function addFieldMapping(ClassMetadata $class, array $mapping): void { if (isset($mapping['name'])) { @@ -429,7 +426,6 @@ private function addFieldMapping(ClassMetadata $class, array $mapping): void $class->addIndex($keys, $options); } - /** @param ClassMetadata $class */ private function addEmbedMapping(ClassMetadata $class, SimpleXMLElement $embed, string $type): void { $attributes = $embed->attributes(); @@ -479,7 +475,6 @@ private function addEmbedMapping(ClassMetadata $class, SimpleXMLElement $embed, $this->addFieldMapping($class, $mapping); } - /** @param ClassMetadata $class */ private function addReferenceMapping(ClassMetadata $class, ?SimpleXMLElement $reference, string $type): void { $cascade = array_keys((array) $reference->cascade); @@ -561,7 +556,6 @@ private function addReferenceMapping(ClassMetadata $class, ?SimpleXMLElement $re $this->addFieldMapping($class, $mapping); } - /** @param ClassMetadata $class */ private function addIndex(ClassMetadata $class, SimpleXMLElement $xmlIndex): void { $attributes = $xmlIndex->attributes(); @@ -624,7 +618,6 @@ private function addIndex(ClassMetadata $class, SimpleXMLElement $xmlIndex): voi $class->addIndex($keys, $options); } - /** @param ClassMetadata $class */ private function addSearchIndex(ClassMetadata $class, SimpleXMLElement $searchIndex): void { $definition = []; @@ -754,7 +747,6 @@ private function getSearchIndexFieldDefinition(SimpleXMLElement $field): array return $fieldDefinition; } - /** @param ClassMetadata $class */ private function addVectorSearchIndex(ClassMetadata $class, SimpleXMLElement $searchIndex): void { $definition = ['fields' => []]; @@ -852,7 +844,6 @@ private function convertXMLElementValue(string $value) return preg_match('/^[-]?\d+$/', $value) ? (int) $value : (float) $value; } - /** @param ClassMetadata $class */ private function setShardKey(ClassMetadata $class, SimpleXMLElement $xmlShardkey): void { $attributes = $xmlShardkey->attributes(); @@ -951,7 +942,6 @@ private function formatErrors(array $xmlErrors): string return implode("\n", array_map(static fn (LibXMLError $error): string => sprintf('Line %d:%d: %s', $error->line, $error->column, $error->message), $xmlErrors)); } - /** @param ClassMetadata $class */ private function addGridFSMappings(ClassMetadata $class, SimpleXMLElement $xmlRoot): void { if (! $class->isFile) { diff --git a/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php b/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php index d3d6d2dc11..b9df9191dd 100644 --- a/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php +++ b/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php @@ -140,11 +140,7 @@ private function createInitializer( }; } - /** - * @param ClassMetadata $metadata - * - * @return array - */ + /** @return array */ private function skippedFieldsFqns(ClassMetadata $metadata): array { $skippedFieldsFqns = []; diff --git a/lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php b/lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php index 891612d297..3d68ab2bfe 100644 --- a/lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php +++ b/lib/Doctrine/ODM/MongoDB/Query/FilterCollection.php @@ -139,8 +139,6 @@ public function isEnabled(string $name): bool /** * Gets enabled filter criteria. * - * @param ClassMetadata $class - * * @return array */ public function getFilterCriteria(ClassMetadata $class): array diff --git a/lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php b/lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php index ff3478cf8a..d038974f4d 100644 --- a/lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php +++ b/lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php @@ -136,7 +136,6 @@ public function primeReferences(ClassMetadata $class, $documents, string $fieldN * ... but you cannot prime this: myDocument.embeddedDocument.referencedDocuments.referencedDocument(s) * This addresses Issue #624. * - * @param ClassMetadata $class * @param array|Traversable $documents * @param FieldMapping|null $mapping * diff --git a/lib/Doctrine/ODM/MongoDB/SchemaManager.php b/lib/Doctrine/ODM/MongoDB/SchemaManager.php index d7dea185db..e360480c55 100644 --- a/lib/Doctrine/ODM/MongoDB/SchemaManager.php +++ b/lib/Doctrine/ODM/MongoDB/SchemaManager.php @@ -232,11 +232,7 @@ private function doGetDocumentIndexes(string $documentName, array &$visited): ar return $indexes; } - /** - * @param ClassMetadata $class - * - * @phpstan-return IndexMapping[] - */ + /** @phpstan-return IndexMapping[] */ private function prepareIndexes(ClassMetadata $class): array { $persister = $this->dm->getUnitOfWork()->getDocumentPersister($class->name); @@ -1026,14 +1022,12 @@ private function runShardCollectionCommand(string $documentName, ?WriteConcern $ ); } - /** @param ClassMetadata $class */ private function ensureGridFSIndexes(ClassMetadata $class, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null, bool $background = false): void { $this->ensureChunksIndex($class, $maxTimeMs, $writeConcern, $background); $this->ensureFilesIndex($class, $maxTimeMs, $writeConcern, $background); } - /** @param ClassMetadata $class */ private function ensureChunksIndex(ClassMetadata $class, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null, bool $background = false): void { $chunksCollection = $this->dm->getDocumentBucket($class->getName())->getChunksCollection(); @@ -1049,7 +1043,6 @@ private function ensureChunksIndex(ClassMetadata $class, ?int $maxTimeMs = null, ); } - /** @param ClassMetadata $class */ private function ensureFilesIndex(ClassMetadata $class, ?int $maxTimeMs = null, ?WriteConcern $writeConcern = null, bool $background = false): void { $filesCollection = $this->dm->getDocumentCollection($class->getName()); diff --git a/lib/Doctrine/ODM/MongoDB/Tools/ResolveTargetDocumentListener.php b/lib/Doctrine/ODM/MongoDB/Tools/ResolveTargetDocumentListener.php index d2e74fcee2..1a0164ee4e 100644 --- a/lib/Doctrine/ODM/MongoDB/Tools/ResolveTargetDocumentListener.php +++ b/lib/Doctrine/ODM/MongoDB/Tools/ResolveTargetDocumentListener.php @@ -86,10 +86,7 @@ public function loadClassMetadata(LoadClassMetadataEventArgs $args): void } } - /** - * @param ClassMetadata $classMetadata - * @phpstan-param AssociationFieldMapping $mapping - */ + /** @phpstan-param AssociationFieldMapping $mapping */ private function remapAssociation(ClassMetadata $classMetadata, array $mapping): void { $newMapping = $this->resolveTargetDocuments[$mapping['targetDocument']]; diff --git a/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php b/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php index 16efa66aae..ca7ef6691d 100644 --- a/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php +++ b/lib/Doctrine/ODM/MongoDB/Utility/LifecycleEventManager.php @@ -293,7 +293,6 @@ private function cascadePostPersist(ClassMetadata $class, object $document, ?Ses } } - /** @param ClassMetadata $class */ private function dispatchEvent(ClassMetadata $class, string $eventName, ?EventArgs $eventArgs = null): void { if ($class->isView()) { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 14560978a7..3e870535f8 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,11 +1,5 @@ parameters: ignoreErrors: - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Aggregation\:\:__construct\(\) has parameter \$classMetadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Aggregation.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Aggregation\:\:execute\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Iterator\\Iterator does not specify its types\: TValue$#' identifier: missingType.generics @@ -30,60 +24,18 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Builder\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php - - message: '#^PHPDoc tag @param references unknown parameter\: \$applyFilters$#' identifier: parameter.notFound count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Builder.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Expr\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Expr.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Expr\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Expr.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\:\:execute\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Iterator\\Iterator does not specify its types\: TValue$#' identifier: missingType.generics count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\AbstractBucket\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractBucket.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\AbstractBucket\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractBucket.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\AbstractReplace\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractReplace.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\AbstractReplace\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/AbstractReplace.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Bucket\\AbstractOutput\:\:avg\(\) has parameter \$expressions with no type specified\.$#' identifier: missingType.parameter @@ -132,24 +84,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Fill.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\GraphLookup\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\GraphLookup\:\:getDocumentPersister\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\GraphLookup\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php - - message: '#^Property Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\GraphLookup\:\:\$from \(string\|null\) is never assigned null so it can be removed from the property type\.$#' identifier: property.unusedType @@ -168,30 +102,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Lookup\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Lookup\:\:getDocumentPersister\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Lookup\:\:getDocumentPersister\(\) return type with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Lookup\:\:prepareFieldName\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Lookup.php - - message: '#^Unable to resolve the template type T in call to method Doctrine\\ODM\\MongoDB\\DocumentManager\:\:getClassMetadata\(\)$#' identifier: argument.templateType @@ -210,12 +120,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Merge.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\Out\:\:fromDocument\(\) has parameter \$classMetadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Out.php - - message: '#^Unable to resolve the template type T in call to method Doctrine\\ODM\\MongoDB\\DocumentManager\:\:getClassMetadata\(\)$#' identifier: argument.templateType @@ -396,12 +300,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/Search/Range.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\SortByCount\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/SortByCount.php - - message: '#^Class Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\UnionWith has type alias PipelineParamType with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -432,12 +330,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/UnionWith.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Aggregation\\Stage\\UnsetStage\:\:__construct\(\) has parameter \$documentPersister with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Aggregation/Stage/UnsetStage.php - - message: '#^Return type \(Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactoryInterface\) of method Doctrine\\ODM\\MongoDB\\DocumentManager\:\:getMetadataFactory\(\) should be compatible with return type \(Doctrine\\Persistence\\Mapping\\ClassMetadataFactory\\>\) of method Doctrine\\Persistence\\ObjectManager\:\:getMetadataFactory\(\)$#' identifier: method.childReturnType @@ -588,120 +480,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadata.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedFields\(\) has parameter \$parentClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedFields\(\) has parameter \$subClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedIndexes\(\) has parameter \$parentClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedIndexes\(\) has parameter \$subClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedRelations\(\) has parameter \$parentClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:addInheritedRelations\(\) has parameter \$subClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:completeIdGeneratorMapping\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:doLoadMetadata\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:doLoadMetadata\(\) has parameter \$parent with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:generateAutoIdGenerator\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:initializeReflection\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:isEntity\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:setInheritedShardKey\(\) has parameter \$parentClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:setInheritedShardKey\(\) has parameter \$subClass with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:validateIdentifier\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactory\:\:wakeupReflection\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactory.php - - - - message: '#^PHPDoc tag @method for method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactoryInterface\:\:getAllMetadata\(\) return type contains generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactoryInterface.php - - - - message: '#^PHPDoc tag @method for method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactoryInterface\:\:getLoadedMetadata\(\) return type contains generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactoryInterface.php - - - - message: '#^PHPDoc tag @method for method Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadataFactoryInterface\:\:getMetadataFor\(\) return type contains generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Mapping/ClassMetadataFactoryInterface.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Mapping\\Driver\\AttributeDriver\:\:getClassAttributes\(\) has parameter \$class with generic class ReflectionClass but does not specify its types\: T$#' identifier: missingType.generics @@ -906,12 +684,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister\:\:getClassDiscriminatorValues\(\) has parameter \$metadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister\:\:isInTransaction\(\) has parameter \$options with no value type specified in iterable type array\.$#' identifier: missingType.iterableValue @@ -954,18 +726,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister\:\:prepareQueryElement\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister\:\:prepareQueryExpression\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Persisters/DocumentPersister.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister\:\:wrapCursor\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Iterator\\Iterator does not specify its types\: TValue$#' identifier: missingType.generics @@ -996,96 +756,30 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:createLazyInitializer\(\) has parameter \$persister with generic class Doctrine\\ODM\\MongoDB\\Persisters\\DocumentPersister but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:createLazyInitializer\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Proxy\\InternalProxy does not specify its types\: T$#' identifier: missingType.generics count: 1 path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:generateProxyClass\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:generateProxyClasses\(\) has parameter \$classes with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:generateSerializeImpl\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:generateUseLazyGhostTrait\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:getProxy\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Proxy\\InternalProxy does not specify its types\: T$#' identifier: missingType.generics count: 1 path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:loadProxyClass\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\LazyGhostProxyFactory\:\:skipClass\(\) has parameter \$metadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/LazyGhostProxyFactory.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Proxy\\Factory\\StaticProxyFactory\:\:createInitializer\(\) should return Closure\(ProxyManager\\Proxy\\GhostObjectInterface\&TDocument\=, string\=, array\\=, Closure\|null\=, array\\=\)\: bool but returns Closure\(ProxyManager\\Proxy\\GhostObjectInterface, string, array, mixed, array\)\: true\.$#' identifier: return.type count: 1 path: lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\Expr\:\:convertExpression\(\) has parameter \$classMetadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Query/Expr.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\Expr\:\:convertExpressions\(\) has parameter \$classMetadata with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Query/Expr.php - - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\Expr\:\:setClassMetadata\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Query/Expr.php - - message: '#^Unsafe call to private method Doctrine\\ODM\\MongoDB\\Query\\Expr\:\:convertExpression\(\) through static\:\:\.$#' identifier: staticClassAccess.privateMethod count: 3 path: lib/Doctrine/ODM/MongoDB/Query/Expr.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\Query\:\:__construct\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Query/Query.php - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\Query\:\:getIterator\(\) return type with generic interface Doctrine\\ODM\\MongoDB\\Iterator\\Iterator does not specify its types\: TValue$#' identifier: missingType.generics @@ -1110,12 +804,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/Query/Query.php - - - message: '#^Method Doctrine\\ODM\\MongoDB\\Query\\ReferencePrimer\:\:defaultPrimer\(\) has parameter \$class with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata but does not specify its types\: T$#' - identifier: missingType.generics - count: 1 - path: lib/Doctrine/ODM/MongoDB/Query/ReferencePrimer.php - - message: '#^Parameter &\$groupedIds by\-ref type of method Doctrine\\ODM\\MongoDB\\Query\\ReferencePrimer\:\:addManyReferences\(\) expects array\\>, array\\> given\.$#' identifier: parameterByRef.type diff --git a/phpstan.neon.dist b/phpstan.neon.dist index c0a69375c6..ffc9ebe773 100644 --- a/phpstan.neon.dist +++ b/phpstan.neon.dist @@ -26,7 +26,7 @@ parameters: - identifier: staticMethod.alreadyNarrowedType path: tests/Doctrine/ - - message: '#with generic class Doctrine\\ODM\\MongoDB\\Mapping\\ClassMetadata does not specify its types: T$#' + - message: '#generic class Doctrine\\ODM\\MongoDB\\(Mapping\\ClassMetadata|Persisters\\DocumentPersister) (but )?does not specify its types\: T$#' identifier: missingType.generics - message: '#^(Constant|Used constant) DOCTRINE_MONGODB_DATABASE not found\.$#' diff --git a/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php b/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php index caec09b847..7bd5c9b677 100644 --- a/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php +++ b/tests/Doctrine/ODM/MongoDB/Tests/SchemaManagerTest.php @@ -1333,7 +1333,6 @@ public static function dataIsMongoTextIndexEquivalentToDocumentIndex(): array ]; } - /** @param ClassMetadata $cm */ private function getDatabaseName(ClassMetadata $cm): string { return ($cm->getDatabase() ?: $this->dm->getConfiguration()->getDefaultDB()) ?: 'doctrine';