Skip to content

Commit fb72873

Browse files
authored
Merge pull request #35 from ray-di/remove-doctrine-annotations
Remove doctrine/annotations and upgrade Psalm to v6
2 parents b1e9e96 + 3586707 commit fb72873

44 files changed

Lines changed: 2062 additions & 2532 deletions

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

‎.github/workflows/continuous-integration.yml‎

Lines changed: 98 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,10 +5,102 @@ on:
55
pull_request:
66
workflow_dispatch:
77

8+
env:
9+
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist --no-plugins"
10+
COMPOSER_UPDATE_FLAGS: ""
11+
812
jobs:
9-
ci:
10-
uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1
11-
with:
12-
old_stable: '["7.3", "7.4", "8.0", "8.1", "8.2", , "8.31"]'
13-
current_stable: 8.4
14-
script: demo/run.php
13+
phpunit:
14+
name: PHPUnit - PHP ${{ matrix.php-version }} (${{ matrix.os }}, ${{ matrix.dependencies }})
15+
runs-on: ${{ matrix.os }}
16+
strategy:
17+
fail-fast: false
18+
matrix:
19+
include:
20+
# PHP 8.2
21+
- {php-version: "8.2", os: ubuntu-latest, dependencies: highest}
22+
- {php-version: "8.2", os: ubuntu-latest, dependencies: lowest}
23+
# PHP 8.3
24+
- {php-version: "8.3", os: ubuntu-latest, dependencies: highest}
25+
- {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}
30+
31+
steps:
32+
- name: Disable autocrlf on Windows
33+
if: contains(matrix.os, 'windows')
34+
run: git config --global core.autocrlf false
35+
36+
- name: Checkout
37+
uses: actions/checkout@v4
38+
with:
39+
fetch-depth: 0
40+
41+
- name: Setup PHP ${{ matrix.php-version }}
42+
uses: shivammathur/setup-php@v2
43+
with:
44+
php-version: ${{ matrix.php-version }}
45+
coverage: pcov
46+
ini-values: |
47+
zend.assertions=1
48+
memory_limit=512M
49+
opcache.jit=0
50+
opcache.jit_buffer_size=0
51+
opcache.enable=0
52+
opcache.enable_cli=0
53+
extensions: fileinfo,pdo,pdo_mysql,pdo_sqlite
54+
55+
- name: Check fileinfo extension
56+
run: php --ri fileinfo
57+
58+
- name: Get composer cache directory
59+
id: composer-cache
60+
shell: bash
61+
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT
62+
63+
- name: Cache dependencies
64+
uses: actions/cache@v4
65+
with:
66+
path: ${{ steps.composer-cache.outputs.dir }}
67+
key: ${{ runner.os }}-php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }}
68+
restore-keys: |
69+
${{ runner.os }}-php${{ matrix.php-version }}-composer-
70+
${{ runner.os }}-composer-
71+
72+
- name: Set platform requirements
73+
shell: bash
74+
run: composer config platform.php ${{ matrix.php-version }}
75+
76+
- name: Handle lowest dependencies
77+
if: matrix.dependencies == 'lowest'
78+
shell: bash
79+
run: echo COMPOSER_UPDATE_FLAGS="$COMPOSER_UPDATE_FLAGS --prefer-lowest" >> $GITHUB_ENV
80+
81+
- name: Remove platform config for highest resolution
82+
if: matrix.dependencies == 'highest'
83+
shell: bash
84+
run: composer config platform --unset
85+
86+
- name: Update dependencies
87+
shell: bash
88+
run: |
89+
composer validate --no-check-all --strict
90+
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}
91+
92+
- name: Run test suite
93+
shell: bash
94+
run: vendor/bin/phpunit --coverage-clover=coverage.xml
95+
env:
96+
XDEBUG_MODE: coverage
97+
98+
- name: Upload coverage report
99+
uses: codecov/codecov-action@v5
100+
with:
101+
token: ${{ secrets.CODECOV_TOKEN }}
102+
fail_ci_if_error: false
103+
104+
- name: Run additional script
105+
shell: bash
106+
run: php demo/run.php

‎.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.3
12+
php_version: 8.4

‎composer.json‎

