Skip to content

Commit 5d00066

Browse files
authored
Add PHP 8.4 support (#50)
* Add PHP 8.4 support
1 parent cfdcce0 commit 5d00066

7 files changed

Lines changed: 24 additions & 21 deletions

File tree

.github/workflows/ci.yml

Lines changed: 13 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -59,16 +59,23 @@ jobs:
5959
run: "vendor/bin/phpstan analyse --no-progress --error-format=github"
6060

6161
tests:
62-
name: "Tests"
62+
name: "Tests (PHP ${{ matrix.php-version }})"
6363
runs-on: "ubuntu-latest"
6464

65+
strategy:
66+
fail-fast: false
67+
matrix:
68+
php-version:
69+
- "8.4"
70+
- "8.5"
71+
6572
steps:
6673
- uses: "actions/checkout@v7"
6774

6875
- name: "Setup PHP"
6976
uses: "shivammathur/setup-php@v2"
7077
with:
71-
php-version: "8.5"
78+
php-version: "${{ matrix.php-version }}"
7279
tools: "composer"
7380
coverage: "xdebug"
7481

@@ -81,7 +88,7 @@ jobs:
8188
run: "vendor/bin/phpunit --configuration phpunit.xml.dist --colors=always"
8289

8390
- name: "Generate coverage summary"
84-
if: ${{ ! cancelled() }}
91+
if: ${{ ! cancelled() && matrix.php-version == '8.5' }}
8592
run: |
8693
echo '```' > var/.phpunit.cache/coverage.txt
8794
vendor/bin/phpunit \
@@ -92,18 +99,18 @@ jobs:
9299
93100
- name: "Report test results"
94101
uses: "mikepenz/action-junit-report@v6"
95-
if: ${{ ! cancelled() }}
102+
if: ${{ ! cancelled() && matrix.php-version == '8.5' }}
96103
with:
97104
report_paths: "var/.phpunit.cache/junit.xml"
98105
annotate_only: true
99106

100107
- name: "Post coverage summary"
101-
if: ${{ ! cancelled() }}
108+
if: ${{ ! cancelled() && matrix.php-version == '8.5' }}
102109
run: 'cat var/.phpunit.cache/coverage.txt >> "$GITHUB_STEP_SUMMARY"'
103110

104111
- name: "Upload coverage report"
105112
uses: "actions/upload-artifact@v7"
106-
if: ${{ ! cancelled() }}
113+
if: ${{ ! cancelled() && matrix.php-version == '8.5' }}
107114
with:
108115
name: "coverage-report"
109116
path: |

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,7 +10,7 @@ A static-analysis linter for DocBook XML files. It scans XML documentation sourc
1010

1111
### Requirements
1212

13-
- PHP 8.5+
13+
- PHP 8.4+
1414
- Extensions: `dom`, `libxml`, `simplexml`
1515

1616
### Setup

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,7 @@
55
"license": "Apache-2.0",
66
"bin": ["bin/docbook-cs"],
77
"require": {
8-
"php": "^8.5",
8+
"php": "^8.4",
99
"ext-dom": "*",
1010
"ext-libxml": "*",
1111
"ext-simplexml": "*"
@@ -14,7 +14,7 @@
1414
"phpunit/phpunit": "^13.2.4",
1515
"phpstan/phpstan": "^2.2.5",
1616
"phpunit/php-code-coverage": "^14.2.3",
17-
"squizlabs/php_codesniffer": "^4.0.1",
17+
"squizlabs/php_codesniffer": "^4.0.2",
1818
"phpstan/phpstan-strict-rules": "^2.0.12",
1919
"phpstan/phpstan-phpunit": "^2.0.18",
2020
"shipmonk/dead-code-detector": "^1.3.2"

src/Path/DiffPathLoader.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -68,9 +68,7 @@ private function candidates(string $path): array
6868
}
6969
}
7070

71-
return array_map($this->normalize(...), $candidates)
72-
|> array_unique(...)
73-
|> array_values(...);
71+
return array_values(array_unique(array_map($this->normalize(...), $candidates)));
7472
}
7573

7674
private function isAbsolute(string $path): bool

src/Report/FileReport.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -243,9 +243,9 @@ private function getFixedSeverityCount(Severity $severity): int
243243
/** @param list<Violation> $violations */
244244
private function countViolationSeverity(array $violations, Severity $severity): int
245245
{
246-
return array_filter(
246+
return count(array_filter(
247247
$violations,
248248
static fn(Violation $violation): bool => $violation->severity === $severity,
249-
) |> count(...);
249+
));
250250
}
251251
}

src/Report/Report.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,18 +50,18 @@ public function getScannedFilesCount(): int
5050

5151
public function getViolatingFilesCount(): int
5252
{
53-
return array_filter(
53+
return count(array_filter(
5454
$this->fileReports,
5555
static fn(FileReport $fileReport): bool => $fileReport->hasFinalViolations(),
56-
) |> count(...);
56+
));
5757
}
5858

5959
public function getChangedFilesCount(): int
6060
{
61-
return array_filter(
61+
return count(array_filter(
6262
$this->fileReports,
6363
static fn(FileReport $fileReport): bool => $fileReport->changed,
64-
) |> count(...);
64+
));
6565
}
6666

6767
public function getFoundViolationsCount(): int

src/Sniff/SimparaSniff.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -231,9 +231,7 @@ private function getAllowedElements(): array
231231
$additional = array_map('trim', explode(',', $extra));
232232
$additional = array_filter($additional, static fn(string $s): bool => $s !== '');
233233

234-
return array_merge(self::SIMPARA_ALLOWED, $additional)
235-
|> array_unique(...)
236-
|> array_values(...);
234+
return array_values(array_unique(array_merge(self::SIMPARA_ALLOWED, $additional)));
237235
}
238236

239237
/** @return list<array{beginOffset: int, closingOffset: int|null}> */

0 commit comments

Comments
 (0)