Skip to content
Draft
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

This file was deleted.

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

namespace Rector\Tests\Php81\Rector\Array_\ArrayToFirstClassCallableRector\Fixture;

final class SkipAsArgValueWithCallerParamTypeArray
{
public function run(array $data)
{
}

public function execute()
{
return $this->run([$this, 'some']);
}

public function some()
{}
}
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

namespace Rector\Tests\Php81\Rector\Array_\ArrayToFirstClassCallableRector\Fixture;

use Rector\Tests\CodeQuality\Rector\Identical\FlipTypeControlToUseExclusiveTypeRector\Source\stdClass;
use Rector\Tests\Php81\Rector\Array_\ArrayToFirstClassCallableRector\Source\SomeExternalObject;

return static function (stdClass $container): void {
$container->services()
->factory([SomeExternalObject::class, 'sleepStatic']);
};
4 changes: 4 additions & 0 deletions src/NodeCollector/NodeAnalyzer/ArrayCallableMethodMatcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,6 +72,10 @@ public function match(
return null;
}

if ($array->getAttribute(AttributeKey::IS_ARG_VALUE) === true) {
return null;
}

$values = $this->valueResolver->getValue($array);
$className = $callerType->getClassName();
$secondItemValue = $items[1]->value;
Expand Down
Loading