Skip to content

Commit

Permalink
Merge branch 'master' into halo
Browse files Browse the repository at this point in the history
  • Loading branch information
koriym authored Apr 19, 2024
2 parents 8a6ece9 + 8209086 commit 76749fd
Show file tree
Hide file tree
Showing 10 changed files with 966 additions and 1,113 deletions.
47 changes: 5 additions & 42 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,45 +6,8 @@ on:
workflow_dispatch:

jobs:
build:

runs-on: ubuntu-latest

strategy:
matrix:
operating-system:
- ubuntu-latest
php-version:
- '8.0'
- '8.1'
- '8.2'
steps:
- name: Checkout
uses: actions/checkout@v1

- name: Setup PHP ${{ matrix.php-version }}
uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
coverage: xdebug
extention: xhprof

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

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --prefer-dist

- name: Run test suite
run: php -d xdebug.mode=coverage ./vendor/bin/phpunit --coverage-clover=coverage.xml

- name: Upload coverage report
uses: codecov/codecov-action@v3
ci:
uses: ray-di/.github/.github/workflows/continuous-integration.yml@v1
with:
old_stable: '["7.4", "8.0", "8.1", "8.2"]'
current_stable: 8.3
60 changes: 4 additions & 56 deletions .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -6,59 +6,7 @@ on:
workflow_dispatch:

jobs:
static-analysis-phpstan:
name: Static Analysis with PHPStan
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: xhprof
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Cache dependencies
uses: actions/cache@v2
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.lock') }}
restore-keys: ${{ runner.os }}-composer-

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run PHPStan
run: ./vendor/bin/phpstan analyse -c phpstan.neon --no-progress --no-interaction --error-format=checkstyle | cs2pr

static-analysis-psalm:
name: Static Analysis with Psalm
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.2
extensions: xhprof
tools: cs2pr
coverage: none

- name: Get composer cache directory
id: composer-cache
run: echo "::set-output name=dir::$(composer config cache-files-dir)"

- name: Install dependencies
run: composer install --no-interaction --no-progress --prefer-dist

- name: Run Psalm
run: ./vendor/bin/psalm --show-info=false --output-format=checkstyle --shepherd | cs2pr
sa:
uses: ray-di/.github/.github/workflows/static-analysis.yml@v1
with:
php_version: 8.3
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
The MIT License (MIT)

Copyright (c) <2020-2022> <Akihito Koriyama>
Copyright (c) <2020-2024> <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
Expand Down
8 changes: 3 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,15 +16,13 @@
"bear/resource": "^1.17",
"koriym/php-server": "^1.0",
"psr/log": "^1 || ^2 || ^3",
"ray/aop": "^2.13",
"ray/di": "^2.14"
"ray/di": "^2.14",
"symfony/process": "^v5.4 || ^v6.4 || ^v7.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.4",
"bear/package": "^1.10",
"bear/qiq-module": "^1.0",
"madapaja/twig-module": "^2.4",
"phpunit/phpunit": "^9.5.27",
"phpunit/phpunit": "^9.6",
"ray/aura-sql-module": "^1.10"
},
"autoload": {
Expand Down
2 changes: 1 addition & 1 deletion src/Http/HttpResource.php
Original file line number Diff line number Diff line change
Expand Up @@ -182,7 +182,7 @@ public function options(string $uri, array $query = []): ResourceObject
}

/**
* @param array<mixed> $query
* @param array<string, mixed> $query
*/
private function safeRequest(string $path, array $query): ResourceObject
{
Expand Down
10 changes: 7 additions & 3 deletions src/QueryMerger.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,15 +13,19 @@
final class QueryMerger
{
/**
* @param array<mixed> $query
* @param array<string, mixed> $query
*/
public function __invoke(string $uri, array $query): Uri
{
$path = (string) parse_url($uri, PHP_URL_PATH);
$uriQueryString = (string) parse_url($uri, PHP_URL_QUERY);
parse_str($uriQueryString, $uriQuery);
/** @var array<string, string> $mergedQuery */
$mergedQuery = $uriQuery + $query;
$uriQueryKeyString = [];
foreach ($uriQuery as $key => $value) {
$uriQueryKeyString[(string) $key] = $value;
}

$mergedQuery = $uriQueryKeyString + $query;

return new Uri($path, $mergedQuery);
}
Expand Down
4 changes: 2 additions & 2 deletions src/Uri.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,11 +9,11 @@ final class Uri
/** @var string */
public $path;

/** @var array<string, string> */
/** @var array<string, mixed> */
public $query;

/**
* @param array<string, string> $query
* @param array<string, mixed> $query
*/
public function __construct(string $path, array $query)
{
Expand Down
Loading

0 comments on commit 76749fd

Please sign in to comment.