Skip to content

Commit

Permalink
Merge pull request #2407 from franmomu/fix_sa_issues
Browse files Browse the repository at this point in the history
Fix PHPStan issues
  • Loading branch information
malarzm authored Feb 15, 2022
2 parents 0947820 + c3486da commit 87f0c64
Show file tree
Hide file tree
Showing 4 changed files with 8 additions and 21 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
14 changes: 7 additions & 7 deletions lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php
Original file line number Diff line number Diff line change
Expand Up @@ -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 */
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -108,7 +108,6 @@ private function createInitializer(
$initializer = null;
$identifier = $metadata->getIdentifierValue($ghostObject);

// @phpstan-ignore-next-line $ghostObject is of type T&GhostObjectInterface<T>
if (! $documentPersister->load(['_id' => $identifier], $ghostObject)) {
$initializer = $originalInitializer;

Expand Down
12 changes: 0 additions & 12 deletions phpstan-baseline.neon
Original file line number Diff line number Diff line change
Expand Up @@ -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\\.$#"
Expand Down Expand Up @@ -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, \\.\\.\\.\\}\\.$#"
Expand Down

0 comments on commit 87f0c64

Please sign in to comment.