Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
104 changes: 98 additions & 6 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,102 @@ on:
pull_request:
workflow_dispatch:

env:
COMPOSER_FLAGS: "--ansi --no-interaction --no-progress --prefer-dist --no-plugins"
COMPOSER_UPDATE_FLAGS: ""

jobs:
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1
with:
old_stable: '["7.3", "7.4", "8.0", "8.1", "8.2", , "8.31"]'
current_stable: 8.4
script: demo/run.php
phpunit:
name: PHPUnit - PHP ${{ matrix.php-version }} (${{ matrix.os }}, ${{ matrix.dependencies }})
runs-on: ${{ matrix.os }}
strategy:
fail-fast: false
matrix:
include:
# PHP 8.2
- {php-version: "8.2", os: ubuntu-latest, dependencies: highest}
- {php-version: "8.2", os: ubuntu-latest, dependencies: lowest}
# 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}

steps:
- name: Disable autocrlf on Windows
if: contains(matrix.os, 'windows')
run: git config --global core.autocrlf false

- name: Checkout
uses: actions/checkout@v4
with:
fetch-depth: 0

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: pcov
ini-values: |
zend.assertions=1
memory_limit=512M
opcache.jit=0
opcache.jit_buffer_size=0
opcache.enable=0
opcache.enable_cli=0
extensions: fileinfo,pdo,pdo_mysql,pdo_sqlite

- name: Check fileinfo extension
run: php --ri fileinfo

- name: Get composer cache directory
id: composer-cache
shell: bash
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache dependencies
uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php${{ matrix.php-version }}-composer-${{ hashFiles('**/composer.json', '**/composer.lock') }}
restore-keys: |
${{ runner.os }}-php${{ matrix.php-version }}-composer-
${{ runner.os }}-composer-

- name: Set platform requirements
shell: bash
run: composer config platform.php ${{ matrix.php-version }}

- name: Handle lowest dependencies
if: matrix.dependencies == 'lowest'
shell: bash
run: echo COMPOSER_UPDATE_FLAGS="$COMPOSER_UPDATE_FLAGS --prefer-lowest" >> $GITHUB_ENV

- name: Remove platform config for highest resolution
if: matrix.dependencies == 'highest'
shell: bash
run: composer config platform --unset

- name: Update dependencies
shell: bash
run: |
composer validate --no-check-all --strict
composer update ${{ env.COMPOSER_UPDATE_FLAGS }} ${{ env.COMPOSER_FLAGS }}

- name: Run test suite
shell: bash
run: vendor/bin/phpunit --coverage-clover=coverage.xml
env:
XDEBUG_MODE: coverage

- name: Upload coverage report
uses: codecov/codecov-action@v5
with:
token: ${{ secrets.CODECOV_TOKEN }}
fail_ci_if_error: false

- name: Run additional script
shell: bash
run: php demo/run.php
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,4 +9,4 @@ jobs:
sa:
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
with:
php_version: 8.3
php_version: 8.4
7 changes: 3 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,19 +10,18 @@
}
],
"require": {
"php": "^7.3 || ^8.0",
"php": "^8.2",
"ext-json": "*",
"ext-pdo": "*",
"aura/sql": "^3.0 | ^4.0 | ^5.0",
"aura/sql": "^5.0.3 | ^6.0",
"bear/resource": "^1.15",
"doctrine/annotations": "^1.12",
"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",
"ray/aura-sql-module": "^1.10.0",
"ray/di": "^2.11"
"ray/di": "^2.20"
},
"require-dev": {
"phpunit/phpunit": "^9.6.19",
Expand Down
37 changes: 0 additions & 37 deletions phpstan-baseline.neon

This file was deleted.

2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,6 @@ parameters:
paths:
- src
- tests
excludes_analyse:
excludePaths:
- %currentWorkingDirectory%/tests/tmp/*
- %currentWorkingDirectory%/tests/Fake/*
13 changes: 0 additions & 13 deletions psalm-baseline.xml

This file was deleted.

4 changes: 3 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src" />
Expand All @@ -15,4 +14,7 @@
<directory name="tests/Fake"/>
</ignoreFiles>
</projectFiles>
<issueHandlers>
<MissingOverrideAttribute errorLevel="suppress" />
</issueHandlers>
</psalm>
35 changes: 14 additions & 21 deletions src-deprecated/Annotation/AliasQuery.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,34 +4,27 @@

namespace Ray\Query\Annotation;

use Attribute;

/**
* Annotates your class methods into which the Injector should inject values
*
* @Annotation
* @Target("METHOD")
*
* @deprecated use MapQuery instead
* @deprecated use Query instead
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class AliasQuery
{
/**
* Query ID
*
* @var string
*/
/** @var string */
public $id;

/**
* Is ID templated ?
*
* @var bool
*/
/** @var bool */
public $templated = false;

/**
* @Enum({"row", "row_list"})
*
* @var string
*/
/** @var 'row'|'row_list' */
public $type = 'row_list';

public function __construct(string $id = '', string $type = 'row_list', bool $templated = false)
{
$this->id = $id;
$this->type = $type;
$this->templated = $templated;
}
}
19 changes: 5 additions & 14 deletions src/Annotation/Query.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,17 +5,8 @@
namespace Ray\Query\Annotation;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;
use Ray\Query\Exception\QueryTypeException;

