Skip to content

Commit

Permalink
Merge pull request #45 from gacela-project/misc/matrix-ci
Browse files Browse the repository at this point in the history
Fix PHP 8.0 bug for anonymous classes and added a matrix CI
  • Loading branch information
JesusValera committed Jul 17, 2021
2 parents 81ae753 + a4f2d0b commit 3533eb3
Show file tree
Hide file tree
Showing 2 changed files with 16 additions and 9 deletions.
19 changes: 12 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,7 @@ on:
name: CI

jobs:

coding-guidelines:
name: Coding Guidelines
runs-on: ubuntu-latest
Expand All @@ -15,7 +16,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
Expand All @@ -35,7 +36,7 @@ jobs:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
Expand All @@ -45,23 +46,27 @@ jobs:
run: composer install --no-interaction --no-ansi --no-progress

- name: Run vimeo/psalm on internal code
run: ./vendor/bin/psalm --config=psalm.xml --no-progress --shepherd --show-info=false --stats
run: ./vendor/bin/psalm --config=psalm.xml --no-progress --shepherd --show-info=false --stats --output-format=github

- name: Run phpstan on internal code
run: ./vendor/bin/phpstan analyze -c phpstan.neon src

tests:
name: Tests
runs-on: ubuntu-latest

strategy:
fail-fast: false
matrix:
operating-system: ['ubuntu-latest', 'windows-latest', 'macos-latest']
php: ['7.4', '8.0']
name: Tests on PHP ${{ matrix.php }}
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Install PHP
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: ${{ matrix.php }}
coverage: none

- name: Install dependencies
Expand Down
6 changes: 4 additions & 2 deletions src/Framework/ClassResolver/ClassInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,12 @@ public function __construct(object $callerObject)

/** @var string[] $callerClassParts */
$callerClassParts = explode('\\', ltrim($callerClass, '\\'));
if (count($callerClassParts) <= 1) {
$last = end($callerClassParts);

if (false !== strpos($last, 'anonymous')) {
$callerClassParts = [
'module-name@anonymous',
'class-name@anonymous',
$last,
];
}

Expand Down

0 comments on commit 3533eb3

Please sign in to comment.