Skip to content

Commit

Permalink
[TASK] Fix php doc comments reported by phpstan level 2
Browse files Browse the repository at this point in the history
Releases: master
Resolves: #90668
Change-Id: I92cc4942f9f06d587a7957a94f006d157143e55c
Reviewed-on: https://review.typo3.org/c/Packages/TYPO3.CMS/+/63569
Tested-by: TYPO3com <noreply@typo3.com>
Tested-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Tested-by: Benni Mack <benni@typo3.org>
Reviewed-by: Oliver Klee <typo3-coding@oliverklee.de>
Reviewed-by: Andreas Fernandez <a.fernandez@scripting-base.de>
Reviewed-by: Benni Mack <benni@typo3.org>
  • Loading branch information
alexanderschnitzler authored and bmack committed Mar 8, 2020
1 parent cef99dd commit b8feea3
Show file tree
Hide file tree
Showing 79 changed files with 124 additions and 118 deletions.
9 changes: 9 additions & 0 deletions phpstan.neon
Expand Up @@ -3,6 +3,15 @@ includes:
# Include bleeding edge rules if necessary but do not commit
# - vendor/phpstan/phpstan/conf/bleedingEdge.neon

rules:
# those are level 2 rules, will be removed once level 2 is completely active
- PHPStan\Rules\PhpDoc\IncompatiblePhpDocTypeRule
- PHPStan\Rules\PhpDoc\IncompatiblePropertyPhpDocTypeRule
- PHPStan\Rules\PhpDoc\InvalidPhpDocTagValueRule
- PHPStan\Rules\PhpDoc\InvalidPHPStanDocTagRule
- PHPStan\Rules\PhpDoc\InvalidThrowsPhpDocValueRule
- PHPStan\Rules\PhpDoc\WrongVariableNameInVarTagRule

parameters:
level: 1

