Skip to content

Commit

Permalink
Merge pull request #93: AttributeReader by default
Browse files Browse the repository at this point in the history
  • Loading branch information
roxblnfk authored Jan 5, 2024
2 parents 9198a4d + 9a39d04 commit af04e98
Show file tree
Hide file tree
Showing 4 changed files with 7 additions and 13 deletions.
8 changes: 4 additions & 4 deletions .github/workflows/main.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,7 +9,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php-version: ['8.1','8.2']
php-version: ['8.1', '8.2', '8.3']
steps:
- name: Checkout
uses: actions/checkout@v2
Expand All @@ -36,11 +36,11 @@ jobs:
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies with composer
if: matrix.php-version != '8.3'
if: matrix.php-version != '8.4'
run: composer update --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Install dependencies with composer php 8.1
if: matrix.php-version == '8.3'
- name: Install dependencies with composer php 8.4
if: matrix.php-version == '8.4'
run: composer update --ignore-platform-reqs --prefer-dist --no-interaction --no-progress --optimize-autoloader --ansi

- name: Execute Tests
Expand Down
2 changes: 0 additions & 2 deletions .github/workflows/psalm.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,5 +12,3 @@ jobs:
with:
os: >-
['ubuntu-latest']
php: >-
['8.2']
6 changes: 1 addition & 5 deletions src/ReaderFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,6 @@
use Doctrine\Common\Annotations\Reader as DoctrineReader;
use Spiral\Attributes\AnnotationReader;
use Spiral\Attributes\AttributeReader;
use Spiral\Attributes\Composite\SelectiveReader;
use Spiral\Attributes\ReaderInterface;

final class ReaderFactory
Expand All @@ -17,10 +16,7 @@ public static function create(DoctrineReader|ReaderInterface $reader = null): Re
return match (true) {
$reader instanceof ReaderInterface => $reader,
$reader instanceof DoctrineReader => new AnnotationReader($reader),
$reader === null => new SelectiveReader([
new AttributeReader(),
new AnnotationReader(),
]),
$reader === null => new AttributeReader(),
};
}
}
4 changes: 2 additions & 2 deletions tests/Annotated/Unit/ReaderFactoryTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,16 +8,16 @@
use Doctrine\Common\Annotations\AnnotationReader as DoctrineAnnotationReader;
use PHPUnit\Framework\TestCase;
use Spiral\Attributes\AnnotationReader;
use Spiral\Attributes\AttributeReader;
use Spiral\Attributes\Composite\MergeReader;
use Spiral\Attributes\Composite\SelectiveReader;

class ReaderFactoryTest extends TestCase
{
public function testCreateFromNull(): void
{
$reader = ReaderFactory::create(null);

$this->assertInstanceOf(SelectiveReader::class, $reader);
$this->assertInstanceOf(AttributeReader::class, $reader);
}

public function testCreateFromDoctrineReader(): void
Expand Down

0 comments on commit af04e98

Please sign in to comment.