Skip to content

Commit

Permalink
Chore: Added dev-tools library
Browse files Browse the repository at this point in the history
- Added micro/dev-tools library;
- Refactored composer commands;
- Run php-cs-fixer;
- CI/CD improvements;

Signed-off-by: Oleksii Bulba <[email protected]>
  • Loading branch information
Oleksii Bulba committed Jun 20, 2023
1 parent 56938c9 commit 3372e2b
Show file tree
Hide file tree
Showing 4 changed files with 30 additions and 33 deletions.
28 changes: 18 additions & 10 deletions .github/workflows/ci.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -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
Expand Down
22 changes: 12 additions & 10 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": "[email protected]:Micro-PHP/dev-tools.git"
}
],
"minimum-stability": "dev",
"autoload": {
"psr-4": {
"Micro\\Framework\\Kernel\\": "src/"
Expand All @@ -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/micro-devtools/tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --verbose --using-cache=no",
"php-cs-try": "./vendor/micro/micro-devtools/tools/php-cs-fixer/vendor/bin/php-cs-fixer fix --verbose --dry-run --using-cache=no",
"phpstan": "./vendor/micro/micro-devtools/tools/phpstan/vendor/bin/phpstan analyze --no-progress",
"psalm": "./vendor/micro/micro-devtools/tools/psalm/vendor/bin/psalm --no-progress --show-info=true --no-cache",
"statics": [
"@phpstan",
"@psalm",
Expand Down
12 changes: 0 additions & 12 deletions src/Kernel.php
Original file line number Diff line number Diff line change
Expand Up @@ -65,9 +65,6 @@ public function setBootLoaders(iterable $bootLoaders): self
return $this;
}

/**
* {@inheritDoc}
*/
public function run(): void
{
if ($this->isStarted) {
Expand All @@ -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)) {
Expand All @@ -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) {
Expand Down
1 change: 0 additions & 1 deletion src/KernelInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -56,7 +56,6 @@ public function loadPlugin(string $applicationPluginClass): void;
* @template T of object
*
* @psalm-param class-string<T>|null $interfaceInherited if empty, each connected plugin will be iterated
*
* @return \Traversable<T|object> Application plugins iterator
*
Expand Down

0 comments on commit 3372e2b

Please sign in to comment.