Skip to content

Commit fdb1867

Browse files
authored
Task/support php parser 5 (#20)
* Support PHP-Parser 4.18 & 5 * Try testing both versions of php-parser * Support proper target branches
1 parent 2606f82 commit fdb1867

File tree

3 files changed

+13
-8
lines changed

3 files changed

+13
-8
lines changed

.github/workflows/php.yml

Lines changed: 11 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -2,25 +2,30 @@ name: 'Unit Tests'
22

33
on:
44
push:
5-
branches: [ main ]
5+
branches: [ release-1.x ]
66
pull_request:
7-
branches: [ main ]
7+
branches: [ release-1.x ]
88

99
jobs:
1010
build-test:
11-
1211
runs-on: ubuntu-latest
12+
strategy:
13+
fail-fast: false
14+
matrix:
15+
composer: [lowest, highest]
1316

1417
steps:
1518
- name: Checkout
16-
uses: actions/checkout@v2
19+
uses: actions/checkout@v4
1720
- name: Setup PHP 8
1821
uses: shivammathur/setup-php@v2
1922
with:
2023
php-version: 8.1
21-
tools: composer:v2
24+
tools: none
2225
coverage: none
2326
- name: Composer Install
24-
run: composer update --no-interaction --no-progress --ansi
27+
uses: ramsey/composer-install@v2
28+
with:
29+
dependency-versions: ${{ matrix.composer }}
2530
- name: Unit Tests
2631
run: ./vendor/bin/pest --colors=always

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -12,7 +12,7 @@
1212
],
1313
"require": {
1414
"php": "^8.1",
15-
"nikic/php-parser": "^v4.14",
15+
"nikic/php-parser": "^v4.18 || ^5.0",
1616
"cspray/typiphy": "^0.3"
1717
},
1818
"require-dev": {

src/PhpParserAnnotatedTargetParser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -29,7 +29,7 @@ final class PhpParserAnnotatedTargetParser implements AnnotatedTargetParser {
2929
private readonly Parser $parser;
3030

3131
public function __construct() {
32-
$this->parser = (new ParserFactory())->create(ParserFactory::ONLY_PHP7);
32+
$this->parser = (new ParserFactory())->createForNewestSupportedVersion();
3333
}
3434

3535
public function parse(AnnotatedTargetParserOptions $options) : Generator {

0 commit comments

Comments
 (0)