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
2 changes: 1 addition & 1 deletion .github/workflows/build.yml
Original file line number Diff line number Diff line change
Expand Up @@ -30,4 +30,4 @@ jobs:
os: >-
['ubuntu-latest', 'windows-latest']
php: >-
['8.1', '8.2', '8.3', '8.4']
['8.1', '8.2', '8.3', '8.4', '8.5']
2 changes: 1 addition & 1 deletion .github/workflows/composer-require-checker.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,4 +32,4 @@ jobs:
os: >-
['ubuntu-latest']
php: >-
['8.1', '8.2', '8.3', '8.4']
['8.1', '8.2', '8.3', '8.4', '8.5']
2 changes: 1 addition & 1 deletion .github/workflows/cs.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.4
php-version: 8.5
tools: composer:v2
coverage: none

Expand Down
5 changes: 3 additions & 2 deletions .github/workflows/mutation.yml
Original file line number Diff line number Diff line change
Expand Up @@ -23,12 +23,13 @@

jobs:
mutation:
uses: yiisoft/actions/.github/workflows/roave-infection.yml@master
uses: yiisoft/actions/.github/workflows/infection.yml@master
with:
min-covered-msi: 100
os: >-
['ubuntu-latest']
php: >-
['8.4']
['8.5']
infection-args: "--ignore-msi-with-no-mutations"
secrets:
STRYKER_DASHBOARD_API_KEY: ${{ secrets.STRYKER_DASHBOARD_API_KEY }}

Check warning

Code scanning / CodeQL

Workflow does not contain permissions Medium

Actions job or workflow does not limit the permissions of the GITHUB_TOKEN. Consider setting an explicit permissions block, using the following as a minimal starting point: {}
1 change: 1 addition & 0 deletions .github/workflows/yiisoft-di.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,6 +38,7 @@ jobs:
- "8.2"
- "8.3"
- "8.4"
- "8.5"

steps:
- name: Checkout Yii Definitions
Expand Down
2 changes: 1 addition & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@

## 3.4.1 under development

- no changes in this release.
- Enh #110: Add PHP 8.5 support (@vjik)

## 3.4.0 March 02, 2025

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ The following are provided:

## Requirements

- PHP 8.1 or higher.
- PHP 8.1 - 8.5.

## Installation

Expand Down
15 changes: 10 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,17 +26,16 @@
}
],
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
"php": "8.1 - 8.5",
"psr/container": "^1.0 || ^2.0"
},
"require-dev": {
"bamarni/composer-bin-plugin": "^1.8.3",
"friendsofphp/php-cs-fixer": "^3.69",
"maglnet/composer-require-checker": "^4.7.1",
"phpunit/phpunit": "^10.5.45",
"rector/rector": "^2.0.9",
"roave/infection-static-analysis-plugin": "^1.35",
"spatie/phpunit-watcher": "^1.24",
"vimeo/psalm": "^5.26.1 || ^6.7.1",
"yiisoft/test-support": "^3.0.1"
},
"autoload": {
Expand All @@ -49,11 +48,17 @@
"Yiisoft\\Definitions\\Tests\\": "tests"
}
},
"extra": {
"bamarni-bin": {
"bin-links": true,
"target-directory": "tools",
"forward-command": true
}
},
"config": {
"sort-packages": true,
"bump-after-update": "dev",
"allow-plugins": {
"infection/extension-installer": true,
"bamarni/composer-bin-plugin": true,
"composer/package-versions-deprecated": true
}
},
Expand Down
2 changes: 1 addition & 1 deletion src/DefinitionStorage.php
Original file line number Diff line number Diff line change
Expand Up @@ -170,7 +170,7 @@ private function isResolvable(string $id, array $building): bool
*
* @link https://github.com/vimeo/psalm/issues/6756
*/
if ($typeName === 'self') {
if ($typeName === 'self' || $typeName === $id) {
continue;
}
$unionTypes[] = $typeName;
Expand Down
2 changes: 1 addition & 1 deletion tests/Support/MagicCall.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ final class MagicCall
public function __call($name, $arguments)
{
$arguments = array_map(
static fn($argument) => get_debug_type($argument),
get_debug_type(...),
$arguments,
);

Expand Down
4 changes: 2 additions & 2 deletions tests/Support/Recorder.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ final class Recorder
public function __call($name, $arguments)
{
$arguments = array_map(
static fn($argument) => get_debug_type($argument),
get_debug_type(...),
$arguments,
);

Expand All @@ -22,7 +22,7 @@ public function __call($name, $arguments)
public static function __callStatic($name, $arguments)
{
$arguments = array_map(
static fn($argument) => get_debug_type($argument),
get_debug_type(...),
$arguments,
);

Expand Down
24 changes: 13 additions & 11 deletions tests/Unit/Helpers/DefinitionExtractorTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,12 +69,18 @@ public function testFromClassWithUnionSelfDependency(): void
{
$definition = DefinitionExtractor::fromClassName(UnionSelfDependency::class)['a'];

$actualType = implode('|', $definition
->getReflection()
->getType()
->getTypes());
$actualType = implode(
'|',
$definition->getReflection()->getType()->getTypes(),
);

$self = PHP_VERSION_ID < 80500 ? 'self' : UnionSelfDependency::class;

$this->assertInstanceOf(ParameterDefinition::class, $definition);
$this->assertSame('self|' . ColorInterface::class, $actualType);
$this->assertSame(
$self . '|' . ColorInterface::class,
$actualType,
);
}

public function testResolveCarConstructor(): void
Expand Down Expand Up @@ -153,16 +159,12 @@ public function testFromNotInstantiableClass(): void

public function testFromClassWithSelfDependency(): void
{
/** @var ParameterDefinition $definition */
$definition = DefinitionExtractor::fromClassName(SelfDependency::class)['a'];

$this->assertInstanceOf(ParameterDefinition::class, $definition);
$this->assertSame(
'self',
$definition
->getReflection()
->getType()
->getName(),
PHP_VERSION_ID < 80500 ? 'self' : SelfDependency::class,
$definition->getReflection()->getType()->getName(),
);
}

Expand Down
2 changes: 2 additions & 0 deletions tools/.gitignore
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
/*/vendor
/*/composer.lock
10 changes: 10 additions & 0 deletions tools/infection/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,10 @@
{
"require-dev": {
"infection/infection": "^0.26 || ^0.31.9"
},
"config": {
"allow-plugins": {
"infection/extension-installer": true
}
}
}
5 changes: 5 additions & 0 deletions tools/psalm/composer.json
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
{
"require-dev": {
"vimeo/psalm": "^5.26.1 || ^6.7.1"
}
}
Loading