Skip to content

Commit

Permalink
[FEATURE] Add PARAM_* from Connection class (#4172)
Browse files Browse the repository at this point in the history
Resolves: #4148
  • Loading branch information
sabbelasichon authored Mar 8, 2024
1 parent b707d2e commit 6d9421f
Show file tree
Hide file tree
Showing 4 changed files with 26 additions and 36 deletions.
12 changes: 6 additions & 6 deletions config/v12/typo3-120.php
Original file line number Diff line number Diff line change
Expand Up @@ -142,18 +142,18 @@
'TYPO3\CMS\Core\Type\ContextualFeedbackSeverity',
'ERROR'
),
]
);
# https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Important-97809-UpdateTypo3iconsToV3.html
$rectorConfig->ruleWithConfiguration(
RenameClassConstFetchRector::class,
[
# https://docs.typo3.org/c/typo3/cms-core/main/en-us/Changelog/12.0/Important-97809-UpdateTypo3iconsToV3.html
new RenameClassAndConstFetch(
'TYPO3\CMS\Core\Imaging\Icon',
'SIZE_DEFAULT',
'TYPO3\CMS\Core\Imaging\Icon',
'SIZE_MEDIUM'
),
new RenameClassAndConstFetch(\PDO::class, 'PARAM_INT', 'TYPO3\CMS\Core\Database\Connection', 'PARAM_INT'),
new RenameClassAndConstFetch(\PDO::class, 'PARAM_STR', 'TYPO3\CMS\Core\Database\Connection', 'PARAM_STR'),
new RenameClassAndConstFetch(\PDO::class, 'PARAM_NULL', 'TYPO3\CMS\Core\Database\Connection', 'PARAM_NULL'),
new RenameClassAndConstFetch(\PDO::class, 'PARAM_LOB', 'TYPO3\CMS\Core\Database\Connection', 'PARAM_LOB'),
new RenameClassAndConstFetch(\PDO::class, 'PARAM_BOOL', 'TYPO3\CMS\Core\Database\Connection', 'PARAM_BOOL'),
]
);

Expand Down
37 changes: 20 additions & 17 deletions config/v13/strict-types.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
declare(strict_types=1);

use PHPStan\Type\ArrayType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\IntegerType;
use PHPStan\Type\MixedType;
use PHPStan\Type\ObjectType;
use PHPStan\Type\BooleanType;
use PHPStan\Type\StringType;
use PHPStan\Type\TypeCombinator;
use Rector\Config\RectorConfig;
Expand Down Expand Up @@ -157,12 +157,7 @@
0,
new StringType()
),
new AddParamTypeDeclaration(
'TYPO3\CMS\Core\Resource\FileInterface',
'rename',
0,
new StringType()
),
new AddParamTypeDeclaration('TYPO3\CMS\Core\Resource\FileInterface', 'rename', 0, new StringType()),
new AddParamTypeDeclaration(
'TYPO3\CMS\Core\Resource\FileInterface',
'getForLocalProcessing',
Expand All @@ -175,12 +170,7 @@
0,
new StringType()
),
new AddParamTypeDeclaration(
'TYPO3\CMS\Core\Resource\FileInterface',
'getProperty',
0,
new StringType()
)
new AddParamTypeDeclaration('TYPO3\CMS\Core\Resource\FileInterface', 'getProperty', 0, new StringType()),
]
);

Expand All @@ -200,10 +190,23 @@
new AddReturnTypeDeclaration(FileInterface::class, 'getMimeType', new StringType()),
new AddReturnTypeDeclaration(FileInterface::class, 'delete', new BooleanType()),
new AddReturnTypeDeclaration(FileInterface::class, 'isIndexed', new BooleanType()),
new AddReturnTypeDeclaration(FileInterface::class, 'getPublicUrl', TypeCombinator::addNull(new StringType())),
new AddReturnTypeDeclaration(FileInterface::class, 'toArray', new ArrayType(new MixedType(), new MixedType())),
new AddReturnTypeDeclaration(FileInterface::class, 'rename', new ObjectType('TYPO3\CMS\Core\Resource\FileInterface')),
new AddReturnTypeDeclaration(FileInterface::class, 'setContents', new \Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType('TYPO3\CMS\Core\Resource\FileInterface')),
new AddReturnTypeDeclaration(FileInterface::class, 'getPublicUrl', TypeCombinator::addNull(
new StringType()
)),
new AddReturnTypeDeclaration(FileInterface::class, 'toArray', new ArrayType(
new MixedType(),
new MixedType()
)),
new AddReturnTypeDeclaration(FileInterface::class, 'rename', new ObjectType(
'TYPO3\CMS\Core\Resource\FileInterface'
)),
new AddReturnTypeDeclaration(
FileInterface::class,
'setContents',
new \Rector\StaticTypeMapper\ValueObject\Type\SelfObjectType(
'TYPO3\CMS\Core\Resource\FileInterface'
)
),
new AddReturnTypeDeclaration(ResourceInterface::class, 'getIdentifier', new StringType()),
new AddReturnTypeDeclaration(ResourceInterface::class, 'getName', new StringType()),
new AddReturnTypeDeclaration(
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,15 +2,7 @@

declare(strict_types=1);

use PHPStan\Type\BooleanType;
use PHPStan\Type\MixedType;
use PHPStan\Type\StringType;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddParamTypeDeclarationRector;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\TypeDeclaration\ValueObject\AddParamTypeDeclaration;
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
use TYPO3\CMS\Core\Resource\FileInterface;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,7 @@

declare(strict_types=1);

use PHPStan\Type\ObjectType;
use PHPStan\Type\StringType;
use Rector\Config\RectorConfig;
use Rector\TypeDeclaration\Rector\ClassMethod\AddReturnTypeDeclarationRector;
use Rector\TypeDeclaration\ValueObject\AddReturnTypeDeclaration;
use TYPO3\CMS\Core\Resource\ResourceInterface;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->import(__DIR__ . '/../../../../../../config/config.php');
Expand Down

0 comments on commit 6d9421f

Please sign in to comment.