From 1d690a42b8214ea81f1fb5d66ce05034fb9de4d2 Mon Sep 17 00:00:00 2001 From: Tomas Votruba Date: Tue, 18 Jun 2024 16:52:13 +0900 Subject: [PATCH] remove container, as simple enough --- bin/rng.php | 16 +++++++--------- composer.json | 10 ++++------ ecs.php | 6 +++++- phpstan.neon | 5 ----- 4 files changed, 16 insertions(+), 21 deletions(-) diff --git a/bin/rng.php b/bin/rng.php index 78f2b16..921ff6d 100755 --- a/bin/rng.php +++ b/bin/rng.php @@ -2,9 +2,10 @@ declare(strict_types=1); -use Illuminate\Container\Container; +use Rector\ReleaseNotesGenerator\ChangelogContentsFactory; use Rector\ReleaseNotesGenerator\Command\GenerateCommand; use Rector\ReleaseNotesGenerator\GithubApiCaller; +use Rector\ReleaseNotesGenerator\GitResolver; use Symfony\Component\Console\Application; $possibleAutoloadPaths = [ @@ -21,17 +22,14 @@ } } +$gitResolver = new GitResolver(); +$githubApiCaller = new GithubApiCaller(); +$changelogContentsFactory = new ChangelogContentsFactory(); -$container = new Container(); -$container->when(GithubApiCaller::class) - ->needs('$githubToken') - ->give(getenv('GITHUB_TOKEN')); - - -$generateChangelogCommand = $container->make(GenerateCommand::class); +$generateCommand = new GenerateCommand($gitResolver, $githubApiCaller, $changelogContentsFactory); $application = new Application(); -$application->add($generateChangelogCommand); +$application->add($generateCommand); $application->setDefaultCommand('generate', true); exit($application->run()); diff --git a/composer.json b/composer.json index 48388f0..3e50173 100644 --- a/composer.json +++ b/composer.json @@ -9,20 +9,18 @@ "require": { "php": "^8.2", "symfony/console": "^6.4|^7.0", - "illuminate/container": "^10.39", "nategood/httpful": "^0.3.2", "webmozart/assert": "^1.11", "nette/utils": "^3.2|^4.0", "symfony/process": "^6.4|^7.0" }, "require-dev": { - "rector/rector": "^1.0", - "symplify/easy-coding-standard": "^12.1", + "rector/rector": "^1.1", + "symplify/easy-coding-standard": "^12.3", "phpstan/phpstan": "^1.11", "phpunit/phpunit": "^10.5", "phpstan/phpstan-webmozart-assert": "^1.2.2", - "phpstan/extension-installer": "^1.3", - "symplify/phpstan-extensions": "^11.4" + "phpstan/extension-installer": "^1.3" }, "autoload": { "psr-4": { @@ -43,6 +41,6 @@ "scripts": { "check-cs": "vendor/bin/ecs check --ansi", "fix-cs": "vendor/bin/ecs check --fix --ansi", - "phpstan": "vendor/bin/phpstan analyse --ansi --error-format symplify" + "phpstan": "vendor/bin/phpstan analyse --ansi" } } diff --git a/ecs.php b/ecs.php index ff5204b..9fdff64 100644 --- a/ecs.php +++ b/ecs.php @@ -7,4 +7,8 @@ return ECSConfig::configure() ->withPreparedSets(symplify: true, common: true, cleanCode: true, psr12: true) ->withRootFiles() - ->withPaths([__DIR__ . '/src', __DIR__ . '/tests']); + ->withPaths([ + __DIR__ . '/bin', + __DIR__ . '/src', + __DIR__ . '/tests', + ]); diff --git a/phpstan.neon b/phpstan.neon index c08f589..0f54c65 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,8 +5,3 @@ parameters: - bin - src - tests - - ignoreErrors: - - - message: '#Parameter \#1 \$implementation of method Illuminate\\Contracts\\Container\\ContextualBindingBuilder\:\:give\(\) expects array\|Closure\|string, string\|false given#' - path: bin/rng.php