Skip to content

Commit 529fdb3

Browse files
committed
PHPStan level 4
1 parent fca9727 commit 529fdb3

File tree

5 files changed

+142
-47
lines changed

5 files changed

+142
-47
lines changed

phpstan-baseline.neon

Lines changed: 135 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -130,6 +130,11 @@ parameters:
130130
count: 1
131131
path: src/Mapping/Driver/AbstractAnnotationDriver.php
132132

133+
-
134+
message: "#^Negated boolean expression is always false\\.$#"
135+
count: 1
136+
path: src/Mapping/Driver/AbstractAnnotationDriver.php
137+
133138
-
134139
message: "#^Call to an undefined method Doctrine\\\\Common\\\\EventArgs\\:\\:getDocument\\(\\)\\.$#"
135140
count: 1
@@ -320,6 +325,11 @@ parameters:
320325
count: 1
321326
path: src/References/ReferencesListener.php
322327

328+
-
329+
message: "#^Else branch is unreachable because ternary operator condition is always true\\.$#"
330+
count: 2
331+
path: src/References/ReferencesListener.php
332+
323333
-
324334
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<object\\>\\:\\:getReflectionProperty\\(\\)\\.$#"
325335
count: 2
@@ -410,6 +420,11 @@ parameters:
410420
count: 2
411421
path: src/Sluggable/SluggableListener.php
412422

423+
-
424+
message: "#^Offset 'type' on array\\{type\\: string, fieldName\\: string, columnName\\: string, length\\?\\: int, id\\?\\: bool, nullable\\?\\: bool, notInsertable\\?\\: bool, notUpdatable\\?\\: bool, \\.\\.\\.\\} on left side of \\?\\? always exists and is not nullable\\.$#"
425+
count: 1
426+
path: src/SoftDeleteable/Mapping/Event/Adapter/ORM.php
427+
413428
-
414429
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$isMappedSuperclass\\.$#"
415430
count: 1
@@ -515,6 +530,11 @@ parameters:
515530
count: 1
516531
path: src/Timestampable/Mapping/Driver/Yaml.php
517532

533+
-
534+
message: "#^Offset 'type' on array\\{type\\: string, fieldName\\: string, columnName\\: string, length\\?\\: int, id\\?\\: bool, nullable\\?\\: bool, notInsertable\\?\\: bool, notUpdatable\\?\\: bool, \\.\\.\\.\\} on left side of \\?\\? always exists and is not nullable\\.$#"
535+
count: 1
536+
path: src/Timestampable/Mapping/Event/Adapter/ORM.php
537+
518538
-
519539
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$identifier\\.$#"
520540
count: 1
@@ -565,6 +585,21 @@ parameters:
565585
count: 2
566586
path: src/Tool/Wrapper/MongoDocumentWrapper.php
567587

588+
-
589+
message: "#^Right side of && is always true\\.$#"
590+
count: 2
591+
path: src/Translatable/Document/Repository/TranslationRepository.php
592+
593+
-
594+
message: "#^Negated boolean expression is always false\\.$#"
595+
count: 1
596+
path: src/Translatable/Entity/Repository/TranslationRepository.php
597+
598+
-
599+
message: "#^Right side of && is always true\\.$#"
600+
count: 2
601+
path: src/Translatable/Entity/Repository/TranslationRepository.php
602+
568603
-
569604
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$associationMappings\\.$#"
570605
count: 1
@@ -660,6 +695,11 @@ parameters:
660695
count: 2
661696
path: src/Translatable/TranslatableListener.php
662697

698+
-
699+
message: "#^Negated boolean expression is always false\\.$#"
700+
count: 1
701+
path: src/Translatable/TranslatableListener.php
702+
663703
-
664704
message: "#^Call to an undefined method Gedmo\\\\Tree\\\\Strategy\\:\\:updateNode\\(\\)\\.$#"
665705
count: 1
@@ -690,6 +730,11 @@ parameters:
690730
count: 2
691731
path: src/Tree/Entity/Repository/NestedTreeRepository.php
692732

733+
-
734+
message: "#^Negated boolean expression is always true\\.$#"
735+
count: 1
736+
path: src/Tree/Entity/Repository/NestedTreeRepository.php
737+
693738
-
694739
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$associationMappings\\.$#"
695740
count: 1
@@ -755,11 +800,31 @@ parameters:
755800
count: 1
756801
path: src/Tree/Strategy/ORM/Closure.php
757802

