Welcome to mirror list, hosted at ThFree Co, Russian Federation.

github.com/nextcloud/server.git - Unnamed repository; edit this file 'description' to name the repository.
summaryrefslogtreecommitdiff
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-27 11:49:45 +0300
committerMorris Jobke <hey@morrisjobke.de>2015-07-27 11:49:45 +0300
commit4efbf12fb857eb6514b8fa1a4fac6f8334577b22 (patch)
tree261c994d0b71c2c88c973980478b8a80cb129dbb /build/OCPSinceChecker.php
parentc9e22f70c8a52049d8d22d23e002afb0f23be9ac (diff)
Implement OCP Since Check for classes and interfaces
Diffstat (limited to 'build/OCPSinceChecker.php')
-rw-r--r--build/OCPSinceChecker.php22
1 files changed, 16 insertions, 6 deletions
diff --git a/build/OCPSinceChecker.php b/build/OCPSinceChecker.php
index c059b687393..0eb1c54f0b8 100644
--- a/build/OCPSinceChecker.php
+++ b/build/OCPSinceChecker.php
@@ -54,12 +54,22 @@ class SinceTagCheckVisitor extends \PhpParser\NodeVisitorAbstract {
/** @var \PhpParser\Comment\Doc[] $comments */
$comments = $node->getAttribute('comments');
- if(count($comments) !== 0) {
- $comment = $comments[count($comments) - 1];
- $text = $comment->getText();
- if(strpos($text, '@deprecated') !== false) {
- $this->deprecatedClass = true;
- }
+
+ 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) {
+ $this->deprecatedClass = true;
+ }
+
+ 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;
}
}