Skip to content

Commit ae7bc95

Browse files
author
Vincent Langlet
committed
✨ Add squiz forbidden functions and discouraged functions rules
1 parent d1aa8fa commit ae7bc95

File tree

3 files changed

+11
-1
lines changed

3 files changed

+11
-1
lines changed

Symfony3Custom/Sniffs/Formatting/YodaConditionSniff.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,8 @@ public function process(PHP_CodeSniffer_File $phpcsFile, $stackPtr)
5959
$tokens[$i]['code'],
6060
array(T_CONSTANT_ENCAPSED_STRING, T_CLOSE_PARENTHESIS, T_OPEN_PARENTHESIS, T_RETURN),
6161
true
62-
)) {
62+
)
63+
) {
6364
return;
6465
}
6566
}

Symfony3Custom/ruleset.xml

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -59,6 +59,8 @@
5959
</rule>
6060

6161
<!-- Added by VincentLanglet repo -->
62+
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
63+
<rule ref="Squiz.PHP.ForbiddenFunctions"/>
6264
<rule ref="Squiz.Strings.DoubleQuoteUsage">
6365
<exclude name="Squiz.Strings.DoubleQuoteUsage.ContainsVar"/>
6466
</rule>

docs/standards.md

Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -88,6 +88,13 @@ We mainly respect the [Symfony Standard](./symfony.md) but
8888
<rule ref="Squiz.WhiteSpace.SemicolonSpacing"/>
8989
```
9090

91+
- Do not use `error_log`, `print_r`, `var_dump`, `sizeof`, `delete`, `print`, `is_null` and `create_function`
92+
93+
```
94+
<rule ref="Squiz.PHP.DiscouragedFunctions"/>
95+
<rule ref="Squiz.PHP.ForbiddenFunctions"/>
96+
```
97+
9198
### Custom
9299
- Some others checks are made about array (`=>` alignments and indentation)
93100

0 commit comments

Comments
 (0)