/**
* Annotates your class methods into which the Injector should inject values
*
* @Annotation
* @Target("METHOD")
* @psalm-suppress MissingConstructor
* @NamedArgumentConstructor
*/
#[Attribute(Attribute::TARGET_METHOD)]
final class Query
{
Expand All @@ -33,13 +24,13 @@ final class Query
*/
public $templated;

/**
* @Enum({"row", "row_list"})
* @var 'row'|'row_list'
*/
/** @var 'row'|'row_list' */
public $type = 'row_list';

/** @SuppressWarnings(PHPMD.BooleanArgumentFlag) */
/**
* @psalm-api
* @SuppressWarnings(PHPMD.BooleanArgumentFlag)
*/
public function __construct(string $id, string $type = 'row_list', bool $templated = false)
{
$this->id = $id;
Expand Down
7 changes: 1 addition & 6 deletions src/Annotation/Sql.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,19 +5,14 @@
namespace Ray\Query\Annotation;

use Attribute;
use Doctrine\Common\Annotations\Annotation\NamedArgumentConstructor;

/**
* @Annotation
* @Target("PROPERTY")
* @NamedArgumentConstructor()
*/
#[Attribute(Attribute::TARGET_PROPERTY | Attribute::TARGET_PARAMETER)]
final class Sql
{
/** @var string */
public $sql;

/** @psalm-api */
public function __construct(string $sql)
{
$this->sql = $sql;
Expand Down
2 changes: 1 addition & 1 deletion src/Exception/QueryNumException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use InvalidArgumentException;

class QueryNumException extends InvalidArgumentException
final class QueryNumException extends InvalidArgumentException
{
}
2 changes: 1 addition & 1 deletion src/Exception/QueryTypeException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use InvalidArgumentException;

class QueryTypeException extends InvalidArgumentException
final class QueryTypeException extends InvalidArgumentException
{
}
2 changes: 1 addition & 1 deletion src/Exception/SqlFileNotFoundException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use LogicException;

class SqlFileNotFoundException extends LogicException
final class SqlFileNotFoundException extends LogicException
{
}
2 changes: 1 addition & 1 deletion src/Exception/SqlNotAnnotatedException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use LogicException;

class SqlNotAnnotatedException extends LogicException
final class SqlNotAnnotatedException extends LogicException
{
}
2 changes: 1 addition & 1 deletion src/Exception/WebQueryException.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,6 @@

use RuntimeException;

class WebQueryException extends RuntimeException
final class WebQueryException extends RuntimeException
{
}
3 changes: 2 additions & 1 deletion src/Iso8601FormatModule.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,7 +6,8 @@

use Ray\Di\AbstractModule;

class Iso8601FormatModule extends AbstractModule
/** @psalm-api */
final class Iso8601FormatModule extends AbstractModule
{
/** @var array<string> */
private $datetimeColumns;
Expand Down
6 changes: 3 additions & 3 deletions src/Iso8601Interceptor.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,10 +21,10 @@ final class Iso8601Interceptor implements MethodInterceptor
/**
* @param string[] $datetimeColumns
*
* @Named("datetimeColumns=iso8601_date_time_columns")
* @psalm-api
*/
#[Named('datetimeColumns=iso8601_date_time_columns')]
public function __construct(array $datetimeColumns)
public function __construct(#[Named('iso8601_date_time_columns')]
array $datetimeColumns)
{
$this->datetimeColumns = $datetimeColumns;
}
Expand Down
Loading
Loading