Completed
Push — feature/rename-phpunit-config ( 357a24...3649e1 )
by Juliette
03:31 queued 01:25
created

NewFunctionParametersSniff   C

Complexity

Total Complexity 13

Size/Duplication

Total Lines 876
Duplicated Lines 5.14 %

Coupling/Cohesion

Components 1
Dependencies 1

Importance

Changes 0
Metric Value
wmc 13
lcom 1
cbo 1
dl 45
loc 876
rs 6.7878
c 0
b 0
f 0

8 Methods

Rating   Name   Duplication   Size   Complexity  
A register() 0 7 1
B process() 45 45 6
A getItemArray() 0 4 1
A getNonVersionArrayKeys() 0 4 1
A getErrorInfo() 0 7 1
A getItemName() 0 4 1
A getErrorMsgTemplate() 0 4 1
A filterErrorData() 0 6 1

How to fix   Duplicated Code   

Duplicated Code

Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.

Common duplication problems, and corresponding solutions are:

1
<?php
2
/**
3
 * \PHPCompatibility\Sniffs\PHP\NewFunctionParametersSniff.
4
 *
5
 * @category PHP
6
 * @package  PHPCompatibility
7
 * @author   Wim Godden <[email protected]>
8
 */
9
10
namespace PHPCompatibility\Sniffs\PHP;
11
12
use PHPCompatibility\AbstractNewFeatureSniff;
13
14
/**
15
 * \PHPCompatibility\Sniffs\PHP\newFunctionParametersSniff.
16
 *
17
 * @category PHP
18
 * @package  PHPCompatibility
19
 * @author   Wim Godden <[email protected]>
20
 */
