Skip to content

Commit

Permalink
skip FirstClassCallableRector on UseCaseTest
Browse files Browse the repository at this point in the history
  • Loading branch information
samsonasik committed Dec 13, 2024
1 parent b6261f2 commit 38ee09a
Show file tree
Hide file tree
Showing 2 changed files with 10 additions and 5 deletions.
5 changes: 5 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,7 @@
use Rector\Php70\Rector\StmtsAwareInterface\IfIssetToCoalescingRector;
use Rector\Php71\Rector\FuncCall\RemoveExtraParametersRector;
use Rector\Php80\Rector\Class_\ClassPropertyAssignToConstructorPromotionRector;
use Rector\Php81\Rector\Array_\FirstClassCallableRector;
use Rector\Php81\Rector\ClassMethod\NewInInitializerRector;
use Rector\Php81\Rector\Property\ReadOnlyPropertyRector;

Expand Down Expand Up @@ -104,6 +105,10 @@
// used by Configurator
__DIR__ . '/src/Scaffolder/src/Command',
],

FirstClassCallableRector::class => [
__DIR__ . '/src/Core/tests/Scope/UseCaseTest.php',
],
])
->withPhpSets(php81: true)
->withPreparedSets(deadCode: true)
Expand Down
10 changes: 5 additions & 5 deletions src/Core/tests/Scope/UseCaseTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -79,7 +79,7 @@ public function testScopeBindingsAsNotSingletons(bool $theSame, string $alias, m

public static function provideScopeBindingsAsNotSingletons(): iterable
{
yield 'array-factory' => [false, 'foo', (new Factory())->makeStdClass(...)];
yield 'array-factory' => [false, 'foo', [Factory::class, 'makeStdClass']];
yield 'class-name' => [false, SampleClass::class, SampleClass::class];
yield 'object' => [true, stdClass::class, new stdClass()];
}
Expand Down Expand Up @@ -107,11 +107,11 @@ public function testScopeDefinition(): void
self::assertNotSame($c1, $c2);
self::assertInstanceOf(stdClass::class, $obj2);
self::assertNotSame($obj1, $obj2);
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);

// $obj2 should be garbage collected
self::assertCount(1, $this->weakMap);
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);

// $obj1 should be garbage collected
self::assertEmpty($this->weakMap);
Expand All @@ -125,7 +125,7 @@ public function testScopeDefinition(): void
public function testChildContainerResolvesDepsFromParent(): void
{
$root = new Container();
$root->bindSingleton('bar', (new Factory())->makeStdClass(...));
$root->bindSingleton('bar', [Factory::class, 'makeStdClass']);
$root->bind(stdClass::class, new stdClass());

$root->runScoped(function (ContainerInterface $c1) use ($root) {
Expand All @@ -149,7 +149,7 @@ public function testChildContainerResolvesDepsFromParent(): void
"Nested container mustn't create new instance using class name as key without definition."
);
});
}, bindings: ['foo' => (new Factory())->makeStdClass(...)]);
}, bindings: ['foo' => [Factory::class, 'makeStdClass']]);
}

/**
Expand Down

0 comments on commit 38ee09a

Please sign in to comment.