Nelmio\Alice\Throwable\Error\TypeErrorFactory::createForInvalidSpecificationBagMethodCall PHP Method

createForInvalidSpecificationBagMethodCall() public static method

public static createForInvalidSpecificationBagMethodCall ( $methodCall ) : TypeError
return TypeError
    public static function createForInvalidSpecificationBagMethodCall($methodCall) : \TypeError
    {
        return new \TypeError(sprintf('Expected method call value to be an array, got "%s" instead.', gettype($methodCall)));
    }

Usage Example

 private function denormalizeCallMethod(CallsDenormalizerInterface $callsDenormalizer, $methodCall, FixtureInterface $scope, FlagParserInterface $parser) : MethodCallInterface
 {
     if (false === is_array($methodCall)) {
         throw TypeErrorFactory::createForInvalidSpecificationBagMethodCall($methodCall);
     }
     $unparsedMethod = key($methodCall);
     if (false === is_string($unparsedMethod)) {
         throw TypeErrorFactory::createForInvalidSpecificationBagMethodCallName($unparsedMethod);
     }
     return $callsDenormalizer->denormalize($scope, $parser, $unparsedMethod, $methodCall[$unparsedMethod]);
 }