Skip to content

Commit

Permalink
fix(bootstrap): use same container instance to create mutation execut…
Browse files Browse the repository at this point in the history
…ion result factory
  • Loading branch information
azjezz authored Nov 29, 2021
1 parent fc85a68 commit de42fad
Showing 1 changed file with 4 additions and 5 deletions.
9 changes: 4 additions & 5 deletions src/Roave/InfectionStaticAnalysis/Bootstrapper.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,17 +18,16 @@ public static function bootstrap(
): Container {
$reflectionOffsetSet = (new ReflectionMethod(Container::class, 'offsetSet'));

$new_container = clone $container;
$factory = static function () use ($container, $runStaticAnalysis): MutantExecutionResultFactory {
$factory = static function (Container $container) use ($runStaticAnalysis): MutantExecutionResultFactory {
return new RunStaticAnalysisAgainstEscapedMutant(
$container->getMutantExecutionResultFactory(),
new MutantExecutionResultFactory($container->getTestFrameworkAdapter()),
$runStaticAnalysis,
);
};

$reflectionOffsetSet->setAccessible(true);
$reflectionOffsetSet->invokeArgs($new_container, [MutantExecutionResultFactory::class, $factory]);
$reflectionOffsetSet->invokeArgs($container, [MutantExecutionResultFactory::class, $factory]);

return $new_container;
return $container;
}
}

0 comments on commit de42fad

Please sign in to comment.