File tree 3 files changed +15
-1
lines changed
3 files changed +15
-1
lines changed Original file line number Diff line number Diff line change @@ -75,7 +75,7 @@ public function process(File $file, $stackptr) {
75
75
// Note that the opening PHP tag includes one newline.
76
76
$ numnewlines = 0 ;
77
77
for ($ i = $ stackptr + 1 ; $ i <= $ stackptr + 5 ; ++$ i ) {
78
- if ($ tokens [$ i ]['code ' ] == T_WHITESPACE && $ tokens [$ i ]['content ' ] == "\n" ) {
78
+ if (isset ( $ tokens [ $ i ]) && $ tokens [$ i ]['code ' ] == T_WHITESPACE && $ tokens [$ i ]['content ' ] == "\n" ) {
79
79
$ numnewlines ++;
80
80
} else {
81
81
break ;
Original file line number Diff line number Diff line change @@ -92,6 +92,19 @@ public function test_moodle_files_boilerplatecomment_short() {
92
92
$ this ->verify_cs_results ();
93
93
}
94
94
95
+ public function test_moodle_files_boilerplatecomment_short_empty () {
96
+ $ this ->set_standard ('moodle ' );
97
+ $ this ->set_sniff ('moodle.Files.BoilerplateComment ' );
98
+ $ this ->set_fixture (__DIR__ . '/fixtures/files/boilerplatecomment/short_empty.php ' );
99
+
100
+ $ this ->set_errors ([
101
+ 1 => 'FileTooShort ' ,
102
+ ]);
103
+ $ this ->set_warnings ([]);
104
+
105
+ $ this ->verify_cs_results ();
106
+ }
107
+
95
108
public function test_moodle_files_boilerplatecomment_wrongline () {
96
109
$ this ->set_standard ('moodle ' );
97
110
$ this ->set_sniff ('moodle.Files.BoilerplateComment ' );
Original file line number Diff line number Diff line change
1
+ <?php
You can’t perform that action at this time.
0 commit comments