This repository was archived by the owner on Mar 20, 2025. It is now read-only.
File tree Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Expand file tree Collapse file tree 2 files changed +8
-0
lines changed Original file line number Diff line number Diff line change @@ -24,6 +24,10 @@ public function perform(): int
24
24
25
25
$ contents = file_get_contents ($ file );
26
26
27
+ if (! str_starts_with ($ contents , '<?php ' )) {
28
+ continue ;
29
+ }
30
+
27
31
$ found = preg_match ('/\s+declare\([^)]+?\);/ ' , $ contents , $ matches );
28
32
if ($ found ) {
29
33
if (str_contains ($ matches [0 ], 'strict_types ' )) {
Original file line number Diff line number Diff line change @@ -30,13 +30,17 @@ public function it_adds_declaration_to_files()
30
30
'app/Support/NoOpClass.php ' => 'tests/fixtures/strict-types/no-op.php ' ,
31
31
'app/Support/SimpleClass.php ' => 'tests/fixtures/strict-types/simple.php ' ,
32
32
'app/Support/ComplexClass.php ' => 'tests/fixtures/strict-types/complex.php ' ,
33
+ 'resources/views/template.blade.php ' => '@noop ' ,
34
+ 'some/other/file.php ' => '<html lang="en"><title>File with <?php echo "PHP"; ?></title></html> ' ,
33
35
]);
34
36
35
37
$ result = $ this ->subject ->perform ();
36
38
37
39
$ this ->assertSame (0 , $ result );
38
40
39
41
$ this ->assertFileNotChanged ('app/Support/NoOpClass.php ' );
42
+ $ this ->assertFileNotChanged ('resources/views/template.blade.php ' );
43
+ $ this ->assertFileNotChanged ('some/other/file.php ' );
40
44
$ this ->assertFileChanges ('tests/fixtures/strict-types/simple.after.php ' , 'app/Support/SimpleClass.php ' );
41
45
$ this ->assertFileChanges ('tests/fixtures/strict-types/complex.after.php ' , 'app/Support/ComplexClass.php ' );
42
46
}
You can’t perform that action at this time.
0 commit comments