@@ -168,7 +168,7 @@ private function getPatchedContents(string $file, string $value, string $positio
168
168
{
169
169
$ fileContents = $ this ->readFile ($ file );
170
170
171
- if (false !== strpos ($ fileContents , $ value )) {
171
+ if (str_contains ($ fileContents , $ value )) {
172
172
return $ fileContents ; // already includes value, skip
173
173
}
174
174
@@ -185,7 +185,7 @@ private function getPatchedContents(string $file, string $value, string $positio
185
185
$ lines = explode ("\n" , $ fileContents );
186
186
$ targetFound = false ;
187
187
foreach ($ lines as $ key => $ line ) {
188
- if (false !== strpos ($ line , $ target )) {
188
+ if (str_contains ($ line , $ target )) {
189
189
array_splice ($ lines , $ key + 1 , 0 , $ value );
190
190
$ targetFound = true ;
191
191
@@ -214,13 +214,13 @@ private function getUnPatchedContents(string $file, $value): string
214
214
{
215
215
$ fileContents = $ this ->readFile ($ file );
216
216
217
- if (false === strpos ($ fileContents , $ value )) {
217
+ if (! str_contains ($ fileContents , $ value )) {
218
218
return $ fileContents ; // value already gone!
219
219
}
220
220
221
- if (false !== strpos ($ fileContents , "\n" .$ value )) {
221
+ if (str_contains ($ fileContents , "\n" .$ value )) {
222
222
$ value = "\n" .$ value ;
223
- } elseif (false !== strpos ($ fileContents , $ value ."\n" )) {
223
+ } elseif (str_contains ($ fileContents , $ value ."\n" )) {
224
224
$ value .= "\n" ;
225
225
}
226
226
@@ -249,7 +249,7 @@ private function isPackageInstalled($packages): bool
249
249
private function relativize (string $ path ): string
250
250
{
251
251
$ rootDir = $ this ->options ->get ('root-dir ' );
252
- if (0 === strpos ($ path , $ rootDir )) {
252
+ if (str_starts_with ($ path , $ rootDir )) {
253
253
$ path = substr ($ path , \strlen ($ rootDir ) + 1 );
254
254
}
255
255
0 commit comments