Skip to content

Commit

Permalink
Merge pull request #13 from webimpress/hotfix/12-disable-UselessOverr…
Browse files Browse the repository at this point in the history
…idingMethod-sniff

Fix #12 - disable UselessOverridingMethod sniff
  • Loading branch information
geerteltink committed Jun 3, 2019
2 parents d7d46e0 + 1a856cc commit 58ee10c
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 29 deletions.
1 change: 0 additions & 1 deletion docs/book/v2/coding-style-guide.md
Expand Up @@ -356,7 +356,6 @@ $instance = new class extends Foo implements
- The code may not contain unreachable code. [*](ruleset.md#squizphpnonexecutablecode)
- The backtick operator may not be used for execution of shell commands. [*](ruleset.md#genericphpbacktickoperator)
- Class and Interface names should be unique in a project and must have a unique fully qualified name. [*](ruleset.md#genericclassesduplicateclassname)
- Methods that only call the parent method should not be defined. [*](ruleset.md#genericcodeanalysisuselessoverridingmethod)
- Files that contain PHP code should only have PHP code and should not have any _"inline HTML"_. [*](ruleset.md#genericfilesinlinehtml)
- There must be exactly one space after a type cast. [*](ruleset.md#genericformattingspaceaftercast)
- Constructors should be named `__construct`, not after the class. [*](ruleset.md#genericnamingconventionsconstructorname)
Expand Down
28 changes: 0 additions & 28 deletions docs/book/v2/ruleset.md
Expand Up @@ -113,34 +113,6 @@ final class Foo
}
```

### Generic.CodeAnalysis.UselessOverridingMethod
Methods that only call the parent method should not be defined.

*Valid: A method that extends functionality on a parent method.*
```php
<?php
final class Foo
{
public function bar() : void
{
parent::bar();
$this->doSomethingElse();
}
}
```

*Invalid: An overriding method that only calls the parent.*
```php
<?php
final class Foo
{
public function bar() : void
{
parent::bar();
}
}
```

### Generic.Files.InlineHTML
Files that contain PHP code should only have PHP code and should not have any _"inline HTML"_.

Expand Down
6 changes: 6 additions & 0 deletions src/ZendCodingStandard/ruleset.xml
Expand Up @@ -134,7 +134,13 @@
<!-- Forbid final methods in final classes -->
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
<!-- Forbid useless empty method overrides -->
<!--
The sniff is disabled because it's not working properly in case we change
default value of parameters.
See: https://github.com/zendframework/zend-coding-standard/issues/12
https://github.com/squizlabs/PHP_CodeSniffer/issues/519
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
-->
<!-- Forbid inline HTML in PHP code -->
<rule ref="Generic.Files.InlineHTML"/>
<!-- Force Unix LF (linefeed) line ending -->
Expand Down

0 comments on commit 58ee10c

Please sign in to comment.