Skip to content

Commit

Permalink
Bump PHP to 8.1, minor refactoring, improve CI (#110)
Browse files Browse the repository at this point in the history
  • Loading branch information
vjik authored Jan 26, 2025
1 parent 9171046 commit aefd188
Show file tree
Hide file tree
Showing 15 changed files with 59 additions and 30 deletions.
25 changes: 22 additions & 3 deletions .github/workflows/bc.yml
Original file line number Diff line number Diff line change
@@ -1,6 +1,25 @@
on:
- pull_request
- push
pull_request:
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'
push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
- 'CHANGELOG.md'
- '.gitignore'
- '.gitattributes'
- 'infection.json.dist'
- 'phpunit.xml.dist'
- 'psalm.xml'

name: backwards compatibility

Expand All @@ -11,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0']
['8.1']
5 changes: 4 additions & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -24,8 +25,10 @@ name: build
jobs:
phpunit:
uses: yiisoft/actions/.github/workflows/phpunit.yml@master
secrets:
codecovToken: ${{ secrets.CODECOV_TOKEN }}
with:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.0', '8.1']
['8.1', '8.2', '8.3']
3 changes: 2 additions & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -30,4 +31,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1', '8.2']
['8.1', '8.2', '8.3']
3 changes: 2 additions & 1 deletion .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@ on:
- 'psalm.xml'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -26,6 +27,6 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1']
['8.2']
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}
7 changes: 5 additions & 2 deletions .github/workflows/rector.yml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
on:
pull_request:
pull_request_target:
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -14,8 +14,11 @@ name: rector
jobs:
rector:
uses: yiisoft/actions/.github/workflows/rector.yml@master
secrets:
token: ${{ secrets.YIISOFT_GITHUB_TOKEN }}
with:
repository: ${{ github.event.pull_request.head.repo.full_name }}
os: >-
['ubuntu-latest']
php: >-
['8.0']
['8.3']
3 changes: 2 additions & 1 deletion .github/workflows/static.yml
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,7 @@ on:
- 'phpunit.xml.dist'

push:
branches: ['master']
paths-ignore:
- 'docs/**'
- 'README.md'
Expand All @@ -28,4 +29,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.0', '8.1']
['8.1', '8.2', '8.3']
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 2.1.2 under development

- no changes in this release.
- Enh #110: Raise the minimum PHP version to 8.1 and minor refactoring (@vjik)

## 2.1.1 September 04, 2024

Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,7 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"psr/http-message": "^1.0|^2.0",
"psr/http-server-handler": "^1.0",
"psr/http-server-middleware": "^1.0",
Expand All @@ -50,7 +50,7 @@
"rector/rector": "^2.0",
"roave/infection-static-analysis-plugin": "^1.16",
"spatie/phpunit-watcher": "^1.23",
"vimeo/psalm": "^4.30|^5.6",
"vimeo/psalm": "^5.6",
"yiisoft/csrf": "^2.0",
"yiisoft/di": "^1.2",
"yiisoft/psr-dummy-provider": "^1.0",
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,6 +17,6 @@

// define sets of rules
$rectorConfig->sets([
LevelSetList::UP_TO_PHP_80,
LevelSetList::UP_TO_PHP_81,
]);
};
6 changes: 3 additions & 3 deletions src/Action/SwaggerJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,9 @@ final class SwaggerJson implements RequestHandlerInterface
private DateInterval|int|null $cacheTTL = null;

public function __construct(
private CacheInterface $cache,
private DataResponseFactoryInterface $responseFactory,
private SwaggerService $swaggerService
private readonly CacheInterface $cache,
private readonly DataResponseFactoryInterface $responseFactory,
private readonly SwaggerService $swaggerService
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Action/SwaggerUi.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,10 +29,10 @@ final class SwaggerUi implements RequestHandlerInterface
private string $jsonUrl = '/';

public function __construct(
private ViewRenderer $viewRenderer,
private SwaggerService $swaggerService,
private AssetManager $assetManager,
private array $params
private readonly ViewRenderer $viewRenderer,
private readonly SwaggerService $swaggerService,
private readonly AssetManager $assetManager,
private readonly array $params
) {
}

Expand Down
2 changes: 1 addition & 1 deletion src/Formatter/ParamsFormatter.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,7 +34,7 @@ public function format(array $params): string
return '{' . implode(', ', $result) . '}';
}

$result = array_map([Html::class, 'encode'], $params);
$result = array_map(Html::encode(...), $params);

return '[' . implode(', ', $result) . ']';
}
Expand Down
6 changes: 3 additions & 3 deletions src/Middleware/SwaggerJson.php
Original file line number Diff line number Diff line change
Expand Up @@ -24,9 +24,9 @@ final class SwaggerJson implements MiddlewareInterface
private DateInterval|int|null $cacheTTL = null;

public function __construct(
private CacheInterface $cache,
private DataResponseFactoryInterface $responseFactory,
private SwaggerService $swaggerService
private readonly CacheInterface $cache,
private readonly DataResponseFactoryInterface $responseFactory,
private readonly SwaggerService $swaggerService
) {
}

Expand Down
8 changes: 4 additions & 4 deletions src/Middleware/SwaggerUi.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,10 +33,10 @@ final class SwaggerUi implements MiddlewareInterface
private string $jsonUrl = '/';

public function __construct(
private ViewRenderer $viewRenderer,
private SwaggerService $swaggerService,
private AssetManager $assetManager,
private array $params
private readonly ViewRenderer $viewRenderer,
private readonly SwaggerService $swaggerService,
private readonly AssetManager $assetManager,
private readonly array $params
) {
}

Expand Down
5 changes: 3 additions & 2 deletions src/Service/SwaggerService.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,9 @@ final class SwaggerService
private string $viewName = 'swagger-ui';
private array $options = [];

public function __construct(private Aliases $aliases)
{
public function __construct(
private readonly Aliases $aliases,
) {
$this->viewPath = dirname(__DIR__, 2) . '/views';
}

Expand Down

0 comments on commit aefd188

Please sign in to comment.