1 | <?php |
||
23 | class PHPMD |
||
24 | { |
||
25 | /** |
||
26 | * The current PHPMD version. |
||
27 | */ |
||
28 | const VERSION = '@package_version@'; |
||
29 | |||
30 | /** |
||
31 | * This property will be set to <b>true</b> when an error |
||
32 | * was found in the processed source code. |
||
33 | * |
||
34 | * @var boolean |
||
35 | * @since 2.10.0 |
||
36 | */ |
||
37 | private $errors = false; |
||
38 | |||
39 | /** |
||
40 | * List of valid file extensions for analyzed files. |
||
41 | * |
||
42 | * @var array(string) |
||
43 | */ |
||
44 | private $fileExtensions = array('php', 'php3', 'php4', 'php5', 'inc'); |
||
45 | |||
46 | /** |
||
47 | * List of exclude directory patterns. |
||
48 | * |
||
49 | * @var array(string) |
||
50 | */ |
||
51 | private $ignorePatterns = array('.git', '.svn', 'CVS', '.bzr', '.hg', 'SCCS'); |
||
52 | |||
53 | /** |
||
54 | * The input source file or directory. |
||
55 | * |
||
56 | * @var string |
||
57 | */ |
||
58 | private $input; |
||
59 | |||
60 | /** |
||
61 | * This property will be set to <b>true</b> when a violation |
||
62 | * was found in the processed source code. |
||
63 | * |
||
64 | * @var boolean |
||
65 | * @since 0.2.5 |
||
66 | */ |
||
67 | private $violations = false; |
||
68 | |||
69 | /** |
||
70 | * Additional options for PHPMD or one of it's parser backends. |
||
71 | * |
||
72 | * @var array |
||
73 | * @since 1.2.0 |
||
74 | */ |
||
75 | 7 | private $options = array(); |
|
76 | |||
77 | 7 | /** |
|
78 | * This method will return <b>true</b> when the processed source code |
||
79 | * contains errors. |
||
80 | * |
||
81 | * @return boolean |
||
82 | * @since 2.10.0 |
||
83 | */ |
||
84 | public function hasErrors() |
||
88 | |||
89 | /** |
||
90 | * This method will return <b>true</b> when the processed source code |
||
91 | * contains violations. |
||
92 | * |
||
93 | * @return boolean |
||
94 | * @since 0.2.5 |
||
95 | */ |
||
96 | 11 | public function hasViolations() |
|
100 | |||
101 | /** |
||
102 | * Returns the input source file or directory path. |
||
103 | * |
||
104 | * @return string |
||
105 | */ |
||
106 | public function getInput() |
||
110 | |||
111 | /** |
||
112 | * Returns an array with valid php source file extensions. |
||
113 | * |
||
114 | * @return string[] |
||
115 | * @since 0.2.0 |
||
116 | */ |
||
117 | public function getFileExtensions() |
||
121 | |||
122 | /** |
||
123 | * Sets a list of filename extensions for valid php source code files. |
||
124 | * |
||
125 | * @param array<string> $fileExtensions Extensions without leading dot. |
||
126 | * @return void |
||
127 | */ |
||
128 | public function setFileExtensions(array $fileExtensions) |
||
132 | |||
133 | /** |
||
134 | * Returns an array with string patterns that mark a file path as invalid. |
||
135 | * |
||
136 | * @return string[] |
||
137 | * @since 0.2.0 |
||
138 | * @deprecated 3.0.0 Use getIgnorePatterns() instead, you always get a list of patterns. |
||
139 | */ |
||
140 | public function getIgnorePattern() |
||
144 | |||
145 | 11 | /** |
|
146 | * Returns an array with string patterns that mark a file path invalid. |
||
147 | * |
||
148 | * @return string[] |
||
149 | * @since 2.9.0 |
||
150 | */ |
||
151 | public function getIgnorePatterns() |
||
155 | |||
156 | 4 | /** |
|
157 | 4 | * Sets a list of ignore patterns that is used to exclude directories from |
|
158 | * the source analysis. |
||
159 | * |
||
160 | * @param array<string> $ignorePatterns List of ignore patterns. |
||
161 | * @return void |
||
162 | * @deprecated 3.0.0 Use addIgnorePatterns() instead, both will add an not set the patterns. |
||
163 | */ |
||
164 | public function setIgnorePattern(array $ignorePatterns) |
||
168 | |||
169 | /** |
||
170 | 11 | * Add a list of ignore patterns which is used to exclude directories from |
|
171 | * the source analysis. |
||
172 | * |
||
173 | * @param array<string> $ignorePatterns List of ignore patterns. |
||
174 | * @return $this |
||
175 | * @since 2.9.0 |
||
176 | */ |
||
177 | public function addIgnorePatterns(array $ignorePatterns) |
||
186 | |||
187 | 11 | /** |
|
188 | 11 | * Returns additional options for PHPMD or one of it's parser backends. |
|
189 | * |
||
190 | * @return array |
||
191 | 11 | */ |
|
192 | 11 | public function getOptions() |
|
196 | 11 | ||
197 | /** |
||
198 | * Sets additional options for PHPMD or one of it's parser backends. |
||
199 | 11 | * |
|
200 | 11 | * @param array $options Additional backend or PHPMD options. |
|
201 | * @return void |
||
202 | */ |
||
203 | 11 | public function setOptions(array $options) |
|
207 | 11 | ||
208 | 11 | /** |
|
209 | * This method will process all files that can be found in the given input |
||
210 | * path. It will apply rules defined in the comma-separated <b>$ruleSets</b> |
||
211 | * argument. The result will be passed to all given renderer instances. |
||
212 | * |
||
213 | * @param string $inputPath |
||
214 | * @param string $ruleSets |
||
215 | * @param \PHPMD\AbstractRenderer[] $renderers |
||
216 | * @param \PHPMD\RuleSetFactory $ruleSetFactory |
||
217 | * @return void |
||
218 | */ |
||
219 | public function processFiles( |
||
259 | } |
||
260 |
It seems like the type of the argument is not accepted by the function/method which you are calling.
In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.
We suggest to add an explicit type cast like in the following example: