Skip to content

Commit 0012055

Browse files
committed
Generic.CodeAnalysis.UnusedFunctionParameter: Settings for symfony/console, slimapi/slimapi
Used forked version of PHP_CodeSniffer, waiting for: * squizlabs/PHP_CodeSniffer#2967 * squizlabs/PHP_CodeSniffer#3017
1 parent 2db51b6 commit 0012055

File tree

3 files changed

+84
-74
lines changed

3 files changed

+84
-74
lines changed

composer.json

Lines changed: 5 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,11 @@
1212
},
1313
"require": {
1414
"php": "~7.3",
15-
"squizlabs/php_codesniffer": "~3.5.5",
16-
"slevomat/coding-standard": "~6.3.5"
15+
"o5/php_codesniffer": "~3.5.6",
16+
"slevomat/coding-standard": "~6.3.10"
17+
},
18+
"replace": {
19+
"squizlabs/php_codesniffer": "3.5.5"
1720
},
1821
"scripts": {
1922
"sniffs": "./vendor/bin/phpcs --standard=src/ruleset.xml -e > sniffs.txt",

src/ruleset.xml

Lines changed: 8 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -82,7 +82,14 @@
8282
<rule ref="Generic.CodeAnalysis.JumbledIncrementer"/>
8383
<rule ref="Generic.CodeAnalysis.UnconditionalIfStatement"/>
8484
<rule ref="Generic.CodeAnalysis.UnnecessaryFinalModifier"/>
85-
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter"/>
85+
<rule ref="Generic.CodeAnalysis.UnusedFunctionParameter">
86+
<properties>
87+
<property name="ignoreTypeHints" type="array">
88+
<element value="InputInterface"/>
89+
<element value="Request"/>
90+
</property>
91+
</properties>
92+
</rule>
8693
<rule ref="Generic.CodeAnalysis.UselessOverridingMethod"/>
8794
<rule ref="Generic.Files.EndFileNewline"/>
8895
<rule ref="Generic.Files.InlineHTML"/>

standard.md

Lines changed: 71 additions & 71 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,8 @@
11
# SlimAPI Coding Standard
22

3+
## Multiple Empty Lines
4+
Multiple consecutive newlines in a file are not allowed.
5+
36
## Strict Types Declaration
47
When declaring strict types you should not put whitespace around the opening bracket or before the closing bracket.
58
<table>
@@ -21,9 +24,6 @@ When declaring strict types you should not put whitespace around the opening bra
2124
</tr>
2225
</table>
2326

24-
## Multiple Empty Lines
25-
Multiple consecutive newlines in a file are not allowed.
26-
2727
## Class Declarations
2828
The opening brace of a class must be on the line after the definition by itself.
2929
<table>
@@ -262,31 +262,6 @@ Method names should not be prefixed with an underscore to indicate visibility.
262262
</tr>
263263
</table>
264264

265-
## Class Declarations
266-
There should be exactly 1 space between the abstract or final keyword and the class keyword and between the class keyword and the class name. The extends and implements keywords, if present, must be on the same line as the class name. When interfaces implemented are spread over multiple lines, there should be exactly 1 interface mentioned per line indented by 1 level. The closing brace of the class must go on the first line after the body of the class and must be on a line by itself.
267-
<table>
268-
<tr>
269-
<th>Valid: Correct spacing around class keyword.</th>
270-
<th>Invalid: 2 spaces used around class keyword.</th>
271-
</tr>
272-
<tr>
273-
<td>
274-
275-
abstract class Foo
276-
{
277-
}
278-
279-
</td>
280-
<td>
281-
282-
abstract class Foo
283-
{
284-
}
285-
286-
</td>
287-
</tr>
288-
</table>
289-
290265
## Property Declarations
291266
Property names should not be prefixed with an underscore to indicate visibility. Visibility should be used to declare properties rather than the var keyword. Only one property should be declared within a statement. The static declaration must come after the visibility declaration.
292267
<table>
@@ -388,6 +363,31 @@ Property names should not be prefixed with an underscore to indicate visibility.
388363
</tr>
389364
</table>
390365

366+
## Class Declarations
367+
There should be exactly 1 space between the abstract or final keyword and the class keyword and between the class keyword and the class name. The extends and implements keywords, if present, must be on the same line as the class name. When interfaces implemented are spread over multiple lines, there should be exactly 1 interface mentioned per line indented by 1 level. The closing brace of the class must go on the first line after the body of the class and must be on a line by itself.
368+
<table>
369+
<tr>
370+
<th>Valid: Correct spacing around class keyword.</th>
371+
<th>Invalid: 2 spaces used around class keyword.</th>
372+
</tr>
373+
<tr>
374+
<td>
375+
376+
abstract class Foo
377+
{
378+
}
379+
380+
</td>
381+
<td>
382+
383+
abstract class Foo
384+
{
385+
}
386+
387+
</td>
388+
</tr>
389+
</table>
390+
391391
## Namespace Declarations
392392
Each use declaration must contain only one namespace and must come after the first namespace declaration. There should be one blank line after the final use statement.
393393
<table>
@@ -483,29 +483,28 @@ There must be one blank line after the namespace declaration.
483483
</tr>
484484
</table>
485485

486-
## Elseif Declarations
487-
PHP's elseif keyword should be used instead of else if.
486+
## End File Newline
487+
PHP Files should end with exactly one newline.
488+
489+
## Control Structure Spacing
490+
Control Structures should have 0 spaces after opening parentheses and 0 spaces before closing parentheses.
488491
<table>
489492
<tr>
490-
<th>Valid: Single word elseif keyword used.</th>
491-
<th>Invalid: Separate else and if keywords used.</th>
493+
<th>Valid: Correct spacing.</th>
494+
<th>Invalid: Whitespace used inside the parentheses.</th>
492495
</tr>
493496
<tr>
494497
<td>
495498

496499
if ($foo) {
497500
$var = 1;
498-
} elseif ($bar) {
499-
$var = 2;
500501
}
501502

502503
</td>
503504
<td>
504505

505-
if ($foo) {
506+
if ( $foo ) {
506507
$var = 1;
507-
} else if ($bar) {
508-
$var = 2;
509508
}
510509

511510
</td>
@@ -642,34 +641,35 @@ Case statements should be indented 4 spaces from the switch keyword. It should
642641
</tr>
643642
</table>
644643

645-
## Control Structure Spacing
646-
Control Structures should have 0 spaces after opening parentheses and 0 spaces before closing parentheses.
644+
## Elseif Declarations
645+
PHP's elseif keyword should be used instead of else if.
647646
<table>
648647
<tr>
649-
<th>Valid: Correct spacing.</th>
650-
<th>Invalid: Whitespace used inside the parentheses.</th>
648+
<th>Valid: Single word elseif keyword used.</th>
649+
<th>Invalid: Separate else and if keywords used.</th>
651650
</tr>
652651
<tr>
653652
<td>
654653

655654
if ($foo) {
656655
$var = 1;
656+
} elseif ($bar) {
657+
$var = 2;
657658
}
658659

659660
</td>
660661
<td>
661662

662-
if ( $foo ) {
663+
if ($foo) {
663664
$var = 1;
665+
} else if ($bar) {
666+
$var = 2;
664667
}
665668

666669
</td>
667670
</tr>
668671
</table>
669672

670-
## End File Newline
671-
PHP Files should end with exactly one newline.
672-
673673
## Method Name
674674
Method names MUST be declared in camelCase.
675675
<table>
@@ -2101,6 +2101,31 @@ All array values must be followed by a comma, including the final value.
21012101
</tr>
21022102
</table>
21032103

2104+
## Lowercase Class Keywords
2105+
The php keywords class, interface, trait, extends, implements, abstract, final, var, and const should be lowercase.
2106+
<table>
2107+
<tr>
2108+
<th>Valid: Lowercase class keywords.</th>
2109+
<th>Invalid: Initial capitalization of class keywords.</th>
2110+
</tr>
2111+
<tr>
2112+
<td>
2113+
2114+
final class Foo extends Bar
2115+
{
2116+
}
2117+
2118+
</td>
2119+
<td>
2120+
2121+
Final Class Foo Extends Bar
2122+
{
2123+
}
2124+
2125+
</td>
2126+
</tr>
2127+
</table>
2128+
21042129
## Self Member Reference
21052130
The self keyword should be used instead of the current class name, should be lowercase, and should not have spaces before or after it.
21062131
<table>
@@ -2178,31 +2203,6 @@ The self keyword should be used instead of the current class name, should be low
21782203
</tr>
21792204
</table>
21802205

2181-
## Lowercase Class Keywords
2182-
The php keywords class, interface, trait, extends, implements, abstract, final, var, and const should be lowercase.
2183-
<table>
2184-
<tr>
2185-
<th>Valid: Lowercase class keywords.</th>
2186-
<th>Invalid: Initial capitalization of class keywords.</th>
2187-
</tr>
2188-
<tr>
2189-
<td>
2190-
2191-
final class Foo extends Bar
2192-
{
2193-
}
2194-
2195-
</td>
2196-
<td>
2197-
2198-
Final Class Foo Extends Bar
2199-
{
2200-
}
2201-
2202-
</td>
2203-
</tr>
2204-
</table>
2205-
22062206
## Doc Comment Alignment
22072207
The asterisks in a doc comment should align, and there should be one space between the asterisk and tags.
22082208
<table>
@@ -2391,4 +2391,4 @@ Semicolons should not have spaces before them.
23912391
</td>
23922392
</tr>
23932393
</table>
2394-
Documentation generated on Sat May 16 17:15:02 2020 +0200 by [PHP_CodeSniffer 3.5.5](https://github.com/squizlabs/PHP_CodeSniffer)
2394+
Documentation generated on Fri, 17 Jul 2020 21:19:25 +0000 by [PHP_CodeSniffer 3.5.6](https://github.com/squizlabs/PHP_CodeSniffer)

0 commit comments

Comments
 (0)