@@ -34,11 +34,11 @@ public function resolve(array $arguments = [], bool $isRequire = false): array
3434 $ packages = [];
3535 foreach ($ arguments as $ i => $ argument ) {
3636 if ((false !== $ pos = strpos ($ argument , ': ' )) || (false !== $ pos = strpos ($ argument , '= ' ))) {
37- $ package = $ this ->resolvePackageName (substr ($ argument , 0 , $ pos ), $ i );
37+ $ package = $ this ->resolvePackageName (substr ($ argument , 0 , $ pos ), $ i, $ isRequire );
3838 $ version = substr ($ argument , $ pos + 1 );
3939 $ packages [] = $ package .': ' .$ version ;
4040 } else {
41- $ packages [] = $ this ->resolvePackageName ($ argument , $ i );
41+ $ packages [] = $ this ->resolvePackageName ($ argument , $ i, $ isRequire );
4242 }
4343 }
4444
@@ -84,9 +84,15 @@ public function parseVersion(string $package, string $version, bool $isRequire):
8484 return ': ' .$ version ;
8585 }
8686
87- private function resolvePackageName (string $ argument , int $ position ): string
87+ private function resolvePackageName (string $ argument , int $ position, bool $ isRequire ): string
8888 {
89- if (false !== strpos ($ argument , '/ ' ) || preg_match (PlatformRepository::PLATFORM_PACKAGE_REGEX , $ argument ) || preg_match ('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i ' , $ argument ) || \in_array ($ argument , ['lock ' , 'mirrors ' , 'nothing ' , '' ])) {
89+ $ skippedPackages = ['mirrors ' , 'nothing ' , '' ];
90+
91+ if (!$ isRequire ) {
92+ $ skippedPackages [] = 'lock ' ;
93+ }
94+
95+ if (false !== strpos ($ argument , '/ ' ) || preg_match (PlatformRepository::PLATFORM_PACKAGE_REGEX , $ argument ) || preg_match ('{(?<=[a-z0-9_/-])\*|\*(?=[a-z0-9_/-])}i ' , $ argument ) || \in_array ($ argument , $ skippedPackages )) {
9096 return $ argument ;
9197 }
9298
0 commit comments