Skip to content

Commit 81bb234

Browse files
authored
Merge pull request #36 from moufmouf/bitly
Adding bitly links for most rules pointing to TCM best practices
2 parents b61c37d + ef79cdb commit 81bb234

10 files changed

+13
-13
lines changed

Diff for: src/Rules/Conditionals/SwitchMustContainDefaultRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function processNode(Node $switch, Scope $scope): array
3838
}
3939

4040
if (!$defaultFound) {
41-
$errors[] = sprintf(PrefixGenerator::generatePrefix($scope).'switch statement does not have a "default" case. If your code is supposed to enter at least one "case" or another, consider adding a "default" case that throws an exception.');
41+
$errors[] = sprintf(PrefixGenerator::generatePrefix($scope).'switch statement does not have a "default" case. If your code is supposed to enter at least one "case" or another, consider adding a "default" case that throws an exception. More info: http://bit.ly/switchdefault');
4242
}
4343

4444
return $errors;

Diff for: src/Rules/Exceptions/DoNotThrowExceptionBaseClassRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function processNode(Node $node, Scope $scope): array
3838

3939
if ($class === 'Exception') {
4040
return [
41-
'Do not throw the \Exception base class. Instead, extend the \Exception base class'
41+
'Do not throw the \Exception base class. Instead, extend the \Exception base class. More info: http://bit.ly/subtypeexception'
4242
];
4343
}
4444
}

Diff for: src/Rules/Exceptions/MustRethrowRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -76,7 +76,7 @@ public function isThrowFound(): bool
7676
$errors = [];
7777

7878
if (!$visitor->isThrowFound()) {
79-
$errors[] = sprintf('%scaught "%s" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception.', PrefixGenerator::generatePrefix($scope), $exceptionType);
79+
$errors[] = sprintf('%scaught "%s" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception. More info: http://bit.ly/failloud', PrefixGenerator::generatePrefix($scope), $exceptionType);
8080
}
8181

8282
return $errors;

Diff for: src/Rules/Exceptions/ThrowMustBundlePreviousExceptionRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -80,7 +80,7 @@ public function getUnusedThrows(): array
8080
$errors = [];
8181

8282
foreach ($visitor->getUnusedThrows() as $throw) {
83-
$errors[] = sprintf('Thrown exceptions in a catch block must bundle the previous exception (see throw statement line %d)', $throw->getLine());
83+
$errors[] = sprintf('Thrown exceptions in a catch block must bundle the previous exception (see throw statement line %d). More info: http://bit.ly/bundleexception', $throw->getLine());
8484
}
8585

8686
return $errors;

Diff for: src/Rules/Superglobals/NoSuperglobalsRule.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,7 +40,7 @@ public function processNode(Node $node, Scope $scope): array
4040
];
4141

4242
if (\in_array($node->name, $forbiddenGlobals, true)) {
43-
return [PrefixGenerator::generatePrefix($scope).'you should not use the $'.$node->name.' superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request).'];
43+
return [PrefixGenerator::generatePrefix($scope).'you should not use the $'.$node->name.' superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request). More info: http://bit.ly/nosuperglobals'];
4444
}
4545

4646
return [];

Diff for: tests/Rules/Conditionals/SwitchMustContainDefaultRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@ public function testProcessNode()
1515
{
1616
$this->analyse([__DIR__ . '/data/switch.php'], [
1717
[
18-
'In function "baz", switch statement does not have a "default" case. If your code is supposed to enter at least one "case" or another, consider adding a "default" case that throws an exception.',
18+
'In function "baz", switch statement does not have a "default" case. If your code is supposed to enter at least one "case" or another, consider adding a "default" case that throws an exception. More info: http://bit.ly/switchdefault',
1919
11,
2020
],
2121
]);

Diff for: tests/Rules/Exceptions/DoNotThrowExceptionBaseClassRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testCheckCatchedException()
1616
{
1717
$this->analyse([__DIR__ . '/data/throw_exception.php'], [
1818
[
19-
'Do not throw the \Exception base class. Instead, extend the \Exception base class',
19+
'Do not throw the \Exception base class. Instead, extend the \Exception base class. More info: http://bit.ly/subtypeexception',
2020
16,
2121
],
2222
]);

Diff for: tests/Rules/Exceptions/MustRethrowRuleTest.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -17,15 +17,15 @@ public function testCheckCatchedException()
1717
{
1818
$this->analyse([__DIR__ . '/data/must_rethrow.php'], [
1919
[
20-
'caught "Exception" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception.',
20+
'caught "Exception" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception. More info: http://bit.ly/failloud',
2121
18,
2222
],
2323
[
24-
'caught "Throwable" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception.',
24+
'caught "Throwable" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception. More info: http://bit.ly/failloud',
2525
24,
2626
],
2727
[
28-
'In function "TestCatch\foo", caught "RuntimeException" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception.',
28+
'In function "TestCatch\foo", caught "RuntimeException" must be rethrown. Either catch a more specific exception or add a "throw" clause in the "catch" block to propagate the exception. More info: http://bit.ly/failloud',
2929
31,
3030
],
3131
]);

Diff for: tests/Rules/Exceptions/ThrowMustBundlePreviousExceptionRuleTest.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@ public function testCheckCatchedException()
1616
{
1717
$this->analyse([__DIR__ . '/data/throw_must_bundle_previous_exception.php'], [
1818
[
19-
'Thrown exceptions in a catch block must bundle the previous exception (see throw statement line 28)',
19+
'Thrown exceptions in a catch block must bundle the previous exception (see throw statement line 28). More info: http://bit.ly/bundleexception',
2020
26,
2121
],
2222
]);

Diff for: tests/Rules/Superglobals/NoSuperglobalsRuleTest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@ public function testPost()
1717

1818
$this->analyse([__DIR__ . '/data/superglobals.php'], [
1919
[
20-
'In function "foo", you should not use the $_POST superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request).',
20+
'In function "foo", you should not use the $_POST superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request). More info: http://bit.ly/nosuperglobals',
2121
8,
2222
],
2323
[
24-
'In method "FooBarSuperGlobal::__construct", you should not use the $_GET superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request).',
24+
'In method "FooBarSuperGlobal::__construct", you should not use the $_GET superglobal. You should instead rely on your framework that provides you with a "request" object (for instance a PSR-7 RequestInterface or a Symfony Request). More info: http://bit.ly/nosuperglobals',
2525
15,
2626
],
2727
]);

0 commit comments

Comments
 (0)