From ec266e89cfaa2f2fd6456bc2b3099036a6473d03 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Thu, 15 Jul 2021 10:28:06 +0900 Subject: [PATCH 1/3] Remove cache --- .github/workflows/static-analysis.yml | 3 ++- composer-require-checker.json | 18 ++++++++++++++++++ composer.json | 1 - .../Module/Cache/DoctrineCacheModule.php | 3 +++ src/Module/SundayModule.php | 2 -- tests/Module/Cache/DoctrineCacheModuleTest.php | 18 ------------------ tests/Module/SundayModuleTest.php | 5 ----- 7 files changed, 23 insertions(+), 27 deletions(-) create mode 100644 composer-require-checker.json rename {src => src-deprecated}/Module/Cache/DoctrineCacheModule.php (94%) delete mode 100644 tests/Module/Cache/DoctrineCacheModuleTest.php diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index 9931c81e..ad3fb90f 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -136,4 +136,5 @@ jobs: composer require --dev maglnet/composer-require-checker ^3.0 - name: Run composer-require-checker - run: ./vendor/bin/composer-require-checker + run: ./vendor/bin/composer-require-checker --config-file=./composer-require-checker.json + diff --git a/composer-require-checker.json b/composer-require-checker.json new file mode 100644 index 00000000..bdfdb709 --- /dev/null +++ b/composer-require-checker.json @@ -0,0 +1,18 @@ +{ + "symbol-whitelist" : [ + "null", "true", "false", + "static", "self", "parent", + "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "mixed", + "Doctrine\\Common\\Cache\\ArrayCache", "Doctrine\\Common\\Cache\\Cache" + ], + "php-core-extensions" : [ + "Core", + "date", + "pcre", + "Phar", + "Reflection", + "SPL", + "standard" + ], + "scan-files" : [] +} diff --git a/composer.json b/composer.json index 615ee3af..1f78fd20 100644 --- a/composer.json +++ b/composer.json @@ -25,7 +25,6 @@ "ext-json": "*", "bear/resource": "^1.15.4", "doctrine/annotations": "^1.12", - "doctrine/cache": "^1.10", "psr/log": "^1.1", "ray/aop": "^2.10.1", "ray/di": "^2.11" diff --git a/src/Module/Cache/DoctrineCacheModule.php b/src-deprecated/Module/Cache/DoctrineCacheModule.php similarity index 94% rename from src/Module/Cache/DoctrineCacheModule.php rename to src-deprecated/Module/Cache/DoctrineCacheModule.php index d9396b78..7a4c94d9 100644 --- a/src/Module/Cache/DoctrineCacheModule.php +++ b/src-deprecated/Module/Cache/DoctrineCacheModule.php @@ -9,6 +9,9 @@ use Ray\Di\AbstractModule; use Ray\Di\Scope; +/** + * @deprecated + */ class DoctrineCacheModule extends AbstractModule { protected function configure(): void diff --git a/src/Module/SundayModule.php b/src/Module/SundayModule.php index 6f8610b0..85d2f856 100644 --- a/src/Module/SundayModule.php +++ b/src/Module/SundayModule.php @@ -5,7 +5,6 @@ namespace BEAR\Sunday\Module; use BEAR\Resource\Module\ResourceModule; -use BEAR\Sunday\Module\Cache\DoctrineCacheModule; use BEAR\Sunday\Provide\Error\ErrorModule; use BEAR\Sunday\Provide\Router\RouterModule; use BEAR\Sunday\Provide\Transfer\HttpCacheModule; @@ -17,7 +16,6 @@ class SundayModule extends AbstractModule protected function configure(): void { $this->install(new HttpCacheModule()); - $this->install(new DoctrineCacheModule()); $this->install(new ResourceModule()); $this->install(new RouterModule()); $this->install(new HttpResponderModule()); diff --git a/tests/Module/Cache/DoctrineCacheModuleTest.php b/tests/Module/Cache/DoctrineCacheModuleTest.php deleted file mode 100644 index a3abd38c..00000000 --- a/tests/Module/Cache/DoctrineCacheModuleTest.php +++ /dev/null @@ -1,18 +0,0 @@ -getInstance(Cache::class); - $this->assertInstanceOf(Cache::class, $cache); - } -} diff --git a/tests/Module/SundayModuleTest.php b/tests/Module/SundayModuleTest.php index 23cdab99..c57d6671 100644 --- a/tests/Module/SundayModuleTest.php +++ b/tests/Module/SundayModuleTest.php @@ -13,8 +13,6 @@ use BEAR\Sunday\Provide\Router\WebRouter; use BEAR\Sunday\Provide\Transfer\HttpResponder; use Doctrine\Common\Annotations\Reader; -use Doctrine\Common\Cache\ArrayCache; -use Doctrine\Common\Cache\Cache; use PHPUnit\Framework\TestCase; use Ray\Di\AbstractModule; use Ray\Di\Injector; @@ -43,9 +41,6 @@ public function testMinApp(): void public function testDependModules(): void { - $cache = $this->injector->getInstance(Cache::class); - $this->assertInstanceOf(ArrayCache::class, $cache); - $reader = $this->injector->getInstance(Reader::class); $this->assertInstanceOf(Reader::class, $reader); From b966b49cc4ed1f25c8c29bce2dfeb03bf5934f68 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Thu, 15 Jul 2021 10:28:52 +0900 Subject: [PATCH 2/3] Soothe psalm --- src/Provide/Transfer/ConditionalResponse.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/src/Provide/Transfer/ConditionalResponse.php b/src/Provide/Transfer/ConditionalResponse.php index 2246810b..f3b27c90 100644 --- a/src/Provide/Transfer/ConditionalResponse.php +++ b/src/Provide/Transfer/ConditionalResponse.php @@ -33,17 +33,17 @@ public function isModified(ResourceObject $ro, array $server): bool /** * {@inheritdoc} */ - public function getOutput(array $originalHeaders): Output + public function getOutput(array $headers): Output { - $headers = []; - foreach ($originalHeaders as $label => $value) { + $newHeaders = []; + foreach ($headers as $label => $value) { if (! in_array($label, self::HEADER_IN_304, true)) { continue; } - $headers[$label] = $value; + $newHeaders[$label] = $value; } - return new Output(304, $headers, ''); + return new Output(304, $newHeaders, ''); } } From 58e9b31146477a1d0a551963a1e58679d224d882 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Thu, 15 Jul 2021 13:22:17 +0900 Subject: [PATCH 3/3] Update coverage config --- .gitignore | 1 + coverage.xml | 372 ----------------------------------------------- phpunit.xml.dist | 9 +- 3 files changed, 7 insertions(+), 375 deletions(-) delete mode 100644 coverage.xml diff --git a/.gitignore b/.gitignore index 118918b8..5d6649c6 100644 --- a/.gitignore +++ b/.gitignore @@ -7,3 +7,4 @@ /coverage.xml /vendor-bin/**/vendor /demo/vendor +/.phpunit-cache diff --git a/coverage.xml b/coverage.xml deleted file mode 100644 index bb2c6d58..00000000 --- a/coverage.xml +++ /dev/null @@ -1,372 +0,0 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ec090945..12b6399d 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,12 +1,15 @@ - - + + src - + tests