Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

[Rector] Apply RemoveDefaultArgumentValueRector #4543

Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 2 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down Expand Up @@ -73,4 +74,5 @@
$services->set(SimplifyIfElseToTernaryRector::class);
$services->set(UnusedForeachValueToArrayKeysRector::class);
$services->set(RemoveConcatAutocastRector::class);
$services->set(RemoveDefaultArgumentValueRector::class);
};
2 changes: 1 addition & 1 deletion system/Encryption/Handlers/SodiumHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 1 addition & 1 deletion system/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down
2 changes: 1 addition & 1 deletion tests/system/CommonFunctionsTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -127,7 +127,7 @@ public function testView()
'bar' => 'baz',
];
$expected = '<h1>bar</h1>';
$this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple', $data, []));
$this->assertStringContainsString($expected, view('\Tests\Support\View\Views\simple', $data));
}

public function testViewSavedData()
Expand Down
8 changes: 4 additions & 4 deletions tests/system/Database/Live/SQLite/AlterTableTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,7 +72,7 @@ public function testFromTableThrowsOnNoTable()

public function testFromTableFillsDetails()
{
$this->createTable('foo');
$this->createTable();

$this->assertTrue($this->db->tableExists('foo'));

Expand Down Expand Up @@ -109,7 +109,7 @@ public function testFromTableFillsDetails()

public function testDropColumnSuccess()
{
$this->createTable('foo');
$this->createTable();

$result = $this->table
->fromTable('foo')
Expand All @@ -127,7 +127,7 @@ public function testDropColumnSuccess()

public function testDropColumnMaintainsKeys()
{
$this->createTable('foo');
$this->createTable();

$oldKeys = $this->db->getIndexData('foo');

Expand Down Expand Up @@ -190,7 +190,7 @@ public function testDropForeignKeySuccess()

public function testProcessCopiesOldData()
{
$this->createTable('foo');
$this->createTable();

$this->db->table('foo_fk')->insert([
'id' => 1,
Expand Down
4 changes: 2 additions & 2 deletions tests/system/HTTP/CURLRequestTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down Expand Up @@ -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);
Expand Down
15 changes: 9 additions & 6 deletions tests/system/Helpers/FormHelperTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -453,7 +453,7 @@ public function testFormDropdownUnselected()
</optgroup>
</select>\n
EOH;
$this->assertEquals($expected, form_dropdown('cars', $options, []));
$this->assertEquals($expected, form_dropdown('cars', $options));
}

public function testFormDropdownInferred()
Expand Down Expand Up @@ -481,7 +481,7 @@ public function testFormDropdownInferred()
</select>\n
EOH;
$_POST['cars'] = 'audi';
$this->assertEquals($expected, form_dropdown('cars', $options, []));
$this->assertEquals($expected, form_dropdown('cars', $options));
unset($_POST['cars']);
}

Expand Down Expand Up @@ -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));
Expand Down
2 changes: 1 addition & 1 deletion tests/system/View/ParserFilterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function testEsc()
{
$parser = new Parser($this->config, $this->viewsDir, $this->loader);

$value1 = esc('<script>', 'html');
$value1 = esc('<script>');
$value2 = esc('<script>', 'js');

$data = [
Expand Down
2 changes: 1 addition & 1 deletion tests/system/View/ParserTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -419,7 +419,7 @@ public function testEscHandling($value, $expected = null)
{
$expected = $value;
}
$this->assertEquals($expected, \esc($value, 'html'));
$this->assertEquals($expected, \esc($value));
}

//------------------------------------------------------------------------
Expand Down