diff --git a/rector.php b/rector.php
index 5cbf3b6dbdea..42628dda9c34 100644
--- a/rector.php
+++ b/rector.php
@@ -14,6 +14,7 @@
use Rector\Core\ValueObject\PhpVersion;
use Rector\DeadCode\Rector\Concat\RemoveConcatAutocastRector;
use Rector\DeadCode\Rector\Foreach_\RemoveUnusedForeachKeyRector;
+use Rector\DeadCode\Rector\MethodCall\RemoveDefaultArgumentValueRector;
use Rector\DeadCode\Rector\Switch_\RemoveDuplicatedCaseInSwitchRector;
use Rector\EarlyReturn\Rector\Foreach_\ChangeNestedForeachIfsToEarlyContinueRector;
use Rector\EarlyReturn\Rector\If_\ChangeIfElseValueAssignToEarlyReturnRector;
@@ -73,4 +74,5 @@
$services->set(SimplifyIfElseToTernaryRector::class);
$services->set(UnusedForeachValueToArrayKeysRector::class);
$services->set(RemoveConcatAutocastRector::class);
+ $services->set(RemoveDefaultArgumentValueRector::class);
};
diff --git a/system/Encryption/Handlers/SodiumHandler.php b/system/Encryption/Handlers/SodiumHandler.php
index 01645c124b62..49b49f51c5cf 100644
--- a/system/Encryption/Handlers/SodiumHandler.php
+++ b/system/Encryption/Handlers/SodiumHandler.php
@@ -87,7 +87,7 @@ public function decrypt($data, $params = null)
// Extract info from encrypted data
$nonce = self::substr($data, 0, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
- $ciphertext = self::substr($data, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES, null);
+ $ciphertext = self::substr($data, SODIUM_CRYPTO_SECRETBOX_NONCEBYTES);
// decrypt data
$data = sodium_crypto_secretbox_open($ciphertext, $nonce, $this->key);
diff --git a/system/Entity.php b/system/Entity.php
index 52b986a9f175..c0ac3dbd9a03 100644
--- a/system/Entity.php
+++ b/system/Entity.php
@@ -352,7 +352,7 @@ public function __get(string $key)
// Or cast it as something?
elseif ($this->_cast)
{
- $result = $this->castAs($result, $key, 'get');
+ $result = $this->castAs($result, $key);
}
return $result;
diff --git a/tests/system/CommonFunctionsTest.php b/tests/system/CommonFunctionsTest.php
index 984e3deb72ff..a8e4d3b0abaf 100644
--- a/tests/system/CommonFunctionsTest.php
+++ b/tests/system/CommonFunctionsTest.php
@@ -127,7 +127,7 @@ public function testView()
'bar' => 'baz',
];
$expected = '
bar
';
- $this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple', $data, []));
+ $this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple', $data));
}
public function testViewSavedData()
diff --git a/tests/system/Database/Live/SQLite/AlterTableTest.php b/tests/system/Database/Live/SQLite/AlterTableTest.php
index 7a771d933711..8d8f5387329e 100644
--- a/tests/system/Database/Live/SQLite/AlterTableTest.php
+++ b/tests/system/Database/Live/SQLite/AlterTableTest.php
@@ -72,7 +72,7 @@ public function testFromTableThrowsOnNoTable()
public function testFromTableFillsDetails()
{
- $this->createTable('foo');
+ $this->createTable();
$this->assertTrue($this->db->tableExists('foo'));
@@ -109,7 +109,7 @@ public function testFromTableFillsDetails()
public function testDropColumnSuccess()
{
- $this->createTable('foo');
+ $this->createTable();
$result = $this->table
->fromTable('foo')
@@ -127,7 +127,7 @@ public function testDropColumnSuccess()
public function testDropColumnMaintainsKeys()
{
- $this->createTable('foo');
+ $this->createTable();
$oldKeys = $this->db->getIndexData('foo');
@@ -190,7 +190,7 @@ public function testDropForeignKeySuccess()
public function testProcessCopiesOldData()
{
- $this->createTable('foo');
+ $this->createTable();
$this->db->table('foo_fk')->insert([
'id' => 1,
diff --git a/tests/system/HTTP/CURLRequestTest.php b/tests/system/HTTP/CURLRequestTest.php
index 50338be2297a..e1ccd5fb2f43 100644
--- a/tests/system/HTTP/CURLRequestTest.php
+++ b/tests/system/HTTP/CURLRequestTest.php
@@ -163,7 +163,7 @@ public function testOptionsHeaders()
'base_uri' => 'http://www.foo.com/api/v1/',
'headers' => ['fruit' => 'apple'],
];
- $request = $this->getRequest([]);
+ $request = $this->getRequest();
$this->assertNull($request->header('fruit'));
$request = $this->getRequest($options);
@@ -227,7 +227,7 @@ public function testOptionsDelay()
'delay' => 2000,
'headers' => ['fruit' => 'apple'],
];
- $request = $this->getRequest([]);
+ $request = $this->getRequest();
$this->assertEquals(0.0, $request->getDelay());
$request = $this->getRequest($options);
diff --git a/tests/system/Helpers/FormHelperTest.php b/tests/system/Helpers/FormHelperTest.php
index c6396d9f8db3..7307f338aca8 100644
--- a/tests/system/Helpers/FormHelperTest.php
+++ b/tests/system/Helpers/FormHelperTest.php
@@ -453,7 +453,7 @@ public function testFormDropdownUnselected()
\n
EOH;
- $this->assertEquals($expected, form_dropdown('cars', $options, []));
+ $this->assertEquals($expected, form_dropdown('cars', $options));
}
public function testFormDropdownInferred()
@@ -481,7 +481,7 @@ public function testFormDropdownInferred()
\n
EOH;
$_POST['cars'] = 'audi';
- $this->assertEquals($expected, form_dropdown('cars', $options, []));
+ $this->assertEquals($expected, form_dropdown('cars', $options));
unset($_POST['cars']);
}
@@ -574,10 +574,13 @@ public function testFormMultiselectArrayData()
'xlarge' => 'Extra Large Shirt',
];
- $data = [
- 'name' => 'shirts[]',
- 'options' => $options,
- 'selected' => ['med', 'large'],
+ $data = [
+ 'name' => 'shirts[]',
+ 'options' => $options,
+ 'selected' => [
+ 'med',
+ 'large',
+ ],
];
$this->assertEquals($expected, form_multiselect($data));
diff --git a/tests/system/View/ParserFilterTest.php b/tests/system/View/ParserFilterTest.php
index c38f4b2d8b10..47ec31fc2ca3 100644
--- a/tests/system/View/ParserFilterTest.php
+++ b/tests/system/View/ParserFilterTest.php
@@ -125,7 +125,7 @@ public function testEsc()
{
$parser = new Parser($this->config, $this->viewsDir, $this->loader);
- $value1 = esc('