Expand Down
Expand Up @@ -111,7 +111,7 @@ protected function getBackendUser(): BackendUserAuthentication
/**
* @param array $modules
* @param \Psr\Http\Message\ServerRequestInterface $request
* @param $configurationToSave
* @param array $configurationToSave
*/
protected function triggerOnSubmitActors(
array $modules,
Expand Down
Expand Up @@ -407,7 +407,7 @@ protected function getHasher(): PasswordHashInterface
* @param int $error see SystemLogErrorClassification
* @param int $userId
* @param array $data additional information, used for the message
* @param $ipAddress
* @param string $ipAddress
* @param Context $context
*/
protected function log(string $message, int $action, int $error, int $userId, array $data, $ipAddress, Context $context): void
Expand Down
Expand Up @@ -179,7 +179,7 @@ protected function initializeToolbarItems()
/**
* Main function generating the BE scaffolding
*
* @param $request ServerRequestInterface
* @param ServerRequestInterface $request
* @return ResponseInterface the response with the content
*/
public function mainAction(ServerRequestInterface $request): ResponseInterface
Expand Down
Expand Up @@ -970,7 +970,7 @@ protected function getNumberOfHiddenElements(array $languageColumns): int
/**
* Check if page can be edited by current user
*
* @param int|null $languageId
* @param int $languageId
* @return bool
*/
protected function isPageEditable(int $languageId): bool
Expand Down
Expand Up @@ -335,7 +335,7 @@ protected function checkBoxParams($itemName, $formElementValue, $checkbox, $chec
* Calculates the bootstrap grid classes based on the amount of columns
* defined in the checkbox item TCA
*
* @param $cols
* @param int $cols
* @return array
* @internal
*/
Expand Down
Expand Up @@ -99,7 +99,7 @@ private function sanitizeConfiguration(array $config, string $fieldName, string
/**
* @param string $fieldName
* @param string $tableName
* @param $checkboxEntry
* @param mixed $checkboxEntry
* @param int $checkboxKey
* @throws \UnexpectedValueException
*/
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/backend/Classes/Template/ModuleTemplate.php
Expand Up @@ -429,7 +429,7 @@ public function setModuleName($moduleName): self
/**
* Generates the Menu for things like Web->Info
*
* @param $moduleMenuIdentifier
* @param string $moduleMenuIdentifier
* @return self
*/
public function registerModuleMenu($moduleMenuIdentifier): self
Expand Down
Expand Up @@ -352,7 +352,7 @@ protected function updatePasswordHashInDatabase(string $table, int $uid, string
* parameters. The syntax is the same as for sprintf()
*
* @param string $message Message to output
* @param array|mixed[] $params
* @param array<int,mixed> $params
*/
protected function writeLogMessage(string $message, ...$params): void
{
Expand Down
Expand Up @@ -481,7 +481,7 @@ public function setCompression($compression)
* If compression is enabled and this is not set,
* gzcompress default level will be used
*
* @param int -1 to 9: Compression level
* @param int $compressionLevel -1 to 9: Compression level
*/
public function setCompressionLevel($compressionLevel)
{
Expand Down
Expand Up @@ -264,7 +264,7 @@ public function setItemTableName($tableName)
* The comparison function given as must return an integer less than, equal to, or greater than
* zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
*
* @param $callbackFunction
* @param callable $callbackFunction
* @see http://www.php.net/manual/en/function.usort.php
*/
public function usort($callbackFunction)
Expand Down
Expand Up @@ -31,7 +31,7 @@ interface SortableCollectionInterface
* The comparison function given as must return an integer less than, equal to, or greater than
* zero if the first argument is considered to be respectively less than, equal to, or greater than the second.
*
* @param $callbackFunction
* @param callable $callbackFunction
* @see http://www.php.net/manual/en/function.usort.php
*/
public function usort($callbackFunction);
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Context/Context.php
Expand Up @@ -57,7 +57,7 @@ class Context implements SingletonInterface
/**
* Sets up the context with pre-defined aspects
*
* @param array|null $defaultAspects
* @param array $defaultAspects
*/
public function __construct(array $defaultAspects = [])
{
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Core/Bootstrap.php
Expand Up @@ -607,7 +607,7 @@ public static function initializeBackendAuthentication($proceedIfNoUserIsLoggedI
*/
public static function initializeLanguageObject()
{
/** @var $GLOBALS['LANG'] \TYPO3\CMS\Core\Localization\LanguageService */
/** @var \TYPO3\CMS\Core\Localization\LanguageService $GLOBALS['LANG'] */
$GLOBALS['LANG'] = LanguageService::createFromUserPreferences($GLOBALS['BE_USER']);
}
}
Expand Up @@ -411,7 +411,7 @@ protected static function setRequestType(int $requestType)
/**
* Define constants and variables
*
* @param string
* @param string $mode
*/
protected static function defineLegacyConstants(string $mode)
{
Expand Down
3 changes: 1 addition & 2 deletions typo3/sysext/core/Classes/DataHandling/DataHandler.php
Expand Up @@ -2407,7 +2407,7 @@ public function getUnique($table, $field, $value, $id, $newPid = 0)
* @param string $field Field name for which $value must be unique
* @param int $uid UID to filter out in the lookup (the record itself...)
* @param int $pid If set, the value will be unique for this PID
* @return \Doctrine\DBAL\Driver\Statement|int Return the prepared statement to check uniqueness
* @return \Doctrine\DBAL\Driver\Statement Return the prepared statement to check uniqueness
*/
protected function getUniqueCountStatement(
string $value,
Expand Down Expand Up @@ -7601,7 +7601,6 @@ protected function fixUniqueInSite(string $table, int $uid): bool
/**
* Check if there are subpages that need an adoption as well
* @param int $pageId
* @param int $pid
*/
protected function fixUniqueInSiteForSubpages(int $pageId)
{
Expand Down
Expand Up @@ -82,7 +82,7 @@ public function __construct(string $userType = self::USER_BACKEND, int $userId =
* @param string $table
* @param int $uid
* @param array $payload
* @param string|null $correlationId
* @param CorrelationId|null $correlationId
* @return string
*/
public function addRecord(string $table, int $uid, array $payload, CorrelationId $correlationId = null): string
Expand All @@ -107,7 +107,7 @@ public function addRecord(string $table, int $uid, array $payload, CorrelationId
* @param string $table
* @param int $uid
* @param array $payload
* @param string|null $correlationId
* @param CorrelationId|null $correlationId
* @return string
*/
public function modifyRecord(string $table, int $uid, array $payload, CorrelationId $correlationId = null): string
Expand All @@ -131,7 +131,7 @@ public function modifyRecord(string $table, int $uid, array $payload, Correlatio
/**
* @param string $table
* @param int $uid
* @param string|null $correlationId
* @param CorrelationId|null $correlationId
* @return string
*/
public function deleteRecord(string $table, int $uid, CorrelationId $correlationId = null): string
Expand All @@ -154,7 +154,7 @@ public function deleteRecord(string $table, int $uid, CorrelationId $correlation
/**
* @param string $table
* @param int $uid
* @param string|null $correlationId
* @param CorrelationId|null $correlationId
* @return string
*/
public function undeleteRecord(string $table, int $uid, CorrelationId $correlationId = null): string
Expand All @@ -178,7 +178,7 @@ public function undeleteRecord(string $table, int $uid, CorrelationId $correlati
* @param string $table
* @param int $uid
* @param array $payload
* @param string|null $correlationId
* @param CorrelationId|null $correlationId
* @return string
*/
public function moveRecord(string $table, int $uid, array $payload, CorrelationId $correlationId = null): string
Expand Down
Expand Up @@ -1317,7 +1317,7 @@ protected function applyLocalizationReferences(string $tableName, $fromId, int $
* Prefixes language title if applicable for the accordant field name in raw data-map item.
*
* @param string $tableName
* @param $fromId
* @param string|int $fromId
* @param int $language
* @param array $data
* @return array
Expand Down
Expand Up @@ -52,7 +52,7 @@ public function __construct(string $name)
* @param array $data
* @param int|string|null $pageId
* @param int|string|null $recordId
* @return object|RecordState
* @return RecordState
*/
public function fromArray(array $data, $pageId = null, $recordId = null): RecordState
{
Expand Down
Expand Up @@ -62,7 +62,7 @@ public function __construct(Connection $connection)
/**
* Creates a conjunction of the given boolean expressions
*
* @param mixed $expressions Optional clause. Requires at least one defined when converting to string.
* @param array<int,mixed> $expressions Optional clause. Requires at least one defined when converting to string.
*
* @return CompositeExpression
*/
Expand All @@ -74,7 +74,7 @@ public function andX(...$expressions): CompositeExpression
/**
* Creates a disjunction of the given boolean expressions.
*
* @param mixed $expressions Optional clause. Requires at least one defined when converting to string.
* @param array<int,mixed> $expressions Optional clause. Requires at least one defined when converting to string.
*
* @return CompositeExpression
*/
Expand Down
24 changes: 12 additions & 12 deletions typo3/sysext/core/Classes/Database/Query/QueryBuilder.php
Expand Up @@ -384,7 +384,7 @@ public function count(string $item): QueryBuilder
* Specifies items that are to be returned in the query result.
* Replaces any previously specified selections, if any.
*
* @param string[] $selects
* @param array<int,string> $selects
* @return QueryBuilder This QueryBuilder instance.
*/
public function select(string ...$selects): QueryBuilder
Expand All @@ -397,7 +397,7 @@ public function select(string ...$selects): QueryBuilder
/**
* Adds an item that is to be returned in the query result.
*
* @param string[] $selects The selection expression.
* @param array<int,string> $selects The selection expression.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand All @@ -414,7 +414,7 @@ public function addSelect(string ...$selects): QueryBuilder
* This should only be used for literal SQL expressions as no
* quoting/escaping of any kind will be performed on the items.
*
* @param string[] $selects Literal SQL expressions to be selected. Warning: No quoting will be done!
* @param array<int,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
Expand All @@ -429,7 +429,7 @@ public function selectLiteral(string ...$selects): QueryBuilder
* only be used for literal SQL expressions as no quoting/escaping of
* any kind will be performed on the items.
*
* @param string[] $selects Literal SQL expressions to be selected.
* @param array<int,string> $selects Literal SQL expressions to be selected.
* @return QueryBuilder This QueryBuilder instance.
*/
public function addSelectLiteral(string ...$selects): QueryBuilder
Expand Down Expand Up @@ -625,7 +625,7 @@ public function set(string $key, $value, bool $createNamedParameter = true, int
* Specifies one or more restrictions to the query result.
* Replaces any previously specified restrictions, if any.
*
* @param mixed $predicates
* @param array<int,mixed> $predicates
* @return QueryBuilder This QueryBuilder instance.
*/
public function where(...$predicates): QueryBuilder
Expand All @@ -639,7 +639,7 @@ public function where(...$predicates): QueryBuilder
* Adds one or more restrictions to the query results, forming a logical
* conjunction with any previously specified restrictions.
*
* @param mixed $where The query restrictions.
* @param array<int,string> $where The query restrictions.
*
* @return QueryBuilder This QueryBuilder instance.
*
Expand All @@ -656,7 +656,7 @@ public function andWhere(...$where): QueryBuilder
* Adds one or more restrictions to the query results, forming a logical
* disjunction with any previously specified restrictions.
*
* @param mixed $where The WHERE statement.
* @param array<int,string> $where The WHERE statement.
*
* @return QueryBuilder This QueryBuilder instance.
*
Expand All @@ -673,7 +673,7 @@ public function orWhere(...$where): QueryBuilder
* Specifies a grouping over the results of the query.
* Replaces any previously specified groupings, if any.
*
* @param mixed $groupBy The grouping expression.
* @param array<int,string> $groupBy The grouping expression.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand All @@ -687,7 +687,7 @@ public function groupBy(...$groupBy): QueryBuilder
/**
* Adds a grouping expression to the query.
*
* @param mixed $groupBy The grouping expression.
* @param array<int,string> $groupBy The grouping expression.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand Down Expand Up @@ -743,7 +743,7 @@ public function values(array $values, bool $createNamedParameters = true): Query
* Specifies a restriction over the groups of the query.
* Replaces any previous having restrictions, if any.
*
* @param mixed $having The restriction over the groups.
* @param array<int,string> $having The restriction over the groups.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand All @@ -757,7 +757,7 @@ public function having(...$having): QueryBuilder
* Adds a restriction over the groups of the query, forming a logical
* conjunction with any existing having restrictions.
*
* @param mixed $having The restriction to append.
* @param array<int,string> $having The restriction to append.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand All @@ -772,7 +772,7 @@ public function andHaving(...$having): QueryBuilder
* Adds a restriction over the groups of the query, forming a logical
* disjunction with any existing having restrictions.
*
* @param mixed $having The restriction to add.
* @param array<int,string> $having The restriction to add.
*
* @return QueryBuilder This QueryBuilder instance.
*/
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Database/QueryView.php
Expand Up @@ -254,7 +254,7 @@ public function saveQueryInAction($uid)
}
// Show query
if ($saveArr['queryTable']) {
/** @var $queryGenerator \TYPO3\CMS\Core\Database\QueryGenerator */
/** @var \TYPO3\CMS\Core\Database\QueryGenerator $queryGenerator */
$queryGenerator = GeneralUtility::makeInstance(QueryGenerator::class);
$queryGenerator->init('queryConfig', $saveArr['queryTable']);
$queryGenerator->makeSelectorTable($saveArr);
Expand Down
Expand Up @@ -28,7 +28,7 @@ class EnvVarProcessor implements EnvVarProcessorInterface
* @param string $name The name of the variable within the namespace
* @param \Closure $getEnv A closure that allows fetching more env vars
* @return mixed
* @throws RuntimeException on error
* @throws \RuntimeException on error
*/
public function getEnv($prefix, $name, \Closure $getEnv)
{
Expand Down
Expand Up @@ -67,7 +67,7 @@ private function __construct()
* @param string $classNameOrType Name of a form protection class, or one
* of the pre-defined form protection types:
* frontend, backend, installtool
* @param array|mixed[] $constructorArguments Arguments for the class-constructor
* @param array<int,mixed> $constructorArguments Arguments for the class-constructor
* @return \TYPO3\CMS\Core\FormProtection\AbstractFormProtection the requested instance
*/
public static function get($classNameOrType = 'default', ...$constructorArguments)
Expand Down Expand Up @@ -179,7 +179,7 @@ public static function getMessageClosure(LanguageService $languageService, Flash
* and stores it internally.
*
* @param string $className
* @param array|mixed[] $constructorArguments
* @param array<int,mixed> $constructorArguments
* @throws \InvalidArgumentException
* @return AbstractFormProtection
*/
Expand Down
2 changes: 1 addition & 1 deletion typo3/sysext/core/Classes/Http/MiddlewareStackResolver.php
Expand Up @@ -99,7 +99,7 @@ protected function loadConfiguration(): ArrayObject
/**
* Order each stack and sanitize to a plain array
*
* @param ArrayObject
* @param ArrayObject $allMiddlewares
* @return array
*/
protected function sanitizeMiddlewares(ArrayObject $allMiddlewares): array
Expand Down

0 comments on commit b8feea3

Please sign in to comment.