From 70a4e4a03af65ad733f4107e477849c950b038fa Mon Sep 17 00:00:00 2001 From: Oleksii Bulba Date: Fri, 4 Aug 2023 22:54:20 +0300 Subject: [PATCH] Chore: Added dev-tools library - Added micro/dev-tools library; - Refactored composer commands; - Run php-cs-fixer; - CI/CD improvements; --- .github/workflows/ci.yaml | 28 ++++++++++++++++++---------- composer.json | 22 ++++++++++++---------- src/Kernel.php | 12 ------------ src/KernelInterface.php | 1 - 4 files changed, 30 insertions(+), 33 deletions(-) diff --git a/.github/workflows/ci.yaml b/.github/workflows/ci.yaml index e54001a..e454cf7 100644 --- a/.github/workflows/ci.yaml +++ b/.github/workflows/ci.yaml @@ -29,20 +29,28 @@ jobs: dependency-versions: 'highest' steps: - - name: "Checkout code" - uses: "actions/checkout@v2" + - name: Checkout code + uses: actions/checkout@v2 - - name: "Install PHP" - uses: "shivammathur/setup-php@v2" + - name: Install PHP + uses: shivammathur/setup-php@v2 with: - coverage: "none" - php-version: "${{ matrix.php-version }}" + coverage: none + php-version: ${{ matrix.php-version }} - - name: "Composer install" - uses: "ramsey/composer-install@v2" + - name: Composer install + uses: ramsey/composer-install@v2 with: - dependency-versions: "${{ matrix.dependency-versions }}" - composer-options: "--prefer-dist --no-progress" + dependency-versions: ${{ matrix.dependency-versions }} + composer-options: --prefer-dist --no-progress + + - name: Test tools install + run: | + cd vendor/micro/dev-tools/tools/psalm; composer install; cd ../../../../..; + cd vendor/micro/dev-tools/tools/phpstan; composer install; cd ../../../../..; + cd vendor/micro/dev-tools/tools/php-cs-fixer; composer install; cd ../../../../..; + cd vendor/micro/dev-tools/tools/phpcs; composer install; cd ../../../../..; + cd vendor/micro/dev-tools/tools/phpmd; composer install; cd ../../../../..; - name: Run tests run: composer run test diff --git a/composer.json b/composer.json index d46e504..9eccdde 100755 --- a/composer.json +++ b/composer.json @@ -14,13 +14,15 @@ "micro/dependency-injection": "^1.6" }, "require-dev": { - "ergebnis/composer-normalize": "^2.29", - "friendsofphp/php-cs-fixer": "^3.13", - "phpstan/phpstan": "^1.9", - "phpunit/php-code-coverage": "^9.2", - "phpunit/phpunit": "^9.5", - "vimeo/psalm": "^5.2" + "micro/dev-tools": "dev-feature/library-created" }, + "repositories": [ + { + "type": "vcs", + "url": "git@github.com:Micro-PHP/dev-tools.git" + } + ], + "minimum-stability": "dev", "autoload": { "psr-4": { "Micro\\Framework\\Kernel\\": "src/" @@ -40,11 +42,11 @@ "scripts": { "coverage": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-text", "coverage-html": "XDEBUG_MODE=coverage ./vendor/bin/phpunit --coverage-html ./test-coverage-report", - "php-cs-fix": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --using-cache=no", - "php-cs-try": "PHP_CS_FIXER_IGNORE_ENV=1 ./vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no", - "phpstan": "./vendor/bin/phpstan analyze --no-progress", "phpunit": "./vendor/bin/phpunit", - "psalm": "./vendor/bin/psalm --no-progress --show-info=true --no-cache", + "php-cs-fix": "./vendor/micro/dev-tools/tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --verbose --using-cache=no", + "php-cs-try": "./vendor/micro/dev-tools/tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no", + "phpstan": "./vendor/micro/dev-tools/tools/phpstan/vendor/bin/phpstan analyze --no-progress", + "psalm": "./vendor/micro/dev-tools/tools/psalm/vendor/bin/psalm --no-progress --show-info=true --no-cache", "statics": [ "@phpstan", "@psalm", diff --git a/src/Kernel.php b/src/Kernel.php index f071524..f268a36 100755 --- a/src/Kernel.php +++ b/src/Kernel.php @@ -65,9 +65,6 @@ public function setBootLoaders(iterable $bootLoaders): self return $this; } - /** - * {@inheritDoc} - */ public function run(): void { if ($this->isStarted) { @@ -78,17 +75,11 @@ public function run(): void $this->isStarted = true; } - /** - * {@inheritDoc} - */ public function container(): Container { return $this->container; } - /** - * {@inheritDoc} - */ public function loadPlugin(string $applicationPluginClass): void { if (\in_array($applicationPluginClass, $this->pluginsLoaded, true)) { @@ -105,9 +96,6 @@ public function loadPlugin(string $applicationPluginClass): void $this->pluginsLoaded[] = $applicationPluginClass; } - /** - * {@inheritDoc} - */ public function plugins(string $interfaceInherited = null): \Traversable { foreach ($this->plugins as $plugin) { diff --git a/src/KernelInterface.php b/src/KernelInterface.php index 75b2d66..8a19aa3 100755 --- a/src/KernelInterface.php +++ b/src/KernelInterface.php @@ -56,7 +56,6 @@ public function loadPlugin(string $applicationPluginClass): void; * @template T of object * * @psalm-param class-string|null $interfaceInherited if empty, each connected plugin will be iterated - * * @return \Traversable Application plugins iterator *