Skip to content

Commit 2be57e7

Browse files
authored
Merge pull request #36 from ray-di/remove-param-reader
Remove koriym/param-reader dependency and support PHP 8.5
2 parents fb72873 + d78e4fb commit 2be57e7

6 files changed

Lines changed: 50 additions & 24 deletions

File tree

.github/workflows/continuous-integration.yml

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -23,10 +23,12 @@ jobs:
2323
# PHP 8.3
2424
- {php-version: "8.3", os: ubuntu-latest, dependencies: highest}
2525
- {php-version: "8.3", os: ubuntu-latest, dependencies: lowest}
26-
# PHP 8.4 (current stable)
27-
# aura/sql 5.x (lowest) is skipped on PHP 8.4: PDO::connect() static/non-static conflict (upstream bug)
28-
- {php-version: "8.4", os: windows-latest, dependencies: highest}
29-
- {php-version: "8.4", os: ubuntu-latest, dependencies: highest}
26+
# PHP 8.4
27+
# aura/sql 5.x (lowest) is skipped on PHP 8.4+: PDO::connect() static/non-static conflict (upstream bug)
28+
- {php-version: "8.4", os: ubuntu-latest, dependencies: highest}
29+
# PHP 8.5
30+
- {php-version: "8.5", os: windows-latest, dependencies: highest}
31+
- {php-version: "8.5", os: ubuntu-latest, dependencies: highest}
3032

3133
steps:
3234
- name: Disable autocrlf on Windows

.github/workflows/static-analysis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,4 +9,4 @@ jobs:
99
sa:
1010
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
1111
with:
12-
php_version: 8.4
12+
php_version: 8.5

CHANGELOG.md

Lines changed: 38 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,38 @@
1+
# Changelog
2+
3+
All notable changes to this project will be documented in this file.
4+
5+
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
6+
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
7+
8+
## [0.11.1] - 2026-03-03
9+
10+
### Added
11+
- PHP 8.5 support
12+
13+
### Removed
14+
- `koriym/param-reader` dependency — replaced with native `ReflectionParameter::getAttributes()`
15+
16+
## [0.11.0] - 2026-03-01
17+
18+
### Added
19+
- PHP 8.2, 8.3, and 8.4 support
20+
21+
### Changed
22+
- **Require PHP ^8.2** — dropped PHP 8.1 (EOL December 2024)
23+
- Replaced `doctrine/annotations` with native PHP 8 Attributes for all annotation classes
24+
- Upgraded `vimeo/psalm` to v6
25+
- Tightened `ray/di` constraint to `^2.20` (parameter-level `#[Named]` requires 2.20+)
26+
- Upgraded `aura/sql` constraint to `^5.0.3 | ^6.0`
27+
28+
### Removed
29+
- `doctrine/annotations` dependency
30+
31+
## [0.10.0] - 2024-12-18
32+
33+
### Added
34+
- PHP 8.4 support
35+
- Fix SQL with comments can be executed ([#33](https://github.com/ray-di/Ray.QueryModule/pull/33))
36+
37+
### Changed
38+
- Refactored type annotations for query result handling

composer.json

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,6 @@
1616
"aura/sql": "^5.0.3 | ^6.0",
1717
"bear/resource": "^1.15",
1818
"guzzlehttp/guzzle": "^6.3 || ^7.0",
19-
"koriym/param-reader": "^1.0",
2019
"koriym/query-locator": "^1.4",
2120
"nikic/php-parser": "^v4.13",
2221
"ray/aop": "^2.10.3",

src/SqlFinder.php

Lines changed: 5 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
namespace Ray\Query;
66

7-
use Koriym\ParamReader\ParamReaderInterface;
87
use Ray\Query\Annotation\Sql;
98
use Ray\Query\Exception\SqlFileNotFoundException;
109
use Ray\Query\Exception\SqlNotAnnotatedException;
@@ -17,29 +16,20 @@
1716
/** @psalm-api */
1817
final class SqlFinder
1918
{
20-
/** @var ParamReaderInterface<object> */
21-
private $reader;
22-
23-
/** @var SqlDir */
24-
private $sqlDir;
25-
26-
/** @param ParamReaderInterface<object> $reader */
2719
public function __construct(
28-
ParamReaderInterface $reader,
29-
SqlDir $sqlDir
20+
private readonly SqlDir $sqlDir,
3021
) {
31-
$this->reader = $reader;
32-
$this->sqlDir = $sqlDir;
3322
}
3423

3524
public function __invoke(ReflectionParameter $param): string
3625
{
37-
/** @var ?Sql $sqlAnnotation */
38-
$sqlAnnotation = $this->reader->getParametrAnnotation($param, Sql::class);
39-
if ($sqlAnnotation === null) {
26+
$attrs = $param->getAttributes(Sql::class);
27+
if ($attrs === []) {
4028
throw new SqlNotAnnotatedException((string) $param);
4129
}
4230

31+
$sqlAnnotation = $attrs[0]->newInstance();
32+
4333
$file = sprintf('%s/%s.sql', $this->sqlDir->value, $sqlAnnotation->sql);
4434
if (! file_exists($file)) {
4535
$msg = sprintf('%s:%s', (string) $param, $file);

src/SqlQueryProviderModule.php

Lines changed: 0 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,6 @@
44

55
namespace Ray\Query;
66

7-
use Koriym\ParamReader\ParamReader;
8-
use Koriym\ParamReader\ParamReaderInterface;
97
use Ray\Di\AbstractModule;
108
use Ray\Di\Scope;
119

@@ -23,7 +21,6 @@ public function __construct(?AbstractModule $module = null)
2321
protected function configure()
2422
{
2523
$this->bind(SqlFinder::class)->in(Scope::SINGLETON);
26-
$this->bind(ParamReaderInterface::class)->to(ParamReader::class)->in(Scope::SINGLETON);
2724
$this->bind(RowInterface::class)->toProvider(RowInterfaceProvider::class)->in(Scope::SINGLETON);
2825
$this->bind(RowListInterface::class)->toProvider(RowListInterfaceProvider::class)->in(Scope::SINGLETON);
2926
$this->bind(InvokeInterface::class)->toProvider(RowListInterfaceProvider::class)->in(Scope::SINGLETON);

0 commit comments

Comments
 (0)