diff --git a/.github/workflows/continuous-integration.yml b/.github/workflows/continuous-integration.yml index 7d97fac..85e44f5 100644 --- a/.github/workflows/continuous-integration.yml +++ b/.github/workflows/continuous-integration.yml @@ -23,10 +23,12 @@ jobs: # PHP 8.3 - {php-version: "8.3", os: ubuntu-latest, dependencies: highest} - {php-version: "8.3", os: ubuntu-latest, dependencies: lowest} - # PHP 8.4 (current stable) - # aura/sql 5.x (lowest) is skipped on PHP 8.4: PDO::connect() static/non-static conflict (upstream bug) - - {php-version: "8.4", os: windows-latest, dependencies: highest} - - {php-version: "8.4", os: ubuntu-latest, dependencies: highest} + # PHP 8.4 + # aura/sql 5.x (lowest) is skipped on PHP 8.4+: PDO::connect() static/non-static conflict (upstream bug) + - {php-version: "8.4", os: ubuntu-latest, dependencies: highest} + # PHP 8.5 + - {php-version: "8.5", os: windows-latest, dependencies: highest} + - {php-version: "8.5", os: ubuntu-latest, dependencies: highest} steps: - name: Disable autocrlf on Windows diff --git a/.github/workflows/static-analysis.yml b/.github/workflows/static-analysis.yml index ed34a12..eb64c7c 100644 --- a/.github/workflows/static-analysis.yml +++ b/.github/workflows/static-analysis.yml @@ -9,4 +9,4 @@ jobs: sa: uses: ray-di/.github/.github/workflows/static-analysis.yml@v1 with: - php_version: 8.4 + php_version: 8.5 diff --git a/CHANGELOG.md b/CHANGELOG.md new file mode 100644 index 0000000..c83243e --- /dev/null +++ b/CHANGELOG.md @@ -0,0 +1,38 @@ +# Changelog + +All notable changes to this project will be documented in this file. + +The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/), +and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html). + +## [0.11.1] - 2026-03-03 + +### Added +- PHP 8.5 support + +### Removed +- `koriym/param-reader` dependency — replaced with native `ReflectionParameter::getAttributes()` + +## [0.11.0] - 2026-03-01 + +### Added +- PHP 8.2, 8.3, and 8.4 support + +### Changed +- **Require PHP ^8.2** — dropped PHP 8.1 (EOL December 2024) +- Replaced `doctrine/annotations` with native PHP 8 Attributes for all annotation classes +- Upgraded `vimeo/psalm` to v6 +- Tightened `ray/di` constraint to `^2.20` (parameter-level `#[Named]` requires 2.20+) +- Upgraded `aura/sql` constraint to `^5.0.3 | ^6.0` + +### Removed +- `doctrine/annotations` dependency + +## [0.10.0] - 2024-12-18 + +### Added +- PHP 8.4 support +- Fix SQL with comments can be executed ([#33](https://github.com/ray-di/Ray.QueryModule/pull/33)) + +### Changed +- Refactored type annotations for query result handling diff --git a/composer.json b/composer.json index 7653354..f07341b 100644 --- a/composer.json +++ b/composer.json @@ -16,7 +16,6 @@ "aura/sql": "^5.0.3 | ^6.0", "bear/resource": "^1.15", "guzzlehttp/guzzle": "^6.3 || ^7.0", - "koriym/param-reader": "^1.0", "koriym/query-locator": "^1.4", "nikic/php-parser": "^v4.13", "ray/aop": "^2.10.3", diff --git a/src/SqlFinder.php b/src/SqlFinder.php index f8fceff..9b9576f 100644 --- a/src/SqlFinder.php +++ b/src/SqlFinder.php @@ -4,7 +4,6 @@ namespace Ray\Query; -use Koriym\ParamReader\ParamReaderInterface; use Ray\Query\Annotation\Sql; use Ray\Query\Exception\SqlFileNotFoundException; use Ray\Query\Exception\SqlNotAnnotatedException; @@ -17,29 +16,20 @@ /** @psalm-api */ final class SqlFinder { - /** @var ParamReaderInterface */ - private $reader; - - /** @var SqlDir */ - private $sqlDir; - - /** @param ParamReaderInterface $reader */ public function __construct( - ParamReaderInterface $reader, - SqlDir $sqlDir + private readonly SqlDir $sqlDir, ) { - $this->reader = $reader; - $this->sqlDir = $sqlDir; } public function __invoke(ReflectionParameter $param): string { - /** @var ?Sql $sqlAnnotation */ - $sqlAnnotation = $this->reader->getParametrAnnotation($param, Sql::class); - if ($sqlAnnotation === null) { + $attrs = $param->getAttributes(Sql::class); + if ($attrs === []) { throw new SqlNotAnnotatedException((string) $param); } + $sqlAnnotation = $attrs[0]->newInstance(); + $file = sprintf('%s/%s.sql', $this->sqlDir->value, $sqlAnnotation->sql); if (! file_exists($file)) { $msg = sprintf('%s:%s', (string) $param, $file); diff --git a/src/SqlQueryProviderModule.php b/src/SqlQueryProviderModule.php index 36b38db..a6aeef2 100644 --- a/src/SqlQueryProviderModule.php +++ b/src/SqlQueryProviderModule.php @@ -4,8 +4,6 @@ namespace Ray\Query; -use Koriym\ParamReader\ParamReader; -use Koriym\ParamReader\ParamReaderInterface; use Ray\Di\AbstractModule; use Ray\Di\Scope; @@ -23,7 +21,6 @@ public function __construct(?AbstractModule $module = null) protected function configure() { $this->bind(SqlFinder::class)->in(Scope::SINGLETON); - $this->bind(ParamReaderInterface::class)->to(ParamReader::class)->in(Scope::SINGLETON); $this->bind(RowInterface::class)->toProvider(RowInterfaceProvider::class)->in(Scope::SINGLETON); $this->bind(RowListInterface::class)->toProvider(RowListInterfaceProvider::class)->in(Scope::SINGLETON); $this->bind(InvokeInterface::class)->toProvider(RowListInterfaceProvider::class)->in(Scope::SINGLETON);