diff --git a/.github/workflows/coverage.yml b/.github/workflows/coverage.yml index ba095f45..7d72c636 100644 --- a/.github/workflows/coverage.yml +++ b/.github/workflows/coverage.yml @@ -39,14 +39,6 @@ jobs: restore-keys: | ${{ runner.os }}-${{ matrix.setup }}-coverage-${{ matrix.php }}- - - name: Code Climate Test Reporter Preparation - run: | - curl -L https://codeclimate.com/downloads/test-reporter/test-reporter-latest-linux-amd64 > ./cc-test-reporter - chmod +x ./cc-test-reporter - ./cc-test-reporter before-build - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: | @@ -57,15 +49,15 @@ jobs: - name: Run test suite run: vendor/bin/phpunit --coverage-text --coverage-clover=coverage.xml --default-time-limit=3 - - name: Code Climate Test Reporter - if: ${{ env.CC_TEST_REPORTER_ID != '' }} - run: | - cp coverage.xml clover.xml - bash <(curl -s https://codecov.io/bash) - ./cc-test-reporter after-build --coverage-input-type clover --exit-code 0 - composer config version 1.9.0 - # composer require codacy/coverage - # vendor/bin/codacycoverage clover coverage.xml - env: - CC_TEST_REPORTER_ID: ${{ secrets.CC_TEST_REPORTER_ID }} - # CODACY_PROJECT_TOKEN: ${{ secrets.CODACY_PROJECT_TOKEN }} + - name: Coverage - Qltysh + uses: qltysh/qlty-action/coverage@v2 + if: matrix.coverage + with: + token: ${{ secrets.QLTY_COVERAGE_TOKEN }} + files: clover.xml + + - name: Coverage - Codecov + if: matrix.coverage + uses: codecov/codecov-action@v5 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/.github/workflows/multi-tester.yml b/.github/workflows/multi-tester.yml index f3853fc3..de578d1a 100644 --- a/.github/workflows/multi-tester.yml +++ b/.github/workflows/multi-tester.yml @@ -12,7 +12,7 @@ jobs: strategy: matrix: - php: ['7.4', '8.2'] + php: ['8.2', '8.4'] setup: ['stable'] name: PHP ${{ matrix.php }} @@ -38,7 +38,6 @@ jobs: - name: Install dependencies if: steps.composer-cache.outputs.cache-hit != 'true' run: | - composer config version 1.9.0 composer require kylekatarnls/multi-tester:^2.5.2 --dev --no-update --no-interaction composer update --prefer-dist --prefer-${{ matrix.setup }} --no-progress --no-interaction diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index df545a09..88864be5 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -13,7 +13,7 @@ jobs: strategy: fail-fast: false matrix: - php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4'] + php: ['7.1', '7.2', '7.3', '7.4', '8.0', '8.1', '8.2', '8.3', '8.4', '8.5'] setup: ['lowest', 'stable', 'next'] name: PHP ${{ matrix.php }} - ${{ matrix.setup }} @@ -41,7 +41,6 @@ jobs: if: steps.composer-cache.outputs.cache-hit != 'true' run: | composer config version 1.9.0 - ${{ matrix.php >= 7.2 && matrix.php < 8 && matrix.setup == 'lowest' && 'composer require --no-update "phpunit/phpunit:^5.7.27||^6.5.14||^7.5.20" --no-interaction;' || '' }} ${{ matrix.php >= 8 && 'composer require --no-update phpunit/phpunit:^8.5.14 --no-interaction;' || '' }} composer update --prefer-dist ${{ matrix.setup != 'next' && format('--prefer-{0}', matrix.setup) || '' }} --no-progress ${{ matrix.php >= 8.1 && '--ignore-platform-req=php' || '' }} --no-interaction diff --git a/composer.json b/composer.json index 3234792e..5ba7164e 100644 --- a/composer.json +++ b/composer.json @@ -33,12 +33,12 @@ "nodejs-php-fallback/less": "^1.0.5", "nodejs-php-fallback/stylus": "^1.0.4", "nodejs-php-fallback/uglify": "^1.0.4", - "phpunit/phpunit": "^7.5.20 || ^8.5.41 || ^9.6.22", + "phpunit/phpunit": "^7.5.20 || ^8.5.52 || ^9.6.34", "phpunit/php-code-coverage": "^6.1.4 || ^7.0.17 || ^9.2.32", "phpunit/php-invoker": "^1.1.4 || ^3.1.1", "pug-php/pug": "^3.4.1", "pug-php/pug-filter-coffee-script": "^1.3.1", - "squizlabs/php_codesniffer": "^3.7.2" + "squizlabs/php_codesniffer": "^3.13.5" }, "replace": { "phug/ast": "self.version", diff --git a/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php b/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php index 0fad46d0..233f5e2e 100644 --- a/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php +++ b/src/Phug/Util/CompatibilityUtil/TestCaseUntyped.php @@ -21,17 +21,17 @@ protected function finishTest() // Override } - protected function setUp() + protected function setUp(): void { $this->prepareTest(); } - protected function tearDown() + protected function tearDown(): void { $this->finishTest(); } - public static function assertMatchesRegularExpression($pattern, $string, $message = '') + public static function assertMatchesRegularExpression(string $pattern, string $string, string $message = ''): void { if (!method_exists(parent::class, 'assertMatchesRegularExpression')) { self::assertRegExp($pattern, $string, $message); @@ -42,7 +42,7 @@ public static function assertMatchesRegularExpression($pattern, $string, $messag parent::assertMatchesRegularExpression($pattern, $string, $message); } - public static function assertFileDoesNotExist($filename, $message = '') + public static function assertFileDoesNotExist(string $filename, string $message = ''): void { if (!method_exists(parent::class, 'assertFileDoesNotExist')) { self::assertFileNotExists($filename, $message); @@ -53,7 +53,7 @@ public static function assertFileDoesNotExist($filename, $message = '') parent::assertFileDoesNotExist($filename, $message); } - public static function assertIsArray($actual, $message = '') + public static function assertIsArray($actual, string $message = ''): void { if (!method_exists(parent::class, 'assertIsArray')) { self::assertSame('array', gettype($actual)); diff --git a/tests/Phug/AbstractLexerTest.php b/tests/Phug/AbstractLexerTest.php index eba9ccfc..91ff686c 100644 --- a/tests/Phug/AbstractLexerTest.php +++ b/tests/Phug/AbstractLexerTest.php @@ -49,7 +49,7 @@ protected function filterTokenClass($className) } } - protected function assertTokens($expression, array $classNames, Lexer $lexer = null, &$tokens = []) + protected function assertTokens($expression, array $classNames, ?Lexer $lexer = null, &$tokens = []) { $lexer = $lexer ?: $this->lexer; $tokens = iterator_to_array($lexer->lex($expression)); diff --git a/tests/Phug/AbstractParserTest.php b/tests/Phug/AbstractParserTest.php index 8774e528..5816c775 100644 --- a/tests/Phug/AbstractParserTest.php +++ b/tests/Phug/AbstractParserTest.php @@ -17,7 +17,7 @@ protected function prepareTest() $this->parser = new Parser(); } - protected function assertNodes($expression, $expected, Parser $parser = null) + protected function assertNodes($expression, $expected, ?Parser $parser = null) { if (is_array($expected)) { $expected = implode("\n", $expected); diff --git a/tests/Phug/Compiler/NodeCompiler/BlockNodeCompilerTest/TestBlockNodeCompiler.php b/tests/Phug/Compiler/NodeCompiler/BlockNodeCompilerTest/TestBlockNodeCompiler.php index 015e1b7b..b13fa5a9 100644 --- a/tests/Phug/Compiler/NodeCompiler/BlockNodeCompilerTest/TestBlockNodeCompiler.php +++ b/tests/Phug/Compiler/NodeCompiler/BlockNodeCompilerTest/TestBlockNodeCompiler.php @@ -9,7 +9,7 @@ class TestBlockNodeCompiler extends BlockNodeCompiler { - public function compileNode(NodeInterface $node, ElementInterface $parent = null) + public function compileNode(NodeInterface $node, ?ElementInterface $parent = null) { $blocks = &$this->getCompiler()->getBlocksByName('foo'); $blocks[] = 'bar'; diff --git a/tests/Phug/FormatterTest.php b/tests/Phug/FormatterTest.php index 7fd65d84..b12d6136 100644 --- a/tests/Phug/FormatterTest.php +++ b/tests/Phug/FormatterTest.php @@ -1354,8 +1354,6 @@ public function testDebugErrorOnRemovedFile() try { include $file; - } catch (\Exception $exception) { - $error = $exception; } catch (\Throwable $exception) { $error = $exception; } @@ -1364,6 +1362,8 @@ public function testDebugErrorOnRemovedFile() unlink($file); clearstatcache(); + self::assertInstanceOf(\Throwable::class, $error); + /** @var LocatedException $error */ $error = $formatter->getDebugError($error, $php); diff --git a/tests/Phug/RendererTest.php b/tests/Phug/RendererTest.php index d9dbd003..bb901ea0 100644 --- a/tests/Phug/RendererTest.php +++ b/tests/Phug/RendererTest.php @@ -482,6 +482,7 @@ public function testHandleErrorInString() $message = $error->getMessage(); } + self::assertIsString($message); self::assertStringContains( 'Division by zero', $message @@ -579,6 +580,7 @@ public function testContextLines() $message = $error->getMessage(); } + self::assertIsString($message); self::assertStringContains('Division by zero', $message); self::assertStringContains('div: p=12/0', $message); self::assertStringContains('// line -1', $message); diff --git a/tests/Phug/TestCompiler.php b/tests/Phug/TestCompiler.php index 63f848b7..b90ab72e 100644 --- a/tests/Phug/TestCompiler.php +++ b/tests/Phug/TestCompiler.php @@ -8,7 +8,7 @@ class TestCompiler extends Compiler { - public function compileNode(NodeInterface $node, ElementInterface $parent = null) + public function compileNode(NodeInterface $node, ?ElementInterface $parent = null) { return 'foo'; } diff --git a/tests/Phug/TestState.php b/tests/Phug/TestState.php index 6f356ee8..7b9d5bf5 100644 --- a/tests/Phug/TestState.php +++ b/tests/Phug/TestState.php @@ -9,7 +9,7 @@ class TestState extends State { private static $lastOptions; - public function __construct(Parser $parser, \Generator $tokens, array $options = null) + public function __construct(Parser $parser, \Generator $tokens, ?array $options = null) { parent::__construct($parser, $tokens, $options); diff --git a/tests/Phug/Utils/MutedExceptionCompiler.php b/tests/Phug/Utils/MutedExceptionCompiler.php index 5efa7915..b8f17e3c 100644 --- a/tests/Phug/Utils/MutedExceptionCompiler.php +++ b/tests/Phug/Utils/MutedExceptionCompiler.php @@ -15,7 +15,7 @@ public function throwException($message, $node = null, $code = 0, $previous = nu // removed } - public function compileNode(NodeInterface $node, ElementInterface $parent = null) + public function compileNode(NodeInterface $node, ?ElementInterface $parent = null) { return $this->forcedReturn ?: parent::compileNode($node, $parent); } diff --git a/tests/Phug/Utils/TwigFormat.php b/tests/Phug/Utils/TwigFormat.php index 0daf3e9b..fadefa0e 100644 --- a/tests/Phug/Utils/TwigFormat.php +++ b/tests/Phug/Utils/TwigFormat.php @@ -8,7 +8,7 @@ class TwigFormat extends XhtmlFormat { - public function __construct(Formatter $formatter = null) + public function __construct(?Formatter $formatter = null) { parent::__construct($formatter);