Skip to content
This repository has been archived by the owner on Apr 18, 2024. It is now read-only.

Commit

Permalink
Merge pull request #11 from paul-thebaud/features/php-8.1
Browse files Browse the repository at this point in the history
PHP 8.0 fix and PHP 8.1 support
  • Loading branch information
paul-thebaud authored Nov 8, 2021
2 parents 0e99e04 + e9f06cd commit 8a63f20
Show file tree
Hide file tree
Showing 3 changed files with 10 additions and 6 deletions.
8 changes: 6 additions & 2 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,8 @@ name: CI

on:
push:
pull_request:
branches: [master, develop]
schedule:
- cron: '0 0 1 * *'

Expand All @@ -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 }}
Expand All @@ -21,10 +23,12 @@ 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
env:
update: true

- name: Install dependencies
run: |
Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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",
Expand Down
6 changes: 3 additions & 3 deletions src/Parsers/CodeParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@
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;
use Roave\BetterReflection\SourceLocator\Type\StringSourceLocator;
Expand Down Expand Up @@ -43,12 +43,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'
Expand Down

0 comments on commit 8a63f20

Please sign in to comment.