Skip to content

Commit

Permalink
Task/support php parser 5 (#20)
Browse files Browse the repository at this point in the history
* Support PHP-Parser 4.18 & 5

* Try testing both versions of php-parser

* Support proper target branches
  • Loading branch information
cspray authored Jun 3, 2024
1 parent 2606f82 commit fdb1867
Show file tree
Hide file tree
Showing 3 changed files with 13 additions and 8 deletions.
17 changes: 11 additions & 6 deletions .github/workflows/php.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,25 +2,30 @@ name: 'Unit Tests'

on:
push:
branches: [ main ]
branches: [ release-1.x ]
pull_request:
branches: [ main ]
branches: [ release-1.x ]

jobs:
build-test:

runs-on: ubuntu-latest
strategy:
fail-fast: false
matrix:
composer: [lowest, highest]

steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Setup PHP 8
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
tools: composer:v2
tools: none
coverage: none
- name: Composer Install
run: composer update --no-interaction --no-progress --ansi
uses: ramsey/composer-install@v2
with:
dependency-versions: ${{ matrix.composer }}
- name: Unit Tests
run: ./vendor/bin/pest --colors=always
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
],
"require": {
"php": "^8.1",
"nikic/php-parser": "^v4.14",
"nikic/php-parser": "^v4.18 || ^5.0",
"cspray/typiphy": "^0.3"
},
"require-dev": {
Expand Down
2 changes: 1 addition & 1 deletion src/PhpParserAnnotatedTargetParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@ final class PhpParserAnnotatedTargetParser implements AnnotatedTargetParser {
private readonly Parser $parser;

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

public function parse(AnnotatedTargetParserOptions $options) : Generator {
Expand Down

0 comments on commit fdb1867

Please sign in to comment.