Skip to content

Commit 87f0c64

Browse files
authored
Merge pull request #2407 from franmomu/fix_sa_issues
Fix PHPStan issues
2 parents 0947820 + c3486da commit 87f0c64

File tree

4 files changed

+8
-21
lines changed

4 files changed

+8
-21
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@
4343
"doctrine/coding-standard": "^9.0",
4444
"jmikola/geojson": "^1.0",
4545
"phpbench/phpbench": "^1.0.0",
46-
"phpstan/phpstan": "^1.1",
46+
"phpstan/phpstan": "^1.4.6",
4747
"phpstan/phpstan-phpunit": "^1.0",
4848
"phpunit/phpunit": "^8.5 || ^9",
4949
"squizlabs/php_codesniffer": "^3.5",

lib/Doctrine/ODM/MongoDB/Aggregation/Stage/GraphLookup.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,25 +22,25 @@
2222

2323
class GraphLookup extends Stage
2424
{
25-
/** @var string */
25+
/** @var string|null */
2626
private $from;
2727

28-
/** @var string|Expr|array */
28+
/** @var string|Expr|array|null */
2929
private $startWith;
3030

31-
/** @var string */
31+
/** @var string|null */
3232
private $connectFromField;
3333

34-
/** @var string */
34+
/** @var string|null */
3535
private $connectToField;
3636

37-
/** @var string */
37+
/** @var string|null */
3838
private $as;
3939

40-
/** @var int */
40+
/** @var int|null */
4141
private $maxDepth;
4242

43-
/** @var string */
43+
/** @var string|null */
4444
private $depthField;
4545

4646
/** @var Stage\GraphLookup\MatchStage */

lib/Doctrine/ODM/MongoDB/Proxy/Factory/StaticProxyFactory.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -108,7 +108,6 @@ private function createInitializer(
108108
$initializer = null;
109109
$identifier = $metadata->getIdentifierValue($ghostObject);
110110

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

phpstan-baseline.neon

Lines changed: 0 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -197,12 +197,6 @@ parameters:
197197
count: 1
198198
path: lib/Doctrine/ODM/MongoDB/PersistentCollection.php
199199

200-
# There is no way to define a generic array as attribute
201-
-
202-
message: "#^Method Doctrine\\\\ODM\\\\MongoDB\\\\UnitOfWork\\:\\:getById\\(\\) should return T of object but returns object\\.$#"
203-
count: 1
204-
path: lib/Doctrine/ODM/MongoDB/UnitOfWork.php
205-
206200
# That statement is never reached because DateTimeInterface is either DateTimeImmutable or DateTime
207201
-
208202
message: "#^Unreachable statement \\- code above always terminates\\.$#"
@@ -253,12 +247,6 @@ parameters:
253247
count: 1
254248
path: tests/Doctrine/ODM/MongoDB/Tests/DocumentRepositoryTest.php
255249

256-
# See https://github.com/phpstan/phpstan/issues/5860
257-
-
258-
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\\.$#"
259-
count: 1
260-
path: lib/Doctrine/ODM/MongoDB/UnitOfWork.php
261-
262250
# 'strategy' offset is defined as nullable, but here there is no check here
263251
-
264252
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, \\.\\.\\.\\}\\.$#"

0 commit comments

Comments
 (0)