From 137b089854fc85523f8a3692fc5ce15e32869f3e Mon Sep 17 00:00:00 2001
From: Daniel Goerz <daniel.goerz@posteo.de>
Date: Fri, 25 Sep 2020 09:52:52 +0200
Subject: [PATCH] [TASK] Activate phpstan rule IncompatiblePhpDocTypeRule

Resolves: #92404
Releases: master, 10.4
Change-Id: Ia5e52c54b888e131386f4bd21d6819266ad2cd46
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/65850
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Alexander Schnitzler <git@alexanderschnitzler.de>
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Alexander Schnitzler <git@alexanderschnitzler.de>
---
 Build/phpstan.level2.neon                                | 2 +-
 .../sysext/core/Classes/Database/Query/QueryBuilder.php  | 9 ++++-----
 .../Classes/Imaging/ImageManipulation/CropVariant.php    | 4 ++--
 .../Imaging/ImageManipulation/CropVariantCollection.php  | 2 +-
 .../Search/Result/DriverFilteredSearchResult.php         | 4 ++--
 .../sysext/frontend/Classes/Typolink/PageLinkBuilder.php | 2 +-
 6 files changed, 11 insertions(+), 12 deletions(-)

diff --git a/Build/phpstan.level2.neon b/Build/phpstan.level2.neon
index 67d2e22afbd9..f0aac63f51ef 100644
--- a/Build/phpstan.level2.neon
+++ b/Build/phpstan.level2.neon
@@ -22,7 +22,7 @@ rules:
 	- PHPStan\Rules\Operators\InvalidBinaryOperationRule
 	- PHPStan\Rules\Operators\InvalidUnaryOperationRule
 	- PHPStan\Rules\Operators\InvalidComparisonOperationRule
-#	- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
+	- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
 	- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
 	- PHPStan\Rules\PhpDoc\InvalidPhpDocTagValueRule
 	- PHPStan\Rules\PhpDoc\InvalidPHPStanDocTagRule
diff --git a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
index d3abf84394c2..3e421c996cd9 100644
--- a/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
+++ b/typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
@@ -401,7 +401,7 @@ class QueryBuilder
      * Specifies items that are to be returned in the query result.
      * Replaces any previously specified selections, if any.
      *
-     * @param array<int,string> $selects
+     * @param string ...$selects
      * @return QueryBuilder This QueryBuilder instance.
      */
     public function select(string ...$selects): QueryBuilder
@@ -414,8 +414,7 @@ class QueryBuilder
     /**
      * Adds an item that is to be returned in the query result.
      *
-     * @param array<int,string> $selects The selection expression.
-     *
+     * @param string ...$selects
      * @return QueryBuilder This QueryBuilder instance.
      */
     public function addSelect(string ...$selects): QueryBuilder
@@ -431,7 +430,7 @@ class QueryBuilder
      * This should only be used for literal SQL expressions as no
      * quoting/escaping of any kind will be performed on the items.
      *
-     * @param array<int,string> $selects Literal SQL expressions to be selected. Warning: No quoting will be done!
+     * @param string ...$selects Literal SQL expressions to be selected. Warning: No quoting will be done!
      * @return QueryBuilder This QueryBuilder instance.
      */
     public function selectLiteral(string ...$selects): QueryBuilder
@@ -446,7 +445,7 @@ class QueryBuilder
      * only be used for literal SQL expressions as no quoting/escaping of
      * any kind will be performed on the items.
      *
-     * @param array<int,string> $selects Literal SQL expressions to be selected.
+     * @param string ...$selects Literal SQL expressions to be selected.
      * @return QueryBuilder This QueryBuilder instance.
      */
     public function addSelectLiteral(string ...$selects): QueryBuilder
diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariant.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariant.php
index 250b4673a98a..0444d463ae13 100644
--- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariant.php
+++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariant.php
@@ -184,7 +184,7 @@ class CropVariant
     }
 
     /**
-     * @param array<int,Ratio> $ratios
+     * @param Ratio ...$ratios
      * @throws InvalidConfigurationException
      */
     protected function setAllowedAspectRatios(Ratio ...$ratios)
@@ -208,7 +208,7 @@ class CropVariant
     }
 
     /**
-     * @param array<int,Area> $areas
+     * @param Area ...$areas
      * @throws InvalidConfigurationException
      */
     protected function setCoverAreas(Area ...$areas)
diff --git a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php
index b36216989674..d63cb35e014d 100644
--- a/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php
+++ b/typo3/sysext/core/Classes/Imaging/ImageManipulation/CropVariantCollection.php
@@ -156,7 +156,7 @@ class CropVariantCollection
     }
 
     /**
-     * @param array<int,CropVariant> $cropVariants
+     * @param CropVariant ...$cropVariants
      * @throws \TYPO3\CMS\Core\Imaging\ImageManipulation\InvalidConfigurationException
      */
     protected function setCropVariants(CropVariant ...$cropVariants)
diff --git a/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php b/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php
index 474dd12a0d8e..befbf85afecf 100644
--- a/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php
+++ b/typo3/sysext/core/Classes/Resource/Search/Result/DriverFilteredSearchResult.php
@@ -126,8 +126,8 @@ class DriverFilteredSearchResult implements FileSearchResultInterface
     /**
      * Filter out identifiers by calling all attached filters
      *
-     * @param array<int,File> $files
-     * @return array
+     * @param File ...$files
+     * @return array<int, File>
      */
     private function applyFilters(File ...$files): array
     {
diff --git a/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php b/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php
index 4a20b37d0779..df856af028d8 100644
--- a/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php
+++ b/typo3/sysext/frontend/Classes/Typolink/PageLinkBuilder.php
@@ -506,7 +506,7 @@ class PageLinkBuilder extends AbstractTypolinkBuilder
      * Create mount point map, based on TypoScript config.MP_mapRootPoints and config.MP_defaults.
      *
      * @param string $defaultMountPoints a string as defined in config.MP_defaults
-     * @param string|null $mapRootPointList a string as defined in config.MP_mapRootPoints
+     * @param string $mapRootPointList a string as defined in config.MP_mapRootPoints
      * @return array
      */
     protected function initializeMountPointMap(string $defaultMountPoints = '', string $mapRootPointList = ''): array
-- 
GitLab