diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 8bb2ccb4..85ef1df1 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -27,7 +27,7 @@ jobs: with: coverage: "none" php-version: "${{ matrix.php }}" - tools: cs2pr, composer:v1 + tools: cs2pr, composer:v2 ini-values: "date.timezone=Europe/Paris" env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 3109d1e4..a9823551 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -36,7 +36,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -71,7 +71,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "pcov" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -117,7 +117,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -154,7 +154,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -194,7 +194,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -234,7 +234,7 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v1 + tools: composer:v2 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: @@ -255,8 +255,8 @@ jobs: - name: "Run PHPUnit" run: "php vendor/bin/simple-phpunit -v" - phpunit-composerv2: - name: "PHPUnit Composer v2 (PHP ${{ matrix.php }})" + phpunit-composerv1: + name: "PHPUnit Composer v1 (PHP ${{ matrix.php }})" runs-on: "ubuntu-18.04" strategy: @@ -275,25 +275,14 @@ jobs: with: php-version: "${{ matrix.php }}" coverage: "none" - tools: composer:v2 + tools: composer:v1 extensions: tidy ini-values: "date.timezone=Europe/Paris" env: COMPOSER_TOKEN: ${{ secrets.GITHUB_TOKEN }} - - name: Get composer cache directory - id: composer-cache - run: echo "::set-output name=dir::$(composer config cache-files-dir)" - - - name: "Cache dependencies installed with Composer" - uses: "actions/cache@v2" - with: - path: ${{ steps.composer-cache.outputs.dir }} - key: "php-${{ matrix.php }}-composer-locked-${{ hashFiles('composer.lock') }}" - restore-keys: "php-${{ matrix.php }}-composer-locked-" - - - name: "Install dependencies with composer" - run: "composer update --no-interaction --optimize-autoloader --no-progress --prefer-dist" + - name: "Install dependencies with Composer" + uses: "ramsey/composer-install@v1" - name: "Setup logs" run: "mkdir -p build/logs" diff --git a/.gitignore b/.gitignore index f1cd87d4..8563349b 100644 --- a/.gitignore +++ b/.gitignore @@ -3,5 +3,5 @@ log/graby.log log/html.log composer.lock -.php_cs.cache +/.php-cs-fixer.cache .phpunit.result.cache diff --git a/.php_cs b/.php-cs-fixer.php similarity index 63% rename from .php_cs rename to .php-cs-fixer.php index c365e2bb..cf560fc5 100644 --- a/.php_cs +++ b/.php-cs-fixer.php @@ -1,6 +1,11 @@ in(__DIR__) + ->exclude(['vendor', 'log']) +; +return (new PhpCsFixer\Config()) ->setRiskyAllowed(true) ->setRules([ '@Symfony' => true, @@ -8,22 +13,18 @@ 'array_syntax' => ['syntax' => 'short'], 'combine_consecutive_unsets' => true, 'heredoc_to_nowdoc' => true, - 'no_extra_consecutive_blank_lines' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block'], + 'no_extra_blank_lines' => ['tokens' => ['break', 'continue', 'extra', 'return', 'throw', 'use', 'parenthesis_brace_block', 'square_brace_block', 'curly_brace_block']], 'no_unreachable_default_argument_value' => true, 'no_useless_else' => true, 'no_useless_return' => true, 'ordered_class_elements' => true, 'ordered_imports' => true, - 'php_unit_strict' => false, + 'php_unit_strict' => true, 'phpdoc_order' => true, // 'psr4' => true, 'strict_comparison' => true, 'strict_param' => true, 'concat_space' => ['spacing' => 'one'], ]) - ->setFinder( - PhpCsFixer\Finder::create() - ->exclude(['vendor', 'log']) - ->in(__DIR__) - ) + ->setFinder($finder) ; diff --git a/composer.json b/composer.json index 26c54fff..45dace0f 100644 --- a/composer.json +++ b/composer.json @@ -15,7 +15,7 @@ "minimum-stability": "dev", "prefer-stable": true, "require": { - "php": ">=7.1", + "php": ">=7.1.3", "ext-curl": "*", "ext-tidy": "*", "fossar/htmlawed": "^1.2.7", @@ -34,7 +34,7 @@ "true/punycode": "^2.1" }, "require-dev": { - "friendsofphp/php-cs-fixer": "^2.16", + "friendsofphp/php-cs-fixer": "^3.0", "guzzlehttp/guzzle": "^6.3.0", "php-http/guzzle6-adapter": "^2.0", "php-http/mock-client": "^1.4", diff --git a/phpstan.neon b/phpstan.neon index d569f7d7..720bf5ea 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -5,7 +5,7 @@ parameters: - tests bootstrapFiles: - - vendor/bin/.phpunit/phpunit-8.3-0/vendor/autoload.php + - vendor/bin/.phpunit/phpunit-8.5-0/vendor/autoload.php ignoreErrors: # because we check for some HTTP client to exist or not (Guzzle 5/6 & cURL) diff --git a/tests/Extractor/ContentExtractorTest.php b/tests/Extractor/ContentExtractorTest.php index 74fec772..fd4d8906 100644 --- a/tests/Extractor/ContentExtractorTest.php +++ b/tests/Extractor/ContentExtractorTest.php @@ -167,7 +167,7 @@ public function testProcessFindString(): void $this->assertStringContainsString('