From 811b9963484a52f2c03ac44de7b931e981888010 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 19 Jan 2021 14:43:51 +0900 Subject: [PATCH 1/3] Make it work without an annotation reader --- composer.json | 4 ++-- src/Annotation/DefaultSchemeHost.php | 10 ++++++++-- tests/bootstrap.php | 8 ++++++++ 3 files changed, 18 insertions(+), 4 deletions(-) diff --git a/composer.json b/composer.json index 969557d7..2df13fae 100644 --- a/composer.json +++ b/composer.json @@ -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": { diff --git a/src/Annotation/DefaultSchemeHost.php b/src/Annotation/DefaultSchemeHost.php index 9379bc51..722d6c77 100644 --- a/src/Annotation/DefaultSchemeHost.php +++ b/src/Annotation/DefaultSchemeHost.php @@ -5,6 +5,7 @@ namespace BEAR\Sunday\Annotation; use Attribute; +use Doctrine\Common\Annotations\NamedArgumentConstructorAnnotation; use Ray\Di\Di\Qualifier; /** @@ -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; + } } diff --git a/tests/bootstrap.php b/tests/bootstrap.php index 6711b6c9..3eca832a 100644 --- a/tests/bootstrap.php +++ b/tests/bootstrap.php @@ -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()); +} From afd9549e9218dab16803071698fd0e38fee1fd45 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 19 Jan 2021 14:45:54 +0900 Subject: [PATCH 2/3] Bump maglnet/composer-require-checker from 2 .0 to 3.0 --- .gitattributes | 1 - .github/workflows/static-analysis.yml | 6 +++--- php-require-checker.config.json | 8 -------- 3 files changed, 3 insertions(+), 12 deletions(-) delete mode 100644 php-require-checker.config.json diff --git a/.gitattributes b/.gitattributes index 12604b84..90c3948b 100644 --- a/.gitattributes +++ b/.gitattributes @@ -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 diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 74bba0bf..9931c81e 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -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 @@ -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 diff --git a/php-require-checker.config.json b/php-require-checker.config.json deleted file mode 100644 index baca894e..00000000 --- a/php-require-checker.config.json +++ /dev/null @@ -1,8 +0,0 @@ -{ - "symbol-whitelist": [ - "null", "true", "false", - "static", "self", "parent", - "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", - "Attribute", "ReflectionAttribute" - ] -} From 29d835f87555d6b956d35a204dfacdaa8722cc65 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 19 Jan 2021 14:47:28 +0900 Subject: [PATCH 3/3] Exclude Squiz.WhiteSpace.FunctionSpacing.Before --- phpcs.xml | 2 ++ 1 file changed, 2 insertions(+) diff --git a/phpcs.xml b/phpcs.xml index 56f58c23..350158ee 100755 --- a/phpcs.xml +++ b/phpcs.xml @@ -41,6 +41,8 @@ + + */tests/Fake/*