From 2b8ac1581331e2a563a57b30335a1a3512e884dc Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Gr=C3=A9goire=20Paris?= Date: Thu, 22 Sep 2022 09:08:46 +0200 Subject: [PATCH] Mark ClassMetadataInfo::sequenceGeneratorDefinition as nullable --- lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php | 6 ++++-- phpstan-baseline.neon | 12 +----------- 2 files changed, 5 insertions(+), 13 deletions(-) diff --git a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php index 8dce93359f8..4b421912469 100644 --- a/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php +++ b/lib/Doctrine/ORM/Mapping/ClassMetadataInfo.php @@ -716,8 +716,8 @@ class ClassMetadataInfo implements ClassMetadata * ) * * - * @var array - * @psalm-var array{sequenceName: string, allocationSize: string, initialValue: string, quoted?: mixed} + * @var array|null + * @psalm-var array{sequenceName: string, allocationSize: string, initialValue: string, quoted?: mixed}|null * @todo Merge with tableGeneratorDefinition into generic generatorDefinition */ public $sequenceGeneratorDefinition; @@ -2376,6 +2376,8 @@ public function isIdGeneratorIdentity() * Checks whether the class uses a sequence for id generation. * * @return bool TRUE if the class uses the SEQUENCE generator, FALSE otherwise. + * + * @psalm-assert-if-true !null $this->sequenceGeneratorDefinition */ public function isIdGeneratorSequence() { diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index f5997905199..b53c1d684ef 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -170,11 +170,6 @@ parameters: count: 2 path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - - message: "#^Negated boolean expression is always false\\.$#" - count: 1 - path: lib/Doctrine/ORM/Mapping/ClassMetadataFactory.php - - message: "#^Parameter \\#2 \\$class of method Doctrine\\\\ORM\\\\Mapping\\\\QuoteStrategy\\:\\:getSequenceName\\(\\) expects Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadata, Doctrine\\\\ORM\\\\Mapping\\\\ClassMetadataInfo given\\.$#" count: 2 @@ -630,11 +625,6 @@ parameters: count: 1 path: lib/Doctrine/ORM/Tools/Console/Command/MappingDescribeCommand.php - - - message: "#^If condition is always true\\.$#" - count: 1 - path: lib/Doctrine/ORM/Tools/EntityGenerator.php - - message: "#^Offset 'allocationSize' on array\\{sequenceName\\: string, allocationSize\\: string, initialValue\\: string, quoted\\?\\: mixed\\} in isset\\(\\) always exists and is not nullable\\.$#" count: 1 @@ -697,7 +687,7 @@ parameters: - message: "#^Right side of && is always true\\.$#" - count: 2 + count: 1 path: lib/Doctrine/ORM/Tools/Export/Driver/XmlExporter.php -