@@ -168,7 +168,7 @@ private function getPatchedContents(string $file, string $value, string $positio
168168 {
169169 $ fileContents = $ this ->readFile ($ file );
170170
171- if (false !== strpos ($ fileContents , $ value )) {
171+ if (str_contains ($ fileContents , $ value )) {
172172 return $ fileContents ; // already includes value, skip
173173 }
174174
@@ -185,7 +185,7 @@ private function getPatchedContents(string $file, string $value, string $positio
185185 $ lines = explode ("\n" , $ fileContents );
186186 $ targetFound = false ;
187187 foreach ($ lines as $ key => $ line ) {
188- if (false !== strpos ($ line , $ target )) {
188+ if (str_contains ($ line , $ target )) {
189189 array_splice ($ lines , $ key + 1 , 0 , $ value );
190190 $ targetFound = true ;
191191
@@ -214,13 +214,13 @@ private function getUnPatchedContents(string $file, $value): string
214214 {
215215 $ fileContents = $ this ->readFile ($ file );
216216
217- if (false === strpos ($ fileContents , $ value )) {
217+ if (! str_contains ($ fileContents , $ value )) {
218218 return $ fileContents ; // value already gone!
219219 }
220220
221- if (false !== strpos ($ fileContents , "\n" .$ value )) {
221+ if (str_contains ($ fileContents , "\n" .$ value )) {
222222 $ value = "\n" .$ value ;
223- } elseif (false !== strpos ($ fileContents , $ value ."\n" )) {
223+ } elseif (str_contains ($ fileContents , $ value ."\n" )) {
224224 $ value .= "\n" ;
225225 }
226226
@@ -249,7 +249,7 @@ private function isPackageInstalled($packages): bool
249249 private function relativize (string $ path ): string
250250 {
251251 $ rootDir = $ this ->options ->get ('root-dir ' );
252- if (0 === strpos ($ path , $ rootDir )) {
252+ if (str_starts_with ($ path , $ rootDir )) {
253253 $ path = substr ($ path , \strlen ($ rootDir ) + 1 );
254254 }
255255
0 commit comments