/**
  * @param Renderer|null                     $renderer
  * @param ParameterListParser|null          $parser
  * @param ParameterListGenerator|null       $generator
  * @param ClassMapper|null                  $classMapper
  * @param ParameterListMerge\MergeTool|null $mergeTool
  * @param Isolator|null                     $isolator
  */
 public function __construct(Renderer $renderer = null, ParameterListParser $parser = null, ParameterListGenerator $generator = null, ClassMapper $classMapper = null, ParameterListMerge\MergeTool $mergeTool = null, Isolator $isolator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $renderer) {
         $renderer = new Renderer();
     }
     if (null === $parser) {
         $parser = new ParameterListParser();
     }
     if (null === $generator) {
         $generator = new ParameterListGenerator();
     }
     if (null === $classMapper) {
         $classMapper = new ClassMapper();
     }
     if (null === $mergeTool) {
         $mergeTool = new ParameterListMerge\MergeTool();
     }
     $this->renderer = $renderer;
     $this->parser = $parser;
     $this->generator = $generator;
     $this->classMapper = $classMapper;
     $this->mergeTool = $mergeTool;
     $this->isolator = Isolator::get($isolator);
 }
 /**
  * @param ClassDefinition    $classDefinition
  * @param MethodDefinition   $methodDefinition
  * @param string             $parameterName
  * @param Type               $type
  * @param Type               $documentedType
  * @param IssueSeverity|null $severity
  */
 public function __construct(ClassDefinition $classDefinition, MethodDefinition $methodDefinition, $parameterName, Type $type, Type $documentedType, IssueSeverity $severity = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     parent::__construct($classDefinition, $methodDefinition, $parameterName, $severity);
     $this->type = $type;
     $this->documentedType = $documentedType;
 }
 /**
  * @param ClassName      $className
  * @param string         $propertyName
  * @param Exception|null $previous
  */
 public function __construct(ClassName $className, $propertyName, Exception $previous = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->className = $className;
     $this->propertyName = $propertyName;
     parent::__construct(sprintf("Undefined property '%s::\$%s'.", $className->string(), $propertyName), 0, $previous);
 }
 /**
  * @param string         $expected
  * @param integer        $position
  * @param Exception|null $previous
  */
 public function __construct($expected, $position, Exception $previous = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->expected = $expected;
     $message = "Unexpected content at position " . $position . ". Expected '" . $expected . "'.";
     parent::__construct($message, $position, $previous);
 }
 /**
  * @param integer        $jsonErrorCode
  * @param string         $path
  * @param Exception|null $previous
  */
 public function __construct($jsonErrorCode, $path, Exception $previous = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->jsonErrorCode = $jsonErrorCode;
     $this->path = $path;
     switch ($jsonErrorCode) {
         case JSON_ERROR_DEPTH:
             $this->jsonErrorMessage = 'The maximum stack depth has been exceeded.';
             break;
         case JSON_ERROR_STATE_MISMATCH:
             $this->jsonErrorMessage = 'Invalid or malformed JSON.';
             break;
         case JSON_ERROR_CTRL_CHAR:
             $this->jsonErrorMessage = 'Control character error, possibly incorrectly encoded.';
             break;
         case JSON_ERROR_SYNTAX:
             $this->jsonErrorMessage = 'Syntax error.';
             break;
         case JSON_ERROR_UTF8:
             $this->jsonErrorMessage = 'Malformed UTF-8 characters, possibly incorrectly encoded.';
             break;
         default:
             $this->jsonErrorMessage = 'An unknown error occurred.';
     }
     parent::__construct(sprintf("Invalid JSON in '%s'. %s", $this->path(), $this->jsonErrorMessage()), 0, $previous);
 }
Example #6
0
 /**
  * @param boolean $throwOnError
  */
 public function __construct($throwOnError = true)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->throwOnError = $throwOnError;
     $this->clearIssues();
     $reflectionParameterClass = new ReflectionClass('ReflectionParameter');
     $this->nativeCallableAvailable = $reflectionParameterClass->hasMethod('isCallable');
 }
 /**
  * @param Renderer|null $renderer
  */
 public function __construct(Renderer $renderer = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $renderer) {
         $renderer = new Renderer();
     }
     $this->renderer = $renderer;
 }
Example #8
0
 /**
  * @param TyphaxParser|null $typhaxParser
  */
 public function __construct(TyphaxParser $typhaxParser = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $typhaxParser) {
         $typhaxParser = new TyphaxParser();
     }
     $this->typhaxParser = $typhaxParser;
 }
Example #9
0
 /**
  * @param string        $outputPath
  * @param array<string> $sourcePaths
  */
 public function __construct($outputPath, array $sourcePaths)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     parent::__construct();
     $this->setOutputPath($outputPath);
     $this->setSourcePaths($sourcePaths);
     $this->loaderPaths = array('vendor/autoload.php');
 }
Example #10
0
 /**
  * @param ProjectValidatorGenerator|null $generator
  * @param Isolator|null                  $isolator
  */
 public function __construct(ProjectValidatorGenerator $generator = null, Isolator $isolator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $generator) {
         $generator = new ProjectValidatorGenerator();
     }
     $this->generator = $generator;
     parent::__construct($isolator);
 }
