diff options
Diffstat (limited to 'build/OCPSinceChecker.php')
-rw-r--r-- | build/OCPSinceChecker.php | 22 |
1 files changed, 11 insertions, 11 deletions
diff --git a/build/OCPSinceChecker.php b/build/OCPSinceChecker.php index 13f58fe2550..ff314170149 100644 --- a/build/OCPSinceChecker.php +++ b/build/OCPSinceChecker.php @@ -40,51 +40,51 @@ class SinceTagCheckVisitor extends \PhpParser\NodeVisitorAbstract { protected $errors = []; public function enterNode(\PhpParser\Node $node) { - if($this->deprecatedClass) { + if ($this->deprecatedClass) { return; } - if($node instanceof \PhpParser\Node\Stmt\Namespace_) { + if ($node instanceof \PhpParser\Node\Stmt\Namespace_) { $this->namespace = $node->name; } - if($node instanceof \PhpParser\Node\Stmt\Interface_ or + if ($node instanceof \PhpParser\Node\Stmt\Interface_ or $node instanceof \PhpParser\Node\Stmt\Class_) { $this->className = $node->name; /** @var \PhpParser\Comment\Doc[] $comments */ $comments = $node->getAttribute('comments'); - if(count($comments) === 0) { + if (count($comments) === 0) { $this->errors[] = 'PHPDoc is needed for ' . $this->namespace . '\\' . $this->className . '::' . $node->name; return; } $comment = $comments[count($comments) - 1]; $text = $comment->getText(); - if(strpos($text, '@deprecated') !== false) { + if (strpos($text, '@deprecated') !== false) { $this->deprecatedClass = true; } - if($this->deprecatedClass === false && strpos($text, '@since') === false && strpos($text, '@deprecated') === false) { + if ($this->deprecatedClass === false && strpos($text, '@since') === false && strpos($text, '@deprecated') === false) { $type = $node instanceof \PhpParser\Node\Stmt\Interface_ ? 'interface' : 'class'; $this->errors[] = '@since or @deprecated tag is needed in PHPDoc for ' . $type . ' ' . $this->namespace . '\\' . $this->className; return; } } - if($node instanceof \PhpParser\Node\Stmt\ClassMethod) { + if ($node instanceof \PhpParser\Node\Stmt\ClassMethod) { /** @var \PhpParser\Node\Stmt\ClassMethod $node */ /** @var \PhpParser\Comment\Doc[] $comments */ $comments = $node->getAttribute('comments'); - if(count($comments) === 0) { + if (count($comments) === 0) { $this->errors[] = 'PHPDoc is needed for ' . $this->namespace . '\\' . $this->className . '::' . $node->name; return; } $comment = $comments[count($comments) - 1]; $text = $comment->getText(); - if(strpos($text, '@since') === false && strpos($text, '@deprecated') === false) { + if (strpos($text, '@since') === false && strpos($text, '@deprecated') === false) { $this->errors[] = '@since or @deprecated tag is needed in PHPDoc for ' . $this->namespace . '\\' . $this->className . '::' . $node->name; return; } @@ -108,7 +108,7 @@ $Regex = new RegexIterator($Iterator, '/^.+\.php$/i', RecursiveRegexIterator::GE $errors = []; -foreach($Regex as $file) { +foreach ($Regex as $file) { $stmts = $parser->parse(file_get_contents($file[0])); $visitor = new SinceTagCheckVisitor(); @@ -119,7 +119,7 @@ foreach($Regex as $file) { $errors = array_merge($errors, $visitor->getErrors()); } -if(count($errors)) { +if (count($errors)) { echo join(PHP_EOL, $errors) . PHP_EOL . PHP_EOL; exit(1); } |