Skip to content

Commit

Permalink
Merge pull request #152 from bearsunday/wokrs-without-annotation
Browse files Browse the repository at this point in the history
Make it work without an annotation reader
  • Loading branch information
koriym authored Jan 19, 2021
2 parents 139fa93 + 29d835f commit 200b5de
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 16 deletions.
1 change: 0 additions & 1 deletion .gitattributes
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@
/phpstan.neon export-ignore
/psalm.xml export-ignore
/phpunit.xml.dist export-ignore
/php-require-checker.config.json export-ignore

# Configure diff output for .php and .phar files.
*.php diff=php
Expand Down
6 changes: 3 additions & 3 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -123,7 +123,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 7.4
php-version: 8.0
coverage: none

- name: Get composer cache directory
Expand All @@ -133,7 +133,7 @@ jobs:
- name: Install dependencies
run: |
composer install --no-interaction --no-progress --prefer-dist
composer require --dev maglnet/composer-require-checker ^2.0
composer require --dev maglnet/composer-require-checker ^3.0
- name: Run composer-require-checker
run: ./vendor/bin/composer-require-checker check --config-file=./php-require-checker.config.json ./composer.json
run: ./vendor/bin/composer-require-checker
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -23,11 +23,11 @@
"require": {
"php": "^7.2 || ^8.0",
"ext-json": "*",
"bear/resource": "^1.15",
"bear/resource": "^1.15.1",
"doctrine/annotations": "^1.10",
"doctrine/cache": "^1.10",
"psr/log": "^1.1",
"ray/aop": "^2.10",
"ray/aop": "^2.10.1",
"ray/di": "^2.11"
},
"require-dev": {
Expand Down
8 changes: 0 additions & 8 deletions php-require-checker.config.json

This file was deleted.

2 changes: 2 additions & 0 deletions phpcs.xml
Original file line number Diff line number Diff line change
Expand Up @@ -41,6 +41,8 @@
<!-- /Base -->
<!-- Option -->
<exclude name="SlevomatCodingStandard.ControlStructures.EarlyExit.EarlyExitNotUsed"/>
<!-- PHP8 attribute -->
<exclude name="Squiz.WhiteSpace.FunctionSpacing.Before"/>
<!-- /Option -->
<!-- Exclude Fake files form Doctrine CS -->
<exclude-pattern>*/tests/Fake/*</exclude-pattern>
Expand Down
10 changes: 8 additions & 2 deletions src/Annotation/DefaultSchemeHost.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace BEAR\Sunday\Annotation;

use Attribute;
use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation;
use Ray\Di\Di\Qualifier;

/**
Expand All @@ -13,8 +14,13 @@
* @Qualifier
*/
#[Attribute(Attribute::TARGET_METHOD), Qualifier]
final class DefaultSchemeHost
final class DefaultSchemeHost implements NamedArgumentConstructorAnnotation
{
/** @var string */
/** @var ?string */
public $value;

public function __construct(?string $value = null)
{
$this->value = $value;
}
}
8 changes: 8 additions & 0 deletions tests/bootstrap.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,5 +2,13 @@

declare(strict_types=1);

use Koriym\Attributes\AttributeReader;
use Ray\ServiceLocator\ServiceLocator;

require dirname(__DIR__) . '/vendor/autoload.php';
array_map('unlink', (array) glob(__DIR__ . '/tmp/*.php'));

// no annotation in PHP 8
if (PHP_MAJOR_VERSION >= 8) {
ServiceLocator::setReader(new AttributeReader());
}

0 comments on commit 200b5de

Please sign in to comment.