Skip to content

Commit

Permalink
bump InstalledPackageResolver
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Nov 13, 2024
1 parent 3271bed commit bd41d82
Show file tree
Hide file tree
Showing 2 changed files with 8 additions and 6 deletions.
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
"php": ">=8.2"
},
"require-dev": {
"rector/rector-src": "dev-main",
"rector/rector-src": "dev-main#e3ba39d",
"phpunit/phpunit": "^10.5",
"phpstan/phpstan": "^1.12",
"symplify/phpstan-rules": "^13.0",
Expand All @@ -17,7 +17,7 @@
"phpstan/phpstan-webmozart-assert": "^1.2",
"symplify/vendor-patches": "^11.3",
"tracy/tracy": "^2.10",
"tomasvotruba/class-leak": "^1.0",
"tomasvotruba/class-leak": "^1.1.2",
"rector/type-perfect": "^1.0",
"rector/swiss-knife": "^1.0"
},
Expand Down
10 changes: 6 additions & 4 deletions src/Composer/ProjectPackageVersionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,14 +14,16 @@
*/
final readonly class ProjectPackageVersionResolver
{
public function __construct(
private InstalledPackageResolver $installedPackageResolver,
) {
private InstalledPackageResolver $installedPackageResolver;

public function __construct()
{
$this->installedPackageResolver = new InstalledPackageResolver(getcwd());
}

public function findPackageVersion(string $packageName): ?string
{
$rootProjectInstalledPackages = $this->installedPackageResolver->resolve(getcwd());
$rootProjectInstalledPackages = $this->installedPackageResolver->resolve();

foreach ($rootProjectInstalledPackages as $rootProjectInstalledPackage) {
if ($rootProjectInstalledPackage->getName() === $packageName) {
Expand Down

0 comments on commit bd41d82

Please sign in to comment.