diff --git a/Build/phpstan.level3.neon b/Build/phpstan.level3.neon index 7eca0f571784a41c29d8bad07c406bffe9293742..16e002b348ce054e77d1910937b0bc5007fc9edb 100644 --- a/Build/phpstan.level3.neon +++ b/Build/phpstan.level3.neon @@ -15,7 +15,7 @@ rules: - PHPStan\Rules\Variables\VariableCloningRule parameters: - checkPhpDocMethodSignatures: false # todo: set to true + checkPhpDocMethodSignatures: true services: - diff --git a/phpstan.neon b/phpstan.neon index 601521d201526eddb3cbb6d1dafbdba5e8497fca..26e7edd40ceae61de245465803d24bb51d1b42f7 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -103,6 +103,16 @@ parameters: count: 1 path: typo3/sysext/belog/Classes/Domain/Model/LogEntry.php + # checkPhpDocMethodSignatures + - + message: "#^Return type \\(TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\Expression\\\\ExpressionBuilder\\) of method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Connection\\:\\:getExpressionBuilder\\(\\) should be compatible with return type \\(Doctrine\\\\DBAL\\\\Query\\\\Expression\\\\ExpressionBuilder\\) of method Doctrine\\\\DBAL\\\\Connection\\:\\:getExpressionBuilder\\(\\)$#" + count: 1 + path: typo3/sysext/core/Classes/Database/Connection.php + - + message: "#^Return type \\(TYPO3\\\\CMS\\\\Core\\\\Database\\\\Query\\\\QueryBuilder\\) of method TYPO3\\\\CMS\\\\Core\\\\Database\\\\Connection\\:\\:createQueryBuilder\\(\\) should be compatible with return type \\(Doctrine\\\\DBAL\\\\Query\\\\QueryBuilder\\) of method Doctrine\\\\DBAL\\\\Connection\\:\\:createQueryBuilder\\(\\)$#" + count: 1 + path: typo3/sysext/core/Classes/Database/Connection.php + # Ignored errors for level 4 - message: "#^Ternary operator condition is always false\\.$#" diff --git a/typo3/sysext/core/Classes/Collection/AbstractRecordCollection.php b/typo3/sysext/core/Classes/Collection/AbstractRecordCollection.php index 5140bebb6e4b8870846e5a59c2cf8fa33ecc245e..5c5d95f95d8d9b87fd071717e80e81fd70e27d98 100644 --- a/typo3/sysext/core/Classes/Collection/AbstractRecordCollection.php +++ b/typo3/sysext/core/Classes/Collection/AbstractRecordCollection.php @@ -119,12 +119,12 @@ abstract class AbstractRecordCollection implements RecordCollectionInterface, Pe * Return the key of the current element * * @link https://php.net/manual/en/iterator.key.php - * @return int 0 on failure. + * @return int|string 0 on failure. */ public function key() { $currentRecord = $this->storage->current(); - return $currentRecord['uid']; + return $currentRecord['uid'] ?? 0; } /** diff --git a/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php b/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php index b05e4b522f50d859fcda5ad861e633bfc621254b..e73eecb37b31e707490e2ad7220331eb2e88d28a 100644 --- a/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php +++ b/typo3/sysext/core/Classes/Resource/Security/FileMetadataPermissionsAspect.php @@ -59,7 +59,7 @@ class FileMetadataPermissionsAspect implements DataHandlerCheckModifyAccessListH * We "abuse" it here to actually check if access is allowed to sys_file_metadata. * * - * @param int $accessAllowed Whether the user has access to modify a table + * @param bool $accessAllowed Whether the user has access to modify a table * @param string $table The name of the table to be modified * @param DataHandler $parent The calling parent object * @throws \UnexpectedValueException diff --git a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php index 572d941318e809b40a7e3ddd079c99edd27a7969..70f3d7b8af3e214f32bd3dc45bc99e3ddb89976c 100644 --- a/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php +++ b/typo3/sysext/extbase/Classes/Persistence/Generic/Query.php @@ -96,7 +96,7 @@ class Query implements QueryInterface protected $statement; /** - * @var int[] + * @var array<string, string> */ protected $orderings = []; @@ -294,7 +294,7 @@ class Query implements QueryInterface * 'bar' => \TYPO3\CMS\Extbase\Persistence\QueryInterface::ORDER_DESCENDING * ) * - * @return int + * @return array<string, string> */ public function getOrderings() { diff --git a/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php b/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php index b29689fcd73ff194b05bad4a6cd38102dfaa3dc8..3c3a322d2d56e4184644b7258da00a7d76930084 100644 --- a/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php +++ b/typo3/sysext/linkvalidator/Classes/Linktype/LinktypeInterface.php @@ -26,7 +26,7 @@ interface LinktypeInterface * @param string $url Url to check * @param array $softRefEntry The soft reference entry which builds the context of that url * @param \TYPO3\CMS\Linkvalidator\LinkAnalyzer $reference Parent instance - * @return string Validation error message or success code + * @return bool TRUE on success or FALSE on error */ public function checkLink($url, $softRefEntry, $reference);