From 2ba54d8ef76136385e8b3acab1f3e9a2bd9d0911 Mon Sep 17 00:00:00 2001 From: Paul Thebaud Date: Mon, 8 Nov 2021 22:15:00 +0100 Subject: [PATCH 1/5] Change PHP 8.0 support and add PHP 8.1 support --- .github/workflows/main.yml | 4 +++- composer.json | 2 +- 2 files changed, 4 insertions(+), 2 deletions(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index f8bcc23..577749f 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -2,6 +2,8 @@ name: CI on: push: + pull_request: + branches: [master, develop] schedule: - cron: '0 0 1 * *' @@ -11,7 +13,7 @@ jobs: strategy: matrix: - php: [ 8.0 ] + php: [ 8.0, 8.1 ] os: [ ubuntu-latest, windows-latest ] name: PHP${{ matrix.php }} - ${{ matrix.os }} diff --git a/composer.json b/composer.json index 81baa4e..18aa7cb 100644 --- a/composer.json +++ b/composer.json @@ -23,7 +23,7 @@ } ], "require": { - "php": "^8.0", + "php": "~8.0.12 || ~8.1.0", "league/container": "^3.2", "phpdocumentor/reflection-docblock": "^4.0|^5.0", "roave/better-reflection": "^3.3|^4.0|^5.0", From 3b5d38db5965ad8876bd2e835183297ecd6085bb Mon Sep 17 00:00:00 2001 From: Paul Thebaud Date: Mon, 8 Nov 2021 22:19:21 +0100 Subject: [PATCH 2/5] Fix code parser --- src/Parsers/CodeParser.php | 5 +++-- 1 file changed, 3 insertions(+), 2 deletions(-) diff --git a/src/Parsers/CodeParser.php b/src/Parsers/CodeParser.php index 609a7bd..0144956 100644 --- a/src/Parsers/CodeParser.php +++ b/src/Parsers/CodeParser.php @@ -10,6 +10,7 @@ use Roave\BetterReflection\BetterReflection; use Roave\BetterReflection\Reflection\ReflectionClass; use Roave\BetterReflection\Reflector\ClassReflector; +use Roave\BetterReflection\Reflector\DefaultReflector; use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure; use Roave\BetterReflection\SourceLocator\Ast\Locator; use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator; @@ -43,12 +44,12 @@ public function __construct(BetterReflection $betterReflection) */ public function parse(Source $source): ReflectionClass { - $reflector = new ClassReflector( + $reflector = new DefaultReflector( new StringSourceLocator($source->toString(), $this->astLocator) ); try { - $classes = $reflector->getAllClasses(); + $classes = $reflector->reflectAllClasses(); } catch (ParseToAstFailure $exception) { throw new InvalidArgumentException( 'code might have an invalid syntax because AST failed to parse it' From 97d7e09d6eb4545fb3a2a67ec2c118e87ec59cf9 Mon Sep 17 00:00:00 2001 From: Paul Thebaud Date: Mon, 8 Nov 2021 22:20:36 +0100 Subject: [PATCH 3/5] Update setup PHP version --- .github/workflows/main.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 577749f..45f2285 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -23,7 +23,7 @@ jobs: uses: actions/checkout@v2 - name: Setup PHP - uses: shivammathur/setup-php@2.11.0 + uses: shivammathur/setup-php@v2 with: php-version: ${{ matrix.php }} coverage: xdebug From 9782900271516a5c447fc3bc76b65b0670786954 Mon Sep 17 00:00:00 2001 From: Paul Thebaud Date: Mon, 8 Nov 2021 22:36:29 +0100 Subject: [PATCH 4/5] Remove useless import --- src/Parsers/CodeParser.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Parsers/CodeParser.php b/src/Parsers/CodeParser.php index 0144956..b17c6f5 100644 --- a/src/Parsers/CodeParser.php +++ b/src/Parsers/CodeParser.php @@ -9,7 +9,6 @@ use PhpUnitGen\Core\Exceptions\InvalidArgumentException; use Roave\BetterReflection\BetterReflection; use Roave\BetterReflection\Reflection\ReflectionClass; -use Roave\BetterReflection\Reflector\ClassReflector; use Roave\BetterReflection\Reflector\DefaultReflector; use Roave\BetterReflection\SourceLocator\Ast\Exception\ParseToAstFailure; use Roave\BetterReflection\SourceLocator\Ast\Locator; From e9f06cda90ef22c8ff204f85b79973e0c3ed2d28 Mon Sep 17 00:00:00 2001 From: Paul Thebaud Date: Mon, 8 Nov 2021 23:49:17 +0100 Subject: [PATCH 5/5] Set setup PHP actions to env update true --- .github/workflows/main.yml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index 45f2285..1802435 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -27,6 +27,8 @@ jobs: with: php-version: ${{ matrix.php }} coverage: xdebug + env: + update: true - name: Install dependencies run: |