803+
-
804+
message: "#^Offset 'indexes' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
805+
count: 1
806+
path: src/Tree/Strategy/ORM/Closure.php
807+
808+
-
809+
message: "#^Offset 'uniqueConstraints' on array\\{name\\: string, schema\\: string, indexes\\: array, uniqueConstraints\\: array, options\\: array\\<string, mixed\\>, quoted\\?\\: bool\\} in isset\\(\\) always exists and is not nullable\\.$#"
810+
count: 1
811+
path: src/Tree/Strategy/ORM/Closure.php
812+
758813
-
759814
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\ObjectManager\\:\\:getUnitOfWork\\(\\)\\.$#"
760815
count: 1
761816
path: src/Tree/TreeListener.php
762817

818+
-
819+
message: "#^Property Gedmo\\\\Uploadable\\\\Event\\\\UploadableBaseEventArgs\\:\\:\\$config is never read, only written\\.$#"
820+
count: 1
821+
path: src/Uploadable/Event/UploadableBaseEventArgs.php
822+
823+
-
824+
message: "#^Property Gedmo\\\\Uploadable\\\\Event\\\\UploadableBaseEventArgs\\:\\:\\$extensionConfiguration is never written, only read\\.$#"
825+
count: 1
826+
path: src/Uploadable/Event/UploadableBaseEventArgs.php
827+
763828
-
764829
message: "#^Access to an undefined property Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:\\$isMappedSuperclass\\.$#"
765830
count: 1
@@ -770,6 +835,11 @@ parameters:
770835
count: 1
771836
path: src/Uploadable/Mapping/Validator.php
772837

838+
-
839+
message: "#^Negated boolean expression is always false\\.$#"
840+
count: 1
841+
path: src/Uploadable/MimeType/MimeTypeGuesser.php
842+
773843
-
774844
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\:\\:getReflectionProperty\\(\\)\\.$#"
775845
count: 1
@@ -795,6 +865,11 @@ parameters:
795865
count: 1
796866
path: tests/Gedmo/Loggable/Fixture/Entity/Geo.php
797867

868+
-
869+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Gedmo\\\\\\\\Loggable\\\\\\\\Document\\\\\\\\Repository\\\\\\\\LogEntryRepository' and Doctrine\\\\ORM\\\\EntityRepository\\<Gedmo\\\\Tests\\\\Loggable\\\\Fixture\\\\Document\\\\Log\\\\Comment\\> will always evaluate to false\\.$#"
870+
count: 1
871+
path: tests/Gedmo/Loggable/LoggableDocumentTest.php
872+
798873
-
799874
message: "#^Call to an undefined method Doctrine\\\\Persistence\\\\Mapping\\\\ClassMetadata\\<T of object\\>\\:\\:mapField\\(\\)\\.$#"
800875
count: 2
@@ -835,13 +910,73 @@ parameters:
835910
count: 1
836911
path: tests/Gedmo/Mapping/Mock/Extension/Encoder/Mapping/Driver/Annotation.php
837912

913+
-
914+
message: "#^Property Gedmo\\\\Tests\\\\Mapping\\\\ReferenceIntegrityMappingTest\\:\\:\\$dm is never written, only read\\.$#"
915+
count: 1
916+
path: tests/Gedmo/Mapping/ReferenceIntegrityMappingTest.php
917+
918+
-
919+
message: "#^Property Gedmo\\\\Tests\\\\Mapping\\\\ReferenceIntegrityMappingTest\\:\\:\\$referenceIntegrity is never written, only read\\.$#"
920+
count: 1
921+
path: tests/Gedmo/Mapping/ReferenceIntegrityMappingTest.php
922+
923+
-
924+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
925+
count: 1
926+
path: tests/Gedmo/Mapping/ReferenceIntegrityMappingTest.php
927+
928+
-
929+
message: "#^Dead catch \\- Doctrine\\\\DBAL\\\\Exception\\\\ForeignKeyConstraintViolationException is never thrown in the try block\\.$#"
930+
count: 1
931+
path: tests/Gedmo/Sortable/SortableTest.php
932+
838933
-
839934
message: "#^Method Gedmo\\\\Tests\\\\Timestampable\\\\Fixture\\\\ArticleCarbon\\:\\:getCreated\\(\\) should return Carbon\\\\Carbon\\|null but returns DateTime\\|null\\.$#"
840935
count: 1
841936
path: tests/Gedmo/Timestampable/Fixture/ArticleCarbon.php
842937

