Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

AttributeReader by default #93

Merged
merged 2 commits into from
Jan 5, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading