File tree Expand file tree Collapse file tree 2 files changed +10
-4
lines changed
Expand file tree Collapse file tree 2 files changed +10
-4
lines changed Original file line number Diff line number Diff line change @@ -61,7 +61,13 @@ public function resolve(): array
6161
6262 public function resolvePackageVersion (string $ packageName ): ?string
6363 {
64- return ($ this ->resolve ()[$ packageName ] ?? null )?->getVersion();
64+ $ package = $ this ->resolve ()[$ packageName ] ?? null ;
65+
66+ if (! $ package instanceof InstalledPackage) {
67+ return null ;
68+ }
69+
70+ return $ package ->getVersion ();
6571 }
6672
6773 /**
Original file line number Diff line number Diff line change @@ -44,13 +44,13 @@ public function getSetFilePath(): string
4444 */
4545 public function matchInstalledPackages (array $ installedPackages ): bool
4646 {
47- $ installedVersion = ( $ installedPackages [$ this ->packageName ] ?? null )?->getVersion() ;
47+ $ package = $ installedPackages [$ this ->packageName ] ?? null ;
4848
49- if ($ installedVersion === null ) {
49+ if (! $ package instanceof InstalledPackage ) {
5050 return false ;
5151 }
5252
53- return Semver::satisfies ($ installedVersion , '^ ' . $ this ->version );
53+ return Semver::satisfies ($ package -> getVersion () , '^ ' . $ this ->version );
5454 }
5555
5656 public function getName (): string
You can’t perform that action at this time.
0 commit comments