Skip to content

Commit

Permalink
ArgumentRemoverRectorTest: replace symfony\yaml reference with dummy (#…
Browse files Browse the repository at this point in the history
…5799)

* ArgumentRemoverRectorTest: replace symfony\yaml reference with dummy

* Keep PARSE_KEYS_AS_STRINGS reference
  • Loading branch information
janedbal authored Apr 3, 2024
1 parent a43f371 commit 8e022d1
Show file tree
Hide file tree
Showing 3 changed files with 34 additions and 21 deletions.
Original file line number Diff line number Diff line change
@@ -1,49 +1,49 @@
<?php

use Symfony\Component\Yaml\Yaml;
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\Yaml;

function argumentRemover()
{
$yaml = [];

Symfony\Component\Yaml\Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS);
Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS);

Symfony\Component\Yaml\Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS);

Symfony\Component\Yaml\Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_CONSTANT);
Yaml::parse($yaml, Yaml::KEPT_CONSTANT);

Yaml::parse($yaml, Yaml::PARSE_KEYS_AS_STRINGS);
Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_KEYS_AS_STRINGS);

Symfony\Component\Yaml\Yaml::parse($yaml, 55);
Symfony\Component\Yaml\Yaml::parse($yaml, 56);
Symfony\Component\Yaml\Yaml::parse($yaml, 'hey');
Symfony\Component\Yaml\Yaml::parse($yaml, 'hi');
Symfony\Component\Yaml\Yaml::parse($yaml, 5.5);
Yaml::parse($yaml, 55);
Yaml::parse($yaml, 56);
Yaml::parse($yaml, 'hey');
Yaml::parse($yaml, 'hi');
Yaml::parse($yaml, 5.5);
}

?>
-----
<?php

use Symfony\Component\Yaml\Yaml;
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\Yaml;

function argumentRemover()
{
$yaml = [];

Symfony\Component\Yaml\Yaml::parse($yaml);
Yaml::parse($yaml);

Symfony\Component\Yaml\Yaml::parse($yaml);
Yaml::parse($yaml);

Symfony\Component\Yaml\Yaml::parse($yaml, Symfony\Component\Yaml\Yaml::PARSE_CONSTANT);
Yaml::parse($yaml, Yaml::KEPT_CONSTANT);

Yaml::parse($yaml);

Symfony\Component\Yaml\Yaml::parse($yaml);
Symfony\Component\Yaml\Yaml::parse($yaml, 56);
Symfony\Component\Yaml\Yaml::parse($yaml);
Symfony\Component\Yaml\Yaml::parse($yaml, 'hi');
Symfony\Component\Yaml\Yaml::parse($yaml);
Yaml::parse($yaml);
Yaml::parse($yaml, 56);
Yaml::parse($yaml);
Yaml::parse($yaml, 'hi');
Yaml::parse($yaml);
}

?>
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

declare(strict_types=1);

namespace Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source;

class Yaml
{
public const KEPT_CONSTANT = 2;

public static function parse($input, $flags) {}
}
Original file line number Diff line number Diff line change
Expand Up @@ -7,12 +7,13 @@
use Rector\Removing\ValueObject\ArgumentRemover;
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\Persister;
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\RemoveInTheMiddle;
use Symfony\Component\Yaml\Yaml;
use Rector\Tests\Removing\Rector\ClassMethod\ArgumentRemoverRector\Source\Yaml;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig
->ruleWithConfiguration(ArgumentRemoverRector::class, [
new ArgumentRemover(Persister::class, 'getSelectJoinColumnSQL', 4, null), new ArgumentRemover(
new ArgumentRemover(Persister::class, 'getSelectJoinColumnSQL', 4, null),
new ArgumentRemover(
Yaml::class,
'parse',
1,
Expand Down

0 comments on commit 8e022d1

Please sign in to comment.