Skip to content

Commit

Permalink
phpstan (#2006)
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Apr 4, 2022
1 parent 38add40 commit 258f2d0
Show file tree
Hide file tree
Showing 5 changed files with 44 additions and 36 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -56,10 +56,6 @@ public function resolve(Node $node): Type
return $types[0];
}

if (count($types) > 1) {
return new UnionType($types);
}

return new MixedType();
return new UnionType($types);
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\DependencyInjection\ContainerBuilder;

function argumentDefalutValue()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')
->setScope(ContainerBuilder::SCOPE_PROTOTYPE);
class Fixture {
function argumentDefalutValue()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')
->setScope(ContainerBuilder::SCOPE_PROTOTYPE);
}
}

?>
Expand All @@ -19,11 +21,13 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\DependencyInjection\ContainerBuilder;

function argumentDefalutValue()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')
->setScope(false);
class Fixture {
function argumentDefalutValue()
{
$container = new ContainerBuilder();
$container->register('foo', 'stdClass')
->setScope(false);
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,14 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\Yaml\Yaml;

function argumentDefaultValue2()
{
Yaml::parse('...', true);
Yaml::parse('...', false);
Yaml::parse('...', false, true);
Yaml::parse('...', false, false, true);
class Fixture2 {
function argumentDefaultValue2()
{
Yaml::parse('...', true);
Yaml::parse('...', false);
Yaml::parse('...', false, true);
Yaml::parse('...', false, false, true);
}
}

?>
Expand All @@ -20,12 +22,14 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\Yaml\Yaml;

function argumentDefaultValue2()
{
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
Yaml::parse('...', 0);
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_OBJECT);
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP);
class Fixture2 {
function argumentDefaultValue2()
{
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_EXCEPTION_ON_INVALID_TYPE);
Yaml::parse('...', 0);
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_OBJECT);
Yaml::parse('...', \Symfony\Component\Yaml\Yaml::PARSE_OBJECT_FOR_MAP);
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -4,11 +4,13 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\Yaml\Yaml;

function argumentDefaultValue3()
{
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);
class Fixture3 {
function argumentDefaultValue3()
{
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, true);

Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, false, true);
}
}

?>
Expand All @@ -19,11 +21,13 @@ namespace Rector\Tests\Arguments\Rector\ClassMethod\ReplaceArgumentDefaultValueR

use Symfony\Component\Yaml\Yaml;

function argumentDefaultValue3()
{
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);
class Fixture3 {
function argumentDefaultValue3()
{
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_EXCEPTION_ON_INVALID_TYPE);

Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_OBJECT);
Yaml::dump(array('foo' => new A(), 'bar' => 1), 0, 0, \Symfony\Component\Yaml\Yaml::DUMP_OBJECT);
}
}

?>
Original file line number Diff line number Diff line change
Expand Up @@ -123,6 +123,6 @@ private function resolveMaximumAllowedParameterCount(
$parameterCounts[] = count($parametersAcceptor->getParameters());
}

return (int) max($parameterCounts);
return max($parameterCounts);
}
}

0 comments on commit 258f2d0

Please sign in to comment.