938+
-
939+
message: "#^Strict comparison using \\=\\=\\= between null and Doctrine\\\\DBAL\\\\Platforms\\\\AbstractPlatform will always evaluate to false\\.$#"
940+
count: 1
941+
path: tests/Gedmo/Tool/BaseTestCaseORM.php
942+
943+
-
944+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Gedmo\\\\\\\\Translatable\\\\\\\\Document\\\\\\\\Repository\\\\\\\\TranslationRepository' and Doctrine\\\\ORM\\\\EntityRepository\\<Gedmo\\\\Translatable\\\\Document\\\\Translation\\> will always evaluate to false\\.$#"
945+
count: 4
946+
path: tests/Gedmo/Translatable/TranslatableDocumentCollectionTest.php
947+
948+
-
949+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Gedmo\\\\\\\\Translatable\\\\\\\\Document\\\\\\\\Repository\\\\\\\\TranslationRepository' and Doctrine\\\\ORM\\\\EntityRepository\\<Gedmo\\\\Translatable\\\\Document\\\\Translation\\> will always evaluate to false\\.$#"
950+
count: 2
951+
path: tests/Gedmo/Translatable/TranslatableDocumentTest.php
952+
953+
-
954+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Doctrine\\\\\\\\ODM\\\\\\\\MongoDB\\\\\\\\Iterator\\\\\\\\Iterator' and array will always evaluate to false\\.$#"
955+
count: 2
956+
path: tests/Gedmo/Tree/MaterializedPathODMMongoDBRepositoryTest.php
957+
958+
-
959+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertInstanceOf\\(\\) with 'Doctrine\\\\\\\\ODM\\\\\\\\MongoDB\\\\\\\\Iterator\\\\\\\\Iterator' and array\\|null will always evaluate to false\\.$#"
960+
count: 2
961+
path: tests/Gedmo/Tree/MaterializedPathODMMongoDBRepositoryTest.php
962+
843963
-
844964
message: "#^Property Gedmo\\\\Tests\\\\Tree\\\\MaterializedPathODMMongoDBRepositoryTest\\:\\:\\$repo \\(Gedmo\\\\Tree\\\\Document\\\\MongoDB\\\\Repository\\\\MaterializedPathRepository\\) does not accept Doctrine\\\\ORM\\\\EntityRepository\\<Gedmo\\\\Tests\\\\Tree\\\\Fixture\\\\Document\\\\Category\\>\\.$#"
845965
count: 1
846966
path: tests/Gedmo/Tree/MaterializedPathODMMongoDBRepositoryTest.php
847967

968+
-
969+
message: "#^Unreachable statement \\- code above always terminates\\.$#"
970+
count: 1
971+
path: tests/Gedmo/Tree/MaterializedPathODMMongoDBTreeLockingTest.php
972+
973+
-
974+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with true will always evaluate to false\\.$#"
975+
count: 1
976+
path: tests/Gedmo/Tree/NestedTreeRootRepositoryTest.php
977+
978+
-
979+
message: "#^Call to static method PHPUnit\\\\Framework\\\\Assert\\:\\:assertIsArray\\(\\) with true will always evaluate to false\\.$#"
980+
count: 1
981+
path: tests/Gedmo/Tree/RepositoryTest.php
982+

phpstan.neon.dist

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,11 +4,14 @@ includes:
44
- vendor/phpstan/phpstan-phpunit/extension.neon
55

66
parameters:
7-
level: 3
7+
level: 4
88
paths:
99
- src
1010
- tests
1111
bootstrapFiles:
1212
- tests/bootstrap.php
13-
doctrine:
14-
objectManagerLoader: tests/object-manager.php
13+
treatPhpDocTypesAsCertain: false
14+
ignoreErrors:
15+
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never written, only read\.#'
16+
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is never read, only written\.#'
17+
- '#^Property Gedmo\\Tests\\.+\\Fixture\\[^:]+::\$\w+ is unused\.#'

src/SoftDeleteable/SoftDeleteableListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,7 +84,7 @@ public function onFlush(EventArgs $args)
8484

8585
$om->persist($object);
8686
$uow->propertyChanged($object, $config['fieldName'], $oldValue, $date);
87-
if ($uow instanceof MongoDBUnitOfWork && !method_exists($uow, 'scheduleExtraUpdate')) {
87+
if ($uow instanceof MongoDBUnitOfWork) {
8888
$ea->recomputeSingleObjectChangeSet($uow, $meta, $object);
8989
} else {
9090
$uow->scheduleExtraUpdate($object, [

tests/Gedmo/Translatable/Issue/Issue165Test.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,6 @@ final class Issue165Test extends BaseTestCaseMongoODM
2828
public const TRANSLATION = Translation::class;
2929

3030
private $translatableListener;
31-
private $articleId;
3231

3332
protected function setUp(): void
3433
{

tests/object-manager.php

Lines changed: 0 additions & 42 deletions
This file was deleted.

0 commit comments

Comments
 (0)