Skip to content

Commit 3cbe708

Browse files
authored
fix(phpstan): apply phpstan fixes (#2721)
## Description Fixes failing PHPStan ``` ------ ------------------------------------------------------------------ Line src/Model/ModelRegistry.php ------ ------------------------------------------------------------------ 122 Variable $schemaJson on left side of ?? always exists and is not nullable. 🪪 nullCoalesce.variable ------ ------------------------------------------------------------------ ------ ----------------------------------------------------------------------- Line src/Util/LegacyTypeConverter.php ------ ----------------------------------------------------------------------- 50 Strict comparison using === between 'null' and 'array'|'int'|'object'|'string' will always evaluate to false. 🪪 identical.alwaysFalse 💡 If Symfony\Component\PropertyInfo\Type::isCollection() is impure, add @phpstan-impure PHPDoc tag above its declaration. Learn more: htt ps://phpstan.org/blog/remembering-and-forgetting-returned-values 💡 If Symfony\Component\PropertyInfo\Type::getClassName() is impure, add @phpstan-impure PHPDoc tag above its declaration. Learn more: htt ps://phpstan.org/blog/remembering-and-forgetting-returned-values 💡 If Symfony\Component\PropertyInfo\Type::getCollectionValueTypes() is impure, add @phpstan-impure PHPDoc tag above its declaration. Lear n more: https://phpstan.org/blog/remembering-and-forgetting-returned- values 💡 If Symfony\Component\PropertyInfo\Type::getCollectionKeyTypes() is impure, add @phpstan-impure PHPDoc tag above its declaration. Learn m ore: https://phpstan.org/blog/remembering-and-forgetting-returned-val ues ------ ----------------------------------------------------------------------- ``` ## What type of PR is this? (check all applicable) - [x] Bug Fix - [ ] Feature - [ ] Refactor - [ ] Deprecation - [ ] Breaking Change - [ ] Documentation Update - [x] CI ## Checklist - [ ] I have made corresponding changes to the documentation (`docs/`)
1 parent 19140a5 commit 3cbe708

2 files changed

Lines changed: 2 additions & 2 deletions

File tree

src/Model/ModelRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -119,7 +119,7 @@ public function register(Model $model): string
119119
$this->unregistered = array_unique($this->unregistered);
120120
// Only store schema if it was successfully generated
121121
if (null !== $schema) {
122-
$this->schemaToModelMap[$identifier][$schemaJson ?? json_encode($schema)] = $model;
122+
$this->schemaToModelMap[$identifier][$schemaJson] = $model;
123123
}
124124
}
125125

src/Util/LegacyTypeConverter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public static function toTypeInfoType(?array $legacyTypes): ?Type
4747
default => throw new \LogicException('Unsupported LegacyType type: '.$legacyType->getBuiltinType().'.'),
4848
};
4949

50-
if (LegacyType::BUILTIN_TYPE_NULL === $legacyType->getBuiltinType() || $legacyType->isNullable()) {
50+
if ($legacyType->isNullable()) {
5151
$nullable = true;
5252
}
5353
}

0 commit comments

Comments
 (0)