forked from illusori/PHP_Codesniffer-VariableAnalysis
-
Notifications
You must be signed in to change notification settings - Fork 2
Expand file tree
/
Copy pathphpcs_example.xml
More file actions
71 lines (69 loc) · 2.9 KB
/
phpcs_example.xml
File metadata and controls
71 lines (69 loc) · 2.9 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
42
43
44
45
46
47
48
49
50
51
52
53
54
55
56
57
58
59
60
61
62
63
64
65
66
67
68
69
70
71
<?xml version="1.0"?>
<ruleset name="Variable Analysis">
<description>Copy this to your ~/phpcs.xml after doing composer require --global ksjogo/variable-analysis.</description>
<!-- If you want everything, with the defaults, just include this line -->
<rule ref="VariableAnalysis"/>
<!-- Or iclude this block to customize VariableAnalysis behaviour -->
<rule ref="VariableAnalysis.VariableAnalysis.VariableAnalysis">
<properties>
<!--
We are not doing any deep analysis, so we cannot check nested instance variables etc.
Just allow them.
-->
<property name="allowInstanceVariables" value="false"/>
<!--
Include the following property if you want to include your own list of pass-by-reference
functions defined in your codebase.
Format is "function:argnum" or "function:argnum1,argnum2" etc.
Whitespace delimits function definitions.
Argument numbers start at 1 and an elipsis '...' means all argument numbers
after the previous should be considered pass-by-reference.
-->
<property name="sitePassByRefFunctions" value="
function_with_first_arg_by_ref:1
function_with_second_and_third_arg_by_ref:2,3
function_with_third_and_remaining_args_by_ref:3,...
"/>
<!--
Include the following property if you want to prevent exception variables declared
in a catch block from causing an unused variable warning, this supports the common
(but not always wanted) pattern of:
try {
// stuff here
} catch (Exception $e) {
// Do something without ever using $e
}
-->
<property name="allowUnusedCaughtExceptions" value="1"/>
<!--
Include the following property if you want to prevent function parametets from causing an
unused variable warning, this supports the common pattern of defining callback functions that
demand a fixed parameter list without actually using all the paramets.
function foo ($a, $b, $c) {
// Do something without ever using some of $a, $b and/or $c
}
-->
<property name="allowUnusedFunctionParameters" value="1"/>
<!--
Include the following property if you want to have a whitelist of variable names
that are commonly used for placeholder "junk" values that ignored and that you
don't want to provoke an unused variable warning for.
Format is "variableName" without a leading $ with whitespace delimiting names.
-->
<property name="validUnusedVariableNames" value="
junk
dummy
"/>
<!--
Include the following property if you want to have a whitelist of variable names
that are defined in all php files and that you don't want to provoke an undefined
variable warning for.
Format is "variableName" without a leading $ with whitespace delimiting names.
-->
<property name="validUndefinedVariableNames" value="
junk
dummy
"/>
</properties>
</rule>
</ruleset>