Skip to content

Commit

Permalink
✨ Disable `SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnn…
Browse files Browse the repository at this point in the history
…otation` (#52)
  • Loading branch information
dpi authored Jul 3, 2023
1 parent 38c0556 commit a4d68e3
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 38 deletions.
1 change: 1 addition & 0 deletions PreviousNextDrupal/ruleset.xml
Original file line number Diff line number Diff line change
Expand Up @@ -42,6 +42,7 @@
<exclude name="SlevomatCodingStandard.TypeHints.ReturnTypeHint.MissingTraversableTypeHintSpecification"/>
</rule>
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHintSpacing" />
<rule ref="SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation"><severity>0</severity></rule>

<!-- Squiz.PHP -->
<rule ref="Squiz.PHP.NonExecutableCode.Unreachable"><severity>0</severity></rule>
Expand Down
4 changes: 4 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -161,6 +161,10 @@ Developers are entrusted to properly self-describe code. Suggestions to improve

This rule has trouble with newer PHP syntax, especially expression throwables. In any case this rule is best enforced with static analysis.

#### SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation

This rule is too greedy about what it thinks is 'useless'. Unique detail is removed.

---

_Drupal is a registered trademark of Dries Buytaert._
Expand Down
13 changes: 0 additions & 13 deletions tests/Sniffs/ReturnTypeHintTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,6 @@

namespace PreviousNext\CodingStandard\Tests\Sniffs;

use SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff;

/**
* @covers \SlevomatCodingStandard\Sniffs\TypeHints\ReturnTypeHintSniff
* @see https://github.com/slevomat/coding-standard/blob/master/doc/type-hints.md#slevomatcodingstandardtypehintsreturntypehint-
Expand All @@ -28,17 +26,6 @@ public function testIgnoreTraversable(): void {
self::assertNoSniffError($report, 8);
}

public function testUseless(): void {
$report = self::checkFile(__DIR__ . '/fixtures/ReturnTypeHintUseless.php');
self::assertSniffError($report, 8, code: ReturnTypeHintSniff::CODE_USELESS_ANNOTATION);
}

public function testUselessWithDescription(): void {
$report = self::checkFile(__DIR__ . '/fixtures/ReturnTypeHintUselessWithDescription.php');
self::assertSame(0, $report->getErrorCount());
self::assertNoSniffError($report, 8);
}

protected static function getSniffName(): string {
return 'SlevomatCodingStandard.TypeHints.ReturnTypeHint';
}
Expand Down
12 changes: 0 additions & 12 deletions tests/Sniffs/fixtures/ReturnTypeHintUseless.php

This file was deleted.

13 changes: 0 additions & 13 deletions tests/Sniffs/fixtures/ReturnTypeHintUselessWithDescription.php

This file was deleted.

0 comments on commit a4d68e3

Please sign in to comment.