Example #11
0
 /**
  * @param string      $name
  * @param Type        $type
  * @param string|null $description
  * @param boolean     $optional
  * @param boolean     $byReference
  */
 public function __construct($name, Type $type, $description = null, $optional = false, $byReference = false)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->name = $name;
     $this->type = $type;
     $this->description = $description;
     $this->optional = $optional;
     $this->byReference = $byReference;
 }
 /**
  * @param ClassDefinition    $classDefinition
  * @param IssueSeverity|null $severity
  */
 public function __construct(ClassDefinition $classDefinition, IssueSeverity $severity = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $severity) {
         $severity = IssueSeverity::ERROR();
     }
     $this->classDefinition = $classDefinition;
     $this->severity = $severity;
 }
 /**
  * @param ClassName      $className
  * @param string         $name
  * @param boolean        $isStatic
  * @param AccessModifier $accessModifier
  * @param integer        $lineNumber
  * @param string         $source
  */
 public function __construct(ClassName $className, $name, $isStatic, AccessModifier $accessModifier, $lineNumber, $source)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->className = $className;
     $this->name = $name;
     $this->isStatic = $isStatic;
     $this->accessModifier = $accessModifier;
     $this->lineNumber = $lineNumber;
     $this->source = $source;
 }
 /**
  * @param IssueInterface     $issue
  * @param Exception|null     $previous
  * @param IssueRenderer|null $renderer
  */
 public function __construct(IssueInterface $issue, Exception $previous = null, IssueRenderer $renderer = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $renderer) {
         $renderer = new IssueRenderer();
     }
     $this->issue = $issue;
     $this->renderer = $renderer;
     parent::__construct($this->renderMessage(), 0, $previous);
 }
Example #15
0
 /**
  * @param ConfigurationReader|null $configurationReader
  */
 public function __construct(ConfigurationReader $configurationReader = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $configurationReader) {
         $configurationReader = new ConfigurationReader();
     }
     $this->configurationReader = $configurationReader;
     parent::__construct('Typhoon', '0.9.0');
     $this->add(new Command\GenerateCommand());
     $this->add(new Command\CheckCommand());
 }
Example #16
0
 /**
  * @param Renderer|null                      $renderer
  * @param RuntimeConfigurationGenerator|null $configurationGenerator
  */
 public function __construct(Renderer $renderer = null, RuntimeConfigurationGenerator $configurationGenerator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $renderer) {
         $renderer = new Renderer();
     }
     if (null === $configurationGenerator) {
         $configurationGenerator = new RuntimeConfigurationGenerator();
     }
     $this->renderer = $renderer;
     $this->configurationGenerator = $configurationGenerator;
 }
Example #17
0
 /**
  * @param ClassName|null $validatorNamespace
  * @param boolean|null   $useNativeCallable
  */
 public function __construct(ClassName $validatorNamespace = null, $useNativeCallable = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $validatorNamespace) {
         $validatorNamespace = ClassName::fromAtoms(array('Typhoon'), true);
     }
     if (null === $useNativeCallable) {
         $useNativeCallable = true;
     }
     $this->validatorNamespace = $validatorNamespace;
     $this->useNativeCallable = $useNativeCallable;
 }
Example #18
0
 /**
  * @param Identifier|null               $valueIdentifier
  * @param ExtensionLoaderInterface|null $extensionLoader
  */
 public function __construct(Identifier $valueIdentifier = null, ExtensionLoaderInterface $extensionLoader = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $valueIdentifier) {
         $valueIdentifier = new Identifier('value');
     }
     if (null === $extensionLoader) {
         $extensionLoader = new ExtensionLoader();
     }
     $this->valueIdentifier = $valueIdentifier;
     $this->extensionLoader = $extensionLoader;
 }
 /**
  * @param ClassName|null $className
  * @param string         $functionName
  * @param Exception|null $previous
  */
 public function __construct(ClassName $className = null, $functionName, Exception $previous = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->className = $className;
     $this->functionName = $functionName;
     if (null === $className) {
         $message = sprintf('Invalid param tags found in the documentation for function %s().', $this->functionName());
     } else {
         $message = sprintf('Invalid param tags found in the documentation for method %s::%s().', $this->className()->string(), $this->functionName());
     }
     parent::__construct($message, 0, $previous);
 }
Example #20
0
 /**
  * @param ClassName                 $className
  * @param array<array<ClassName>>   $usedClasses
  * @param array<MethodDefinition>   $methods
  * @param array<PropertyDefinition> $properties
  */
 public function __construct(ClassName $className, array $usedClasses = array(), array $methods = array(), array $properties = array())
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->className = $className->toAbsolute();
     $this->methods = $methods;
     $this->properties = $properties;
     if ($className->hasParent()) {
         $namespaceName = $className->parent();
     } else {
         $namespaceName = null;
     }
     $this->classNameResolver = new ClassNameResolver($namespaceName, $usedClasses);
 }
