Repository: VKCOM/noverify
Pull request #1026 (2021-07-04 20:25:17)

linter: fixed messages for some checks


Patch:
diff --git a/src/linter/block.go b/src/linter/block.go
index a52e11e..d4387c4 100644
--- a/src/linter/block.go
+++ b/src/linter/block.go
@@ -233,7 +233,7 @@ func (b *blockWalker) handleCommentToken(n ir.Node, t *token.Token) {
 	doc := phpdoc.Parse(b.r.ctx.phpdocTypeParser, string(t.Value))
 
 	if phpdoc.IsSuspicious(t.Value) {
-		b.r.Report(n, LevelWarning, "phpdocLint", "multiline phpdoc comment should start with /**, not /*")
+		b.r.Report(n, LevelWarning, "phpdocLint", "Multiline PHPDoc comment should start with /**, not /*")
 	}
 
 	for _, p := range doc.Parsed {
@@ -436,7 +436,7 @@ func (b *blockWalker) checkDupGlobal(s *ir.GlobalStmt) {
 		// Check whether this var was already global'ed.
 		// We use nonLocalVars for function-wide analysis and vars for local analysis.
 		if _, ok := vars[nm]; ok {
-			b.r.Report(v, LevelWarning, "dupGlobal", "global statement mentions $%s more than once", nm)
+			b.r.Report(v, LevelWarning, "dupGlobal", "Global statement mentions $%s more than once", nm)
 		} else {
 			vars[nm] = struct{}{}
 			if b.nonLocalVars[nm] == varGlobal {
@@ -774,7 +774,7 @@ func (b *blockWalker) checkUnreachableForFinallyReturn(tryStmt *ir.TryStmt, tryC
 	}
 
 	if catchContainsDie {
-		b.r.Report(tryStmt.Finally, LevelError, "deadCode", "block finally is unreachable (because catch block %d contains a exit/die)", catchWithDieIndex)
+		b.r.Report(tryStmt.Finally, LevelError, "deadCode", "Block finally is unreachable (because catch block %d contains a exit/die)", catchWithDieIndex)
 
 		// If there is an error when the finally block is unreachable,
 		// then errors due to return in finally are skipped.
@@ -1114,7 +1114,7 @@ func (b *blockWalker) handleForeach(s *ir.ForeachStmt) bool {
 
 		b.untrackVarName(key.Name)
 
-		b.r.Report(s.Key, LevelError, "unused", "foreach key $%s is unused, can simplify $%s => $%s to just $%s", key.Name, key.Name, variable.Name, variable.Name)
+		b.r.Report(s.Key, LevelError, "unused", "Foreach key $%s is unused, can simplify $%s => $%s to just $%s", key.Name, key.Name, variable.Name, variable.Name)
 	}
 
 	return false
@@ -1812,7 +1812,7 @@ func (b *blockWalker) paramClobberCheck(v *ir.SimpleVar) {
 		return
 	}
 	if _, ok := b.unusedParams[v.Name]; ok && !b.path.Conditional() {
-		b.r.Report(v, LevelWarning, "paramClobber", "$%s param re-assigned before being used", v.Name)
+		b.r.Report(v, LevelWarning, "paramClobber", "Param $%s re-assigned before being used", v.Name)
 	}
 }
 
diff --git a/src/linter/root.go b/src/linter/root.go
index e750e78..83c8872 100644
--- a/src/linter/root.go
+++ b/src/linter/root.go
@@ -825,7 +825,7 @@ func (d *rootWalker) enterPropertyList(pl *ir.PropertyListStmt) bool {
 
 	typeHintType, ok := d.parseTypeNode(pl.Type)
 	if ok && !d.typeHintHasMoreAccurateType(typeHintType, phpDocType) {
-		d.Report(pl, LevelNotice, "typeHint", "specify the type for the property in phpdoc, 'array' type hint too generic")
+		d.Report(pl, LevelNotice, "typeHint", "Specify the type for the property in PHPDoc, 'array' type hint too generic")
 	}
 
 	for _, pNode := range pl.Properties {
@@ -928,10 +928,13 @@ func (d *rootWalker) enterClassMethod(meth *ir.ClassMethodStmt) bool {
 		sc.SetInInstanceMethod(true)
 	}
 
+	class := d.getClass()
+
 	if meth.Doc.Raw == "" && modif.accessLevel == meta.Public {
 		// Permit having "__call" and other magic method without comments.
 		if !insideInterface && !strings.HasPrefix(nm, "_") {
-			d.Report(meth.MethodName, LevelNotice, "phpdoc", "Missing PHPDoc for %q public method", nm)
+			methodFQN := class.Name + "::" + nm
+			d.Report(meth.MethodName, LevelNotice, "phpdoc", "Missing PHPDoc for %s public method", methodFQN)
 		}
 	}
 	d.checkCommentMisspellings(meth.MethodName, meth.Doc.Raw)
@@ -942,8 +945,6 @@ func (d *rootWalker) enterClassMethod(meth *ir.ClassMethodStmt) bool {
 	phpDocReturnType := doc.returnType
 	phpDocParamTypes := doc.types
 
-	class := d.getClass()
-
 	returnTypeHint, ok := d.parseTypeNode(meth.ReturnType)
 	if ok && !doc.inherit {
 		d.checkFuncReturnType(meth.MethodName, meth.MethodName.Value, returnTypeHint, phpDocReturnType)
@@ -1050,7 +1051,7 @@ func (d *rootWalker) reportPhpdocErrors(n ir.Node, errs phpdocErrors) {
 
 func (d *rootWalker) parsePHPDocVar(n ir.Node, doc phpdoc.Comment) (m types.Map) {
 	if phpdoc.IsSuspicious([]byte(doc.Raw)) {
-		d.Report(n, LevelWarning, "phpdocLint", "multiline phpdoc comment should start with /**, not /*")
+		d.Report(n, LevelWarning, "phpdocLint", "Multiline PHPDoc comment should start with /**, not /*")
 	}
 
 	for _, part := range doc.Parsed {
@@ -1232,7 +1233,7 @@ func (d *rootWalker) checkPHPDocMixinRef(n ir.Node, part phpdoc.CommentPart) {
 	}
 
 	if _, ok := d.metaInfo().GetClass(name); !ok {
-		d.Report(n, LevelWarning, "phpdocRef", "line %d: @mixin tag refers to unknown class %s", part.Line(), name)
+		d.Report(n, LevelWarning, "phpdocRef", "Line %d: @mixin tag refers to unknown class %s", part.Line(), name)
 	}
 }
 
@@ -1244,7 +1245,7 @@ func (d *rootWalker) parsePHPDoc(n ir.Node, doc phpdoc.Comment, actualParams []i
 	}
 
 	if phpdoc.IsSuspicious([]byte(doc.Raw)) {
-		result.errs.pushLint("multiline phpdoc comment should start with /**, not /*")
+		result.errs.pushLint("Multiline PHPDoc comment should start with /**, not /*")
 	}
 
 	actualParamNames := make(map[string]struct{}, len(actualParams))
@@ -1356,7 +1357,7 @@ func (d *rootWalker) checkTypeNode(n ir.Node) {
 	for _, typ := range typeList {
 		if typ.Elem == "parent" && d.ctx.st.CurrentClass != "" {
 			if d.ctx.st.CurrentParentClass == "" {
-				d.Report(n, LevelError, "typeHint", "cannot use 'parent' typehint when current class has no parent")
+				d.Report(n, LevelError, "typeHint", "Cannot use 'parent' typehint when current class has no parent")
 			}
 		}
 	}
@@ -1618,14 +1619,14 @@ func (d *rootWalker) checkParamsTypeHint(funcName *ir.Identifier, funcParams par
 		}
 
 		if !d.typeHintHasMoreAccurateType(typeHintType, phpDocType) {
-			d.Report(funcName, LevelNotice, "typeHint", "specify the type for the parameter $%s in phpdoc, 'array' type hint too generic", param)
+			d.Report(funcName, LevelNotice, "typeHint", "Specify the type for the parameter $%s in PHPDoc, 'array' type hint too generic", param)
 		}
 	}
 }
 
 func (d *rootWalker) checkFuncReturnType(fun ir.Node, funcName string, returnTypeHint, phpDocReturnType types.Map) {
 	if !d.typeHintHasMoreAccurateType(returnTypeHint, phpDocReturnType) {
-		d.Report(fun, LevelNotice, "typeHint", "specify the return type for the function %s in phpdoc, 'array' type hint too generic", funcName)
+		d.Report(fun, LevelNotice, "typeHint", "Specify the return type for the function %s in PHPDoc, 'array' type hint too generic", funcName)
 	}
 }
 


Test patch:
diff --git a/src/tests/checkers/basic_test.go b/src/tests/checkers/basic_test.go
index bb349d9..f4c25ca 100644
--- a/src/tests/checkers/basic_test.go
+++ b/src/tests/checkers/basic_test.go
@@ -94,7 +94,7 @@ function f1($cond) {
   }
 }
 `)
-	test.Expect = []string{`global statement mentions $x more than once`}
+	test.Expect = []string{`Global statement mentions $x more than once`}
 	test.RunAndMatch()
 }
 
@@ -120,7 +120,7 @@ function f3() {
 }
 `)
 	test.Expect = []string{
-		`global statement mentions $x1 more than once`,
+		`Global statement mentions $x1 more than once`,
 		`$x2 already global'ed above`,
 		`$x3 already global'ed above`,
 	}
@@ -191,8 +191,8 @@ function f() {
 }
 `)
 	test.Expect = []string{
-		`foreach key $i is unused, can simplify $i => $v to just $v`,
-		`foreach key $i is unused, can simplify $i => $v to just $v`,
+		`Foreach key $i is unused, can simplify $i => $v to just $v`,
+		`Foreach key $i is unused, can simplify $i => $v to just $v`,
 	}
 	test.RunAndMatch()
 }
diff --git a/src/tests/checkers/oop_test.go b/src/tests/checkers/oop_test.go
index ffcb1ab..1c99d79 100644
--- a/src/tests/checkers/oop_test.go
+++ b/src/tests/checkers/oop_test.go
@@ -1447,7 +1447,7 @@ class Bar {
 `)
 	test.Expect = []string{
 		`Call to undefined method {\BarWithSomeMixin}->method3()`,
-		`line 4: @mixin tag refers to unknown class \Boo`,
+		`Line 4: @mixin tag refers to unknown class \Boo`,
 	}
 	test.RunAndMatch()
 }
diff --git a/src/tests/checkers/paramClobber_test.go b/src/tests/checkers/paramClobber_test.go
index abc0bfe..d7ee55f 100644
--- a/src/tests/checkers/paramClobber_test.go
+++ b/src/tests/checkers/paramClobber_test.go
@@ -58,7 +58,7 @@ function f($x) {
 }
 `)
 	test.Expect = []string{
-		`$x param re-assigned before being used`,
+		`Param $x re-assigned before being used`,
 	}
 	test.RunAndMatch()
 }
@@ -75,7 +75,7 @@ class C {
 }
 `)
 	test.Expect = []string{
-		`$x param re-assigned before being used`,
+		`Param $x re-assigned before being used`,
 	}
 	test.RunAndMatch()
 }
@@ -91,7 +91,7 @@ function f() {
 }
 `)
 	test.Expect = []string{
-		`$x param re-assigned before being used`,
+		`Param $x re-assigned before being used`,
 	}
 	test.RunAndMatch()
 }
diff --git a/src/tests/checkers/phpdoc_test.go b/src/tests/checkers/phpdoc_test.go
index 594bf89..6b16912 100644
--- a/src/tests/checkers/phpdoc_test.go
+++ b/src/tests/checkers/phpdoc_test.go
@@ -321,7 +321,7 @@ func TestPHPDocPresence(t *testing.T) {
 	class TheClass {
 		/**
 		 * This function is a good example.
-		 * It's public and has a phpdoc comment.
+		 * It's public and has a PHPDoc comment.
 		 */
 		public function documentedPub() {}
 
@@ -335,8 +335,8 @@ func TestPHPDocPresence(t *testing.T) {
 		protected function prot() {}
 	}`)
 	test.Expect = []string{
-		`Missing PHPDoc for "pub" public method`,
-		`Missing PHPDoc for "traitPub" public method`,
+		`Missing PHPDoc for \TheClass::pub public method`,
+		`Missing PHPDoc for \TheTrait::traitPub public method`,
 	}
 	test.RunAndMatch()
 }
@@ -513,11 +513,11 @@ function f2($a) {
 }
 `)
 	test.Expect = []string{
-		`multiline phpdoc comment should start with /**, not /*`,
-		`multiline phpdoc comment should start with /**, not /*`,
-		`multiline phpdoc comment should start with /**, not /*`,
-		`multiline phpdoc comment should start with /**, not /*`,
-		`multiline phpdoc comment should start with /**, not /*`,
+		`Multiline PHPDoc comment should start with /**, not /*`,
+		`Multiline PHPDoc comment should start with /**, not /*`,
+		`Multiline PHPDoc comment should start with /**, not /*`,
+		`Multiline PHPDoc comment should start with /**, not /*`,
+		`Multiline PHPDoc comment should start with /**, not /*`,
 	}
 	test.RunAndMatch()
 }
diff --git a/src/tests/checkers/typehint_test.go b/src/tests/checkers/typehint_test.go
index f589cff..3b53f4d 100644
--- a/src/tests/checkers/typehint_test.go
+++ b/src/tests/checkers/typehint_test.go
@@ -124,12 +124,12 @@ function f2() {
 }
 `)
 	test.Expect = []string{
-		`specify the type for the property in phpdoc, 'array' type hint too generic`,
-		`specify the type for the property in phpdoc, 'array' type hint too generic`,
-		`specify the type for the parameter $a in phpdoc, 'array' type hint too generic`,
-		`specify the return type for the function f1 in phpdoc, 'array' type hint too generic`,
-		`specify the type for the parameter $a in phpdoc, 'array' type hint too generic`,
-		`specify the return type for the function f in phpdoc, 'array' type hint too generic`,
+		`Specify the type for the property in PHPDoc, 'array' type hint too generic`,
+		`Specify the type for the property in PHPDoc, 'array' type hint too generic`,
+		`Specify the type for the parameter $a in PHPDoc, 'array' type hint too generic`,
+		`Specify the return type for the function f1 in PHPDoc, 'array' type hint too generic`,
+		`Specify the type for the parameter $a in PHPDoc, 'array' type hint too generic`,
+		`Specify the return type for the function f in PHPDoc, 'array' type hint too generic`,
 	}
 	linttest.RunFilterMatch(test, "typeHint")
 }
diff --git a/src/tests/golden/testdata/flysystem/golden.txt b/src/tests/golden/testdata/flysystem/golden.txt
index f6c77f2..b2ee795 100644
--- a/src/tests/golden/testdata/flysystem/golden.txt
+++ b/src/tests/golden/testdata/flysystem/golden.txt
@@ -19,31 +19,31 @@ WARNING phpdocRef: line 8: @see tag refers to unknown symbol League\Flysystem\Re
 WARNING phpdocRef: line 8: @see tag refers to unknown symbol League\Flysystem\ReadInterface::read at testdata/flysystem/src/Adapter/Polyfill/StreamedReadingTrait.php:43
     abstract public function read($path);
                              ^^^^
-MAYBE   phpdoc: Missing PHPDoc for "write" public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:58
+MAYBE   phpdoc: 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 "update" public method at testdata/flysystem/src/Adapter/Polyfill/StreamedWritingTrait.php:59
+MAYBE   phpdoc: 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
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:63
     public function write($path, $contents, array $config = [])
                     ^^^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:75
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:75
     public function writeStream($path, $resource, array $config = [])
                     ^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:93
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:93
     public function put($path, $contents, array $config = [])
                     ^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:108
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:108
     public function putStream($path, $resource, array $config = [])
                     ^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:146
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:146
     public function update($path, $contents, array $config = [])
                     ^^^^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:159
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:159
     public function updateStream($path, $resource, array $config = [])
                     ^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $config in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:257
+MAYBE   typeHint: Specify the type for the parameter $config in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Filesystem.php:257
     public function createDir($dirname, array $config = [])
                     ^^^^^^^^^
 WARNING unused: Variable $e is unused (use $_ to ignore this inspection or specify --unused-var-regex flag) at testdata/flysystem/src/Handler.php:129
@@ -64,16 +64,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 "storeSafely" public method at testdata/flysystem/src/SafeStorage.php:23
+MAYBE   phpdoc: 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 "retrieveSafely" public method at testdata/flysystem/src/SafeStorage.php:28
+MAYBE   phpdoc: 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 "forFileInfo" public method at testdata/flysystem/src/UnreadableFileException.php:9
+MAYBE   phpdoc: 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 "isSeekableStream" public method at testdata/flysystem/src/Util.php:258
+MAYBE   phpdoc: 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
@@ -82,7 +82,7 @@ MAYBE   regexpSimplify: May re-write '#^[a-zA-Z]{1}:[^\\\/]#' as '#^[a-zA-Z]:[^\
 MAYBE   regexpSimplify: May re-write '#^[a-zA-Z]{1}:$#' as '#^[a-zA-Z]:$#' at testdata/flysystem/src/Util.php:346
         if (preg_match('#^[a-zA-Z]{1}:$#', $basename)) {
                        ^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $entry in phpdoc, 'array' type hint too generic at testdata/flysystem/src/Util/ContentListingFormatter.php:52
+MAYBE   typeHint: Specify the type for the parameter $entry in PHPDoc, 'array' type hint too generic at testdata/flysystem/src/Util/ContentListingFormatter.php:52
     private function addPathInfo(array $entry)
                      ^^^^^^^^^^^
 WARNING unused: Variable $e is unused (use $_ to ignore this inspection or specify --unused-var-regex flag) at testdata/flysystem/src/Util/MimeType.php:208
diff --git a/src/tests/golden/testdata/idn/golden.txt b/src/tests/golden/testdata/idn/golden.txt
index b0ab42d..b6d65d7 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 "idn_to_ascii" public method at testdata/idn/idn.php:64
+MAYBE   phpdoc: 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 of old array syntax (use short form instead) at testdata/idn/idn.php:64
@@ -7,7 +7,7 @@ MAYBE   arraySyntax: Use of old array syntax (use short form instead) at testdat
 MAYBE   arraySyntax: Use of old array syntax (use short form instead) at testdata/idn/idn.php:87
         $idna_info = array(
                      
-MAYBE   phpdoc: Missing PHPDoc for "idn_to_utf8" public method at testdata/idn/idn.php:96
+MAYBE   phpdoc: 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 of old array syntax (use short form instead) 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 ade25ea..f6f6d29 100644
--- a/src/tests/golden/testdata/mustache/golden.txt
+++ b/src/tests/golden/testdata/mustache/golden.txt
@@ -121,13 +121,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 "getFilterName" public method at testdata/mustache/src/Mustache/Exception/UnknownFilterException.php:34
+MAYBE   phpdoc: 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 "getHelperName" public method at testdata/mustache/src/Mustache/Exception/UnknownHelperException.php:34
+MAYBE   phpdoc: 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 "getTemplateName" public method at testdata/mustache/src/Mustache/Exception/UnknownTemplateException.php:34
+MAYBE   phpdoc: 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/options-resolver/golden.txt b/src/tests/golden/testdata/options-resolver/golden.txt
index 53e017c..6466d80 100644
--- a/src/tests/golden/testdata/options-resolver/golden.txt
+++ b/src/tests/golden/testdata/options-resolver/golden.txt
@@ -1,7 +1,7 @@
-MAYBE   typeHint: specify the return type for the function getNormalizers in phpdoc, 'array' type hint too generic at testdata/options-resolver/Debug/OptionsResolverIntrospector.php:94
+MAYBE   typeHint: Specify the return type for the function getNormalizers in PHPDoc, 'array' type hint too generic at testdata/options-resolver/Debug/OptionsResolverIntrospector.php:94
     public function getNormalizers(string $option): array
                     ^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the return type for the function getDeprecation in phpdoc, 'array' type hint too generic at testdata/options-resolver/Debug/OptionsResolverIntrospector.php:116
+MAYBE   typeHint: Specify the return type for the function getDeprecation in PHPDoc, 'array' type hint too generic at testdata/options-resolver/Debug/OptionsResolverIntrospector.php:116
     public function getDeprecation(string $option): array
                     ^^^^^^^^^^^^^^
 MAYBE   deprecated: Call to deprecated method {\ReflectionParameter}->getClass() (7.4) at testdata/options-resolver/OptionsResolver.php:188
@@ -25,12 +25,12 @@ WARNING phpdocLint: @param for non-existing argument $message at testdata/option
 MAYBE   complexity: Too big method: more than 150 lines at testdata/options-resolver/OptionsResolver.php:917
     public function offsetGet($option, bool $triggerDeprecation = true)
                     ^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $invalidTypes in phpdoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1123
+MAYBE   typeHint: Specify the type for the parameter $invalidTypes in PHPDoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1123
     private function verifyTypes(string $type, $value, array &$invalidTypes, int $level = 0): bool
                      ^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $values in phpdoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1259
+MAYBE   typeHint: Specify the type for the parameter $values in PHPDoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1259
     private function formatValues(array $values): string
                      ^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $options in phpdoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1268
+MAYBE   typeHint: Specify the type for the parameter $options in PHPDoc, 'array' type hint too generic at testdata/options-resolver/OptionsResolver.php:1268
     private function formatOptions(array $options): string
                      ^^^^^^^^^^^^^
diff --git a/src/tests/golden/testdata/parsedown/golden.txt b/src/tests/golden/testdata/parsedown/golden.txt
index 60ce658..8a04095 100644
--- a/src/tests/golden/testdata/parsedown/golden.txt
+++ b/src/tests/golden/testdata/parsedown/golden.txt
@@ -1,19 +1,19 @@
-MAYBE   typeHint: specify the type for the parameter $lines in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:162
+MAYBE   typeHint: Specify the type for the parameter $lines in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:162
     protected function lines(array $lines)
                        ^^^^^
-MAYBE   typeHint: specify the type for the parameter $lines in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:167
+MAYBE   typeHint: Specify the type for the parameter $lines in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:167
     protected function linesElements(array $lines)
                        ^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Component in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:319
+MAYBE   typeHint: Specify the type for the parameter $Component in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:319
     protected function extractElement(array $Component)
                        ^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:428
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:428
     protected function blockCommentContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^^^^
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:560
                 'handler' => array(
                 ^
-MAYBE   typeHint: specify the type for the parameter $CurrentBlock in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:574
+MAYBE   typeHint: Specify the type for the parameter $CurrentBlock in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:574
     protected function blockList($Line, array $CurrentBlock = null)
                        ^^^^^^^^^
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:633
@@ -22,7 +22,7 @@ MAYBE   trailingComma: last element in a multi-line array must have a trailing c
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:630
                 'handler' => array(
                 ^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:643
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:643
     protected function blockListContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^
 MAYBE   ternarySimplify: Could rewrite as `$matches[1] ?? ''` at testdata/parsedown/parsedown.php:674
@@ -34,7 +34,7 @@ MAYBE   trailingComma: last element in a multi-line array must have a trailing c
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:680
                 'handler' => array(
                 ^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:729
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:729
     protected function blockListComplete(array $Block)
                        ^^^^^^^^^^^^^^^^^
 MAYBE   regexpSimplify: May re-write '/^>[ ]?+(.*+)/' as '/^> ?+(.*+)/' at testdata/parsedown/parsedown.php:750
@@ -43,19 +43,19 @@ MAYBE   regexpSimplify: May re-write '/^>[ ]?+(.*+)/' as '/^> ?+(.*+)/' at testd
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:755
                     'handler' => array(
                     ^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:767
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:767
     protected function blockQuoteContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^^
 MAYBE   regexpSimplify: May re-write '/^>[ ]?+(.*+)/' as '/^> ?+(.*+)/' at testdata/parsedown/parsedown.php:774
         if ($Line['text'][0] === '>' and preg_match('/^>[ ]?+(.*+)/', $Line['text'], $matches))
                                                     ^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:811
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:811
     protected function blockSetextHeader($Line, array $Block = null)
                        ^^^^^^^^^^^^^^^^^
 WARNING strictCmp: 3rd argument of in_array must be true when comparing strings at testdata/parsedown/parsedown.php:840
             if (in_array($element, $this->textLevelElements))
                 ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:857
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:857
     protected function blockMarkupContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^^^
 MAYBE   regexpSimplify: May re-write '/^\[(.+?)\]:[ ]*+<?(\S+?)>?(?:[ ]+["\'(](.+)["\')])?[ ]*+$/' as '/^\[(.+?)\]: *+<?(\S+?)>?(?: +["'(](.+)["')])? *+$/' at testdata/parsedown/parsedown.php:875
@@ -64,19 +64,19 @@ MAYBE   regexpSimplify: May re-write '/^\[(.+?)\]:[ ]*+<?(\S+?)>?(?:[ ]+["\'(](.
 MAYBE   ternarySimplify: Could rewrite as `$matches[3] ?? null` at testdata/parsedown/parsedown.php:881
                 'title' => isset($matches[3]) ? $matches[3] : null,
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:897
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:897
     protected function blockTable($Line, array $Block = null)
                        ^^^^^^^^^^
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:973
                 'handler' => array(
                 ^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1020
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1020
     protected function blockTableContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^^
 MAYBE   trailingComma: last element in a multi-line array must have a trailing comma at testdata/parsedown/parsedown.php:1046
                     'handler' => array(
                     ^
-MAYBE   typeHint: specify the type for the parameter $Block in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1093
+MAYBE   typeHint: Specify the type for the parameter $Block in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1093
     protected function paragraphContinue($Line, array $Block)
                        ^^^^^^^^^^^^^^^^^
 MAYBE   regexpSimplify: May re-write '/[ ]*+\n/' as '/ *+\n/' at testdata/parsedown/parsedown.php:1265
@@ -100,28 +100,28 @@ MAYBE   trailingComma: last element in a multi-line array must have a trailing c
 MAYBE   regexpSimplify: May re-write '/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui' as '~\bhttps?+:/{2}[^\s<]+\b/*+~ui' at testdata/parsedown/parsedown.php:1540
             and preg_match('/\bhttps?+:[\/]{2}[^\s<]+\b\/*+/ui', $Excerpt['context'], $matches, PREG_OFFSET_CAPTURE)
                            ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1591
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1591
     protected function handle(array $Element)
                        ^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1627
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1627
     protected function handleElementRecursive(array $Element)
                        ^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Elements in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1632
+MAYBE   typeHint: Specify the type for the parameter $Elements in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1632
     protected function handleElementsRecursive(array $Elements)
                        ^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1637
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1637
     protected function elementApplyRecursive($closure, array $Element)
                        ^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1653
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1653
     protected function elementApplyRecursiveDepthFirst($closure, array $Element)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Elements in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1669
+MAYBE   typeHint: Specify the type for the parameter $Elements in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1669
     protected function elementsApplyRecursive($closure, array $Elements)
                        ^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Elements in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1679
+MAYBE   typeHint: Specify the type for the parameter $Elements in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1679
     protected function elementsApplyRecursiveDepthFirst($closure, array $Elements)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1689
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1689
     protected function element(array $Element)
                        ^^^^^^^
 WARNING undefined: Variable $text might have not been defined at testdata/parsedown/parsedown.php:1755
@@ -130,7 +130,7 @@ WARNING undefined: Variable $text might have not been defined at testdata/parsed
 WARNING undefined: Variable $text might have not been defined at testdata/parsedown/parsedown.php:1759
                     $markup .= $text;
                                ^^^^^
-MAYBE   typeHint: specify the type for the parameter $Elements in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1773
+MAYBE   typeHint: Specify the type for the parameter $Elements in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1773
     protected function elements(array $Elements)
                        ^^^^^^^^
 MAYBE   ternarySimplify: Could rewrite as `$Element['autobreak'] ?? isset($Element['name'])` at testdata/parsedown/parsedown.php:1786
@@ -139,13 +139,13 @@ MAYBE   ternarySimplify: Could rewrite as `$Element['autobreak'] ?? isset($Eleme
 WARNING strictCmp: 3rd argument of in_array must be true when comparing strings at testdata/parsedown/parsedown.php:1807
         if ( ! in_array('', $lines)
                ^^^^^^^^^^^^^^^^^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1861
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1861
     protected function sanitiseElement(array $Element)
                        ^^^^^^^^^^^^^^^
 WARNING unused: Variable $val is unused (use $_ to ignore this inspection or specify --unused-var-regex flag) at testdata/parsedown/parsedown.php:1882
             foreach ($Element['attributes'] as $att => $val)
                                                        ^^^^
-MAYBE   typeHint: specify the type for the parameter $Element in phpdoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1900
+MAYBE   typeHint: Specify the type for the parameter $Element in PHPDoc, 'array' type hint too generic at testdata/parsedown/parsedown.php:1900
     protected function filterUnsafeUrlInAttribute(array $Element, $attribute)
                        ^^^^^^^^^^^^^^^^^^^^^^^^^^
 ERROR   classMembersOrder: Property $breaksEnabled must go before methods in the class Parsedown at testdata/parsedown/parsedown.php:66
diff --git a/src/tests/golden/testdata/qrcode/golden.txt b/src/tests/golden/testdata/qrcode/golden.txt
index ee92f44..87a2671 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 "output_image" public method at testdata/qrcode/qrcode.php:45
+MAYBE   phpdoc: Missing PHPDoc for \QRCode::output_image public method at testdata/qrcode/qrcode.php:45
   public function output_image() {
                   ^^^^^^^^^^^^
-MAYBE   phpdoc: Missing PHPDoc for "render_image" public method at testdata/qrcode/qrcode.php:53
+MAYBE   phpdoc: 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
diff --git a/src/tests/golden/testdata/underscore/golden.txt b/src/tests/golden/testdata/underscore/golden.txt
index 00f15ec..f07f6ff 100644
--- a/src/tests/golden/testdata/underscore/golden.txt
+++ b/src/tests/golden/testdata/underscore/golden.txt
@@ -175,7 +175,7 @@ MAYBE   arraySyntax: Use of old array syntax (use short form instead) at testdat
 MAYBE   arraySyntax: Use of old array syntax (use short form instead) at testdata/underscore/underscore.php:1102
     $filled_args = array();
                    ^^^^^^^
-ERROR   unused: foreach key $k is unused, can simplify $k => $v to just $v at testdata/underscore/underscore.php:1107
+ERROR   unused: Foreach key $k is unused, can simplify $k => $v to just $v at testdata/underscore/underscore.php:1107
       foreach($caller_args as $k=>$v) {
                               ^^
 ERROR   classMembersOrder: Property $_uniqueId must go before methods in the class __ at testdata/underscore/underscore.php:817
diff --git a/src/tests/inline/testdata/checkers/deadCode.php b/src/tests/inline/testdata/checkers/deadCode.php
index 57c4c3b..009eab4 100644
--- a/src/tests/inline/testdata/checkers/deadCode.php
+++ b/src/tests/inline/testdata/checkers/deadCode.php
@@ -30,7 +30,7 @@ function finallyReturnBadDieInCatch(): int {
         throwException();
     } catch (Exception $_) {
         die();
-    } finally { // want `block finally is unreachable (because catch block 1 contains a exit/die)`
+    } finally { // want `Block finally is unreachable (because catch block 1 contains a exit/die)`
         return 1;
     }
 }
@@ -44,7 +44,7 @@ function finallyReturnBadMultiplyExitPointInCatch(): int {
         } else {
             return 2;
         }
-    } finally { // want `block finally is unreachable (because catch block 1 contains a exit/die)`
+    } finally { // want `Block finally is unreachable (because catch block 1 contains a exit/die)`
         return 1;
     }
 }
@@ -81,7 +81,7 @@ function finallyReturnBadMultiplyCatchWithDie(): int {
         return 2;
     } catch (Exception $_) {
         die();
-    } finally { // want `block finally is unreachable (because catch block 2 contains a exit/die)`
+    } finally { // want `Block finally is unreachable (because catch block 2 contains a exit/die)`
         return 1;
     }
 }
@@ -93,7 +93,7 @@ function finallyReturnBadMultiplyCatchWithExit(): int {
         return 2;
     } catch (Exception $_) {
         exit();
-    } finally { // want `block finally is unreachable (because catch block 2 contains a exit/die)`
+    } finally { // want `Block finally is unreachable (because catch block 2 contains a exit/die)`
         return 1;
     }
 }
diff --git a/src/tests/inline/testdata/checkers/typeHint.php b/src/tests/inline/testdata/checkers/typeHint.php
index 8d36f0a..fa82f04 100644
--- a/src/tests/inline/testdata/checkers/typeHint.php
+++ b/src/tests/inline/testdata/checkers/typeHint.php
@@ -3,13 +3,13 @@
 class Boo {}
 
 class FooBad {
-    public parent $a; // want `cannot use 'parent' typehint when current class has no parent`
+    public parent $a; // want `Cannot use 'parent' typehint when current class has no parent`
 
-    public function f1(): parent { // want `cannot use 'parent' typehint when current class has no parent`
+    public function f1(): parent { // want `Cannot use 'parent' typehint when current class has no parent`
         return new Boo;
     }
 
-    public function f2(parent $a) { // want `cannot use 'parent' typehint when current class has no parent`
+    public function f2(parent $a) { // want `Cannot use 'parent' typehint when current class has no parent`
         return new Boo;
     }
 }