mirror of https://github.com/rectorphp/rector.git
Updated Rector to commit 637d48cd42527577e5c8fc65d8683b47129afa1a
637d48cd42
Remove deprecated ArrayShapeFromConstantArrayReturnRector (#4662)
This commit is contained in:
parent
813a09001a
commit
da5c8d8544
|
@ -52,7 +52,7 @@
|
|||
|
||||
- [Transform](#transform) (22)
|
||||
|
||||
- [TypeDeclaration](#typedeclaration) (45)
|
||||
- [TypeDeclaration](#typedeclaration) (44)
|
||||
|
||||
- [Visibility](#visibility) (3)
|
||||
|
||||
|
@ -7640,27 +7640,6 @@ return static function (RectorConfig $rectorConfig): void {
|
|||
|
||||
<br>
|
||||
|
||||
### ArrayShapeFromConstantArrayReturnRector
|
||||
|
||||
Add array shape exact types based on constant keys of array
|
||||
|
||||
- class: [`Rector\TypeDeclaration\Rector\ClassMethod\ArrayShapeFromConstantArrayReturnRector`](../rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php)
|
||||
|
||||
```diff
|
||||
final class SomeClass
|
||||
{
|
||||
+ /**
|
||||
+ * @return array{name: string}
|
||||
+ */
|
||||
public function run(string $name)
|
||||
{
|
||||
return ['name' => $name];
|
||||
}
|
||||
}
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
### BinaryOpNullableToInstanceofRector
|
||||
|
||||
Change && and || between nullable objects to instanceof compares
|
||||
|
|
|
@ -1,56 +0,0 @@
|
|||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\TypeDeclaration\Rector\ClassMethod;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Stmt\ClassMethod;
|
||||
use PHPStan\Analyser\Scope;
|
||||
use Rector\Core\Rector\AbstractScopeAwareRector;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @deprecated As we're moving from docblock types as unreliable and work only with native type declarations. See https://getrector.com/blog/new-in-rector-015-complete-safe-and-known-type-declarations
|
||||
*/
|
||||
final class ArrayShapeFromConstantArrayReturnRector extends AbstractScopeAwareRector
|
||||
{
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Add array shape exact types based on constant keys of array', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
public function run(string $name)
|
||||
{
|
||||
return ['name' => $name];
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
final class SomeClass
|
||||
{
|
||||
/**
|
||||
* @return array{name: string}
|
||||
*/
|
||||
public function run(string $name)
|
||||
{
|
||||
return ['name' => $name];
|
||||
}
|
||||
}
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [ClassMethod::class];
|
||||
}
|
||||
/**
|
||||
* @param ClassMethod $node
|
||||
*/
|
||||
public function refactorWithScope(Node $node, Scope $scope) : ?Node
|
||||
{
|
||||
return null;
|
||||
}
|
||||
}
|
|
@ -19,12 +19,12 @@ final class VersionResolver
|
|||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '0013604ebd8bf101ca9bd013a56d7e831bcdf51e';
|
||||
public const PACKAGE_VERSION = '637d48cd42527577e5c8fc65d8683b47129afa1a';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2023-08-06 00:32:48';
|
||||
public const RELEASE_DATE = '2023-08-06 00:32:57';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
|
|
@ -22,4 +22,4 @@ if (PHP_VERSION_ID < 50600) {
|
|||
|
||||
require_once __DIR__ . '/composer/autoload_real.php';
|
||||
|
||||
return ComposerAutoloaderInit14fb859f619c3158c7cf565c9a356221::getLoader();
|
||||
return ComposerAutoloaderInit5e1d8c0044421cc4d5b61845878befd6::getLoader();
|
||||
|
|
|
@ -2670,7 +2670,6 @@ return array(
|
|||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddReturnTypeDeclarationBasedOnParentClassMethodRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddReturnTypeDeclarationRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddVoidReturnTypeWhereNoReturnRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ArrayShapeFromConstantArrayReturnRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\BoolReturnTypeFromStrictScalarReturnsRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromStrictScalarReturnsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\NumericReturnTypeFromStrictScalarReturnsRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ParamAnnotationIncorrectNullableRector' => $baseDir . '/rules/TypeDeclaration/Rector/ClassMethod/ParamAnnotationIncorrectNullableRector.php',
|
||||
|
|
|
@ -2,7 +2,7 @@
|
|||
|
||||
// autoload_real.php @generated by Composer
|
||||
|
||||
class ComposerAutoloaderInit14fb859f619c3158c7cf565c9a356221
|
||||
class ComposerAutoloaderInit5e1d8c0044421cc4d5b61845878befd6
|
||||
{
|
||||
private static $loader;
|
||||
|
||||
|
@ -22,17 +22,17 @@ class ComposerAutoloaderInit14fb859f619c3158c7cf565c9a356221
|
|||
return self::$loader;
|
||||
}
|
||||
|
||||
spl_autoload_register(array('ComposerAutoloaderInit14fb859f619c3158c7cf565c9a356221', 'loadClassLoader'), true, true);
|
||||
spl_autoload_register(array('ComposerAutoloaderInit5e1d8c0044421cc4d5b61845878befd6', 'loadClassLoader'), true, true);
|
||||
self::$loader = $loader = new \Composer\Autoload\ClassLoader(\dirname(__DIR__));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit14fb859f619c3158c7cf565c9a356221', 'loadClassLoader'));
|
||||
spl_autoload_unregister(array('ComposerAutoloaderInit5e1d8c0044421cc4d5b61845878befd6', 'loadClassLoader'));
|
||||
|
||||
require __DIR__ . '/autoload_static.php';
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit14fb859f619c3158c7cf565c9a356221::getInitializer($loader));
|
||||
call_user_func(\Composer\Autoload\ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6::getInitializer($loader));
|
||||
|
||||
$loader->setClassMapAuthoritative(true);
|
||||
$loader->register(true);
|
||||
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit14fb859f619c3158c7cf565c9a356221::$files;
|
||||
$filesToLoad = \Composer\Autoload\ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6::$files;
|
||||
$requireFile = \Closure::bind(static function ($fileIdentifier, $file) {
|
||||
if (empty($GLOBALS['__composer_autoload_files'][$fileIdentifier])) {
|
||||
$GLOBALS['__composer_autoload_files'][$fileIdentifier] = true;
|
||||
|
|
|
@ -4,7 +4,7 @@
|
|||
|
||||
namespace Composer\Autoload;
|
||||
|
||||
class ComposerStaticInit14fb859f619c3158c7cf565c9a356221
|
||||
class ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6
|
||||
{
|
||||
public static $files = array (
|
||||
'ad155f8f1cf0d418fe49e248db8c661b' => __DIR__ . '/..' . '/react/promise/src/functions_include.php',
|
||||
|
@ -2924,7 +2924,6 @@ class ComposerStaticInit14fb859f619c3158c7cf565c9a356221
|
|||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddReturnTypeDeclarationBasedOnParentClassMethodRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationBasedOnParentClassMethodRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddReturnTypeDeclarationRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/AddReturnTypeDeclarationRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\AddVoidReturnTypeWhereNoReturnRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/AddVoidReturnTypeWhereNoReturnRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ArrayShapeFromConstantArrayReturnRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ArrayShapeFromConstantArrayReturnRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\BoolReturnTypeFromStrictScalarReturnsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/BoolReturnTypeFromStrictScalarReturnsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\NumericReturnTypeFromStrictScalarReturnsRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/NumericReturnTypeFromStrictScalarReturnsRector.php',
|
||||
'Rector\\TypeDeclaration\\Rector\\ClassMethod\\ParamAnnotationIncorrectNullableRector' => __DIR__ . '/../..' . '/rules/TypeDeclaration/Rector/ClassMethod/ParamAnnotationIncorrectNullableRector.php',
|
||||
|
@ -3014,9 +3013,9 @@ class ComposerStaticInit14fb859f619c3158c7cf565c9a356221
|
|||
public static function getInitializer(ClassLoader $loader)
|
||||
{
|
||||
return \Closure::bind(function () use ($loader) {
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit14fb859f619c3158c7cf565c9a356221::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit14fb859f619c3158c7cf565c9a356221::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit14fb859f619c3158c7cf565c9a356221::$classMap;
|
||||
$loader->prefixLengthsPsr4 = ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6::$prefixLengthsPsr4;
|
||||
$loader->prefixDirsPsr4 = ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6::$prefixDirsPsr4;
|
||||
$loader->classMap = ComposerStaticInit5e1d8c0044421cc4d5b61845878befd6::$classMap;
|
||||
|
||||
}, null, ClassLoader::class);
|
||||
}
|
||||
|
|
Loading…
Reference in New Issue