Skip to content

Commit

Permalink
Merge pull request #250 from azjezz/patch-1
Browse files Browse the repository at this point in the history
fix(bootstrap): use same container instance to create mutation execution result factory
  • Loading branch information
Ocramius authored Nov 29, 2021
2 parents fc85a68 + de42fad commit 5625e51
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 5625e51

Please sign in to comment.