mirror of
https://github.com/RSS-Bridge/rss-bridge.git
synced 2025-08-02 17:14:38 +02:00
Updated Classes (markdown)
parent
748feeb3e2
commit
f0da186194
1 changed files with 55 additions and 1 deletions
56
Classes.md
56
Classes.md
|
@ -76,4 +76,58 @@ class MyClass extends BaseClass {
|
|||
|
||||
</div></details><br>
|
||||
|
||||
_Reference_: [`Generic.CodeAnalysis.UselessOverridingMethod`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php)
|
||||
_Reference_: [`Generic.CodeAnalysis.UselessOverridingMethod`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/Generic/Sniffs/CodeAnalysis/UselessOverridingMethodSniff.php)
|
||||
|
||||
# abstract and final declarations MUST precede the visibility declaration
|
||||
|
||||
When declaring `abstract` and `final` functions, the visibility (scope) must follow after `abstract` or `final`.
|
||||
|
||||
<details><summary>Example</summary><div><br>
|
||||
|
||||
**Bad**
|
||||
|
||||
```PHP
|
||||
class MyClass extends BaseClass {
|
||||
public abstract function AbstractFunction() { }
|
||||
public final function FinalFunction() { }
|
||||
}
|
||||
```
|
||||
|
||||
**Good** (`abstract` and `final` before `public`)
|
||||
|
||||
```PHP
|
||||
class MyClass extends BaseClass {
|
||||
abstract public function AbstractFunction() { }
|
||||
final public function FinalFunction() { }
|
||||
}
|
||||
```
|
||||
|
||||
</div></details><br>
|
||||
|
||||
_Reference_: [`PSR2.Methods.MethodDeclaration`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php)
|
||||
|
||||
# static declaration MUST come after the visibility declaration
|
||||
|
||||
The `static` keyword must come after the visibility (scope) parameter.
|
||||
|
||||
<details><summary>Example</summary><div><br>
|
||||
|
||||
**Bad**
|
||||
|
||||
```PHP
|
||||
class MyClass extends BaseClass {
|
||||
static public function StaticFunction() { }
|
||||
}
|
||||
```
|
||||
|
||||
**Good** (`static` after `public`)
|
||||
|
||||
```PHP
|
||||
class MyClass extends BaseClass {
|
||||
public static function StaticFunction() { }
|
||||
}
|
||||
```
|
||||
|
||||
</div></details><br>
|
||||
|
||||
_Reference_: [`PSR2.Methods.MethodDeclaration`](https://github.com/squizlabs/PHP_CodeSniffer/blob/master/src/Standards/PSR2/Sniffs/Methods/MethodDeclarationSniff.php)
|
Loading…
Add table
Add a link
Reference in a new issue