diff --git a/composer.json b/composer.json index f8c0d0d074..5626992972 100644 --- a/composer.json +++ b/composer.json @@ -43,7 +43,7 @@ "doctrine/coding-standard": "^9.0", "jmikola/geojson": "^1.0", "phpbench/phpbench": "^1.0.0", - "phpstan/phpstan": "^1.1", + "phpstan/phpstan": "^1.4.6", "phpstan/phpstan-phpunit": "^1.0", "phpunit/phpunit": "^8.5 || ^9", "squizlabs/php_codesniffer": "^3.5", diff --git a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php index 9f854b6346..d365c17d32 100644 --- a/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php +++ b/lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php @@ -22,25 +22,25 @@ class GraphLookup extends Stage { - /** @var string */ + /** @var string|null */ private $from; - /** @var string|Expr|array */ + /** @var string|Expr|array|null */ private $startWith; - /** @var string */ + /** @var string|null */ private $connectFromField; - /** @var string */ + /** @var string|null */ private $connectToField; - /** @var string */ + /** @var string|null */ private $as; - /** @var int */ + /** @var int|null */ private $maxDepth; - /** @var string */ + /** @var string|null */ private $depthField; /** @var Stage\GraphLookup\MatchStage */ diff --git a/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php b/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php index 85e41af03f..5c4e9f242d 100644 --- a/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php +++ b/lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php @@ -108,7 +108,6 @@ private function createInitializer( $initializer = null; $identifier = $metadata->getIdentifierValue($ghostObject); - // @phpstan-ignore-next-line $ghostObject is of type T&GhostObjectInterface if (! $documentPersister->load(['_id' => $identifier], $ghostObject)) { $initializer = $originalInitializer; diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 53949a6521..df9765c975 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -197,12 +197,6 @@ parameters: count: 1 path: lib/Doctrine/ODM/MongoDB/PersistentCollection.php - # There is no way to define a generic array as attribute - - - message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\UnitOfWork\\:\\:getById\\(\\) should return T of object but returns object\\.$#" - count: 1 - path: lib/Doctrine/ODM/MongoDB/UnitOfWork.php - # That statement is never reached because DateTimeInterface is either DateTimeImmutable or DateTime - message: "#^Unreachable statement \\- code above always terminates\\.$#" @@ -253,12 +247,6 @@ parameters: count: 1 path: tests/Doctrine/ODM/MongoDB/Tests/DocumentRepositoryTest.php - # See https://github.com/phpstan/phpstan/issues/5860 - - - message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\UnitOfWork\\:\\:getOrCreateDocument\\(\\) should return T of object but returns \\(Doctrine\\\\Persistence\\\\NotifyPropertyChanged&ProxyManager\\\\Proxy\\\\GhostObjectInterface&T of object\\)\\|\\(ProxyManager\\\\Proxy\\\\GhostObjectInterface&T of object\\)\\|T of object\\.$#" - count: 1 - path: lib/Doctrine/ODM/MongoDB/UnitOfWork.php - # 'strategy' offset is defined as nullable, but here there is no check here - message: "#^Offset 'strategy' does not exist on array\\{\\}\\|array\\{type\\?\\: string, fieldName\\: string, name\\: string, isCascadeRemove\\: bool, isCascadePersist\\: bool, isCascadeRefresh\\: bool, isCascadeMerge\\: bool, isCascadeDetach\\: bool, \\.\\.\\.\\}\\.$#"