From d941cf9ff4947b914afed8b2b4f2fc7f098c9e9b Mon Sep 17 00:00:00 2001 From: Rico Sonntag Date: Mon, 18 Mar 2024 10:15:26 +0100 Subject: [PATCH] Apply php-cs-fixer/rector rules --- .github/workflows/ci.yml | 6 ------ .github/workflows/phpcs.yml | 27 --------------------------- .github/workflows/phpstan.yml | 27 --------------------------- composer.json | 3 +-- phpstan-baseline.neon | 6 +----- src/Facade/DataFacade.php | 13 +++++++------ src/Traits/ModuleCustomTrait.php | 8 ++++---- 7 files changed, 13 insertions(+), 77 deletions(-) delete mode 100644 .github/workflows/phpcs.yml delete mode 100644 .github/workflows/phpstan.yml diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index c1b4c03..79b1a6b 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -73,9 +73,3 @@ jobs: if: ${{ always() && steps.install.conclusion == 'success' }} run: | composer ci:test:php:rector - - - id: tests_unit - name: Unit Tests - if: ${{ always() && steps.install.conclusion == 'success' }} - run: | - composer ci:test:php:unit diff --git a/.github/workflows/phpcs.yml b/.github/workflows/phpcs.yml deleted file mode 100644 index 14c0481..0000000 --- a/.github/workflows/phpcs.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: PHP_CodeSniffer - -on: [push, pull_request] - -jobs: - run: - runs-on: ${{ matrix.operating-system }} - - strategy: - matrix: - operating-system: [ubuntu-22.04] - php-version: ['8.1', '8.2'] - - name: Testing PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }} - - steps: - - uses: shivammathur/setup-php@master - with: - php-version: ${{ matrix.php-version }} - extensions: json,intl,mbstring - - - name: Checkout repository - uses: actions/checkout@v3 - - - run: composer validate - - run: composer install --no-progress - - run: vendor/bin/phpcs src/ --standard=PSR12 diff --git a/.github/workflows/phpstan.yml b/.github/workflows/phpstan.yml deleted file mode 100644 index a7dfdec..0000000 --- a/.github/workflows/phpstan.yml +++ /dev/null @@ -1,27 +0,0 @@ -name: PHPStan - -on: [push, pull_request] - -jobs: - run: - runs-on: ${{ matrix.operating-system }} - - strategy: - matrix: - operating-system: [ubuntu-22.04] - php-version: ['8.1', '8.2'] - - name: Testing PHP ${{ matrix.php-version }} on ${{ matrix.operating-system }} - - steps: - - uses: shivammathur/setup-php@master - with: - php-version: ${{ matrix.php-version }} - extensions: json,intl,mbstring - - - name: Checkout repository - uses: actions/checkout@v3 - - - run: composer validate - - run: composer install --no-progress - - run: vendor/bin/phpstan analyse -c phpstan.neon diff --git a/composer.json b/composer.json index 407e4ec..cdc0a3f 100644 --- a/composer.json +++ b/composer.json @@ -94,8 +94,7 @@ "ci:test": [ "@ci:test:php:lint", "@ci:test:php:phpstan", - "@ci:test:php:rector", - "@ci:test:php:unit" + "@ci:test:php:rector" ], "module:check": [ "@ci:test" diff --git a/phpstan-baseline.neon b/phpstan-baseline.neon index 54d5891..aab4991 100644 --- a/phpstan-baseline.neon +++ b/phpstan-baseline.neon @@ -1,6 +1,2 @@ parameters: - ignoreErrors: - - - message: "#^Call to an undefined method Fisharebest\\\\Webtrees\\\\Module\\\\ModuleCustomInterface\\:\\:assetUrl\\(\\)\\.$#" - count: 1 - path: src/Processor/ImageProcessor.php + ignoreErrors: [] diff --git a/src/Facade/DataFacade.php b/src/Facade/DataFacade.php index d9bac1a..18fc0a1 100644 --- a/src/Facade/DataFacade.php +++ b/src/Facade/DataFacade.php @@ -159,12 +159,13 @@ private function sortChildrenByBirthdate(RecursiveIteratorIterator $recursiveIte && $nodeData->getData()->getIndividual()->getBirthDate()->isOK() ) ) { - $item->setChildren( - $childrenCollection - ->sort($this->birthDateComparator()) - ->values() - ->toArray() - ); + /** @var Node[] $children */ + $children = $childrenCollection + ->sort($this->birthDateComparator()) + ->values() + ->toArray(); + + $item->setChildren($children); } } } diff --git a/src/Traits/ModuleCustomTrait.php b/src/Traits/ModuleCustomTrait.php index 4a38882..859aedb 100644 --- a/src/Traits/ModuleCustomTrait.php +++ b/src/Traits/ModuleCustomTrait.php @@ -40,10 +40,10 @@ public function customModuleLatestVersionUrl(): string return self::CUSTOM_LATEST_VERSION; } -// protected function extractVersion(string $content): string -// { -// return json_decode($content, true)['tag_name'] ?? ''; -// } + // protected function extractVersion(string $content): string + // { + // return json_decode($content, true)['tag_name'] ?? ''; + // } public function customModuleLatestVersion(): string {