@@ -104,7 +104,7 @@ private function removeObsoletePackageJsonLinks(): bool
104
104
105
105
foreach (['dependencies ' => $ jsDependencies , 'devDependencies ' => $ jsDevDependencies ] as $ key => $ packages ) {
106
106
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 ' )) {
108
108
continue ;
109
109
}
110
110
if (file_exists ($ this ->rootDir .'/ ' .substr ($ version , 5 ).'/package.json ' )) {
@@ -161,18 +161,18 @@ private function resolveImportMapPackages($phpPackage): array
161
161
$ package = $ constraintConfig ['package ' ] ?? $ importMapName ;
162
162
$ entrypoint = $ constraintConfig ['entrypoint ' ] ?? false ;
163
163
} 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 )));
165
165
}
166
166
167
167
// When "$constraintConfig" matches one of the following cases:
168
168
// - "entrypoint:%PACKAGE%/script.js"
169
169
// - {"version": "entrypoint:%PACKAGE%/script.js"}
170
- if (0 === strpos ($ constraint , 'entrypoint: ' )) {
170
+ if (str_starts_with ($ constraint , 'entrypoint: ' )) {
171
171
$ entrypoint = true ;
172
172
$ constraint = str_replace ('entrypoint: ' , 'path: ' , $ constraint );
173
173
}
174
174
175
- if (0 === strpos ($ constraint , 'path: ' )) {
175
+ if (str_starts_with ($ constraint , 'path: ' )) {
176
176
$ path = substr ($ constraint , 5 );
177
177
$ path = str_replace ('%PACKAGE% ' , \dirname ($ packageJson ->getPath ()), $ path );
178
178
@@ -280,7 +280,7 @@ private function updateImportMap(array $importMapEntries): void
280
280
continue ;
281
281
}
282
282
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 ));
284
284
}
285
285
286
286
if (isset ($ importMapEntry ['path ' ])) {
@@ -313,7 +313,7 @@ private function updateImportMap(array $importMapEntries): void
313
313
continue ;
314
314
}
315
315
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 )));
317
317
}
318
318
}
319
319
0 commit comments