Skip to content

Commit 8a6c93a

Browse files
committed
[PHP 8.5] replace WrapFuncCallWithPhpVersionIdCheckerRector with RemoveFuncCallRector removal
1 parent 7f05799 commit 8a6c93a

File tree

12 files changed

+6
-332
lines changed

12 files changed

+6
-332
lines changed

config/set/php85.php

Lines changed: 5 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -19,6 +19,7 @@
1919
use Rector\Php85\Rector\ShellExec\ShellExecFunctionCallOverBackticksRector;
2020
use Rector\Php85\Rector\Switch_\ColonAfterSwitchCaseRector;
2121
use Rector\Removing\Rector\FuncCall\RemoveFuncCallArgRector;
22+
use Rector\Removing\Rector\FuncCall\RemoveFuncCallRector;
2223
use Rector\Removing\ValueObject\RemoveFuncCallArg;
2324
use Rector\Renaming\Rector\Cast\RenameCastRector;
2425
use Rector\Renaming\Rector\ClassConstFetch\RenameClassConstFetchRector;
@@ -28,8 +29,6 @@
2829
use Rector\Renaming\ValueObject\MethodCallRename;
2930
use Rector\Renaming\ValueObject\RenameCast;
3031
use Rector\Renaming\ValueObject\RenameClassAndConstFetch;
31-
use Rector\Transform\Rector\FuncCall\WrapFuncCallWithPhpVersionIdCheckerRector;
32-
use Rector\Transform\ValueObject\WrapFuncCallWithPhpVersionIdChecker;
3332

3433
return static function (RectorConfig $rectorConfig): void {
3534
$rectorConfig->rules(
@@ -199,16 +198,10 @@
199198
);
200199

201200
// https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_no-op_functions_from_the_resource_to_object_conversion
202-
$rectorConfig->ruleWithConfiguration(
203-
WrapFuncCallWithPhpVersionIdCheckerRector::class,
204-
[
205-
new WrapFuncCallWithPhpVersionIdChecker('curl_close', 80500),
206-
new WrapFuncCallWithPhpVersionIdChecker('curl_share_close', 80500),
207-
new WrapFuncCallWithPhpVersionIdChecker('finfo_close', 80500),
208-
new WrapFuncCallWithPhpVersionIdChecker('imagedestroy', 80500),
209-
new WrapFuncCallWithPhpVersionIdChecker('xml_parser_free', 80500),
210-
]
211-
);
201+
// these function have no effect when use
202+
$rectorConfig->ruleWithConfiguration(RemoveFuncCallRector::class, [
203+
'curl_close', 'curl_share_close', 'finfo_close', 'imagedestroy', 'xml_parser_free',
204+
]);
212205

213206
// https://wiki.php.net/rfc/deprecations_php_8_5#deprecate_filter_default_constant
214207
$rectorConfig->ruleWithConfiguration(RenameConstantRector::class, [

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/different_function.php.inc

Lines changed: 0 additions & 8 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/skip_already_if_version_check.php.inc

Lines changed: 0 additions & 12 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/skip_already_if_version_check_with_function_exists.php.inc

Lines changed: 0 additions & 12 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/skip_func_call_in_assignment.php.inc

Lines changed: 0 additions & 7 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/skip_func_call_in_condition.php.inc

Lines changed: 0 additions & 9 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/Fixture/wrapped_function.php.inc

Lines changed: 0 additions & 21 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/WrapFuncCallWithPhpVersionIdCheckerRectorTest.php

Lines changed: 0 additions & 28 deletions
This file was deleted.

rules-tests/Transform/Rector/FuncCall/WrapFuncCallWithPhpVersionIdCheckerRector/config/configured_rule.php

Lines changed: 0 additions & 13 deletions
This file was deleted.

rules/Removing/Rector/FuncCall/RemoveFuncCallRector.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ final class RemoveFuncCallRector extends AbstractRector implements ConfigurableR
2626

2727
public function getRuleDefinition(): RuleDefinition
2828
{
29-
return new RuleDefinition('Remove function', [
29+
return new RuleDefinition('Remove defined function calls', [
3030
new ConfiguredCodeSample(
3131
<<<'CODE_SAMPLE'
3232
$x = 'something';

0 commit comments

Comments
 (0)