mirror of
https://github.com/rectorphp/rector.git
synced 2025-01-17 13:28:18 +01:00
Updated Rector to commit 9a0d03a293b3a6aef9fb2c134c27586e2f046043
9a0d03a293
[Php74] Add RestoreIncludePathToIniRestoreRector (#5973)
This commit is contained in:
parent
b9449048ac
commit
f57ed0a59b
@ -12,6 +12,7 @@ use Rector\Php74\Rector\FuncCall\ArrayKeyExistsOnPropertyRector;
|
||||
use Rector\Php74\Rector\FuncCall\FilterVarToAddSlashesRector;
|
||||
use Rector\Php74\Rector\FuncCall\MbStrrposEncodingArgumentPositionRector;
|
||||
use Rector\Php74\Rector\FuncCall\MoneyFormatToNumberFormatRector;
|
||||
use Rector\Php74\Rector\FuncCall\RestoreIncludePathToIniRestoreRector;
|
||||
use Rector\Php74\Rector\Property\RestoreDefaultNullToNullableTypePropertyRector;
|
||||
use Rector\Php74\Rector\StaticCall\ExportToReflectionFunctionRector;
|
||||
use Rector\Php74\Rector\Ternary\ParenthesizeNestedTernaryRector;
|
||||
@ -22,5 +23,5 @@ return static function (RectorConfig $rectorConfig) : void {
|
||||
# https://wiki.php.net/rfc/deprecations_php_7_4
|
||||
'is_real' => 'is_float',
|
||||
]);
|
||||
$rectorConfig->rules([ArrayKeyExistsOnPropertyRector::class, FilterVarToAddSlashesRector::class, ExportToReflectionFunctionRector::class, MbStrrposEncodingArgumentPositionRector::class, RealToFloatTypeCastRector::class, NullCoalescingOperatorRector::class, ClosureToArrowFunctionRector::class, RestoreDefaultNullToNullableTypePropertyRector::class, CurlyToSquareBracketArrayStringRector::class, MoneyFormatToNumberFormatRector::class, ParenthesizeNestedTernaryRector::class]);
|
||||
$rectorConfig->rules([ArrayKeyExistsOnPropertyRector::class, FilterVarToAddSlashesRector::class, ExportToReflectionFunctionRector::class, MbStrrposEncodingArgumentPositionRector::class, RealToFloatTypeCastRector::class, NullCoalescingOperatorRector::class, ClosureToArrowFunctionRector::class, RestoreDefaultNullToNullableTypePropertyRector::class, CurlyToSquareBracketArrayStringRector::class, MoneyFormatToNumberFormatRector::class, ParenthesizeNestedTernaryRector::class, RestoreIncludePathToIniRestoreRector::class]);
|
||||
};
|
||||
|
@ -1,4 +1,4 @@
|
||||
# 380 Rules Overview
|
||||
# 381 Rules Overview
|
||||
|
||||
<br>
|
||||
|
||||
@ -38,7 +38,7 @@
|
||||
|
||||
- [Php73](#php73) (9)
|
||||
|
||||
- [Php74](#php74) (12)
|
||||
- [Php74](#php74) (13)
|
||||
|
||||
- [Php80](#php80) (16)
|
||||
|
||||
@ -4820,6 +4820,19 @@ Add null default to properties with PHP 7.4 property nullable type
|
||||
|
||||
<br>
|
||||
|
||||
### RestoreIncludePathToIniRestoreRector
|
||||
|
||||
Change `restore_include_path()` to ini_restore("include_path")
|
||||
|
||||
- class: [`Rector\Php74\Rector\FuncCall\RestoreIncludePathToIniRestoreRector`](../rules/Php74/Rector/FuncCall/RestoreIncludePathToIniRestoreRector.php)
|
||||
|
||||
```diff
|
||||
-restore_include_path();
|
||||
+ini_restore('include_path');
|
||||
```
|
||||
|
||||
<br>
|
||||
|
||||
## Php80
|
||||
|
||||
### AddParamBasedOnParentClassMethodRector
|
||||
|
@ -0,0 +1,59 @@
|
||||
<?php
|
||||
|
||||
declare (strict_types=1);
|
||||
namespace Rector\Php74\Rector\FuncCall;
|
||||
|
||||
use PhpParser\Node;
|
||||
use PhpParser\Node\Arg;
|
||||
use PhpParser\Node\Expr\FuncCall;
|
||||
use PhpParser\Node\Name;
|
||||
use PhpParser\Node\Scalar\String_;
|
||||
use Rector\Rector\AbstractRector;
|
||||
use Rector\ValueObject\PhpVersionFeature;
|
||||
use Rector\VersionBonding\Contract\MinPhpVersionInterface;
|
||||
use Symplify\RuleDocGenerator\ValueObject\CodeSample\CodeSample;
|
||||
use Symplify\RuleDocGenerator\ValueObject\RuleDefinition;
|
||||
/**
|
||||
* @changelog https://www.php.net/manual/en/migration74.deprecated.php#migration74.deprecated.core.restore-include-path
|
||||
* @see https://3v4l.org/Kcs98
|
||||
* @see \Rector\Tests\Php74\Rector\FuncCall\RestoreIncludePathToIniRestoreRector\RestoreIncludePathToIniRestoreRectorTest
|
||||
*/
|
||||
final class RestoreIncludePathToIniRestoreRector extends AbstractRector implements MinPhpVersionInterface
|
||||
{
|
||||
public function provideMinPhpVersion() : int
|
||||
{
|
||||
return PhpVersionFeature::DEPRECATE_RESTORE_INCLUDE_PATH;
|
||||
}
|
||||
public function getRuleDefinition() : RuleDefinition
|
||||
{
|
||||
return new RuleDefinition('Change restore_include_path() to ini_restore("include_path")', [new CodeSample(<<<'CODE_SAMPLE'
|
||||
restore_include_path();
|
||||
CODE_SAMPLE
|
||||
, <<<'CODE_SAMPLE'
|
||||
ini_restore('include_path');
|
||||
CODE_SAMPLE
|
||||
)]);
|
||||
}
|
||||
/**
|
||||
* @return array<class-string<Node>>
|
||||
*/
|
||||
public function getNodeTypes() : array
|
||||
{
|
||||
return [FuncCall::class];
|
||||
}
|
||||
/**
|
||||
* @param FuncCall $node
|
||||
*/
|
||||
public function refactor(Node $node) : ?FuncCall
|
||||
{
|
||||
if (!$this->isName($node, 'restore_include_path')) {
|
||||
return null;
|
||||
}
|
||||
if ($node->isFirstClassCallable()) {
|
||||
return null;
|
||||
}
|
||||
$node->name = new Name('ini_restore');
|
||||
$node->args[0] = new Arg(new String_('include_path'));
|
||||
return $node;
|
||||
}
|
||||
}
|
@ -19,12 +19,12 @@ final class VersionResolver
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const PACKAGE_VERSION = '2741d3cf54674f78b729c9e65fea1cc1d8cc3376';
|
||||
public const PACKAGE_VERSION = '9a0d03a293b3a6aef9fb2c134c27586e2f046043';
|
||||
/**
|
||||
* @api
|
||||
* @var string
|
||||
*/
|
||||
public const RELEASE_DATE = '2024-06-15 06:59:16';
|
||||
public const RELEASE_DATE = '2024-06-16 07:09:11';
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
@ -333,6 +333,10 @@ final class PhpVersionFeature
|
||||
* @var int
|
||||
*/
|
||||
public const DEPRECATE_NESTED_TERNARY = \Rector\ValueObject\PhpVersion::PHP_74;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
public const DEPRECATE_RESTORE_INCLUDE_PATH = \Rector\ValueObject\PhpVersion::PHP_74;
|
||||
/**
|
||||
* @var int
|
||||
*/
|
||||
|
1
vendor/composer/autoload_classmap.php
vendored
1
vendor/composer/autoload_classmap.php
vendored
@ -1868,6 +1868,7 @@ return array(
|
||||
'Rector\\Php74\\Rector\\FuncCall\\FilterVarToAddSlashesRector' => $baseDir . '/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\MbStrrposEncodingArgumentPositionRector' => $baseDir . '/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\MoneyFormatToNumberFormatRector' => $baseDir . '/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\RestoreIncludePathToIniRestoreRector' => $baseDir . '/rules/Php74/Rector/FuncCall/RestoreIncludePathToIniRestoreRector.php',
|
||||
'Rector\\Php74\\Rector\\LNumber\\AddLiteralSeparatorToNumberRector' => $baseDir . '/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php',
|
||||
'Rector\\Php74\\Rector\\Property\\RestoreDefaultNullToNullableTypePropertyRector' => $baseDir . '/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php',
|
||||
'Rector\\Php74\\Rector\\StaticCall\\ExportToReflectionFunctionRector' => $baseDir . '/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php',
|
||||
|
1
vendor/composer/autoload_static.php
vendored
1
vendor/composer/autoload_static.php
vendored
@ -2087,6 +2087,7 @@ class ComposerStaticInit617a88c9745824dcc98208775208cc4b
|
||||
'Rector\\Php74\\Rector\\FuncCall\\FilterVarToAddSlashesRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/FuncCall/FilterVarToAddSlashesRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\MbStrrposEncodingArgumentPositionRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/FuncCall/MbStrrposEncodingArgumentPositionRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\MoneyFormatToNumberFormatRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/FuncCall/MoneyFormatToNumberFormatRector.php',
|
||||
'Rector\\Php74\\Rector\\FuncCall\\RestoreIncludePathToIniRestoreRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/FuncCall/RestoreIncludePathToIniRestoreRector.php',
|
||||
'Rector\\Php74\\Rector\\LNumber\\AddLiteralSeparatorToNumberRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/LNumber/AddLiteralSeparatorToNumberRector.php',
|
||||
'Rector\\Php74\\Rector\\Property\\RestoreDefaultNullToNullableTypePropertyRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/Property/RestoreDefaultNullToNullableTypePropertyRector.php',
|
||||
'Rector\\Php74\\Rector\\StaticCall\\ExportToReflectionFunctionRector' => __DIR__ . '/../..' . '/rules/Php74/Rector/StaticCall/ExportToReflectionFunctionRector.php',
|
||||
|
Loading…
x
Reference in New Issue
Block a user