From d3d599e780b87ca5b44d601bb238f726f55e29f9 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 24 Nov 2026 01:36:35 +0900 Subject: [PATCH 1/4] Move the coding-standards workflow to the shared v1 workflow - Call ray-di/.github coding-standards.yml@v1 with php_version 8.4 instead of the stale v2 branch. --- .github/workflows/coding-standards.yml | 4 +++- 1 file changed, 3 insertions(+), 1 deletion(-) diff --git a/.github/workflows/coding-standards.yml b/.github/workflows/coding-standards.yml index 6f162f1..2a62ee6 100644 --- a/.github/workflows/coding-standards.yml +++ b/.github/workflows/coding-standards.yml @@ -7,4 +7,6 @@ on: jobs: cs: - uses: ray-di/.github/.github/workflows/coding-standards.yml@v2 + uses: ray-di/.github/.github/workflows/coding-standards.yml@v1 + with: + php_version: 8.4 From 641ed6c8d432198bc5738321b470f658f18269f0 Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 24 Nov 2026 01:36:35 +0900 Subject: [PATCH 2/4] Update PHPUnit to 11 and the dev tools to their current majors - PHPUnit ^11.5 (the newest major PHP 8.2 allows), PHPStan ^2.1, PHPMD ^3.0, PHP_CodeSniffer ^4.0; Psalm ^6.0 || ^7.0 since Psalm 5 cannot install next to PHPUnit 11. - Remove the unused bamarni/composer-bin-plugin and its config; there is no vendor-bin directory. - Point the PHPUnit and Psalm schema locations at the installed versions and use the phpmd analyze syntax in the sa script. - Drop assertions PHPStan 2 reports as always true, and supply the missing-entity class name from a fixture instead of a @var on a literal. --- composer.json | 25 +++++++------------------ phpunit.xml.dist | 5 ++--- psalm.xml | 2 +- tests/Fake/FakeMissingEntity.php | 18 ++++++++++++++++++ tests/WebQueryBdrTest.php | 2 -- tests/WebResponseMapperTest.php | 8 ++------ 6 files changed, 30 insertions(+), 30 deletions(-) create mode 100644 tests/Fake/FakeMissingEntity.php diff --git a/composer.json b/composer.json index 69d25f4..755712e 100644 --- a/composer.json +++ b/composer.json @@ -19,13 +19,12 @@ "rize/uri-template": "^0.3 || ^0.4" }, "require-dev": { - "bamarni/composer-bin-plugin": "^1.8", - "phpunit/phpunit": "^10.5.46", - "squizlabs/php_codesniffer": "^3.8", - "phpstan/phpstan": "^1.10", - "vimeo/psalm": "^5.18 || ^6.0 || ^7.0", + "phpmd/phpmd": "^3.0", "phpmetrics/phpmetrics": "^2.8", - "phpmd/phpmd": "^2.15" + "phpstan/phpstan": "^2.1", + "phpunit/phpunit": "^11.5", + "squizlabs/php_codesniffer": "^4.0", + "vimeo/psalm": "^6.0 || ^7.0" }, "autoload": { "psr-4": { @@ -53,7 +52,7 @@ "sa": [ "./vendor/bin/psalm --monochrome --show-info=true", "./vendor/bin/phpstan analyse -c phpstan.neon", - "./vendor/bin/phpmd src text ./phpmd.xml" + "./vendor/bin/phpmd analyze src --format text --ruleset ./phpmd.xml" ], "test": "./vendor/bin/phpunit", "tests": [ @@ -70,16 +69,6 @@ ] }, "config": { - "sort-packages": true, - "allow-plugins": { - "dealerdirect/phpcodesniffer-composer-installer": true, - "bamarni/composer-bin-plugin": true - } - }, - "extra": { - "bamarni-bin": { - "bin-links": true, - "forward-command": false - } + "sort-packages": true } } diff --git a/phpunit.xml.dist b/phpunit.xml.dist index ba2d152..6059032 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,8 +1,7 @@ - - + - + tests diff --git a/psalm.xml b/psalm.xml index 84667fd..3f70d09 100644 --- a/psalm.xml +++ b/psalm.xml @@ -4,7 +4,7 @@ phpVersion="8.4" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" - xsi:schemaLocation="https://getpsalm.org/schema/config vendor-bin/tools/vendor/vimeo/psalm/config.xsd" + xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" findUnusedBaselineEntry="true" findUnusedCode="false" > diff --git a/tests/Fake/FakeMissingEntity.php b/tests/Fake/FakeMissingEntity.php new file mode 100644 index 0000000..ef70dcd --- /dev/null +++ b/tests/Fake/FakeMissingEntity.php @@ -0,0 +1,18 @@ +fooProduct = $this->buildFooProduct($body); $result = $this->fooProduct->listWithTax('active'); - $this->assertIsArray($result); $this->assertCount(2, $result); $this->assertInstanceOf(FakeProductEntity::class, $result[0]); $this->assertSame(110, $result[0]->price); @@ -82,7 +81,6 @@ public function testRowListWithoutFactory(): void $body = '[{"name":"Widget","price":100},{"name":"Gadget","price":200}]'; $this->fooProduct = $this->buildFooProduct($body); $result = $this->fooProduct->list('active'); - $this->assertIsArray($result); $this->assertCount(2, $result); $this->assertInstanceOf(FakeProductEntity::class, $result[0]); } diff --git a/tests/WebResponseMapperTest.php b/tests/WebResponseMapperTest.php index d32fdfa..7f96914 100644 --- a/tests/WebResponseMapperTest.php +++ b/tests/WebResponseMapperTest.php @@ -103,9 +103,7 @@ public function testEntityWithoutConstructorThrows(): void public function testInvalidFactoryThrows(): void { - /** @var class-string $missing */ - $missing = 'NotAClass\\Factory'; - $webQuery = new WebQuery(id: 'id', factory: $missing); + $webQuery = new WebQuery(id: 'id', factory: 'NotAClass\\Factory'); $this->expectException(InvalidWebFactoryException::class); $this->mapper()->map($webQuery, null, true, ['name' => 'Widget']); } @@ -119,10 +117,8 @@ public function testNonPublicFactoryMethodThrows(): void public function testEntityClassNotFoundThrows(): void { - /** @var class-string $missing */ - $missing = 'NotAnEntity\\Klass'; $this->expectException(InvalidWebEntityException::class); - $this->mapper()->map(new WebQuery('id'), $missing, true, ['name' => 'x']); + $this->mapper()->map(new WebQuery('id'), FakeMissingEntity::name(), true, ['name' => 'x']); } public function testEmptyBodyRowReturnsNull(): void From 5643ca0f65e58901ed358ec3ee76341ac34858bc Mon Sep 17 00:00:00 2001 From: Akihito Koriyama Date: Tue, 24 Nov 2026 01:36:35 +0900 Subject: [PATCH 3/4] Tidy repository files - Add .gitattributes so tests and tool configs are left out of the dist archive. - Ignore the build/ and coverage.xml outputs of the coverage scripts. - Remove RELEASE-NOTES-1.0.0-rc1.md; the GitHub release and CHANGELOG.md hold the same notes. - Point the fixtures' $schema at docs/web_query.json, where the schema lives. --- .gitattributes | 11 +++++ .gitignore | 2 + RELEASE-NOTES-1.0.0-rc1.md | 85 ------------------------------------- tests/Fake/web_product.json | 2 +- tests/Fake/web_query.json | 2 +- 5 files changed, 15 insertions(+), 87 deletions(-) create mode 100644 .gitattributes delete mode 100644 RELEASE-NOTES-1.0.0-rc1.md diff --git a/.gitattributes b/.gitattributes new file mode 100644 index 0000000..89e99a9 --- /dev/null +++ b/.gitattributes @@ -0,0 +1,11 @@ +* text=auto eol=lf + +/.github export-ignore +/tests export-ignore +/.gitattributes export-ignore +/.gitignore export-ignore +/phpcs.xml export-ignore +/phpmd.xml export-ignore +/phpstan.neon export-ignore +/phpunit.xml.dist export-ignore +/psalm.xml export-ignore diff --git a/.gitignore b/.gitignore index 6e04c06..737d1bb 100644 --- a/.gitignore +++ b/.gitignore @@ -1,4 +1,6 @@ /vendor/ /.phpunit.cache/ /composer.lock +/build/ +/coverage.xml .DS_Store \ No newline at end of file diff --git a/RELEASE-NOTES-1.0.0-rc1.md b/RELEASE-NOTES-1.0.0-rc1.md deleted file mode 100644 index b80eacf..0000000 --- a/RELEASE-NOTES-1.0.0-rc1.md +++ /dev/null @@ -1,85 +0,0 @@ -# Release Notes - Ray.WebQuery 1.0.0-rc1 - -## ๐Ÿš€ Initial Release - -Ray.WebQuery 1.0.0-rc1 is the first release candidate of our new web API access mapping framework, extracted from Ray.MediaQuery to provide dedicated HTTP client functionality. - -## โœจ Key Features - -### Web API Query System -- **`#[WebQuery]` Annotation**: Mark interface methods for automatic HTTP request mapping -- **Multiple Response Types**: Support for JSON arrays, raw strings, and PSR-7 MessageInterface -- **URI Template Support**: Dynamic URL parameter binding using `{param}` syntax -- **AOP Integration**: Seamless method interception using Ray.Aop - -### Configuration Management -- **JSON Configuration**: Define web APIs in structured JSON files -- **Schema Validation**: Complete JSON schema for web query definitions -- **Template Bindings**: Support for global URI template parameter bindings - -### HTTP Client Integration -- **Guzzle HTTP Client**: Built on the reliable Guzzle HTTP library -- **PSR-7 Compatibility**: Full support for PSR-7 HTTP message interfaces -- **Parameter Injection**: Automatic parameter conversion and injection - -## ๐Ÿ—๏ธ Architecture - -The framework follows a clean separation of concerns: - -- **MediaQueryWebModule**: Dependency injection configuration -- **WebQueryInterceptor**: AOP-based method interception -- **WebQueryConfig**: Configuration loading and validation -- **WebApiQuery**: HTTP request execution - -## ๐Ÿ“‹ Requirements - -- PHP 8.1+ -- Ray.MediaQuery 1.0.0-rc1 -- Guzzle HTTP 7.2+ - -## ๐Ÿ”ง Installation - -```bash -composer require ray/web-query -``` - -## ๐Ÿ“ Basic Usage - -```php - Date: Tue, 24 Nov 2026 01:36:35 +0900 Subject: [PATCH 4/4] Add the MIT LICENSE file declared in composer.json --- LICENSE | 21 +++++++++++++++++++++ 1 file changed, 21 insertions(+) create mode 100644 LICENSE diff --git a/LICENSE b/LICENSE new file mode 100644 index 0000000..a0db66f --- /dev/null +++ b/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2025-2026 Akihito Koriyama + +Permission is hereby granted, free of charge, to any person obtaining a copy +of this software and associated documentation files (the "Software"), to deal +in the Software without restriction, including without limitation the rights +to use, copy, modify, merge, publish, distribute, sublicense, and/or sell +copies of the Software, and to permit persons to whom the Software is +furnished to do so, subject to the following conditions: + +The above copyright notice and this permission notice shall be included in +all copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, +FITNESS FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE +AUTHORS OR COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER +LIABILITY, WHETHER IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, +OUT OF OR IN CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN +THE SOFTWARE.