@@ -39,17 +39,17 @@ public function __construct(
3939 $ this ->distributionStoragePath = "$ storagePath/distribution " ;
4040 }
4141
42- public function exists (string $ packageName , string $ packageVersion , string $ reference , string $ type ): bool
42+ public function exists (string $ packageName , string $ packageVersion , ? string $ reference , ? string $ type ): bool
4343 {
44- return $ this ->filesystem ->exists ($ this ->path ($ packageName , $ packageVersion , $ reference , $ type ));
44+ return null !== $ reference && null !== $ type && $ this ->filesystem ->exists ($ this ->path ($ packageName , $ packageVersion , $ reference , $ type ));
4545 }
4646
4747 public function path (string $ packageName , string $ packageVersion , string $ reference , string $ type ): string
4848 {
4949 return "$ this ->distributionStoragePath / $ packageName/ $ packageVersion- $ reference. $ type " ;
5050 }
5151
52- public function resolve (Version $ version , string $ reference , string $ type , bool $ async ): bool
52+ public function resolve (Version $ version , ? string $ reference , ? string $ type , bool $ async ): bool
5353 {
5454 $ package = $ version ->getPackage ();
5555 $ packageName = $ package ->getName ();
@@ -74,13 +74,13 @@ public function resolve(Version $version, string $reference, string $type, bool
7474 }
7575
7676 return match (true ) {
77- $ this ->buildDistributions && null === $ version ->getDist () => $ this ->build ($ version , $ reference , $ type ),
78- $ this ->mirrorDistributions && null !== $ version ->getDist () => $ this ->mirror ($ version , $ reference , $ type ),
77+ $ this ->buildDistributions && null === $ version ->getDist () => $ this ->build ($ version , $ reference ?? $ version -> getSourceReference () , $ type ?? $ version -> getSourceType () ),
78+ $ this ->mirrorDistributions && null !== $ version ->getDist () => $ this ->mirror ($ version , $ reference ?? $ version -> getDistReference () , $ type ?? $ version -> getDistType () ),
7979 default => false ,
8080 };
8181 }
8282
83- private function build (Version $ version , string $ reference , string $ type ): bool
83+ private function build (Version $ version , ? string $ reference , ? string $ type ): bool
8484 {
8585 // Skip building of outdated references for now
8686 if ($ reference !== $ version ->getSourceReference ()) {
@@ -117,7 +117,7 @@ private function build(Version $version, string $reference, string $type): bool
117117 return true ;
118118 }
119119
120- private function mirror (Version $ version , string $ reference , string $ type ): bool
120+ private function mirror (Version $ version , ? string $ reference , ? string $ type ): bool
121121 {
122122 // Skip mirroring of outdated references for now
123123 if ($ reference !== $ version ->getDistReference ()) {
0 commit comments