21
class NewFunctionParametersSniff extends AbstractNewFeatureSniff
22
{
23
    /**
24
     * A list of new functions, not present in older versions.
25
     *
26
     * The array lists : version number with false (not present) or true (present).
27
     * The index is the location of the parameter in the parameter list, starting at 0 !
28
     * If's sufficient to list the first version where the function appears.
29
     *
30
     * @var array
31
     */
32
    protected $newFunctionParameters = array(
33
        'array_filter' => array(
34
            2 => array(
35
                'name' => 'flag',
36
                '5.5' => false,
37
                '5.6' => true,
38
            ),
39
        ),
40
        'array_slice' => array(
41
            1 => array(
42
                'name' => 'preserve_keys',
43
                '5.0.1' => false,
44
                '5.0.2' => true,
45
            ),
46
        ),
47
        'array_unique' => array(
48
            1 => array(
49
                'name' => 'sort_flags',
50
                '5.2.8' => false,
51
                '5.2.9' => true,
52
            ),
53
        ),
54
        'assert' => array(
55
            1 => array(
56
                'name' => 'description',
57
                '5.4.7' => false,
58
                '5.4.8' => true,
59
            ),
60
        ),
61
        'base64_decode' => array(
62
            1 => array(
63
                'name' => 'strict',
64
                '5.1' => false,
65
                '5.2' => true,
66
            ),
67
        ),
68
        'class_implements' => array(
69
            1 => array(
70
                'name' => 'autoload',
71
                '5.0' => false,
72
                '5.1' => true,
73
            ),
74
        ),
75
        'class_parents' => array(
76
            1 => array(
77
                'name' => 'autoload',
78
                '5.0' => false,
79
                '5.1' => true,
80
            ),
81
        ),
82
        'clearstatcache' => array(
83
            0 => array(
84
                'name' => 'clear_realpath_cache',
85
                '5.2' => false,
86
                '5.3' => true,
87
            ),
88
            1 => array(
89
                'name' => 'filename',
90
                '5.2' => false,
91
                '5.3' => true,
92
            ),
93
        ),
94
        'copy' => array(
95
            2 => array(
96
                'name' => 'context',
97
                '5.2' => false,
98
                '5.3' => true,
99
            ),
100
        ),
101
        'curl_multi_info_read' => array(
102
            1 => array(
103
                'name' => 'msgs_in_queue',
104
                '5.1' => false,
105
                '5.2' => true,
106
            ),
107
        ),
108
        'debug_backtrace' => array(
109
            0 => array(
110
                'name' => 'options',
111
                '5.2.4' => false,
112
                '5.2.5' => true,
113
            ),
114
            1 => array(
115
                'name' => 'limit',
116
                '5.3' => false,
117
                '5.4' => true,
118
            ),
119
        ),
120
        'debug_print_backtrace' => array(
121
            0 => array(
122
                'name' => 'options',
123
                '5.3.5' => false,
124
                '5.3.6' => true,
125
            ),
126
            1 => array(
127
                'name' => 'limit',
128
                '5.3' => false,
129
                '5.4' => true,
130
            ),
131
        ),
132
        'dirname' => array(
133
            1 => array(
134
                'name' => 'levels',
135
                '5.6' => false,
136
                '7.0' => true,
137
            ),
138
        ),
139
        'dns_get_record' => array(
140
            4 => array(
141
                'name' => 'raw',
142
                '5.3' => false,
143
                '5.4' => true,
144
            ),
145
        ),
146
        'fgetcsv' => array(
147
            4 => array(
148
                'name' => 'escape',
149
                '5.2' => false,
150
                '5.3' => true,
151
            ),
152
        ),
153
        'fputcsv' => array(
154
            4 => array(
155
                'name' => 'escape_char',
156
                '5.5.3' => false,
157
                '5.5.4' => true,
158
            ),
159
        ),
160
        'file_get_contents' => array(
161
            3 => array(
162
                'name' => 'offset',
163
                '5.0' => false,
164
                '5.1' => true,
165
            ),
166
            4 => array(
167
                'name' => 'maxlen',
168
                '5.0' => false,
169
                '5.1' => true,
170
            ),
171
        ),
172
        'filter_input_array' => array(
173
            2 => array(
174
                'name' => 'add_empty',
175
                '5.3' => false,
176
                '5.4' => true,
177
            ),
178
        ),
179
        'filter_var_array' => array(
180
            2 => array(
181
                'name' => 'add_empty',
182
                '5.3' => false,
183
                '5.4' => true,
184
            ),
185
        ),
186
        'gettimeofday' => array(
187
            0 => array(
188
                'name' => 'return_float',
189
                '5.0' => false,
190
                '5.1' => true,
191
            ),
192
        ),
193
        'get_defined_functions' => array(
194
            0 => array(
195
                'name' => 'exclude_disabled',
196
                '7.0.14' => false,
197
                '7.0.15' => true,
198
            ),
199
        ),
200
        'get_html_translation_table' => array(
201
            2 => array(
202
                'name' => 'encoding',
203
                '5.3.3' => false,
204
                '5.3.4' => true,
205
            ),
206
        ),
207
        'get_loaded_extensions' => array(
208
            0 => array(
209
                'name' => 'zend_extensions',
210
                '5.2.3' => false,
211
                '5.2.4' => true,
212
            ),
213
        ),
214
        'gzcompress' => array(
215
            2 => array(
216
                'name' => 'encoding',
217
                '5.3' => false,
218
                '5.4' => true,
219
            ),
220
        ),
221
        'gzdeflate' => array(
222
            2 => array(
223
                'name' => 'encoding',
224
                '5.3' => false,
225
                '5.4' => true,
226
            ),
227
        ),
228
        'htmlentities' => array(
229
            3 => array(
230
                'name' => 'double_encode',
231
                '5.2.2' => false,
232
                '5.2.3' => true,
233
            ),
234
        ),
235
        'htmlspecialchars' => array(
236
            3 => array(
237
                'name' => 'double_encode',
238
                '5.2.2' => false,
239
                '5.2.3' => true,
240
            ),
241
        ),
242
        'http_build_query' => array(
243
            2 => array(
244
                'name' => 'arg_separator',
245
                '5.1.1' => false,
246
                '5.1.2' => true,
247
            ),
248
            3 => array(
249
                'name' => 'enc_type',
250
                '5.3' => false,
251
                '5.4' => true,
252
            ),
253
        ),
254
        'idn_to_ascii' => array(
255
            2 => array(
256
                'name' => 'variant',
257
                '5.3' => false,
258
                '5.4' => true,
259
            ),
260
            3 => array(
261
                'name' => 'idna_info',
262
                '5.3' => false,
263
                '5.4' => true,
264
            ),
265
        ),
266
        'idn_to_utf8' => array(
267
            2 => array(
268
                'name' => 'variant',
269
                '5.3' => false,
270
                '5.4' => true,
271
            ),
272
            3 => array(
273
                'name' => 'idna_info',
274
                '5.3' => false,
275
                '5.4' => true,
276
            ),
277
        ),
278
        'imagecolorset' => array(
279
            5 => array(
280
                'name' => 'alpha',
281
                '5.3' => false,
282
                '5.4' => true,
283
            ),
284
        ),
285
        'imagepng' => array(
286
            2 => array(
287
                'name' => 'quality',
288
                '5.1.1' => false,
289
                '5.1.2' => true,
290
            ),
291
            3 => array(
292
                'name' => 'filters',
293
                '5.1.2' => false,
294
                '5.1.3' => true,
295
            ),
296
        ),
297
        'imagerotate' => array(
298
            3 => array(
299
                'name' => 'ignore_transparent',
300
                '5.0' => false,
301
                '5.1' => true,
302
            ),
303
        ),
304
        'imap_open' => array(
305
            4 => array(
306
                'name' => 'n_retries',
307
                '5.1' => false,
308
                '5.2' => true,
309
            ),
310
            5 => array(
311
                'name' => 'params',
312
                '5.3.1' => false,
313
                '5.3.2' => true,
314
            ),
315
        ),
316
        'imap_reopen' => array(
317
            3 => array(
318
                'name' => 'n_retries',
319
                '5.1' => false,
320
                '5.2' => true,
321
            ),
322
        ),
323
        'ini_get_all' => array(
324
            1 => array(
325
                'name' => 'details',
326
                '5.2' => false,
327
                '5.3' => true,
328
            ),
329
        ),
330
        'is_a' => array(
331
            2 => array(
332
                'name' => 'allow_string',
333
                '5.3.8' => false,
334
                '5.3.9' => true,
335
            ),
336
        ),
337
        'is_subclass_of' => array(
338
            2 => array(
339
                'name' => 'allow_string',
340
                '5.3.8' => false,
341
                '5.3.9' => true,
342
            ),
343
        ),
344
        'iterator_to_array' => array(
345
            1 => array(
346
                'name' => 'use_keys',
347
                '5.2.0' => false,
348
                '5.2.1' => true,
349
            ),
350
        ),
351
        'json_decode' => array(
352
            2 => array(
353
                'name' => 'depth',
354
                '5.2' => false,
355
                '5.3' => true,
356
            ),
357
            3 => array(
358
                'name' => 'options',
359
                '5.3' => false,
360
                '5.4' => true,
361
            ),
362
        ),
363
        'json_encode' => array(
364
            1 => array(
365
                'name' => 'options',
366
                '5.2' => false,
367
                '5.3' => true,
368
            ),
369
            2 => array(
370
                'name' => 'depth',
371
                '5.4' => false,
372
                '5.5' => true,
373
            ),
374
        ),
375
        'memory_get_peak_usage' => array(
376
            0 => array(
377
                'name' => 'real_usage',
378
                '5.1' => false,
379
                '5.2' => true,
380
            ),
381
        ),
382
        'memory_get_usage' => array(
383
            0 => array(
384
                'name' => 'real_usage',
385
                '5.1' => false,
386
                '5.2' => true,
387
            ),
388
        ),
389
        'mb_encode_numericentity' => array(
390
            3 => array(
391
                'name' => 'is_hex',
392
                '5.3' => false,
393
                '5.4' => true,
394
            ),
395
        ),
396
        'mb_strrpos' => array(
397
            /*
398
             * Note: the actual position is 2, but the original 3rd
399
             * parameter 'encoding' was moved to the 4th position.
400
             * So the only way to detect if offset is used is when
401
             * both offset and encoding are set.
402
             */
403
            3 => array(
404
                'name' => 'offset',
405
                '5.1' => false,
406
                '5.2' => true,
407
            ),
408
        ),
409
        'mssql_connect' => array(
410
            3 => array(
411
                'name' => 'new_link',
412
                '5.0' => false,
413
                '5.1' => true,
414
            ),
415
        ),
416
        'mysqli_commit' => array(
417
            1 => array(
418
                'name' => 'flags',
419
                '5.4' => false,
420
                '5.5' => true,
421
            ),
422
            2 => array(
423
                'name' => 'name',
424
                '5.4' => false,
425
                '5.5' => true,
426
            ),
427
        ),
428
        'mysqli_rollback' => array(
429
            1 => array(
430
                'name' => 'flags',
431
                '5.4' => false,
432
                '5.5' => true,
433
            ),
434
            2 => array(
435
                'name' => 'name',
436
                '5.4' => false,
437
                '5.5' => true,
438
            ),
439
        ),
440
        'nl2br' => array(
441
            1 => array(
442
                'name' => 'is_xhtml',
443
                '5.2' => false,
444
                '5.3' => true,
445
            ),
446
        ),
447
        'openssl_decrypt' => array(
448
            4 => array(
449
                'name' => 'iv',
450
                '5.3.2' => false,
451
                '5.3.3' => true,
452
            ),
453
            5 => array(
454
                'name' => 'tag',
455
                '7.0' => false,
456
                '7.1' => true,
457
            ),
458
            6 => array(
459
                'name' => 'aad',
460
                '7.0' => false,
461
                '7.1' => true,
462
            ),
463
        ),
464
        'openssl_encrypt' => array(
465
            4 => array(
466
                'name' => 'iv',
467
                '5.3.2' => false,
468
                '5.3.3' => true,
469
            ),
470
            5 => array(
471
                'name' => 'tag',
472
                '7.0' => false,
473
                '7.1' => true,
474
            ),
475
            6 => array(
476
                'name' => 'aad',
477
                '7.0' => false,
478
                '7.1' => true,
479
            ),
480
            7 => array(
481
                'name' => 'tag_length',
482
                '7.0' => false,
483
                '7.1' => true,
484
            ),
485
        ),
486
        'openssl_pkcs7_verify' => array(
487
            5 => array(
488
                'name' => 'content',
489
                '5.0' => false,
490
                '5.1' => true,
491
            ),
492
        ),
493
        'openssl_seal' => array(
494
            4 => array(
495
                'name' => 'method',
496
                '5.2' => false,
497
                '5.3' => true,
498
            ),
499
        ),
500
        'openssl_verify' => array(
501
            3 => array(
502
                'name' => 'signature_alg',
503
                '5.1' => false,
504
                '5.2' => true,
505
            ),
506
        ),
507
        'parse_ini_file' => array(
508
            2 => array(
509
                'name' => 'scanner_mode',
510
                '5.2' => false,
511
                '5.3' => true,
512
            ),
513
        ),
514
        'parse_url' => array(
515
            1 => array(
516
                'name' => 'component',
517
                '5.1.1' => false,
518
                '5.1.2' => true,
519
            ),
520
        ),
521
        'pg_lo_create' => array(
522
            1 => array(
523
                'name' => 'object_id',
524
                '5.2' => false,
525
                '5.3' => true,
526
            ),
527
        ),
528
        'pg_lo_import' => array(
529
            2 => array(
530
                'name' => 'object_id',
531
                '5.2' => false,
532
                '5.3' => true,
533
            ),
534
        ),
535
        'preg_replace' => array(
536
            4 => array(
537
                'name' => 'count',
538
                '5.0' => false,
539
                '5.1' => true,
540
            ),
541
        ),
542
        'preg_replace_callback' => array(
543
            4 => array(
544
                'name' => 'count',
545
                '5.0' => false,
546
                '5.1' => true,
547
            ),
548
        ),
549
        'round' => array(
550
            2 => array(
551
                'name' => 'mode',
552
                '5.2' => false,
553
                '5.3' => true,
554
            ),
555
        ),
556
        'sem_acquire' => array(
557
            1 => array(
558
                'name' => 'nowait',
559
                '5.6' => false,
560
                '5.6.1' => true,
561
            ),
562
        ),
563
        'session_regenerate_id' => array(
564
            0 => array(
565
                'name' => 'delete_old_session',
566
                '5.0' => false,
567
                '5.1' => true,
568
            ),
569
        ),
570
        'session_set_cookie_params' => array(
571
            4 => array(
572
                'name' => 'httponly',
573
                '5.1' => false,
574
                '5.2' => true,
575
            ),
576
        ),
577
        'session_set_save_handler' => array(
578
            6 => array(
579
                'name' => 'create_sid',
580
                '5.5.0' => false,
581
                '5.5.1' => true,
582
            ),
583
        ),
584
        'session_start' => array(
585
            0 => array(
586
                'name' => 'options',
587
                '5.6' => false,
588
                '7.0' => true,
589
            ),
590
        ),
591
        'setcookie' => array(
592
            6 => array(
593
                'name' => 'httponly',
594
                '5.1' => false,
595
                '5.2' => true,
596
            ),
597
        ),
598
        'setrawcookie' => array(
599
            6 => array(
600
                'name' => 'httponly',
601
                '5.1' => false,
602
                '5.2' => true,
603
            ),
604
        ),
605
        'simplexml_load_file' => array(
606
            4 => array(
607
                'name' => 'is_prefix',
608
                '5.1' => false,
609
                '5.2' => true,
610
            ),
611
        ),
612
        'simplexml_load_string' => array(
613
            4 => array(
614
                'name' => 'is_prefix',
615
                '5.1' => false,
616
                '5.2' => true,
617
            ),
618
        ),
619
        'spl_autoload_register' => array(
620
            2 => array(
621
                'name' => 'prepend',
622
                '5.2' => false,
623
                '5.3' => true,
624
            ),
625
        ),
626
        'stream_context_create' => array(
627
            1 => array(
628
                'name' => 'params',
629
                '5.2' => false,
630
                '5.3' => true,
631
            ),
632
        ),
633
        'stream_copy_to_stream' => array(
634
            3 => array(
635
                'name' => 'offset',
636
                '5.0' => false,
637
                '5.1' => true,
638
            ),
639
        ),
640
        'stream_get_contents' => array(
641
            2 => array(
642
                'name' => 'offset',
643
                '5.0' => false,
644
                '5.1' => true,
645
            ),
646
        ),
647
        'stream_wrapper_register' => array(
648
            2 => array(
649
                'name' => 'flags',
650
                '5.2.3' => false,
651
                '5.2.4' => true,
652
            ),
653
        ),
654
        'stristr' => array(
655
            2 => array(
656
                'name' => 'before_needle',
657
                '5.2' => false,
658
                '5.3' => true,
659
            ),
660
        ),
661
        'strstr' => array(
662
            2 => array(
663
                'name' => 'before_needle',
664
                '5.2' => false,
665
                '5.3' => true,
666
            ),
667
        ),
668
        'str_word_count' => array(
669
            2 => array(
670
                'name' => 'charlist',
671
                '5.0' => false,
672
                '5.1' => true,
673
            ),
674
        ),
675
        'substr_count' => array(
676
            2 => array(
677
                'name' => 'offset',
678
                '5.0' => false,
679
                '5.1' => true,
680
            ),
681
            3 => array(
682
                'name' => 'length',
683
                '5.0' => false,
684
                '5.1' => true,
685
            ),
686
        ),
687
        'sybase_connect' => array(
688
            5 => array(
689
                'name' => 'new',
690
                '5.2' => false,
691
                '5.3' => true,
692
            ),
693
        ),
694
        'timezone_transitions_get' => array(
695
            1 => array(
696
                'name' => 'timestamp_begin',
697
                '5.2' => false,
698
                '5.3' => true,
699
            ),
700
            2 => array(
701
                'name' => 'timestamp_end',
702
                '5.2' => false,
703
                '5.3' => true,
704
            ),
705
        ),
706
        'timezone_identifiers_list' => array(
707
            0 => array(
708
                'name' => 'what',
709
                '5.2' => false,
710
                '5.3' => true,
711
            ),
712
            1 => array(
713
                'name' => 'country',
714
                '5.2' => false,
715
                '5.3' => true,
716
            ),
717
        ),
718
        'token_get_all' => array(
719
            1 => array(
720
                'name' => 'flags',
721
                '5.6' => false,
722
                '7.0' => true,
723
            ),
724
        ),
725
        'ucwords' => array(
726
            1 => array(
727
                'name' => 'delimiters',
728
                '5.4.31' => false,
729
                '5.5.15' => false,
730
                '5.4.32' => true,
731
                '5.5.16' => true,
732
            ),
733
        ),
734
        'unserialize' => array(
735
            1 => array(
736
                'name' => 'options',
737
                '5.6' => false,
738
                '7.0' => true,
739
            ),
740
        ),
741
    );
742
743
744
    /**
745
     * Returns an array of tokens this test wants to listen for.
746
     *
747
     * @return array
748
     */
749
    public function register()
750
    {
751
        // Handle case-insensitivity of function names.
752
        $this->newFunctionParameters = $this->arrayKeysToLowercase($this->newFunctionParameters);
753
754
        return array(T_STRING);
755
    }//end register()
756
757
    /**
758
     * Processes this test, when one of its tokens is encountered.
759
     *
760
     * @param \PHP_CodeSniffer_File $phpcsFile The file being scanned.
761
     * @param int                   $stackPtr  The position of the current token in
762
     *                                         the stack passed in $tokens.
763
     *
764
     * @return void
765
     */
766 View Code Duplication
    public function process(\PHP_CodeSniffer_File $phpcsFile, $stackPtr)
0 ignored issues
show
Duplication introduced by
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.

Loading history...
767
    {
768
        $tokens = $phpcsFile->getTokens();
769
770
        $ignore = array(
771
            T_DOUBLE_COLON,
772
            T_OBJECT_OPERATOR,
773
            T_FUNCTION,
774
            T_CONST,
775
        );
776
777
        $prevToken = $phpcsFile->findPrevious(T_WHITESPACE, ($stackPtr - 1), null, true);
778
        if (in_array($tokens[$prevToken]['code'], $ignore) === true) {
779
            // Not a call to a PHP function.
780
            return;
781
        }
782
783
        $function   = $tokens[$stackPtr]['content'];
784
        $functionLc = strtolower($function);
785
786
        if (isset($this->newFunctionParameters[$functionLc]) === false) {
787
            return;
788
        }
789
790
        $parameterCount = $this->getFunctionCallParameterCount($phpcsFile, $stackPtr);
791
        if ($parameterCount === 0) {
792
            return;
793
        }
794
795
        // If the parameter count returned > 0, we know there will be valid open parenthesis.
796
        $openParenthesis = $phpcsFile->findNext(\PHP_CodeSniffer_Tokens::$emptyTokens, $stackPtr + 1, null, true, null, true);
797
        $parameterOffsetFound = $parameterCount - 1;
798
799
        foreach ($this->newFunctionParameters[$functionLc] as $offset => $parameterDetails) {
800
            if ($offset <= $parameterOffsetFound) {
801
                $itemInfo = array(
802
                    'name'   => $function,
803
                    'nameLc' => $functionLc,
804
                    'offset' => $offset,
805
                );
806
                $this->handleFeature($phpcsFile, $openParenthesis, $itemInfo);
807
            }
808
        }
809
810
    }//end process()
811
812
813
    /**
814
     * Get the relevant sub-array for a specific item from a multi-dimensional array.
815
     *
816
     * @param array $itemInfo Base information about the item.
817
     *
818
     * @return array Version and other information about the item.
819
     */
820
    public function getItemArray(array $itemInfo)
821
    {
822
        return $this->newFunctionParameters[$itemInfo['nameLc']][$itemInfo['offset']];
823
    }
824
825
826
    /**
827
     * Get an array of the non-PHP-version array keys used in a sub-array.
828
     *
829
     * @return array
830
     */
831
    protected function getNonVersionArrayKeys()
832
    {
833
        return array('name');
834
    }
835
836
837
    /**
838
     * Retrieve the relevant detail (version) information for use in an error message.
839
     *
840
     * @param array $itemArray Version and other information about the item.
841
     * @param array $itemInfo  Base information about the item.
842
     *
843
     * @return array
844
     */
845
    public function getErrorInfo(array $itemArray, array $itemInfo)
846
    {
847
        $errorInfo = parent::getErrorInfo($itemArray, $itemInfo);
848
        $errorInfo['paramName'] = $itemArray['name'];
849
850
        return $errorInfo;
851
    }
852
853
854
    /**
855
     * Get the item name to be used for the creation of the error code.
856
     *
857
     * @param array $itemInfo  Base information about the item.
858
     * @param array $errorInfo Detail information about an item.
859
     *
860
     * @return string
861
     */
862
    protected function getItemName(array $itemInfo, array $errorInfo)
863
    {
864
        return $itemInfo['name'].'_'.$errorInfo['paramName'];
865
    }
866
867
868
    /**
869
     * Get the error message template for this sniff.
870
     *
871
     * @return string
872
     */
873
    protected function getErrorMsgTemplate()
874
    {
875
        return 'The function %s() does not have a parameter "%s" in PHP version %s or earlier';
876
    }
877
878
879
    /**
880
     * Allow for concrete child classes to filter the error data before it's passed to PHPCS.
881
     *
882
     * @param array $data      The error data array which was created.
883
     * @param array $itemInfo  Base information about the item this error message applied to.
884
     * @param array $errorInfo Detail information about an item this error message applied to.
885
     *
886
     * @return array
887
     */
888
    protected function filterErrorData(array $data, array $itemInfo, array $errorInfo)
889
    {
890
        array_shift($data);
891
        array_unshift($data, $itemInfo['name'], $errorInfo['paramName']);
892
        return $data;
893
    }
894
895
896
}//end class
897