Example #21
0
 /**
  * @param ProjectAnalyzer|null $analyzer
  * @param IssueRenderer|null   $issueRenderer
  * @param Isolator|null        $isolator
  */
 public function __construct(ProjectAnalyzer $analyzer = null, IssueRenderer $issueRenderer = null, Isolator $isolator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $analyzer) {
         $analyzer = new ProjectAnalyzer();
     }
     if (null === $issueRenderer) {
         $issueRenderer = new IssueRenderer();
     }
     $this->analyzer = $analyzer;
     $this->issueRenderer = $issueRenderer;
     parent::__construct($isolator);
 }
 /**
  * @param TyphaxASTGenerator|null $typeGenerator
  * @param TypeRenderer|null       $typeRenderer
  */
 public function __construct(TyphaxASTGenerator $typeGenerator = null, TypeRenderer $typeRenderer = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $typeGenerator) {
         $typeGenerator = new TyphaxASTGenerator();
     }
     if (null === $typeRenderer) {
         $typeRenderer = new TypeRenderer();
     }
     $this->typeGenerator = $typeGenerator;
     $this->typeRenderer = $typeRenderer;
     $this->argumentExpression = new Variable(new Identifier('argument'));
     $this->indexExpression = new Variable(new Identifier('index'));
     $this->validatorNamespace = ClassName::fromAtoms(array('Typhoon'), true);
 }
Example #23
0
 /**
  * @param ClassMapper|null         $classMapper
  * @param ParameterListParser|null $parameterListParser
  * @param MergeTool|null           $mergeTool
  */
 public function __construct(ClassMapper $classMapper = null, ParameterListParser $parameterListParser = null, MergeTool $mergeTool = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $classMapper) {
         $classMapper = new ClassMapper();
     }
     if (null === $parameterListParser) {
         $parameterListParser = new ParameterListParser();
     }
     if (null === $mergeTool) {
         $mergeTool = new MergeTool(false);
     }
     $this->classMapper = $classMapper;
     $this->parameterListParser = $parameterListParser;
     $this->mergeTool = $mergeTool;
 }
 /**
  * @param ClassMapper|null                 $classMapper
  * @param ValidatorClassGenerator|null     $validatorClassGenerator
  * @param array<StaticClassGenerator>|null $staticClassGenerators
  * @param Isolator|null                    $isolator
  */
 public function __construct(ClassMapper $classMapper = null, ValidatorClassGenerator $validatorClassGenerator = null, array $staticClassGenerators = null, Isolator $isolator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     if (null === $classMapper) {
         $classMapper = new ClassMapper();
     }
     if (null === $validatorClassGenerator) {
         $validatorClassGenerator = new ValidatorClassGenerator();
     }
     if (null === $staticClassGenerators) {
         $staticClassGenerators = array(new FacadeGenerator(), new AbstractValidatorGenerator(), new DummyValidatorGenerator(), new TypeInspectorGenerator(), new ExceptionGenerator\UnexpectedInputExceptionGenerator(), new ExceptionGenerator\MissingArgumentExceptionGenerator(), new ExceptionGenerator\UnexpectedArgumentExceptionGenerator(), new ExceptionGenerator\UnexpectedArgumentValueExceptionGenerator());
     }
     $this->classMapper = $classMapper;
     $this->validatorClassGenerator = $validatorClassGenerator;
     $this->staticClassGenerators = $staticClassGenerators;
     $this->isolator = Isolator::get($isolator);
 }
 /**
  * @param ClassDefinition    $classDefinition
  * @param MethodDefinition   $methodDefinition
  * @param IssueSeverity|null $severity
  */
 public function __construct(ClassDefinition $classDefinition, MethodDefinition $methodDefinition, IssueSeverity $severity = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     parent::__construct($classDefinition, $severity);
     $this->methodDefinition = $methodDefinition;
 }
 /**
  * @param IssueVisitorInterface $visitor
  *
  * @return mixed
  */
 public function accept(IssueVisitorInterface $visitor)
 {
     TypeCheck::get(__CLASS__)->accept(func_get_args());
     return $visitor->visitDefinedParameterVariableLength($this);
 }
 /**
  * @param IssueVisitorInterface $visitor
  *
  * @return mixed
  */
 public function accept(IssueVisitorInterface $visitor)
 {
     TypeCheck::get(__CLASS__)->accept(func_get_args());
     return $visitor->visitUndocumentedParameter($this);
 }
Example #28
0
 /**
  * @param Isolator|null $isolator
  */
 public function __construct(Isolator $isolator = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->isolator = Isolator::get($isolator);
     parent::__construct();
 }
Example #29
0
 /**
  * @param array<Issue\IssueInterface> $issues
  */
 public function __construct(array $issues = array())
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->issues = $issues;
 }
 /**
  * @param string         $reason
  * @param Exception|null $previous
  */
 public function __construct($reason, Exception $previous = null)
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->reason = $reason;
     parent::__construct(sprintf("Invalid configuration. %s", $this->reason()), 0, $previous);
 }