From 726e5955786969b7c650d989657b55c12d4521e1 Mon Sep 17 00:00:00 2001 From: Markus Podar Date: Sun, 28 Jan 2024 19:33:31 +0100 Subject: [PATCH] Add support for nikic/php-parser:^5 and (hopefully) doctrine/dbal:^4 (#1502) * Add support for nikic/php-parser:^5 - `createForHostVersion` has been added to php-parse 4.18 so code can run with both versions [1] - therefore also bumped the minimum required version to it Note: The dev dependency vimeo/psalm is **not** compatible with php-parser:^5 currently. This does not impact usages of this library, but sometimes cause friction when working on this library. For our CI this isn't a problem, because we already remove that dependency before running the test suite. [1] https://github.com/nikic/PHP-Parser/blob/master/UPGRADE-5.0.md#changes-to-the-parser-factory * gha: prevent cancelling of all jobs if one fails * Update CHANGELOG.md * gha: remove unsupported Laravel / PHP combinations According to https://laravel.com/docs/10.x/releases * Add dbal:^4 too --- .github/workflows/run-integration-tests.yml | 9 +++++++-- CHANGELOG.md | 1 + composer.json | 4 ++-- src/UsesResolver.php | 2 +- 4 files changed, 11 insertions(+), 5 deletions(-) diff --git a/.github/workflows/run-integration-tests.yml b/.github/workflows/run-integration-tests.yml index 96173bf..31bc718 100644 --- a/.github/workflows/run-integration-tests.yml +++ b/.github/workflows/run-integration-tests.yml @@ -17,6 +17,7 @@ jobs: env: COMPOSER_NO_INTERACTION: 1 strategy: + fail-fast: false matrix: php: [8.3, 8.2, 8.1, 8.0, 7.4, 7.3] laravel: [10.*, 9.*, 8.*] @@ -25,14 +26,18 @@ jobs: laravel: 10.* - php: 7.4 laravel: 10.* - - php: 7.4 - laravel: 10.* - php: 7.3 laravel: 10.* + - php: 8.3 + laravel: 9.* - php: 7.4 laravel: 9.* - php: 7.3 laravel: 9.* + - php: 8.3 + laravel: 8.* + - php: 8.2 + laravel: 8.* name: P${{ matrix.php }} - Laravel${{ matrix.laravel }} steps: - name: Checkout code diff --git a/CHANGELOG.md b/CHANGELOG.md index 70ed218..fdab75d 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -13,6 +13,7 @@ All notable changes to this project will be documented in this file. - Add support for attribute accessors marked as protected. [#1339 / pindab0ter](https://github.com/barryvdh/laravel-ide-helper/pull/1339) ### Added +- Add support for nikic/php-parser 5 (next to 4) [#1502 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1502) - Add support for `immutable_date:*` and `immutable_datetime:*` casts. [#1380 / thekonz](https://github.com/barryvdh/laravel-ide-helper/pull/1380) 2023-02-04, 2.13.0 diff --git a/composer.json b/composer.json index 2eecae2..22d94d8 100644 --- a/composer.json +++ b/composer.json @@ -24,11 +24,11 @@ "ext-json": "*", "barryvdh/reflection-docblock": "^2.0.6", "composer/class-map-generator": "^1.0", - "doctrine/dbal": "^2.6 || ^3", + "doctrine/dbal": "^2.6 || ^3 || ^4", "illuminate/console": "^8 || ^9 || ^10", "illuminate/filesystem": "^8 || ^9 || ^10", "illuminate/support": "^8 || ^9 || ^10", - "nikic/php-parser": "^4.7", + "nikic/php-parser": "^4.18 || ^5", "phpdocumentor/type-resolver": "^1.1.0" }, "require-dev": { diff --git a/src/UsesResolver.php b/src/UsesResolver.php index 205da9c..4900a12 100644 --- a/src/UsesResolver.php +++ b/src/UsesResolver.php @@ -64,7 +64,7 @@ class UsesResolver '\\' ); - $parser = (new ParserFactory())->create(ParserFactory::PREFER_PHP7); + $parser = (new ParserFactory())->createForHostVersion(); $namespaceData = null; foreach ($parser->parse($code) as $node) {