コード例 #1
0
 /**
  * @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);
 }
コード例 #2
0
 /**
  * @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;
 }
コード例 #3
0
 /**
  * @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);
 }
コード例 #4
0
 /**
  * @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);
 }
コード例 #5
0
 /**
  * @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);
 }
コード例 #6
0
ファイル: MergeTool.php プロジェクト: eloquent/typhoon
 /**
  * @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');
 }
コード例 #7
0
 /**
  * @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;
 }
コード例 #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;
 }
コード例 #9
0
ファイル: Configuration.php プロジェクト: eloquent/typhoon
 /**
  * @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');
 }
コード例 #10
0
ファイル: GenerateCommand.php プロジェクト: eloquent/typhoon
 /**
  * @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);
 }
コード例 #11
0
ファイル: Parameter.php プロジェクト: eloquent/typhoon
 /**
  * @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;
 }
コード例 #12
0
 /**
  * @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;
 }
コード例 #13
0
 /**
  * @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;
 }
コード例 #14
0
 /**
  * @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);
 }
コード例 #15
0
ファイル: Application.php プロジェクト: eloquent/typhoon
 /**
  * @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());
 }
コード例 #16
0
ファイル: FacadeGenerator.php プロジェクト: eloquent/typhoon
 /**
  * @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;
 }
コード例 #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;
 }
コード例 #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;
 }
コード例 #19
0
 /**
  * @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);
 }
コード例 #20
0
ファイル: ClassDefinition.php プロジェクト: eloquent/typhoon
 /**
  * @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);
 }
コード例 #21
0
ファイル: CheckCommand.php プロジェクト: eloquent/typhoon
 /**
  * @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);
 }
コード例 #22
0
 /**
  * @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);
 }
コード例 #23
0
ファイル: ProjectAnalyzer.php プロジェクト: eloquent/typhoon
 /**
  * @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;
 }
コード例 #24
0
 /**
  * @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);
 }
コード例 #25
0
 /**
  * @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;
 }
コード例 #26
0
 /**
  * @param IssueVisitorInterface $visitor
  *
  * @return mixed
  */
 public function accept(IssueVisitorInterface $visitor)
 {
     TypeCheck::get(__CLASS__)->accept(func_get_args());
     return $visitor->visitDefinedParameterVariableLength($this);
 }
コード例 #27
0
 /**
  * @param IssueVisitorInterface $visitor
  *
  * @return mixed
  */
 public function accept(IssueVisitorInterface $visitor)
 {
     TypeCheck::get(__CLASS__)->accept(func_get_args());
     return $visitor->visitUndocumentedParameter($this);
 }
コード例 #28
0
ファイル: Command.php プロジェクト: eloquent/typhoon
 /**
  * @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();
 }
コード例 #29
0
ファイル: AnalysisResult.php プロジェクト: eloquent/typhoon
 /**
  * @param array<Issue\IssueInterface> $issues
  */
 public function __construct(array $issues = array())
 {
     $this->typeCheck = TypeCheck::get(__CLASS__, func_get_args());
     $this->issues = $issues;
 }
コード例 #30
0
 /**
  * @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);
 }