*/ final class MockedClassCollector implements Collector { public function getNodeType() : string { return MethodCall::class; } /** * @param MethodCall $node * @return string[]|null */ public function processNode(Node $node, Scope $scope) : ?array { if (!$node->name instanceof Identifier) { return null; } $methodName = $node->name->toString(); if (!\in_array($methodName, ['createMock', 'buildMock'], \true)) { return null; } $firstArg = $node->getArgs()[0] ?? null; if (!$firstArg instanceof Arg) { return null; } $mockedClassType = $scope->getType($firstArg->value); if (!$mockedClassType instanceof ConstantStringType) { return null; } return [$mockedClassType->getValue()]; } }