summaryrefslogtreecommitdiffstats
diff options
context:
space:
mode:
authorMorris Jobke <hey@morrisjobke.de>2015-07-27 13:14:56 +0200
committerMorris Jobke <hey@morrisjobke.de>2015-07-27 13:14:56 +0200
commite68741c1b04661d328ef5387c35a1f4dcab5d80b (patch)
tree261c994d0b71c2c88c973980478b8a80cb129dbb
parent4edfadac96fcf267c97371e67e5feccec94b337e (diff)
parent4efbf12fb857eb6514b8fa1a4fac6f8334577b22 (diff)
downloadnextcloud-server-e68741c1b04661d328ef5387c35a1f4dcab5d80b.tar.gz
nextcloud-server-e68741c1b04661d328ef5387c35a1f4dcab5d80b.zip
Merge pull request #17894 from owncloud/since-check-for-classes-and-interfaces
Implement OCP Since Check for classes and interfaces
-rw-r--r--build/OCPSinceChecker.php22
-rw-r--r--lib/public/db/querybuilder/iliteral.php3
-rw-r--r--lib/public/db/querybuilder/iparameter.php3
-rw-r--r--lib/public/db/querybuilder/iqueryfunction.php3
-rw-r--r--lib/public/files/mount/imountmanager.php1
-rw-r--r--lib/public/template.php2
6 files changed, 28 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;
}
}
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 {
/**