From c9e22f70c8a52049d8d22d23e002afb0f23be9ac Mon Sep 17 00:00:00 2001 From: Morris Jobke <hey@morrisjobke.de> Date: Mon, 27 Jul 2015 10:49:26 +0200 Subject: Add PHPDoc for classes and interfaces --- lib/public/db/querybuilder/iliteral.php | 3 +++ lib/public/db/querybuilder/iparameter.php | 3 +++ lib/public/db/querybuilder/iqueryfunction.php | 3 +++ lib/public/files/mount/imountmanager.php | 1 + lib/public/template.php | 2 ++ 5 files changed, 12 insertions(+) diff --git a/lib/public/db/querybuilder/iliteral.php b/lib/public/db/querybuilder/iliteral.php index a09b25bb2b9..f5db1ce0456 100644 --- a/lib/public/db/querybuilder/iliteral.php +++ b/lib/public/db/querybuilder/iliteral.php @@ -20,6 +20,9 @@ */ namespace OCP\DB\QueryBuilder; +/** + * @since 8.2.0 + */ interface ILiteral { /** * @return string diff --git a/lib/public/db/querybuilder/iparameter.php b/lib/public/db/querybuilder/iparameter.php index 0eb525b3522..f597163ba00 100644 --- a/lib/public/db/querybuilder/iparameter.php +++ b/lib/public/db/querybuilder/iparameter.php @@ -20,6 +20,9 @@ */ namespace OCP\DB\QueryBuilder; +/** + * @since 8.2.0 + */ interface IParameter { /** * @return string diff --git a/lib/public/db/querybuilder/iqueryfunction.php b/lib/public/db/querybuilder/iqueryfunction.php index 499b6e1efcc..4e8c163f777 100644 --- a/lib/public/db/querybuilder/iqueryfunction.php +++ b/lib/public/db/querybuilder/iqueryfunction.php @@ -20,6 +20,9 @@ */ namespace OCP\DB\QueryBuilder; +/** + * @since 8.2.0 + */ interface IQueryFunction { /** * @return string diff --git a/lib/public/files/mount/imountmanager.php b/lib/public/files/mount/imountmanager.php index 96ec1e11ad3..1eb9b66dad8 100644 --- a/lib/public/files/mount/imountmanager.php +++ b/lib/public/files/mount/imountmanager.php @@ -25,6 +25,7 @@ namespace OCP\Files\Mount; * Interface IMountManager * * Manages all mounted storages in the system + * @since 8.2.0 */ interface IMountManager { diff --git a/lib/public/template.php b/lib/public/template.php index cc91bff2528..b308240306d 100644 --- a/lib/public/template.php +++ b/lib/public/template.php @@ -137,6 +137,8 @@ function html_select_options($options, $selected, $params=array()) { /** * This class provides the template system for owncloud. You can use it to load * specific templates, add data and generate the html code + * + * @since 8.0.0 */ class Template extends \OC_Template { /** -- cgit v1.2.3 From 4efbf12fb857eb6514b8fa1a4fac6f8334577b22 Mon Sep 17 00:00:00 2001 From: Morris Jobke <hey@morrisjobke.de> Date: Mon, 27 Jul 2015 10:49:45 +0200 Subject: Implement OCP Since Check for classes and interfaces --- build/OCPSinceChecker.php | 22 ++++++++++++++++------ 1 file 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; } } -- cgit v1.2.3