@@ -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 ();
@@ -73,13 +73,13 @@ public function resolve(Version $version, string $reference, string $type, bool
7373 }
7474
7575 return match (true ) {
76- $ this ->buildDistributions && null === $ version ->getDist () => $ this ->build ($ version , $ reference , $ type ),
77- $ this ->mirrorDistributions && null !== $ version ->getDist () => $ this ->mirror ($ version , $ reference , $ type ),
76+ $ this ->buildDistributions && null === $ version ->getDist () => $ this ->build ($ version , $ reference ?? $ version -> getSourceReference () , $ type ?? $ version -> getSourceType () ),
77+ $ this ->mirrorDistributions && null !== $ version ->getDist () => $ this ->mirror ($ version , $ reference ?? $ version -> getDistReference () , $ type ?? $ version -> getDistType () ),
7878 default => false ,
7979 };
8080 }
8181
82- private function build (Version $ version , string $ reference , string $ type ): bool
82+ private function build (Version $ version , ? string $ reference , ? string $ type ): bool
8383 {
8484 // Skip building of outdated references for now
8585 if ($ reference !== $ version ->getSourceReference ()) {
@@ -116,7 +116,7 @@ private function build(Version $version, string $reference, string $type): bool
116116 return true ;
117117 }
118118
119- private function mirror (Version $ version , string $ reference , string $ type ): bool
119+ private function mirror (Version $ version , ? string $ reference , ? string $ type ): bool
120120 {
121121 // Skip mirroring of outdated references for now
122122 if ($ reference !== $ version ->getDistReference ()) {
0 commit comments