diff --git a/lang/en/local_moodlecheck.php b/lang/en/local_moodlecheck.php
index a0f2082..ddcf1d3 100644
--- a/lang/en/local_moodlecheck.php
+++ b/lang/en/local_moodlecheck.php
@@ -48,15 +48,6 @@
$string['error_phpdocsfistline'] = 'No one-line description found in phpdocs for {$a->object}';
$string['rule_phpdocsfistline'] = 'File-level phpdocs block and class phpdocs should have one-line short description';
-$string['error_phpdocsinvalidtag'] = 'Invalid phpdocs tag {$a->tag} used';
-$string['rule_phpdocsinvalidtag'] = 'Used phpdocs tags are valid';
-
-$string['error_phpdocsnotrecommendedtag'] = 'Not recommended phpdocs tag {$a->tag} used';
-$string['rule_phpdocsnotrecommendedtag'] = 'Used phpdocs tags are recommended';
-
-$string['error_phpdocsinvalidpathtag'] = 'Incorrect path for phpdocs tag {$a->tag} detected';
-$string['rule_phpdocsinvalidpathtag'] = 'Used phpdocs tags have correct paths';
-
$string['error_phpdocsinvalidinlinetag'] = 'Invalid inline phpdocs tag {$a->tag} found';
$string['rule_phpdocsinvalidinlinetag'] = 'Inline phpdocs tags are valid';
diff --git a/rules/phpdocs_basic.php b/rules/phpdocs_basic.php
index 366a0a3..6fcba79 100644
--- a/rules/phpdocs_basic.php
+++ b/rules/phpdocs_basic.php
@@ -33,11 +33,6 @@
local_moodlecheck_registry::add_rule('definedoccorrect')->set_callback('local_moodlecheck_definedoccorrect');
local_moodlecheck_registry::add_rule('filehascopyright')->set_callback('local_moodlecheck_filehascopyright');
local_moodlecheck_registry::add_rule('filehaslicense')->set_callback('local_moodlecheck_filehaslicense');
-local_moodlecheck_registry::add_rule('phpdocsinvalidtag')->set_callback('local_moodlecheck_phpdocsinvalidtag');
-local_moodlecheck_registry::add_rule('phpdocsnotrecommendedtag')->set_callback('local_moodlecheck_phpdocsnotrecommendedtag')
- ->set_severity('warning');
-local_moodlecheck_registry::add_rule('phpdocsinvalidpathtag')->set_callback('local_moodlecheck_phpdocsinvalidpathtag')
- ->set_severity('warning');
local_moodlecheck_registry::add_rule('phpdocsinvalidinlinetag')->set_callback('local_moodlecheck_phpdocsinvalidinlinetag');
local_moodlecheck_registry::add_rule('phpdocsuncurlyinlinetag')->set_callback('local_moodlecheck_phpdocsuncurlyinlinetag');
local_moodlecheck_registry::add_rule('phpdoccontentsinlinetag')->set_callback('local_moodlecheck_phpdoccontentsinlinetag');
@@ -90,75 +85,6 @@ function local_moodlecheck_noinlinephpdocs(local_moodlecheck_file $file) {
return $errors;
}
-/**
- * Check that all the phpdoc tags used are valid ones
- *
- * @param local_moodlecheck_file $file
- * @return array of found errors
- */
-function local_moodlecheck_phpdocsinvalidtag(local_moodlecheck_file $file) {
- $errors = [];
- foreach ($file->get_all_phpdocs() as $phpdocs) {
- foreach ($phpdocs->get_tags() as $tag) {
- $tag = preg_replace('|^@([^\s]*).*|s', '$1', $tag);
- if (!in_array($tag, local_moodlecheck_phpdocs::$validtags)) {
- $errors[] = [
- 'line' => $phpdocs->get_line_number($file, '@' . $tag),
- 'tag' => '@' . $tag, ];
- }
- }
- }
- return $errors;
-}
-
-/**
- * Check that all the phpdoc tags used are recommended ones
- *
- * @param local_moodlecheck_file $file
- * @return array of found errors
- */
-function local_moodlecheck_phpdocsnotrecommendedtag(local_moodlecheck_file $file) {
- $errors = [];
- foreach ($file->get_all_phpdocs() as $phpdocs) {
- foreach ($phpdocs->get_tags() as $tag) {
- $tag = preg_replace('|^@([^\s]*).*|s', '$1', $tag);
- if (in_array($tag, local_moodlecheck_phpdocs::$validtags) &&
- !in_array($tag, local_moodlecheck_phpdocs::$recommendedtags)) {
- $errors[] = [
- 'line' => $phpdocs->get_line_number($file, '@' . $tag),
- 'tag' => '@' . $tag, ];
- }
- }
- }
- return $errors;
-}
-
-/**
- * Check that all the path-restricted phpdoc tags used are in place
- *
- * @param local_moodlecheck_file $file
- * @return array of found errors
- */
-function local_moodlecheck_phpdocsinvalidpathtag(local_moodlecheck_file $file) {
- $errors = [];
- foreach ($file->get_all_phpdocs() as $phpdocs) {
- foreach ($phpdocs->get_tags() as $tag) {
- $tag = preg_replace('|^@([^\s]*).*|s', '$1', $tag);
- if (in_array($tag, local_moodlecheck_phpdocs::$validtags) &&
- in_array($tag, local_moodlecheck_phpdocs::$recommendedtags) &&
- isset(local_moodlecheck_phpdocs::$pathrestrictedtags[$tag])) {
- // Verify file path matches some of the valid paths for the tag.
- if (!preg_filter(local_moodlecheck_phpdocs::$pathrestrictedtags[$tag], '$0', $file->get_filepath())) {
- $errors[] = [
- 'line' => $phpdocs->get_line_number($file, '@' . $tag),
- 'tag' => '@' . $tag, ];
- }
- }
- }
- }
- return $errors;
-}
-
/**
* Check that all the inline phpdoc tags found are valid
*
diff --git a/tests/moodlecheck_rules_test.php b/tests/moodlecheck_rules_test.php
index f1029aa..e6f1ad4 100644
--- a/tests/moodlecheck_rules_test.php
+++ b/tests/moodlecheck_rules_test.php
@@ -125,7 +125,7 @@ public function test_phpdoc_tags_general(): void {
$xpath = new \DOMXpath($xmlresult);
$found = $xpath->query("//file/error");
// TODO: Change to DOMNodeList::count() when php71 support is gone.
- $this->assertSame(17, $found->length);
+ $this->assertSame(10, $found->length);
// Also verify various bits by content.
$this->assertStringContainsString('incomplete_param_annotation has incomplete parameters list', $result);
@@ -138,13 +138,6 @@ public function test_phpdoc_tags_general(): void {
$this->assertStringContainsString('mismatch_param_types2 has incomplete parameters list', $result);
$this->assertStringContainsString('mismatch_param_types3 has incomplete parameters list', $result);
$this->assertStringContainsString('incomplete_return_annotation has incomplete parameters list', $result);
- $this->assertStringContainsString('Invalid phpdocs tag @small', $result);
- $this->assertStringContainsString('Invalid phpdocs tag @zzzing', $result);
- $this->assertStringContainsString('Invalid phpdocs tag @inheritdoc', $result);
- $this->assertStringContainsString('Incorrect path for phpdocs tag @covers', $result);
- $this->assertStringContainsString('Incorrect path for phpdocs tag @dataProvider', $result);
- $this->assertStringContainsString('Incorrect path for phpdocs tag @group', $result);
- $this->assertStringContainsString('@codingStandardsIgnoreLine', $result);
$this->assertStringNotContainsString('@deprecated', $result);
$this->assertStringNotContainsString('correct_param_types', $result);
$this->assertStringNotContainsString('correct_return_type', $result);
@@ -222,66 +215,9 @@ public function test_phpdoc_union_types(): void {
);
}
- /**
- * Verify various phpdoc tags in tests directories.
- *
- * @covers ::local_moodlecheck_phpdocsinvalidtag
- * @covers ::local_moodlecheck_phpdocsnotrecommendedtag
- * @covers ::local_moodlecheck_phpdocsinvalidpathtag
- */
- public function test_phpdoc_tags_tests(): void {
- global $PAGE;
- $output = $PAGE->get_renderer('local_moodlecheck');
- $path = new local_moodlecheck_path('local/moodlecheck/tests/fixtures/phpdoc_tags_test.php ', null);
- $result = $output->display_path($path, 'xml');
-
- // Convert results to XML Objext.
- $xmlresult = new \DOMDocument();
- $xmlresult->loadXML($result);
-
- // Let's verify we have received a xml with file top element and 5 children.
- $xpath = new \DOMXpath($xmlresult);
- $found = $xpath->query("//file/error");
- // TODO: Change to DOMNodeList::count() when php71 support is gone.
- $this->assertSame(3, $found->length);
-
- // Also verify various bits by content.
- $this->assertStringContainsString('Invalid phpdocs tag @small', $result);
- $this->assertStringContainsString('Invalid phpdocs tag @zzzing', $result);
- $this->assertStringContainsString('Invalid phpdocs tag @inheritdoc', $result);
- $this->assertStringNotContainsString('Incorrect path for phpdocs tag @covers', $result);
- $this->assertStringNotContainsString('Incorrect path for phpdocs tag @dataProvider', $result);
- $this->assertStringNotContainsString('Incorrect path for phpdocs tag @group', $result);
- $this->assertStringNotContainsString('@deprecated', $result);
- }
-
- /**
- * Verify phpunit codeCoverageIgnore can be applied to an entire file.
- *
- * @covers ::local_moodlecheck_phpdocsinvalidtag
- */
- public function test_phpdoc_phpunit_coverage_ignored_for_file(): void {
- global $PAGE;
- $output = $PAGE->get_renderer('local_moodlecheck');
- $path = new local_moodlecheck_path('local/moodlecheck/tests/fixtures/phpdoc_phpunit_coverage_ignored.php ', null);
- $result = $output->display_path($path, 'xml');
-
- // Convert results to XML Objext.
- $xmlresult = new \DOMDocument();
- $xmlresult->loadXML($result);
-
- // Let's verify we have received a xml with file top element and 5 children.
- $xpath = new \DOMXpath($xmlresult);
- $found = $xpath->query("//file/error");
-
- // TODO: Change to DOMNodeList::count() when php71 support is gone.
- $this->assertSame(0, $found->length);
- }
-
/**
* Verify various phpdoc tags can be used inline.
*
- * @covers ::local_moodlecheck_phpdocsinvalidinlinetag
* @covers ::local_moodlecheck_phpdocsuncurlyinlinetag
* @covers ::local_moodlecheck_phpdoccontentsinlinetag
*/