/**
  * Factory for instantiation of parameter validator
  *
  * @return \Closure
  */
 public function parameterValidatorFactory()
 {
     return function (ServiceContainer $container) {
         $parameterValidator = new ParameterValidator($container->get('ecomdev.phpspec.magento_di_adapter.code_generator.io'), $container->get('ecomdev.phpspec.magento_di_adapter.code_generator.defined_classes'), $container->get('loader.transformer.typehintindex'));
         $parameterValidator->addGenerator(Generator\Factory::class, Generator\Factory::ENTITY_TYPE)->addGenerator(Generator\Repository::class, Generator\Repository::ENTITY_TYPE)->addGenerator(Generator\Converter::class, Generator\Converter::ENTITY_TYPE)->addGenerator(Generator\Persistor::class, Generator\Persistor::ENTITY_TYPE)->addGenerator(MapperGenerator::class, MapperGenerator::ENTITY_TYPE)->addGenerator(SearchResults::class, SearchResults::ENTITY_TYPE);
         return $parameterValidator;
     };
 }
 /**
  * Generates DI related stuff via parameter validator
  *
  * @param ExampleNode $example
  * @param Specification $context
  * @param MatcherManager $matchers
  * @param CollaboratorManager $collaborators
  *
  * @return $this
  */
 public function prepare(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators)
 {
     if ($example->getSpecification()->getClassReflection()->hasMethod('let')) {
         $this->parameterValidator->validate($example->getSpecification()->getClassReflection()->getMethod('let'));
     }
     $this->parameterValidator->validate($example->getFunctionReflection());
     return $this;
 }
 function it_does_pass_regular_example_into_parameter_validator_and_let_method_if_they_are_defined(ExampleNode $example, Specification $context, MatcherManager $matchers, CollaboratorManager $collaborators, SpecificationNode $specificationNode, \ReflectionClass $reflectionClass)
 {
     $example->getSpecification()->willReturn($specificationNode);
     $specificationNode->getClassReflection()->willReturn($reflectionClass);
     $reflectionClass->hasMethod('let')->willReturn(true);
     $exampleClosureReflection = new \ReflectionFunction(function () {
     });
     $letClosureReflection = new \ReflectionFunction(function () {
     });
     $reflectionClass->getMethod('let')->willReturn($letClosureReflection)->shouldBeCalled();
     $example->getFunctionReflection()->willReturn($exampleClosureReflection)->shouldBeCalled();
     $this->parameterValidator->validate($letClosureReflection)->shouldBeCalled();
     $this->parameterValidator->validate($exampleClosureReflection)->shouldBeCalled();
     $this->prepare($example, $context, $matchers, $collaborators)->shouldReturn($this);
 }