@@ -104,7 +104,7 @@ private function removeObsoletePackageJsonLinks(): bool
104104
105105 foreach (['dependencies ' => $ jsDependencies , 'devDependencies ' => $ jsDevDependencies ] as $ key => $ packages ) {
106106 foreach ($ packages as $ name => $ version ) {
107- if ('@ ' !== $ name [0 ] || 0 !== strpos ($ version , 'file: ' .$ this ->vendorDir .'/ ' ) || false === strpos ($ version , '/assets ' )) {
107+ if ('@ ' !== $ name [0 ] || ! str_starts_with ($ version , 'file: ' .$ this ->vendorDir .'/ ' ) || ! str_contains ($ version , '/assets ' )) {
108108 continue ;
109109 }
110110 if (file_exists ($ this ->rootDir .'/ ' .substr ($ version , 5 ).'/package.json ' )) {
@@ -161,18 +161,18 @@ private function resolveImportMapPackages($phpPackage): array
161161 $ package = $ constraintConfig ['package ' ] ?? $ importMapName ;
162162 $ entrypoint = $ constraintConfig ['entrypoint ' ] ?? false ;
163163 } else {
164- throw new \InvalidArgumentException (sprintf ('Invalid constraint config for key "%s": "%s" given, array or string expected. ' , $ importMapName , var_export ($ constraintConfig , true )));
164+ throw new \InvalidArgumentException (\ sprintf ('Invalid constraint config for key "%s": "%s" given, array or string expected. ' , $ importMapName , var_export ($ constraintConfig , true )));
165165 }
166166
167167 // When "$constraintConfig" matches one of the following cases:
168168 // - "entrypoint:%PACKAGE%/script.js"
169169 // - {"version": "entrypoint:%PACKAGE%/script.js"}
170- if (0 === strpos ($ constraint , 'entrypoint: ' )) {
170+ if (str_starts_with ($ constraint , 'entrypoint: ' )) {
171171 $ entrypoint = true ;
172172 $ constraint = str_replace ('entrypoint: ' , 'path: ' , $ constraint );
173173 }
174174
175- if (0 === strpos ($ constraint , 'path: ' )) {
175+ if (str_starts_with ($ constraint , 'path: ' )) {
176176 $ path = substr ($ constraint , 5 );
177177 $ path = str_replace ('%PACKAGE% ' , \dirname ($ packageJson ->getPath ()), $ path );
178178
@@ -280,7 +280,7 @@ private function updateImportMap(array $importMapEntries): void
280280 continue ;
281281 }
282282
283- $ this ->io ->writeError (sprintf ('Updating package <comment>%s</> from <info>%s</> to <info>%s</>. ' , $ name , $ version , $ versionConstraint ));
283+ $ this ->io ->writeError (\ sprintf ('Updating package <comment>%s</> from <info>%s</> to <info>%s</>. ' , $ name , $ version , $ versionConstraint ));
284284 }
285285
286286 if (isset ($ importMapEntry ['path ' ])) {
@@ -313,7 +313,7 @@ private function updateImportMap(array $importMapEntries): void
313313 continue ;
314314 }
315315
316- throw new \InvalidArgumentException (sprintf ('Invalid importmap entry: "%s". ' , var_export ($ importMapEntry , true )));
316+ throw new \InvalidArgumentException (\ sprintf ('Invalid importmap entry: "%s". ' , var_export ($ importMapEntry , true )));
317317 }
318318 }
319319
0 commit comments