This project does not seem to handle request data directly as such no vulnerable execution paths were found.
include
, or for example
via PHP's auto-loading mechanism.
These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more
1 | <?php |
||
2 | |||
3 | class Kint_ObjectTest extends PHPUnit_Framework_TestCase |
||
0 ignored issues
–
show
|
|||
4 | { |
||
5 | public function testAddRepresentation() |
||
6 | { |
||
7 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
8 | |||
9 | $this->assertSame(array(), $o->representations); |
||
10 | $this->assertSame(null, $o->value); |
||
11 | |||
12 | $this->assertTrue($o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1'))); |
||
13 | $this->assertSame( |
||
14 | array( |
||
15 | $r1->name => $r1, |
||
16 | ), |
||
17 | $o->representations |
||
18 | ); |
||
19 | $this->assertSame($r1, $o->value); |
||
20 | |||
21 | $this->assertFalse($o->addRepresentation($r1)); |
||
22 | $this->assertSame( |
||
23 | array( |
||
24 | $r1->name => $r1, |
||
25 | ), |
||
26 | $o->representations |
||
27 | ); |
||
28 | |||
29 | $this->assertTrue($o->addRepresentation($r2 = new Kint_Object_Representation('Rep 2'))); |
||
30 | $this->assertSame( |
||
31 | array( |
||
32 | $r1->name => $r1, |
||
33 | $r2->name => $r2, |
||
34 | ), |
||
35 | $o->representations |
||
36 | ); |
||
37 | |||
38 | $this->assertTrue($o->addRepresentation($r3 = new Kint_Object_Representation('Rep 3'), 0)); |
||
39 | $this->assertSame( |
||
40 | array( |
||
41 | $r3->name => $r3, |
||
42 | $r1->name => $r1, |
||
43 | $r2->name => $r2, |
||
44 | ), |
||
45 | $o->representations |
||
46 | ); |
||
47 | |||
48 | $this->assertTrue($o->addRepresentation($r4 = new Kint_Object_Representation('Rep 4'), 1)); |
||
49 | $this->assertSame( |
||
50 | array( |
||
51 | $r3->name => $r3, |
||
52 | $r4->name => $r4, |
||
53 | $r1->name => $r1, |
||
54 | $r2->name => $r2, |
||
55 | ), |
||
56 | $o->representations |
||
57 | ); |
||
58 | |||
59 | $this->assertTrue($o->addRepresentation($r5 = new Kint_Object_Representation('Rep 5'), 100)); |
||
60 | $this->assertSame( |
||
61 | array( |
||
62 | $r3->name => $r3, |
||
63 | $r4->name => $r4, |
||
64 | $r1->name => $r1, |
||
65 | $r2->name => $r2, |
||
66 | $r5->name => $r5, |
||
67 | ), |
||
68 | $o->representations |
||
69 | ); |
||
70 | |||
71 | $this->assertTrue($o->addRepresentation($r6 = new Kint_Object_Representation('Rep 6'), -100)); |
||
72 | $this->assertSame( |
||
73 | array( |
||
74 | $r6->name => $r6, |
||
75 | $r3->name => $r3, |
||
76 | $r4->name => $r4, |
||
77 | $r1->name => $r1, |
||
78 | $r2->name => $r2, |
||
79 | $r5->name => $r5, |
||
80 | ), |
||
81 | $o->representations |
||
82 | ); |
||
83 | |||
84 | $this->assertSame($r1, $o->value); |
||
85 | } |
||
86 | |||
87 | public function testReplaceRepresentation() |
||
88 | { |
||
89 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
90 | $o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1')); |
||
91 | $o->addRepresentation($r2 = new Kint_Object_Representation('Rep 2')); |
||
92 | $o->addRepresentation($r3 = new Kint_Object_Representation('Rep 3')); |
||
93 | |||
94 | $this->assertSame( |
||
95 | array( |
||
96 | $r1->name => $r1, |
||
97 | $r2->name => $r2, |
||
98 | $r3->name => $r3, |
||
99 | ), |
||
100 | $o->representations |
||
101 | ); |
||
102 | |||
103 | $o->replaceRepresentation($r2_2 = new Kint_Object_Representation('Rep 2')); |
||
0 ignored issues
–
show
$r2_2 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
104 | |||
105 | $this->assertSame( |
||
106 | array( |
||
107 | $r1->name => $r1, |
||
108 | $r2_2->name => $r2_2, |
||
0 ignored issues
–
show
$r2_2 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
109 | $r3->name => $r3, |
||
110 | ), |
||
111 | $o->representations |
||
112 | ); |
||
113 | |||
114 | $o->replaceRepresentation($r2, 0); |
||
115 | |||
116 | $this->assertSame( |
||
117 | array( |
||
118 | $r2->name => $r2, |
||
119 | $r1->name => $r1, |
||
120 | $r3->name => $r3, |
||
121 | ), |
||
122 | $o->representations |
||
123 | ); |
||
124 | |||
125 | $o->replaceRepresentation($r2_2, 1); |
||
0 ignored issues
–
show
$r2_2 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
126 | |||
127 | $this->assertSame( |
||
128 | array( |
||
129 | $r1->name => $r1, |
||
130 | $r2_2->name => $r2_2, |
||
0 ignored issues
–
show
$r2_2 does not seem to conform to the naming convention (^[a-z][a-zA-Z0-9]*$ ).
This check examines a number of code elements and verifies that they conform to the given naming conventions. You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods. ![]() |
|||
131 | $r3->name => $r3, |
||
132 | ), |
||
133 | $o->representations |
||
134 | ); |
||
135 | } |
||
136 | |||
137 | public function testRemoveRepresentation() |
||
138 | { |
||
139 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
140 | $o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1')); |
||
141 | $o->addRepresentation($r2 = new Kint_Object_Representation('Rep 2')); |
||
142 | $o->addRepresentation($r3 = new Kint_Object_Representation('Rep 3')); |
||
143 | |||
144 | $this->assertSame( |
||
145 | array( |
||
146 | $r1->name => $r1, |
||
147 | $r2->name => $r2, |
||
148 | $r3->name => $r3, |
||
149 | ), |
||
150 | $o->representations |
||
151 | ); |
||
152 | |||
153 | $o->removeRepresentation($r2->name); |
||
154 | |||
155 | $this->assertSame( |
||
156 | array( |
||
157 | $r1->name => $r1, |
||
158 | $r3->name => $r3, |
||
159 | ), |
||
160 | $o->representations |
||
161 | ); |
||
162 | } |
||
163 | |||
164 | public function testGetRepresentation() |
||
165 | { |
||
166 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
167 | $o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1')); |
||
168 | $o->addRepresentation($r2 = new Kint_Object_Representation('Rep 2')); |
||
169 | $o->addRepresentation($r3 = new Kint_Object_Representation('Rep 3')); |
||
170 | |||
171 | $this->assertSame($r1, $o->getRepresentation($r1->name)); |
||
172 | $this->assertSame($r2, $o->getRepresentation($r2->name)); |
||
173 | $this->assertSame($r3, $o->getRepresentation($r3->name)); |
||
174 | $this->assertSame(null, $o->getRepresentation('Non-existant representation name')); |
||
175 | } |
||
176 | |||
177 | public function testGetRepresentations() |
||
178 | { |
||
179 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
180 | $o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1')); |
||
181 | $o->addRepresentation($r2 = new Kint_Object_Representation('Rep 2')); |
||
182 | $o->addRepresentation($r3 = new Kint_Object_Representation('Rep 3')); |
||
183 | |||
184 | $this->assertSame( |
||
185 | array( |
||
186 | $r1->name => $r1, |
||
187 | $r2->name => $r2, |
||
188 | $r3->name => $r3, |
||
189 | ), |
||
190 | $o->getRepresentations() |
||
191 | ); |
||
192 | } |
||
193 | |||
194 | public function testClearRepresentations() |
||
195 | { |
||
196 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
197 | $o->addRepresentation($r1 = new Kint_Object_Representation('Rep 1')); |
||
198 | $o->addRepresentation(new Kint_Object_Representation('Rep 2')); |
||
199 | $o->addRepresentation(new Kint_Object_Representation('Rep 3')); |
||
200 | |||
201 | $o->clearRepresentations(); |
||
202 | |||
203 | $this->assertSame(array(), $o->representations); |
||
204 | $this->assertSame($r1, $o->value); |
||
205 | } |
||
206 | |||
207 | public function testGetType() |
||
208 | { |
||
209 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
210 | $o->type = 'array'; |
||
211 | $this->assertEquals('array', $o->getType()); |
||
212 | } |
||
213 | |||
214 | public function modifierProvider() |
||
215 | { |
||
216 | return array( |
||
217 | 'public' => array( |
||
218 | false, |
||
219 | false, |
||
220 | Kint_Object::ACCESS_PUBLIC, |
||
221 | 'public', |
||
222 | ), |
||
223 | 'public const' => array( |
||
224 | true, |
||
225 | false, |
||
226 | Kint_Object::ACCESS_PUBLIC, |
||
227 | 'public const', |
||
228 | ), |
||
229 | 'public static' => array( |
||
230 | false, |
||
231 | true, |
||
232 | Kint_Object::ACCESS_PUBLIC, |
||
233 | 'public static', |
||
234 | ), |
||
235 | 'protected' => array( |
||
236 | false, |
||
237 | false, |
||
238 | Kint_Object::ACCESS_PROTECTED, |
||
239 | 'protected', |
||
240 | ), |
||
241 | 'private' => array( |
||
242 | false, |
||
243 | false, |
||
244 | Kint_Object::ACCESS_PRIVATE, |
||
245 | 'private', |
||
246 | ), |
||
247 | 'none' => array( |
||
248 | false, |
||
249 | false, |
||
250 | Kint_Object::ACCESS_NONE, |
||
251 | null, |
||
252 | ), |
||
253 | 'private static' => array( |
||
254 | false, |
||
255 | true, |
||
256 | Kint_Object::ACCESS_PRIVATE, |
||
257 | 'private static', |
||
258 | ), |
||
259 | 'public const static' => array( |
||
260 | true, |
||
261 | true, |
||
262 | Kint_Object::ACCESS_PUBLIC, |
||
263 | 'public const static', |
||
264 | ), |
||
265 | 'const' => array( |
||
266 | true, |
||
267 | false, |
||
268 | Kint_Object::ACCESS_NONE, |
||
269 | 'const', |
||
270 | ), |
||
271 | ); |
||
272 | $accesses = array( |
||
0 ignored issues
–
show
$accesses = array(\Kint_...bject::ACCESS_PRIVATE); does not seem to be reachable.
This check looks for unreachable code. It uses sophisticated control flow analysis techniques to find statements which will never be executed. Unreachable code is most often the result of function fx() {
try {
doSomething();
return true;
}
catch (\Exception $e) {
return false;
}
return false;
}
In the above example, the last ![]() $accesses is not used, you could remove the assignment.
This check looks for variable assignements that are either overwritten by other assignments or where the variable is not used subsequently. $myVar = 'Value';
$higher = false;
if (rand(1, 6) > 3) {
$higher = true;
} else {
$higher = false;
}
Both the ![]() |
|||
273 | Kint_Object::ACCESS_NONE, |
||
274 | Kint_Object::ACCESS_PUBLIC, |
||
275 | Kint_Object::ACCESS_PROTECTED, |
||
276 | Kint_Object::ACCESS_PRIVATE, |
||
277 | ); |
||
278 | } |
||
279 | |||
280 | /** |
||
281 | * @dataProvider modifierProvider |
||
282 | */ |
||
283 | public function testGetModifiers($const, $static, $access, $expect) |
||
284 | { |
||
285 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
286 | $o->const = $const; |
||
287 | $o->static = $static; |
||
288 | $o->access = $access; |
||
289 | $this->assertSame($expect, $o->getModifiers()); |
||
290 | } |
||
291 | |||
292 | public function testGetAccess() |
||
293 | { |
||
294 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
295 | $this->assertNull($o->getAccess()); |
||
296 | $o->access = Kint_Object::ACCESS_PUBLIC; |
||
297 | $this->assertEquals('public', $o->getAccess()); |
||
298 | $o->access = Kint_Object::ACCESS_PROTECTED; |
||
299 | $this->assertEquals('protected', $o->getAccess()); |
||
300 | $o->access = Kint_Object::ACCESS_PRIVATE; |
||
301 | $this->assertEquals('private', $o->getAccess()); |
||
302 | } |
||
303 | |||
304 | View Code Duplication | public function testGetName() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
305 | { |
||
306 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
307 | $o->name = '$var'; |
||
308 | $this->assertEquals('$var', $o->getName()); |
||
309 | $o->name = '($a + $b)'; |
||
310 | $this->assertEquals('($a + $b)', $o->getName()); |
||
311 | $o->name = 'This is just a name, nothing more, nothing less.'; |
||
312 | $this->assertEquals('This is just a name, nothing more, nothing less.', $o->getName()); |
||
313 | } |
||
314 | |||
315 | public function testGetOperator() |
||
316 | { |
||
317 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
318 | $this->assertNull($o->getOperator()); |
||
319 | $o->operator = Kint_Object::OPERATOR_NONE; |
||
320 | $this->assertNull($o->getOperator()); |
||
321 | $o->operator = Kint_Object::OPERATOR_ARRAY; |
||
322 | $this->assertEquals('=>', $o->getOperator()); |
||
323 | $o->operator = Kint_Object::OPERATOR_OBJECT; |
||
324 | $this->assertEquals('->', $o->getOperator()); |
||
325 | $o->operator = Kint_Object::OPERATOR_STATIC; |
||
326 | $this->assertEquals('::', $o->getOperator()); |
||
327 | } |
||
328 | |||
329 | View Code Duplication | public function testGetSize() |
|
0 ignored issues
–
show
This method seems to be duplicated in your project.
Duplicated code is one of the most pungent code smells. If you need to duplicate the same code in three or more different places, we strongly encourage you to look into extracting the code into a single class or operation. You can also find more detailed suggestions in the “Code” section of your repository. ![]() |
|||
330 | { |
||
331 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
332 | $this->assertNull($o->getSize()); |
||
333 | $o->size = 0; |
||
334 | $this->assertEquals(0, $o->getSize()); |
||
335 | $o->size = 42; |
||
336 | $this->assertEquals(42, $o->getSize()); |
||
337 | } |
||
338 | |||
339 | public function testGetValueShort() |
||
340 | { |
||
341 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
342 | $r = new Kint_Object_Representation('contents'); |
||
0 ignored issues
–
show
|
|||
343 | $o->addRepresentation($r); |
||
344 | |||
345 | $r->contents = true; |
||
0 ignored issues
–
show
It seems like
true of type boolean is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
346 | $this->assertNull($o->getValueShort()); |
||
347 | $o->type = 'boolean'; |
||
348 | $this->assertEquals('true', $o->getValueShort()); |
||
349 | $r->contents = false; |
||
0 ignored issues
–
show
It seems like
false of type false is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
350 | $this->assertEquals('false', $o->getValueShort()); |
||
351 | $o->type = 'integer'; |
||
352 | $r->contents = 1234; |
||
0 ignored issues
–
show
It seems like
1234 of type integer is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
353 | $this->assertEquals(1234, $o->getValueShort()); |
||
354 | $o->type = 'double'; |
||
355 | $r->contents = 1234.5678; |
||
0 ignored issues
–
show
It seems like
1234.5678 of type double is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
356 | $this->assertEquals(1234.5678, $o->getValueShort()); |
||
357 | $o->type = 'array'; |
||
358 | $r->contents = array(); |
||
359 | $this->assertNull($o->getValueShort()); |
||
360 | $o->type = 'string'; |
||
361 | $r->contents = 'string'; |
||
0 ignored issues
–
show
It seems like
'string' of type string is incompatible with the declared type array of property $contents .
Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property. Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property.. ![]() |
|||
362 | $this->assertNull($o->getValueShort()); |
||
363 | } |
||
364 | |||
365 | public function testGetAccessPath() |
||
366 | { |
||
367 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
368 | $this->assertNull($o->getAccessPath()); |
||
369 | $o->access_path = 'abcdefg, hijk elemeno p'; |
||
370 | $this->assertEquals('abcdefg, hijk elemeno p', $o->getAccessPath()); |
||
371 | } |
||
372 | |||
373 | public function testBlank() |
||
374 | { |
||
375 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
376 | $this->assertNull($o->name); |
||
377 | $this->assertNull($o->access_path); |
||
378 | |||
379 | $o = Kint_Object::blank(); |
||
380 | $this->assertNull($o->name); |
||
381 | $this->assertNull($o->access_path); |
||
382 | |||
383 | $o = Kint_Object::blank('$var'); |
||
384 | $this->assertEquals('$var', $o->name); |
||
385 | $this->assertEquals('$var', $o->access_path); |
||
386 | |||
387 | $o = Kint_Object::blank('Name', 'access_path'); |
||
388 | $this->assertEquals('Name', $o->name); |
||
389 | $this->assertEquals('access_path', $o->access_path); |
||
390 | } |
||
391 | |||
392 | public function testTransplant() |
||
393 | { |
||
394 | $o = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
395 | |||
396 | $o->name = 'name'; |
||
397 | $o->size = 42; |
||
398 | $o->access_path = 'access_path'; |
||
399 | $o->access = Kint_Object::ACCESS_PUBLIC; |
||
400 | $o->static = true; |
||
401 | $o->const = true; |
||
402 | $o->type = 'type'; |
||
403 | $o->depth = 43; |
||
404 | $o->owner_class = 'owner_class'; |
||
405 | $o->operator = Kint_Object::OPERATOR_OBJECT; |
||
406 | $o->reference = true; |
||
407 | $o->hints = array('test', 'transplant', 'hints'); |
||
408 | |||
409 | $r = new Kint_Object_Representation('Test'); |
||
0 ignored issues
–
show
|
|||
410 | $o->addRepresentation($r); |
||
411 | |||
412 | $o2 = $o->transplant(new Kint_Object()); |
||
0 ignored issues
–
show
|
|||
413 | |||
414 | $this->assertEquals($o, $o2); |
||
415 | $this->assertNotSame($o, $o2); |
||
416 | $this->assertSame($o->value, $o2->value); |
||
417 | |||
418 | $o2 = new Kint_Object(); |
||
419 | $r2 = new Kint_Object_Representation('Test 2'); |
||
0 ignored issues
–
show
|
|||
420 | $o2->addRepresentation($r2); |
||
421 | $o2->hints = array('test', 'thoroughly'); |
||
422 | |||
423 | $o2 = $o->transplant($o2); |
||
424 | |||
425 | $this->assertSame(array('test_2' => $r2, 'test' => $r), $o2->representations); |
||
426 | $this->assertSame(array('test', 'transplant', 'hints', 'test', 'thoroughly'), $o2->hints); |
||
427 | } |
||
428 | |||
429 | public function testIsSequential() |
||
430 | { |
||
431 | $this->assertTrue(Kint_Object::isSequential(array(1, 2, 3, 4))); |
||
432 | $this->assertFalse(Kint_Object::isSequential(array(0 => 1, 1 => 2, 3 => 3, 2 => 4))); |
||
433 | $this->assertFalse(Kint_Object::isSequential(array(0 => 1, 1 => 2, '02' => 3, 3 => 4))); |
||
434 | } |
||
435 | |||
436 | public function testSortByAccess() |
||
437 | { |
||
438 | $o1 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
439 | $o2 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
440 | $o3 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
441 | |||
442 | $a = array($o1, $o2, $o3); |
||
0 ignored issues
–
show
|
|||
443 | |||
444 | $o1->access = Kint_Object::ACCESS_PRIVATE; |
||
445 | $o2->access = Kint_Object::ACCESS_PROTECTED; |
||
446 | $o3->access = Kint_Object::ACCESS_PUBLIC; |
||
447 | |||
448 | $this->assertSame(array($o1, $o2, $o3), $a); |
||
449 | |||
450 | usort($a, 'Kint_Object::sortByAccess'); |
||
451 | $this->assertSame(array($o3, $o2, $o1), $a); |
||
452 | |||
453 | $o1->access = Kint_Object::ACCESS_PROTECTED; |
||
454 | $o2->access = Kint_Object::ACCESS_PRIVATE; |
||
455 | |||
456 | usort($a, 'Kint_Object::sortByAccess'); |
||
457 | $this->assertSame(array($o3, $o1, $o2), $a); |
||
458 | } |
||
459 | |||
460 | public function testSortByName() |
||
461 | { |
||
462 | $o1 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
463 | $o2 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
464 | $o3 = new Kint_Object(); |
||
0 ignored issues
–
show
|
|||
465 | |||
466 | $a = array($o1, $o2, $o3); |
||
0 ignored issues
–
show
|
|||
467 | |||
468 | $o1->name = 'Name Z'; |
||
469 | $o2->name = 'Name B'; |
||
470 | $o3->name = 'Name A'; |
||
471 | |||
472 | $this->assertSame(array($o1, $o2, $o3), $a); |
||
473 | |||
474 | usort($a, 'Kint_Object::sortByName'); |
||
475 | $this->assertSame(array($o3, $o2, $o1), $a); |
||
476 | |||
477 | $o1->name = 'Name M'; |
||
478 | $o2->name = 'Name Z2'; |
||
479 | |||
480 | usort($a, 'Kint_Object::sortByName'); |
||
481 | $this->assertSame(array($o3, $o1, $o2), $a); |
||
482 | } |
||
483 | } |
||
484 |
This check examines a number of code elements and verifies that they conform to the given naming conventions.
You can set conventions for local variables, abstract classes, utility classes, constant, properties, methods, parameters, interfaces, classes, exceptions and special methods.