From 9fc8256ffcbf286380f538dddc09710cd5df634a Mon Sep 17 00:00:00 2001 From: Abdul Malik Ikhsan Date: Fri, 19 Mar 2021 19:40:10 +0700 Subject: [PATCH] [Rector] Apply Rector: RemoveUnusedPrivateMethodRector --- composer.json | 3 ++- rector.php | 3 +++ system/Entity.php | 16 ---------------- 3 files changed, 5 insertions(+), 17 deletions(-) diff --git a/composer.json b/composer.json index 77ced90db322..e229501f346d 100644 --- a/composer.json +++ b/composer.json @@ -22,7 +22,8 @@ "phpunit/phpunit": "^9.1", "predis/predis": "^1.1", "rector/rector": "^0.9", - "squizlabs/php_codesniffer": "^3.3" + "squizlabs/php_codesniffer": "^3.3", + "symplify/rule-doc-generator": "9.2.11" }, "suggest": { "ext-fileinfo": "Improves mime type detection for files" diff --git a/rector.php b/rector.php index d3eee90f6a1e..788c52078d35 100644 --- a/rector.php +++ b/rector.php @@ -12,6 +12,7 @@ use Rector\CodingStyle\Rector\FuncCall\CountArrayToEmptyArrayComparisonRector; use Rector\Core\Configuration\Option; use Rector\Core\ValueObject\PhpVersion; +use Rector\DeadCode\Rector\ClassMethod\RemoveUnusedPrivateMethodRector; use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector; use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector; use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector; @@ -38,6 +39,7 @@ __DIR__ . '/tests/system/Models', __DIR__ . '/tests/_support', PassStrictParameterToFunctionParameterRector::class => [__DIR__ . '/tests/system/Database/Live/SelectTest.php'], + RemoveUnusedPrivateMethodRector::class => [__DIR__ . '/tests/system/Test/ReflectionHelperTest.php'], ]); // Rector relies on autoload setup of your project; Composer autoload is included by default; to add more: @@ -72,4 +74,5 @@ $services->set(RemoveUnusedForeachKeyRector::class); $services->set(SimplifyIfElseToTernaryRector::class); $services->set(UnusedForeachValueToArrayKeysRector::class); + $services->set(RemoveUnusedPrivateMethodRector::class); }; diff --git a/system/Entity.php b/system/Entity.php index 52b986a9f175..b04c2ac3c27a 100644 --- a/system/Entity.php +++ b/system/Entity.php @@ -577,22 +577,6 @@ protected function castAs($value, string $attribute, string $method = 'get') return $handlers[$type]::$method($value, $params); } - //-------------------------------------------------------------------- - - /** - * Cast as JSON - * - * @param mixed $value - * @param boolean $asArray - * - * @return mixed - * @throws CastException - */ - private function castAsJson($value, bool $asArray = false) - { - return CastAsJson::get($value, $asArray ? ['array'] : []); - } - /** * Support for json_encode() *