@@ -25,16 +25,16 @@ public function perform(): int
25
25
private function updateMigrations (): void
26
26
{
27
27
foreach ($ this ->findFilesContaining ('/\bclass\s+\S+\s+extends\s+Migration\s/ ' ) as $ path ) {
28
- if (str_starts_with ($ path , 'stubs/ ' )) {
28
+ if (\ str_starts_with ($ path , 'stubs/ ' )) {
29
29
continue ;
30
30
}
31
31
32
- $ contents = $ this ->convertClassDefinition (file_get_contents ($ path ));
33
- if (is_null ($ contents )) {
32
+ $ contents = $ this ->convertClassDefinition (\ file_get_contents ($ path ));
33
+ if (\ is_null ($ contents )) {
34
34
continue ;
35
35
}
36
36
37
- file_put_contents ($ path , $ contents );
37
+ \ file_put_contents ($ path , $ contents );
38
38
}
39
39
}
40
40
@@ -47,43 +47,43 @@ private function updateStubs(): void
47
47
];
48
48
49
49
foreach ($ stubs as $ stub ) {
50
- if (! file_exists ('stubs/ ' . $ stub )) {
50
+ if (! \ file_exists ('stubs/ ' . $ stub )) {
51
51
continue ;
52
52
}
53
53
54
- $ contents = file_get_contents ('stubs/ ' . $ stub );
55
- $ contents = str_replace (
54
+ $ contents = \ file_get_contents ('stubs/ ' . $ stub );
55
+ $ contents = \ str_replace (
56
56
['DummyClass ' , '{{ class }} ' , '{{class}} ' ],
57
57
'ShiftTemporaryClassNamePlaceholder ' ,
58
58
$ contents
59
59
);
60
- $ contents = str_replace (
60
+ $ contents = \ str_replace (
61
61
['DummyTable ' , '{{ table }} ' , '{{table}} ' ],
62
62
'ShiftTemporaryTableNamePlaceholder ' ,
63
63
$ contents
64
64
);
65
65
66
66
$ contents = $ this ->convertClassDefinition ($ contents );
67
- if (is_null ($ contents )) {
67
+ if (\ is_null ($ contents )) {
68
68
continue ;
69
69
}
70
70
71
- $ contents = str_replace ('ShiftTemporaryClassNamePlaceholder ' , '{{ class }} ' , $ contents );
72
- $ contents = str_replace ('ShiftTemporaryTableNamePlaceholder ' , '{{ table }} ' , $ contents );
71
+ $ contents = \ str_replace ('ShiftTemporaryClassNamePlaceholder ' , '{{ class }} ' , $ contents );
72
+ $ contents = \ str_replace ('ShiftTemporaryTableNamePlaceholder ' , '{{ table }} ' , $ contents );
73
73
74
- file_put_contents ('stubs/ ' . $ stub , $ contents );
74
+ \ file_put_contents ('stubs/ ' . $ stub , $ contents );
75
75
}
76
76
}
77
77
78
78
private function convertClassDefinition ($ contents ): ?string
79
79
{
80
- $ found = preg_match ('/^class\s+(\S+)\s+extends\s+Migration(\s+)/m ' , $ contents , $ matches );
80
+ $ found = \ preg_match ('/^class\s+(\S+)\s+extends\s+Migration(\s+)/m ' , $ contents , $ matches );
81
81
if (! $ found ) {
82
82
return null ;
83
83
}
84
84
85
- $ contents = str_replace (rtrim ($ matches [0 ]), 'return new class extends Migration ' , $ contents );
86
- $ contents = preg_replace ('/\b ' . preg_quote ($ matches [1 ], '/ ' ) . '::/ ' , 'self:: ' , $ contents );
85
+ $ contents = \ str_replace (\ rtrim ($ matches [0 ]), 'return new class extends Migration ' , $ contents );
86
+ $ contents = \ preg_replace ('/\b ' . \ preg_quote ($ matches [1 ], '/ ' ) . '::/ ' , 'self:: ' , $ contents );
87
87
88
88
return Str::replaceLast ('} ' , '}; ' , $ contents );
89
89
}
0 commit comments