Lines changed: 3 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,19 +10,18 @@
1010
}
1111
],
1212
"require": {
13-
"php": "^7.3 || ^8.0",
13+
"php": "^8.2",
1414
"ext-json": "*",
1515
"ext-pdo": "*",
16-
"aura/sql": "^3.0 | ^4.0 | ^5.0",
16+
"aura/sql": "^5.0.3 | ^6.0",
1717
"bear/resource": "^1.15",
18-
"doctrine/annotations": "^1.12",
1918
"guzzlehttp/guzzle": "^6.3 || ^7.0",
2019
"koriym/param-reader": "^1.0",
2120
"koriym/query-locator": "^1.4",
2221
"nikic/php-parser": "^v4.13",
2322
"ray/aop": "^2.10.3",
2423
"ray/aura-sql-module": "^1.10.0",
25-
"ray/di": "^2.11"
24+
"ray/di": "^2.20"
2625
},
2726
"require-dev": {
2827
"phpunit/phpunit": "^9.6.19",

‎phpstan-baseline.neon‎

Lines changed: 0 additions & 37 deletions
This file was deleted.

‎phpstan.neon‎

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -3,6 +3,6 @@ parameters:
33
paths:
44
- src
55
- tests
6-
excludes_analyse:
6+
excludePaths:
77
- %currentWorkingDirectory%/tests/tmp/*
88
- %currentWorkingDirectory%/tests/Fake/*

‎psalm-baseline.xml‎

Lines changed: 0 additions & 13 deletions
This file was deleted.

‎psalm.xml‎

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
66
xmlns="https://getpsalm.org/schema/config"
77
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
8-
errorBaseline="psalm-baseline.xml"
98
>
109
<projectFiles>
1110
<directory name="src" />
@@ -15,4 +14,7 @@
1514
<directory name="tests/Fake"/>
1615
</ignoreFiles>
1716
</projectFiles>
17+
<issueHandlers>
18+
<MissingOverrideAttribute errorLevel="suppress" />
19+
</issueHandlers>
1820
</psalm>

‎src-deprecated/Annotation/AliasQuery.php‎

Lines changed: 14 additions & 21 deletions
Original file line numberDiff line numberDiff line change
@@ -4,34 +4,27 @@
44

55
namespace Ray\Query\Annotation;
66

7+
use Attribute;
8+
79
/**
8-
* Annotates your class methods into which the Injector should inject values
9-
*
10-
* @Annotation
11-
* @Target("METHOD")
12-
*
13-
* @deprecated use MapQuery instead
10+
* @deprecated use Query instead
1411
*/
12+
#[Attribute(Attribute::TARGET_METHOD)]
1513
final class AliasQuery
1614
{
17-
/**
18-
* Query ID
19-
*
20-
* @var string
21-
*/
15+
/** @var string */
2216
public $id;
2317

24-
/**
25-
* Is ID templated ?
26-
*
27-
* @var bool
28-
*/
18+
/** @var bool */
2919
public $templated = false;
3020

31-
/**
32-
* @Enum({"row", "row_list"})
33-
*
34-
* @var string
35-
*/
21+
/** @var 'row'|'row_list' */
3622
public $type = 'row_list';
23+
24+
public function __construct(string $id = '', string $type = 'row_list', bool $templated = false)
25+
{
26+
$this->id = $id;
27+
$this->type = $type;
28+
$this->templated = $templated;
29+
}
3730
}

‎src/Annotation/Query.php‎

Lines changed: 5 additions & 14 deletions
Original file line numberDiff line numberDiff line change
@@ -5,17 +5,8 @@
55
namespace Ray\Query\Annotation;
66

77
use Attribute;
8-
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
98
use Ray\Query\Exception\QueryTypeException;
109

11-
/**
12-
* Annotates your class methods into which the Injector should inject values
13-
*
14-
* @Annotation
15-
* @Target("METHOD")
16-
* @psalm-suppress MissingConstructor
17-
* @NamedArgumentConstructor
18-
*/
1910
#[Attribute(Attribute::TARGET_METHOD)]
2011
final class Query
2112
{
@@ -33,13 +24,13 @@ final class Query
3324
*/
3425
public $templated;
3526

36-
/**
37-
* @Enum({"row", "row_list"})
38-
* @var 'row'|'row_list'
39-
*/
27+
/** @var 'row'|'row_list' */
4028
public $type = 'row_list';
4129

42-
/** @SuppressWarnings(PHPMD.BooleanArgumentFlag) */
30+
/**
31+
* @psalm-api
32+
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
33+
*/
4334
public function __construct(string $id, string $type = 'row_list', bool $templated = false)
4435
{
4536
$this->id = $id;

‎src/Annotation/Sql.php‎

Lines changed: 1 addition & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,19 +5,14 @@
55
namespace Ray\Query\Annotation;
66

77
use Attribute;
8-
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
98

10-
/**
11-
* @Annotation
12-
* @Target("PROPERTY")
13-
* @NamedArgumentConstructor()
14-
*/
159
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)]
1610
final class Sql
1711
{
1812
/** @var string */
1913
public $sql;
2014

15+
/** @psalm-api */
2116
public function __construct(string $sql)
2217
{
2318
$this->sql = $sql;

0 commit comments

Comments
 (0)