From 597a63a86ca8c5f9d1ec2dc74fe3d1269d43434a Mon Sep 17 00:00:00 2001 From: "Alexander M. Turek" Date: Wed, 9 Aug 2023 15:05:08 +0200 Subject: [PATCH] PHPStan 1.10.28, Psalm 5.14.1 (#10895) --- composer.json | 4 ++-- lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php | 5 ++++- lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php | 5 ++++- lib/Doctrine/ORM/Tools/EntityGenerator.php | 4 ++-- .../ORM/Tools/Pagination/LimitSubqueryOutputWalker.php | 2 +- psalm-baseline.xml | 5 +---- 6 files changed, 14 insertions(+), 11 deletions(-) diff --git a/composer.json b/composer.json index a897bbbf8f..14646162ad 100644 --- a/composer.json +++ b/composer.json @@ -42,14 +42,14 @@ "doctrine/annotations": "^1.13 || ^2", "doctrine/coding-standard": "^9.0.2 || ^12.0", "phpbench/phpbench": "^0.16.10 || ^1.0", - "phpstan/phpstan": "~1.4.10 || 1.10.25", + "phpstan/phpstan": "~1.4.10 || 1.10.28", "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6", "psr/log": "^1 || ^2 || ^3", "squizlabs/php_codesniffer": "3.7.2", "symfony/cache": "^4.4 || ^5.4 || ^6.0", "symfony/var-exporter": "^4.4 || ^5.4 || ^6.2", "symfony/yaml": "^3.4 || ^4.0 || ^5.0 || ^6.0", - "vimeo/psalm": "4.30.0 || 5.13.1" + "vimeo/psalm": "4.30.0 || 5.14.1" }, "conflict": { "doctrine/annotations": "<1.13 || >= 3.0" diff --git a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php index abd94fd01e..827ef873b5 100644 --- a/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php +++ b/lib/Doctrine/ORM/Mapping/Driver/XmlDriver.php @@ -944,7 +944,10 @@ private function cacheToArray(SimpleXMLElement $cacheMapping): array private function getCascadeMappings(SimpleXMLElement $cascadeElement): array { $cascades = []; - foreach ($cascadeElement->children() as $action) { + $children = $cascadeElement->children(); + assert($children !== null); + + foreach ($children as $action) { // According to the JPA specifications, XML uses "cascade-persist" // instead of "persist". Here, both variations // are supported because YAML, Annotation and Attribute use "persist" diff --git a/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php b/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php index c5b7ecc2c6..e1c7b13fcf 100644 --- a/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php +++ b/lib/Doctrine/ORM/Mapping/UnderscoreNamingStrategy.php @@ -30,7 +30,10 @@ class UnderscoreNamingStrategy implements NamingStrategy /** @var int */ private $case; - /** @var string */ + /** + * @var string + * @psalm-var non-empty-string + */ private $pattern; /** diff --git a/lib/Doctrine/ORM/Tools/EntityGenerator.php b/lib/Doctrine/ORM/Tools/EntityGenerator.php index 5bf086d52b..04be655188 100644 --- a/lib/Doctrine/ORM/Tools/EntityGenerator.php +++ b/lib/Doctrine/ORM/Tools/EntityGenerator.php @@ -1376,7 +1376,7 @@ protected function generateEntityStubMethod(ClassMetadataInfo $metadata, $type, $this->staticReflection[$metadata->name]['methods'][] = strtolower($methodName); $var = sprintf('%sMethodTemplate', $type); - $template = static::$$var; + $template = (string) static::$$var; $methodTypeHint = ''; $types = Type::getTypesMap(); @@ -1695,7 +1695,7 @@ protected function generateFieldMappingPropertyDocBlock(array $fieldMapping, Cla } if (isset($fieldMapping['options']['comment']) && $fieldMapping['options']['comment']) { - $options[] = '"comment"="' . str_replace('"', '""', $fieldMapping['options']['comment']) . '"'; + $options[] = '"comment"="' . str_replace('"', '""', (string) $fieldMapping['options']['comment']) . '"'; } if (isset($fieldMapping['options']['collation']) && $fieldMapping['options']['collation']) { diff --git a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php index 02fae2564c..6bcd178d03 100644 --- a/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php +++ b/lib/Doctrine/ORM/Tools/Pagination/LimitSubqueryOutputWalker.php @@ -404,7 +404,7 @@ private function recreateInnerSql( /** * @return string[][] - * @psalm-return array{0: list, 1: list} + * @psalm-return array{0: list, 1: list} */ private function generateSqlAliasReplacements(): array { diff --git a/psalm-baseline.xml b/psalm-baseline.xml index 2b887162e5..fd8707f080 100644 --- a/psalm-baseline.xml +++ b/psalm-baseline.xml @@ -1,5 +1,5 @@ - + IterableResult @@ -964,9 +964,6 @@ children()]]> children()]]> - - children()]]> - getName() === 'embeddable']]> getName() === 'entity']]>