Repository: VKCOM/noverify
Pull request #1091 (2021-08-20 11:18:59)

linter: renamed `phpdoc` checker to `missingPhpdoc`


Patch:
diff --git a/docs/checkers_doc.md b/docs/checkers_doc.md
index b0fb794..1a95856 100644
--- a/docs/checkers_doc.md
+++ b/docs/checkers_doc.md
@@ -91,8 +91,8 @@
    - [`classMembersOrder` checker](#classmembersorder-checker)
    - [`deprecated` checker](#deprecated-checker)
    - [`langDeprecated` checker](#langdeprecated-checker)
+   - [`missingPhpdoc` checker](#missingphpdoc-checker)
    - [`nestedTernary` checker](#nestedternary-checker)
-   - [`phpdoc` checker](#phpdoc-checker)
    - [`propNullDefault` checker (autofixable)](#propnulldefault-checker)
    - [`redundantCast` checker](#redundantcast-checker)
    - [`trailingComma` checker (autofixable)](#trailingcomma-checker)
@@ -1807,27 +1807,7 @@ $_ = is_float($a);
 <p><br></p>
 
 
-### `nestedTernary` checker
-
-#### Description
-
-Report an unspecified order in a nested ternary operator.
-
-#### Non-compliant code:
-```php
-$_ = 1 ? 2 : 3 ? 4 : 5; // There is no clear order of execution.
-```
-
-#### Compliant code:
-```php
-$_ = (1 ? 2 : 3) ? 4 : 5;
-// or
-$_ = 1 ? 2 : (3 ? 4 : 5);
-```
-<p><br></p>
-
-
-### `phpdoc` checker
+### `missingPhpdoc` checker
 
 #### Description
 
@@ -1857,6 +1837,26 @@ public function process($acts, $config) {
 <p><br></p>
 
 
+### `nestedTernary` checker
+
+#### Description
+
+Report an unspecified order in a nested ternary operator.
+
+#### Non-compliant code:
+```php
+$_ = 1 ? 2 : 3 ? 4 : 5; // There is no clear order of execution.
+```
+
+#### Compliant code:
+```php
+$_ = (1 ? 2 : 3) ? 4 : 5;
+// or
+$_ = 1 ? 2 : (3 ? 4 : 5);
+```
+<p><br></p>
+
+
 ### `propNullDefault` checker
 
 > Auto fix available
diff --git a/src/linter/report.go b/src/linter/report.go
index d850a5e..0a294ba 100644
--- a/src/linter/report.go
+++ b/src/linter/report.go
@@ -292,7 +292,7 @@ thisFunctionAlwaysExits();`,
 		},
 
 		{
-			Name:     "phpdoc",
+			Name:     "missingPhpdoc",
 			Default:  false,
 			Quickfix: false,
 			Comment:  `Report missing PHPDoc on public methods.`,
diff --git a/src/linter/root.go b/src/linter/root.go
index 24e7d1a..2d11c63 100644
--- a/src/linter/root.go
+++ b/src/linter/root.go
@@ -1088,7 +1088,7 @@ func (d *rootWalker) enterClassMethod(meth *ir.ClassMethodStmt) bool {
 		// Permit having "__call" and other magic method without comments.
 		if !insideInterface && !strings.HasPrefix(nm, "_") {
 			methodFQN := class.Name + "::" + nm
-			d.Report(meth.MethodName, LevelNotice, "phpdoc", "Missing PHPDoc for %s public method", methodFQN)
+			d.Report(meth.MethodName, LevelNotice, "missingPhpdoc", "Missing PHPDoc for %s public method", methodFQN)
 		}
 	}
 	d.checkCommentMisspellings(meth.MethodName, meth.Doc.Raw)


Test patch:
diff --git a/src/tests/golden/golden_test.go b/src/tests/golden/golden_test.go
index 26ddd7e..be50020 100644
--- a/src/tests/golden/golden_test.go
+++ b/src/tests/golden/golden_test.go
@@ -38,7 +38,7 @@ func TestGolden(t *testing.T) {
 		{
 			Name: "embeddedrules",
 			Disable: []string{
-				`deadCode`,
+				"deadCode",
 			},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
@@ -48,8 +48,8 @@ func TestGolden(t *testing.T) {
 		{
 			Name: "mustache",
 			Disable: []string{
-				`arraySyntax`,
-				`redundantCast`,
+				"arraySyntax",
+				"redundantCast",
 			},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
@@ -95,7 +95,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "parsedown",
-			Disable: []string{`phpdoc`, `arraySyntax`},
+			Disable: []string{"missingPhpdoc", "arraySyntax"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
 				`stubs/phpstorm-stubs/mbstring/mbstring.php`,
@@ -104,7 +104,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "underscore",
-			Disable: []string{`phpdoc`},
+			Disable: []string{"missingPhpdoc"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
 			},
@@ -112,7 +112,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "phprocksyd",
-			Disable: []string{`phpdoc`},
+			Disable: []string{"missingPhpdoc"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/standard/basic.php`,
 				`stubs/phpstorm-stubs/pcntl/pcntl.php`,
@@ -123,7 +123,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "flysystem",
-			Disable: []string{`redundantCast`},
+			Disable: []string{"redundantCast"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
 				`stubs/phpstorm-stubs/SPL/SPL.php`,
@@ -140,7 +140,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "inflector",
-			Disable: []string{"phpdoc"},
+			Disable: []string{"missingPhpdoc"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
 				`stubs/phpstorm-stubs/SPL/SPL.php`,
@@ -150,7 +150,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "options-resolver",
-			Disable: []string{"phpdoc"},
+			Disable: []string{"missingPhpdoc"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/SPL/SPL.php`,
 				`stubs/phpstorm-stubs/Reflection/Reflection.php`,
@@ -163,7 +163,7 @@ func TestGolden(t *testing.T) {
 
 		{
 			Name:    "twitter-api-php",
-			Disable: []string{"phpdoc", "arraySyntax"},
+			Disable: []string{"missingPhpdoc", "arraySyntax"},
 			Deps: []string{
 				`stubs/phpstorm-stubs/pcre/pcre.php`,
 				`stubs/phpstorm-stubs/SPL/SPL.php`,
diff --git a/src/tests/golden/testdata/flysystem/golden.txt b/src/tests/golden/testdata/flysystem/golden.txt
index 84b55a4..28f061a 100644
--- a/src/tests/golden/testdata/flysystem/golden.txt
+++ b/src/tests/golden/testdata/flysystem/golden.txt
@@ -55,10 +55,10 @@ WARNING phpdocRef: @see tag refers to unknown symbol League\Flysystem\ReadInterf
 WARNING phpdocRef: @see tag refers to unknown symbol League\Flysystem\ReadInterface::read at testdata/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php:41
      * @see League\Flysystem\ReadInterface::read()
             ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\Adapter\Polyfill\StreamedWritingTrait::write public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:58
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\Adapter\Polyfill\StreamedWritingTrait::write public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:58
     abstract public function write($pash, $contents, Config $config);
                              ^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\Adapter\Polyfill\StreamedWritingTrait::update public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:59
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\Adapter\Polyfill\StreamedWritingTrait::update public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:59
     abstract public function update($pash, $contents, Config $config);
                              ^^^^^^
 MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:63
@@ -100,16 +100,16 @@ WARNING unused: Variable $e is unused (use $_ to ignore this inspection or speci
 WARNING unused: Variable $e is unused (use $_ to ignore this inspection or specify --unused-var-regex flag) at testdata/flysystem/src/Plugin/PluggableTrait.php:89
         } catch (PluginNotFoundException $e) {
                                          ^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\SafeStorage::storeSafely public method at testdata/flysystem/src/SafeStorage.php:23
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\SafeStorage::storeSafely public method at testdata/flysystem/src/SafeStorage.php:23
     public function storeSafely($key, $value)
                     ^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\SafeStorage::retrieveSafely public method at testdata/flysystem/src/SafeStorage.php:28
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\SafeStorage::retrieveSafely public method at testdata/flysystem/src/SafeStorage.php:28
     public function retrieveSafely($key)
                     ^^^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\UnreadableFileException::forFileInfo public method at testdata/flysystem/src/UnreadableFileException.php:9
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\UnreadableFileException::forFileInfo public method at testdata/flysystem/src/UnreadableFileException.php:9
     public static function forFileInfo(SplFileInfo $fileInfo)
                            ^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \League\Flysystem\Util::isSeekableStream public method at testdata/flysystem/src/Util.php:258
+MAYBE   missingPhpdoc: Missing PHPDoc for \League\Flysystem\Util::isSeekableStream public method at testdata/flysystem/src/Util.php:258
     public static function isSeekableStream($resource)
                            ^^^^^^^^^^^^^^^^
 MAYBE   regexpSimplify: May re-write '#^[a-zA-Z]{1}:[^\\\/]#' as '#^[a-zA-Z]:[^\\/]#' at testdata/flysystem/src/Util.php:341
diff --git a/src/tests/golden/testdata/idn/golden.txt b/src/tests/golden/testdata/idn/golden.txt
index e76ec40..17aace3 100644
--- a/src/tests/golden/testdata/idn/golden.txt
+++ b/src/tests/golden/testdata/idn/golden.txt
@@ -1,4 +1,4 @@
-MAYBE   phpdoc: Missing PHPDoc for \Symfony\Polyfill\Intl\Idn\Idn::idn_to_ascii public method at testdata/idn/idn.php:64
+MAYBE   missingPhpdoc: Missing PHPDoc for \Symfony\Polyfill\Intl\Idn\Idn::idn_to_ascii public method at testdata/idn/idn.php:64
     public static function idn_to_ascii($domain, $options, $variant, &$idna_info = array())
                            ^^^^^^^^^^^^
 MAYBE   arraySyntax: Use the short form '[]' instead of the old 'array()' at testdata/idn/idn.php:64
@@ -10,7 +10,7 @@ WARNING errorSilence: Don't use @, silencing errors is bad practice at testdata/
 MAYBE   arraySyntax: Use the short form '[]' instead of the old 'array()' at testdata/idn/idn.php:87
         $idna_info = array(
                      
-MAYBE   phpdoc: Missing PHPDoc for \Symfony\Polyfill\Intl\Idn\Idn::idn_to_utf8 public method at testdata/idn/idn.php:96
+MAYBE   missingPhpdoc: Missing PHPDoc for \Symfony\Polyfill\Intl\Idn\Idn::idn_to_utf8 public method at testdata/idn/idn.php:96
     public static function idn_to_utf8($domain, $options, $variant, &$idna_info = array())
                            ^^^^^^^^^^^
 MAYBE   arraySyntax: Use the short form '[]' instead of the old 'array()' at testdata/idn/idn.php:96
diff --git a/src/tests/golden/testdata/mustache/golden.txt b/src/tests/golden/testdata/mustache/golden.txt
index da0164b..19a34ae 100644
--- a/src/tests/golden/testdata/mustache/golden.txt
+++ b/src/tests/golden/testdata/mustache/golden.txt
@@ -136,13 +136,13 @@ ERROR   undefined: Call to undefined method {\Mustache_Cache}->setLogger() at te
 MAYBE   ternarySimplify: Could rewrite as `$this->delimiters ?: '{{ }}'` at testdata/mustache/src/Mustache/Engine.php:628
             'delimiters'      => $this->delimiters ? $this->delimiters : '{{ }}',
                                  ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \Mustache_Exception_UnknownFilterException::getFilterName public method at testdata/mustache/src/Mustache/Exception/UnknownFilterException.php:34
+MAYBE   missingPhpdoc: Missing PHPDoc for \Mustache_Exception_UnknownFilterException::getFilterName public method at testdata/mustache/src/Mustache/Exception/UnknownFilterException.php:34
     public function getFilterName()
                     ^^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \Mustache_Exception_UnknownHelperException::getHelperName public method at testdata/mustache/src/Mustache/Exception/UnknownHelperException.php:34
+MAYBE   missingPhpdoc: Missing PHPDoc for \Mustache_Exception_UnknownHelperException::getHelperName public method at testdata/mustache/src/Mustache/Exception/UnknownHelperException.php:34
     public function getHelperName()
                     ^^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \Mustache_Exception_UnknownTemplateException::getTemplateName public method at testdata/mustache/src/Mustache/Exception/UnknownTemplateException.php:34
+MAYBE   missingPhpdoc: Missing PHPDoc for \Mustache_Exception_UnknownTemplateException::getTemplateName public method at testdata/mustache/src/Mustache/Exception/UnknownTemplateException.php:34
     public function getTemplateName()
                     ^^^^^^^^^^^^^^^
 WARNING regexpVet: '\w' intersects with '\d' in [\w\d\.] at testdata/mustache/src/Mustache/Loader/InlineLoader.php:115
diff --git a/src/tests/golden/testdata/qrcode/golden.txt b/src/tests/golden/testdata/qrcode/golden.txt
index a5c5b62..619629d 100644
--- a/src/tests/golden/testdata/qrcode/golden.txt
+++ b/src/tests/golden/testdata/qrcode/golden.txt
@@ -1,7 +1,7 @@
-MAYBE   phpdoc: Missing PHPDoc for \QRCode::output_image public method at testdata/qrcode/qrcode.php:45
+MAYBE   missingPhpdoc: Missing PHPDoc for \QRCode::output_image public method at testdata/qrcode/qrcode.php:45
   public function output_image() {
                   ^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for \QRCode::render_image public method at testdata/qrcode/qrcode.php:53
+MAYBE   missingPhpdoc: Missing PHPDoc for \QRCode::render_image public method at testdata/qrcode/qrcode.php:53
   public function render_image() {
                   ^^^^^^^^^^^^
 MAYBE   ternarySimplify: Could rewrite as `$this->options['bc'] ?? 'FFFFFF'` at testdata/qrcode/qrcode.php:59