diff --git a/src/Analyser/FileAnalyser.php b/src/Analyser/FileAnalyser.php index f2f39c2556..806d86bbbc 100644 --- a/src/Analyser/FileAnalyser.php +++ b/src/Analyser/FileAnalyser.php @@ -91,7 +91,7 @@ public function analyseFile( $fileErrors[] = new Error($e->getMessage(), $file, $node->getLine(), false, null, null, $e->getTip()); continue; } catch (IdentifierNotFound $e) { - $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), false); + $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, $node->getLine(), false, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); continue; } @@ -232,7 +232,7 @@ public function analyseFile( } catch (\PHPStan\AnalysedCodeException $e) { $fileErrors[] = new Error($e->getMessage(), $file, null, false, null, null, $e->getTip()); } catch (IdentifierNotFound $e) { - $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, null, false); + $fileErrors[] = new Error(sprintf('Reflection error: %s not found.', $e->getIdentifier()->getName()), $file, null, false, null, null, 'Learn more at https://phpstan.org/user-guide/discovering-symbols'); } } elseif (is_dir($file)) { $fileErrors[] = new Error(sprintf('File %s is a directory.', $file), $file, null, false); diff --git a/src/Rules/Classes/ClassConstantRule.php b/src/Rules/Classes/ClassConstantRule.php index a1a517c0d5..5d96bde182 100644 --- a/src/Rules/Classes/ClassConstantRule.php +++ b/src/Rules/Classes/ClassConstantRule.php @@ -91,14 +91,14 @@ public function processNode(Node $node, Scope $scope): array if (strtolower($constantName) === 'class') { return [ - RuleErrorBuilder::message(sprintf('Class %s not found.', $className))->build(), + RuleErrorBuilder::message(sprintf('Class %s not found.', $className))->discoveringSymbolsTip()->build(), ]; } return [ RuleErrorBuilder::message( sprintf('Access to constant %s on an unknown class %s.', $constantName, $className) - )->build(), + )->discoveringSymbolsTip()->build(), ]; } else { $messages = $this->classCaseSensitivityCheck->checkClassNames([new ClassNameNodePair($className, $class)]); diff --git a/src/Rules/Classes/ExistingClassInClassExtendsRule.php b/src/Rules/Classes/ExistingClassInClassExtendsRule.php index b23c0a5bd1..53e049e9d1 100644 --- a/src/Rules/Classes/ExistingClassInClassExtendsRule.php +++ b/src/Rules/Classes/ExistingClassInClassExtendsRule.php @@ -50,7 +50,7 @@ public function processNode(Node $node, Scope $scope): array '%s extends unknown class %s.', $currentClassName !== null ? sprintf('Class %s', $currentClassName) : 'Anonymous class', $extendedClassName - ))->nonIgnorable()->build(); + ))->nonIgnorable()->discoveringSymbolsTip()->build(); } } else { $reflection = $this->reflectionProvider->getClass($extendedClassName); diff --git a/src/Rules/Classes/ExistingClassInInstanceOfRule.php b/src/Rules/Classes/ExistingClassInInstanceOfRule.php index 5cf38c106f..c0b83b1e4b 100644 --- a/src/Rules/Classes/ExistingClassInInstanceOfRule.php +++ b/src/Rules/Classes/ExistingClassInInstanceOfRule.php @@ -68,7 +68,7 @@ public function processNode(Node $node, Scope $scope): array } return [ - RuleErrorBuilder::message(sprintf('Class %s not found.', $name))->line($class->getLine())->build(), + RuleErrorBuilder::message(sprintf('Class %s not found.', $name))->line($class->getLine())->discoveringSymbolsTip()->build(), ]; } elseif ($this->checkClassCaseSensitivity) { return $this->classCaseSensitivityCheck->checkClassNames([new ClassNameNodePair($name, $class)]); diff --git a/src/Rules/Classes/ExistingClassInTraitUseRule.php b/src/Rules/Classes/ExistingClassInTraitUseRule.php index 12cb359287..a26b0b6387 100644 --- a/src/Rules/Classes/ExistingClassInTraitUseRule.php +++ b/src/Rules/Classes/ExistingClassInTraitUseRule.php @@ -65,7 +65,7 @@ public function processNode(Node $node, Scope $scope): array foreach ($node->traits as $trait) { $traitName = (string) $trait; if (!$this->reflectionProvider->hasClass($traitName)) { - $messages[] = RuleErrorBuilder::message(sprintf('%s uses unknown trait %s.', $currentName, $traitName))->nonIgnorable()->build(); + $messages[] = RuleErrorBuilder::message(sprintf('%s uses unknown trait %s.', $currentName, $traitName))->nonIgnorable()->discoveringSymbolsTip()->build(); } else { $reflection = $this->reflectionProvider->getClass($traitName); if ($reflection->isClass()) { diff --git a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php index 9c0b4ae69b..5e3bef9fb3 100644 --- a/src/Rules/Classes/ExistingClassesInClassImplementsRule.php +++ b/src/Rules/Classes/ExistingClassesInClassImplementsRule.php @@ -54,7 +54,7 @@ public function processNode(Node $node, Scope $scope): array '%s implements unknown interface %s.', $currentClassName !== null ? sprintf('Class %s', $currentClassName) : 'Anonymous class', $implementedClassName - ))->nonIgnorable()->build(); + ))->nonIgnorable()->discoveringSymbolsTip()->build(); } } else { $reflection = $this->reflectionProvider->getClass($implementedClassName); diff --git a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php index 4847172050..0dfc51bf64 100644 --- a/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php +++ b/src/Rules/Classes/ExistingClassesInInterfaceExtendsRule.php @@ -50,7 +50,7 @@ public function processNode(Node $node, Scope $scope): array 'Interface %s extends unknown interface %s.', $currentInterfaceName, $extendedInterfaceName - ))->nonIgnorable()->build(); + ))->nonIgnorable()->discoveringSymbolsTip()->build(); } } else { $reflection = $this->reflectionProvider->getClass($extendedInterfaceName); diff --git a/src/Rules/Classes/InstantiationRule.php b/src/Rules/Classes/InstantiationRule.php index 8b504943b8..5bfea4a2e5 100644 --- a/src/Rules/Classes/InstantiationRule.php +++ b/src/Rules/Classes/InstantiationRule.php @@ -120,7 +120,7 @@ private function checkClassName(string $class, Node $node, Scope $scope): array } return [ - RuleErrorBuilder::message(sprintf('Instantiated class %s not found.', $class))->build(), + RuleErrorBuilder::message(sprintf('Instantiated class %s not found.', $class))->discoveringSymbolsTip()->build(), ]; } else { $messages = $this->classCaseSensitivityCheck->checkClassNames([ diff --git a/src/Rules/Classes/MixinRule.php b/src/Rules/Classes/MixinRule.php index 4b2d5ac413..12a0a8fdd6 100644 --- a/src/Rules/Classes/MixinRule.php +++ b/src/Rules/Classes/MixinRule.php @@ -110,7 +110,7 @@ public function processNode(Node $node, Scope $scope): array foreach ($type->getReferencedClasses() as $class) { if (!$this->reflectionProvider->hasClass($class)) { - $errors[] = RuleErrorBuilder::message(sprintf('PHPDoc tag @mixin contains unknown class %s.', $class))->build(); + $errors[] = RuleErrorBuilder::message(sprintf('PHPDoc tag @mixin contains unknown class %s.', $class))->discoveringSymbolsTip()->build(); } elseif ($this->reflectionProvider->getClass($class)->isTrait()) { $errors[] = RuleErrorBuilder::message(sprintf('PHPDoc tag @mixin contains invalid type %s.', $class))->build(); } elseif ($this->checkClassCaseSensitivity) { diff --git a/src/Rules/Constants/ConstantRule.php b/src/Rules/Constants/ConstantRule.php index d380317484..8770d20c2f 100644 --- a/src/Rules/Constants/ConstantRule.php +++ b/src/Rules/Constants/ConstantRule.php @@ -24,7 +24,7 @@ public function processNode(Node $node, Scope $scope): array RuleErrorBuilder::message(sprintf( 'Constant %s not found.', (string) $node->name - ))->build(), + ))->discoveringSymbolsTip()->build(), ]; } diff --git a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php index 77b94c352f..d52cf8c680 100644 --- a/src/Rules/Exceptions/CaughtExceptionExistenceRule.php +++ b/src/Rules/Exceptions/CaughtExceptionExistenceRule.php @@ -47,7 +47,7 @@ public function processNode(Node $node, Scope $scope): array if ($scope->isInClassExists($className)) { continue; } - $errors[] = RuleErrorBuilder::message(sprintf('Caught class %s not found.', $className))->line($class->getLine())->build(); + $errors[] = RuleErrorBuilder::message(sprintf('Caught class %s not found.', $className))->line($class->getLine())->discoveringSymbolsTip()->build(); continue; } diff --git a/src/Rules/Functions/CallToNonExistentFunctionRule.php b/src/Rules/Functions/CallToNonExistentFunctionRule.php index 78b2b2f6e8..b4a10083f2 100644 --- a/src/Rules/Functions/CallToNonExistentFunctionRule.php +++ b/src/Rules/Functions/CallToNonExistentFunctionRule.php @@ -40,7 +40,7 @@ public function processNode(Node $node, Scope $scope): array if (!$this->reflectionProvider->hasFunction($node->name, $scope)) { return [ - RuleErrorBuilder::message(sprintf('Function %s not found.', (string) $node->name))->build(), + RuleErrorBuilder::message(sprintf('Function %s not found.', (string) $node->name))->discoveringSymbolsTip()->build(), ]; } diff --git a/src/Rules/Methods/CallStaticMethodsRule.php b/src/Rules/Methods/CallStaticMethodsRule.php index fd94d4fdc2..9b5c771fdf 100644 --- a/src/Rules/Methods/CallStaticMethodsRule.php +++ b/src/Rules/Methods/CallStaticMethodsRule.php @@ -129,7 +129,7 @@ public function processNode(Node $node, Scope $scope): array 'Call to static method %s() on an unknown class %s.', $methodName, $className - ))->build(), + ))->discoveringSymbolsTip()->build(), ]; } else { $errors = $this->classCaseSensitivityCheck->checkClassNames([new ClassNameNodePair($className, $class)]); diff --git a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php index 479e4152a7..b6854978f2 100644 --- a/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php +++ b/src/Rules/Namespaces/ExistingNamesInGroupUseRule.php @@ -76,7 +76,7 @@ public function processNode(Node $node, Scope $scope): array private function checkConstant(Node\Name $name): ?RuleError { if (!$this->reflectionProvider->hasConstant($name, null)) { - return RuleErrorBuilder::message(sprintf('Used constant %s not found.', (string) $name))->line($name->getLine())->build(); + return RuleErrorBuilder::message(sprintf('Used constant %s not found.', (string) $name))->discoveringSymbolsTip()->line($name->getLine())->build(); } return null; @@ -85,7 +85,7 @@ private function checkConstant(Node\Name $name): ?RuleError private function checkFunction(Node\Name $name): ?RuleError { if (!$this->reflectionProvider->hasFunction($name, null)) { - return RuleErrorBuilder::message(sprintf('Used function %s not found.', (string) $name))->line($name->getLine())->build(); + return RuleErrorBuilder::message(sprintf('Used function %s not found.', (string) $name))->discoveringSymbolsTip()->line($name->getLine())->build(); } if ($this->checkFunctionNameCase) { diff --git a/src/Rules/Namespaces/ExistingNamesInUseRule.php b/src/Rules/Namespaces/ExistingNamesInUseRule.php index 1a125bceaf..40a575934b 100644 --- a/src/Rules/Namespaces/ExistingNamesInUseRule.php +++ b/src/Rules/Namespaces/ExistingNamesInUseRule.php @@ -73,7 +73,7 @@ private function checkConstants(array $uses): array continue; } - $errors[] = RuleErrorBuilder::message(sprintf('Used constant %s not found.', (string) $use->name))->line($use->name->getLine())->build(); + $errors[] = RuleErrorBuilder::message(sprintf('Used constant %s not found.', (string) $use->name))->line($use->name->getLine())->discoveringSymbolsTip()->build(); } return $errors; @@ -88,7 +88,7 @@ private function checkFunctions(array $uses): array $errors = []; foreach ($uses as $use) { if (!$this->reflectionProvider->hasFunction($use->name, null)) { - $errors[] = RuleErrorBuilder::message(sprintf('Used function %s not found.', (string) $use->name))->line($use->name->getLine())->build(); + $errors[] = RuleErrorBuilder::message(sprintf('Used function %s not found.', (string) $use->name))->line($use->name->getLine())->discoveringSymbolsTip()->build(); } elseif ($this->checkFunctionNameCase) { $functionReflection = $this->reflectionProvider->getFunction($use->name, null); $realName = $functionReflection->getName(); diff --git a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php index ef6fa02bc3..02f9761f24 100644 --- a/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php +++ b/src/Rules/PhpDoc/InvalidPhpDocVarTagTypeRule.php @@ -144,7 +144,7 @@ public function processNode(Node $node, Scope $scope): array $errors[] = RuleErrorBuilder::message(sprintf( sprintf('%s contains unknown class %%s.', $identifier), $referencedClass - ))->build(); + ))->discoveringSymbolsTip()->build(); } if (!$this->checkClassCaseSensitivity) { diff --git a/src/Rules/Properties/AccessStaticPropertiesRule.php b/src/Rules/Properties/AccessStaticPropertiesRule.php index 6356d85966..1fec283302 100644 --- a/src/Rules/Properties/AccessStaticPropertiesRule.php +++ b/src/Rules/Properties/AccessStaticPropertiesRule.php @@ -113,7 +113,7 @@ public function processNode(Node $node, Scope $scope): array 'Access to static property $%s on an unknown class %s.', $name, $class - ))->build(), + ))->discoveringSymbolsTip()->build(), ]; } else { $messages = $this->classCaseSensitivityCheck->checkClassNames([new ClassNameNodePair($class, $node->class)]); diff --git a/src/Rules/Properties/ExistingClassesInPropertiesRule.php b/src/Rules/Properties/ExistingClassesInPropertiesRule.php index 6c190eef61..05cb04794b 100644 --- a/src/Rules/Properties/ExistingClassesInPropertiesRule.php +++ b/src/Rules/Properties/ExistingClassesInPropertiesRule.php @@ -77,7 +77,7 @@ public function processNode(Node $node, Scope $scope): array $propertyReflection->getDeclaringClass()->getDisplayName(), $node->name->name, $referencedClass - ))->build(); + ))->discoveringSymbolsTip()->build(); } if ($this->checkClassCaseSensitivity) { diff --git a/src/Rules/RuleErrorBuilder.php b/src/Rules/RuleErrorBuilder.php index fac7da86ed..13f0214b04 100644 --- a/src/Rules/RuleErrorBuilder.php +++ b/src/Rules/RuleErrorBuilder.php @@ -104,6 +104,11 @@ public function tip(string $tip): self return $this; } + public function discoveringSymbolsTip(): self + { + return $this->tip('Learn more at https://phpstan.org/user-guide/discovering-symbols'); + } + public function identifier(string $identifier): self { $this->properties['identifier'] = $identifier; diff --git a/src/Rules/RuleLevelHelper.php b/src/Rules/RuleLevelHelper.php index de359f0b2b..8d2c0d2686 100644 --- a/src/Rules/RuleLevelHelper.php +++ b/src/Rules/RuleLevelHelper.php @@ -157,7 +157,7 @@ public function findTypeToCheck( continue; } - $errors[] = RuleErrorBuilder::message(sprintf($unknownClassErrorPattern, $referencedClass))->line($var->getLine())->build(); + $errors[] = RuleErrorBuilder::message(sprintf($unknownClassErrorPattern, $referencedClass))->line($var->getLine())->discoveringSymbolsTip()->build(); } if (count($errors) > 0 || $hasClassExistsClass) { diff --git a/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php b/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php index 2c64be2e26..6025adb242 100644 --- a/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/IterableInForeachRuleTest.php @@ -29,6 +29,7 @@ public function testCheckWithMaybes(): void [ 'Iterating over an object of an unknown class IterablesInForeach\Bar.', 47, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php index 9d315091bd..51b23204c1 100644 --- a/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php +++ b/tests/PHPStan/Rules/Arrays/NonexistentOffsetInArrayDimFetchRuleTest.php @@ -36,10 +36,12 @@ public function testRule(): void [ 'Access to offset \'bar\' on an unknown class NonexistentOffset\Bar.', 101, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an offset on an unknown class NonexistentOffset\Bar.', 102, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Offset 0 does not exist on array.', diff --git a/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php b/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php index 25d480e13d..da9b3ff3d1 100644 --- a/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ClassConstantRuleTest.php @@ -29,6 +29,7 @@ public function testClassConstant(): void [ 'Class ClassConstantNamespace\Bar not found.', 6, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Using self outside of class scope.', @@ -53,6 +54,7 @@ public function testClassConstant(): void [ 'Access to constant FOO on an unknown class ClassConstantNamespace\UnknownClass.', 21, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class ClassConstantNamespace\Foo referenced with incorrect case: ClassConstantNamespace\FOO.', @@ -123,10 +125,12 @@ public function testClassConstantVisibility(): void [ 'Access to constant FOO on an unknown class ClassConstantVisibility\UnknownClassFirst.', 112, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to constant FOO on an unknown class ClassConstantVisibility\UnknownClassSecond.', 112, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Cannot access constant FOO on int|string.', @@ -149,14 +153,17 @@ public function testClassExists(): void [ 'Class UnknownClass\Bar not found.', 24, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class UnknownClass\Foo not found.', 26, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class UnknownClass\Foo not found.', 29, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php index c9a061443a..836894513f 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInClassExtendsRuleTest.php @@ -40,6 +40,7 @@ public function testRuleExtendsError(): void [ 'Class ExtendsError\Foo extends unknown class ExtendsError\Bar.', 5, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class ExtendsError\Lorem extends interface ExtendsError\BazInterface.', diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php index 424080859b..18d571f3e8 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInInstanceOfRuleTest.php @@ -32,6 +32,7 @@ public function testClassDoesNotExist(): void [ 'Class InstanceOfNamespace\Bar not found.', 7, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Using self outside of class scope.', diff --git a/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php index 42f73d58ef..826094c52a 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassInTraitUseRuleTest.php @@ -40,6 +40,7 @@ public function testTraitUseError(): void [ 'Class TraitUseError\Foo uses unknown trait TraitUseError\FooTrait.', 8, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], /*[ 'Trait TraitUseError\BarTrait uses class TraitUseError\Foo.', @@ -56,6 +57,7 @@ public function testTraitUseError(): void [ 'Anonymous class uses unknown trait TraitUseError\FooTrait.', 27, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Anonymous class uses interface TraitUseError\Baz.', diff --git a/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php index 3c6262a73b..72f58b2369 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassesInClassImplementsRuleTest.php @@ -40,6 +40,7 @@ public function testRuleImplementsError(): void [ 'Class ImplementsError\Foo implements unknown interface ImplementsError\Bar.', 5, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class ImplementsError\Lorem implements class ImplementsError\Foo.', diff --git a/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php b/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php index dca85d2a7b..196edc0421 100644 --- a/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php +++ b/tests/PHPStan/Rules/Classes/ExistingClassesInInterfaceExtendsRuleTest.php @@ -40,6 +40,7 @@ public function testRuleExtendsError(): void [ 'Interface InterfaceExtendsError\Foo extends unknown interface InterfaceExtendsError\Bar.', 5, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Interface InterfaceExtendsError\Lorem extends class InterfaceExtendsError\BazClass.', diff --git a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php index 0373e482ee..df1c4f4098 100644 --- a/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php +++ b/tests/PHPStan/Rules/Classes/InstantiationRuleTest.php @@ -45,6 +45,7 @@ public function testInstantiation(): void [ 'Instantiated class TestInstantiation\FooBarInstantiation not found.', 27, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class TestInstantiation\BarInstantiation constructor invoked with 0 parameters, 1 required.', @@ -61,6 +62,7 @@ public function testInstantiation(): void [ 'Instantiated class Test not found.', 33, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class DatePeriod constructor invoked with 0 parameters, 1-4 required.', @@ -153,14 +155,17 @@ public function testInstantiation(): void [ 'Instantiated class UndefinedClass1 not found.', 169, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Instantiated class UndefinedClass2 not found.', 172, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Instantiated class UndefinedClass3 not found.', 179, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class TestInstantiation\FinalClass does not have a constructor and must be instantiated without any parameters.', diff --git a/tests/PHPStan/Rules/Classes/MixinRuleTest.php b/tests/PHPStan/Rules/Classes/MixinRuleTest.php index 5d7b7c061d..f55594b784 100644 --- a/tests/PHPStan/Rules/Classes/MixinRuleTest.php +++ b/tests/PHPStan/Rules/Classes/MixinRuleTest.php @@ -60,6 +60,7 @@ public function testRule(): void [ 'PHPDoc tag @mixin contains unknown class MixinRule\UnknownestClass.', 50, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'PHPDoc tag @mixin contains invalid type MixinRule\FooTrait.', @@ -68,6 +69,7 @@ public function testRule(): void [ 'PHPDoc tag @mixin contains unknown class MixinRule\U.', 59, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Generic type MixinRule\Consecteur in PHPDoc tag @mixin does not specify all template types of class MixinRule\Consecteur: T, U', diff --git a/tests/PHPStan/Rules/Constants/ConstantRuleTest.php b/tests/PHPStan/Rules/Constants/ConstantRuleTest.php index a3294f4610..cef571f595 100644 --- a/tests/PHPStan/Rules/Constants/ConstantRuleTest.php +++ b/tests/PHPStan/Rules/Constants/ConstantRuleTest.php @@ -22,10 +22,12 @@ public function testConstants(): void [ 'Constant NONEXISTENT_CONSTANT not found.', 10, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Constant DEFINED_CONSTANT not found.', 13, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], /*[ 'Constant DEFINED_CONSTANT_IF not found.', @@ -45,6 +47,8 @@ public function testCompilerHaltOffsetConstantIsUndefinedDetection(): void [ 'Constant __COMPILER_HALT_OFFSET__ not found.', 3, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', + ], ]); } diff --git a/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php b/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php index ffb6c0bf33..9d7ee8ca2f 100644 --- a/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php +++ b/tests/PHPStan/Rules/Exceptions/CaughtExceptionExistenceRuleTest.php @@ -30,6 +30,8 @@ public function testCheckCaughtException(): void [ 'Caught class FooCatchException not found.', 29, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', + ], [ 'Class TestCatch\MyCatchException referenced with incorrect case: TestCatch\MyCatchEXCEPTION.', diff --git a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php index a800683d22..ce681ebb3b 100644 --- a/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallCallablesRuleTest.php @@ -85,6 +85,7 @@ public function testRule(): void [ 'Invoking callable on an unknown class CallCallables\Bar.', 90, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Parameter #1 ...$foo of closure expects CallCallables\Foo, array given.', diff --git a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php index 7249213abb..c03dd40888 100644 --- a/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php +++ b/tests/PHPStan/Rules/Functions/CallToNonExistentFunctionRuleTest.php @@ -30,6 +30,8 @@ public function testCallToNonexistentFunction(): void [ 'Function foobarNonExistentFunction not found.', 5, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', + ], ]); } @@ -40,6 +42,8 @@ public function testCallToNonexistentNestedFunction(): void [ 'Function barNonExistentFunction not found.', 5, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', + ], ]); } diff --git a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php index 04d32c4327..a07993abb2 100644 --- a/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallMethodsRuleTest.php @@ -71,6 +71,7 @@ public function testCallMethods(): void [ 'Call to method doFoo() on an unknown class Test\UnknownClass.', 63, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Result of method Test\Bar::returnsVoid() (void) is used.', @@ -195,10 +196,12 @@ public function testCallMethods(): void [ 'Call to method test() on an unknown class Test\FirstUnknownClass.', 312, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Call to method test() on an unknown class Test\SecondUnknownClass.', 312, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Cannot call method ipsum() on Test\Foo|null.', diff --git a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php index a900b4aefd..74a04b5fc3 100644 --- a/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php +++ b/tests/PHPStan/Rules/Methods/CallStaticMethodsRuleTest.php @@ -71,6 +71,7 @@ public function testCallStaticMethods(): void [ 'Call to static method loremIpsum() on an unknown class CallStaticMethods\UnknownStaticMethodClass.', 67, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Call to private method __construct() of class CallStaticMethods\ClassWithConstructor.', @@ -223,6 +224,7 @@ public function testCallStaticMethods(): void [ 'Call to static method doFoo() on an unknown class CallStaticMethods\TraitWithStaticMethod.', 328, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php b/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php index 8d8cce2c74..442d127776 100644 --- a/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php +++ b/tests/PHPStan/Rules/Namespaces/ExistingNamesInGroupUseRuleTest.php @@ -27,6 +27,7 @@ public function testRule(): void [ 'Used function Uses\baz not found.', 7, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Interface Uses\Lorem referenced with incorrect case: Uses\LOREM.', @@ -39,6 +40,7 @@ public function testRule(): void [ 'Used constant Uses\OTHER_CONSTANT not found.', 15, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php b/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php index e70e70037f..28e7a437ae 100644 --- a/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php +++ b/tests/PHPStan/Rules/Namespaces/ExistingNamesInUseRuleTest.php @@ -23,10 +23,12 @@ public function testRule(): void [ 'Used function Uses\bar not found.', 7, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Used constant Uses\OTHER_CONSTANT not found.', 8, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Function Uses\foo used with incorrect case: Uses\Foo.', diff --git a/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php b/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php index 89f4cf6ed5..939b973b26 100644 --- a/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php +++ b/tests/PHPStan/Rules/PhpDoc/InvalidPhpDocVarTagTypeRuleTest.php @@ -43,6 +43,7 @@ public function testRule(): void [ 'PHPDoc tag @var for variable $test contains unknown class InvalidVarTagType\aray.', 20, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'PHPDoc tag @var for variable $value contains unresolvable type.', diff --git a/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php index 14eaf47416..0742dcfe0b 100644 --- a/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessPropertiesRuleTest.php @@ -68,6 +68,7 @@ public function testAccessProperties(): void [ 'Access to property $foo on an unknown class TestAccessProperties\UnknownClass.', 63, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined property TestAccessProperties\FooAccessProperties::$emptyBaz.', @@ -96,10 +97,12 @@ public function testAccessProperties(): void [ 'Access to property $test on an unknown class TestAccessProperties\FirstUnknownClass.', 146, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to property $test on an unknown class TestAccessProperties\SecondUnknownClass.', 146, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined property TestAccessProperties\WithFooAndBarProperty|TestAccessProperties\WithFooProperty::$bar.', @@ -215,6 +218,7 @@ public function testAccessPropertiesWithoutUnionTypes(): void [ 'Access to property $foo on an unknown class TestAccessProperties\UnknownClass.', 63, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined property TestAccessProperties\FooAccessProperties::$emptyBaz.', @@ -243,10 +247,12 @@ public function testAccessPropertiesWithoutUnionTypes(): void [ 'Access to property $test on an unknown class TestAccessProperties\FirstUnknownClass.', 146, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to property $test on an unknown class TestAccessProperties\SecondUnknownClass.', 146, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined property TestAccessProperties\SomeInterface&TestAccessProperties\WithFooProperty::$bar.', @@ -384,18 +390,22 @@ public function testClassExists(): void [ 'Access to property $lorem on an unknown class AccessPropertiesClassExists\Bar.', 15, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to property $lorem on an unknown class AccessPropertiesClassExists\Baz.', 15, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to property $lorem on an unknown class AccessPropertiesClassExists\Baz.', 18, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to property $lorem on an unknown class AccessPropertiesClassExists\Bar.', 22, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php index b4ac8d1c7f..5890eb94d1 100644 --- a/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/AccessStaticPropertiesRuleTest.php @@ -54,6 +54,7 @@ public function testAccessStaticProperties(): void [ 'Access to static property $test on an unknown class UnknownStaticProperties.', 47, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined static property IpsumAccessStaticProperties::$baz.', @@ -114,6 +115,7 @@ public function testAccessStaticProperties(): void [ 'Access to static property $test on an unknown class NonexistentClass.', 97, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Access to an undefined static property FooAccessStaticProperties&SomeInterface::$nonexistent.', @@ -174,6 +176,7 @@ public function testAccessStaticProperties(): void [ 'Access to static property $foo on an unknown class TraitWithStaticProperty.', 209, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php index afc0245723..305d6a7a23 100644 --- a/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php +++ b/tests/PHPStan/Rules/Properties/ExistingClassesInPropertiesRuleTest.php @@ -32,26 +32,32 @@ public function testNonexistentClass(): void [ 'Property PropertiesTypes\Foo::$bar has unknown class PropertiesTypes\Bar as its type.', 12, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$bars has unknown class PropertiesTypes\Bar as its type.', 18, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$dolors has unknown class PropertiesTypes\Dolor as its type.', 21, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$dolors has unknown class PropertiesTypes\Ipsum as its type.', 21, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$fooWithWrongCase has unknown class PropertiesTypes\BAR as its type.', 24, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$fooWithWrongCase has unknown class PropertiesTypes\Fooo as its type.', 24, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Class PropertiesTypes\Foo referenced with incorrect case: PropertiesTypes\FOO.', @@ -64,10 +70,12 @@ public function testNonexistentClass(): void [ 'Property PropertiesTypes\Foo::$nonexistentClassInGenericObjectType has unknown class PropertiesTypes\Foooo as its type.', 33, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesTypes\Foo::$nonexistentClassInGenericObjectType has unknown class PropertiesTypes\Barrrr as its type.', 33, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ] ); @@ -83,14 +91,17 @@ public function testNativeTypes(): void [ 'Property PropertiesNativeTypes\Foo::$bar has unknown class PropertiesNativeTypes\Bar as its type.', 10, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesNativeTypes\Foo::$baz has unknown class PropertiesNativeTypes\Baz as its type.', 13, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], [ 'Property PropertiesNativeTypes\Foo::$baz has unknown class PropertiesNativeTypes\Baz as its type.', 13, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); } diff --git a/tests/PHPStan/Rules/Variables/ThrowTypeRuleTest.php b/tests/PHPStan/Rules/Variables/ThrowTypeRuleTest.php index 3ffaad172d..f674af7523 100644 --- a/tests/PHPStan/Rules/Variables/ThrowTypeRuleTest.php +++ b/tests/PHPStan/Rules/Variables/ThrowTypeRuleTest.php @@ -39,6 +39,7 @@ public function testRule(): void [ 'Throwing object of an unknown class ThrowValues\NonexistentClass.', 44, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ] ); diff --git a/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php b/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php index ab47ab9b44..4371c48567 100644 --- a/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php +++ b/tests/PHPStan/Rules/Variables/VariableCloningRuleTest.php @@ -37,6 +37,7 @@ public function testClone(): void [ 'Cloning object of an unknown class VariableCloning\Bar.', 23, + 'Learn more at https://phpstan.org/user-guide/discovering-symbols', ], ]); }