From c250973f1835299b076b5c2e72b2a916111559c1 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 6 Sep 2024 16:15:08 +0200 Subject: [PATCH 1/9] Open 2.0.x --- .github/workflows/build.yml | 2 +- composer.json | 10 +++++----- 2 files changed, 6 insertions(+), 6 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa81766..d5e9d35 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -6,7 +6,7 @@ on: pull_request: push: branches: - - "1.1.x" + - "2.0.x" jobs: lint: diff --git a/composer.json b/composer.json index 5934d15..209e87b 100644 --- a/composer.json +++ b/composer.json @@ -6,8 +6,8 @@ "MIT" ], "require": { - "php": "^7.2 || ^8.0", - "phpstan/phpstan": "^1.12" + "php": "^7.4 || ^8.0", + "phpstan/phpstan": "^2.0" }, "conflict": { "dibi/dibi": "<3.0" @@ -15,9 +15,9 @@ "require-dev": { "dibi/dibi": "~4.0", "php-parallel-lint/php-parallel-lint": "^1.2", - "phpstan/phpstan-phpunit": "^1.4", - "phpstan/phpstan-strict-rules": "^1.6", - "phpunit/phpunit": "^9.5" + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6" }, "config": { "platform": { From dffaf824af4606716a78310fe2dddeaf3e97530a Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 6 Sep 2024 16:15:39 +0200 Subject: [PATCH 2/9] Stop testing PHP 7.2 and 7.3 --- .github/workflows/build.yml | 18 ------------------ 1 file changed, 18 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d5e9d35..d70ff59 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -16,8 +16,6 @@ jobs: strategy: matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -41,10 +39,6 @@ jobs: - name: "Install dependencies" run: "composer install --no-interaction --no-progress --no-suggest" - - name: "Downgrade PHPUnit" - if: matrix.php-version == '7.2' || matrix.php-version == '7.3' - run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies" - - name: "Lint" run: "make lint" @@ -94,8 +88,6 @@ jobs: fail-fast: false matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -124,10 +116,6 @@ jobs: if: ${{ matrix.dependencies == 'highest' }} run: "composer update --no-interaction --no-progress --no-suggest" - - name: "Downgrade PHPUnit" - if: matrix.php-version == '7.2' || matrix.php-version == '7.3' - run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies" - - name: "Tests" run: "make tests" @@ -139,8 +127,6 @@ jobs: fail-fast: false matrix: php-version: - - "7.2" - - "7.3" - "7.4" - "8.0" - "8.1" @@ -171,9 +157,5 @@ jobs: if: ${{ matrix.dependencies == 'highest' }} run: "composer update --no-interaction --no-progress --no-suggest" - - name: "Downgrade PHPUnit" - if: matrix.php-version == '7.2' || matrix.php-version == '7.3' - run: "composer require --dev phpunit/phpunit:^7.5.20 --update-with-dependencies" - - name: "PHPStan" run: "make phpstan" From 5f12265b102b74f6b712cd74339183bc7aeca363 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 6 Sep 2024 16:16:26 +0200 Subject: [PATCH 3/9] Update build-cs --- .github/workflows/build.yml | 2 +- Makefile | 2 +- src/Reflection/Dibi/DibiFluentMethodReflection.php | 8 +++----- .../Dibi/DibiFluentClassReflectionExtensionTest.php | 6 ++---- 4 files changed, 7 insertions(+), 11 deletions(-) diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index d70ff59..c399b73 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -56,7 +56,7 @@ jobs: with: repository: "phpstan/build-cs" path: "build-cs" - ref: "1.x" + ref: "2.x" - name: "Install PHP" uses: "shivammathur/setup-php@v2" diff --git a/Makefile b/Makefile index 90e23ba..b2b6703 100644 --- a/Makefile +++ b/Makefile @@ -13,7 +13,7 @@ lint: .PHONY: cs-install cs-install: git clone https://github.com/phpstan/build-cs.git || true - git -C build-cs fetch origin && git -C build-cs reset --hard origin/1.x + git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x composer install --working-dir build-cs .PHONY: cs diff --git a/src/Reflection/Dibi/DibiFluentMethodReflection.php b/src/Reflection/Dibi/DibiFluentMethodReflection.php index c055006..d76ced9 100644 --- a/src/Reflection/Dibi/DibiFluentMethodReflection.php +++ b/src/Reflection/Dibi/DibiFluentMethodReflection.php @@ -15,11 +15,9 @@ class DibiFluentMethodReflection implements MethodReflection { - /** @var string */ - private $name; + private string $name; - /** @var ClassReflection */ - private $dibiFluent; + private ClassReflection $dibiFluent; public function __construct(string $name, ClassReflection $dibiFluent) { @@ -68,7 +66,7 @@ public function getVariants(): array TemplateTypeMap::createEmpty(), [], true, - new ObjectType('Dibi\Fluent') + new ObjectType('Dibi\Fluent'), ), ]; } diff --git a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php index 6b1f9de..acb2a00 100644 --- a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php +++ b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php @@ -12,11 +12,9 @@ class DibiFluentClassReflectionExtensionTest extends PHPStanTestCase { - /** @var Broker */ - private $broker; + private Broker $broker; - /** @var DibiFluentClassReflectionExtension */ - private $extension; + private DibiFluentClassReflectionExtension $extension; protected function setUp(): void { From e2d9cfcd850b26f4cec57ce63b6a58f8e6706549 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Thu, 26 Sep 2024 20:11:20 +0200 Subject: [PATCH 4/9] Fix after PHPStan update --- .../Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php | 3 +-- 1 file changed, 1 insertion(+), 2 deletions(-) diff --git a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php index acb2a00..ec57ea7 100644 --- a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php +++ b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php @@ -4,7 +4,6 @@ use Dibi\Fluent; use PHPStan\Broker\Broker; -use PHPStan\Reflection\ParametersAcceptorSelector; use PHPStan\Testing\PHPStanTestCase; use PHPStan\Type\VerbosityLevel; use stdClass; @@ -52,7 +51,7 @@ public function testGetMethod(): void { $classReflection = $this->broker->getClass(Fluent::class); $methodReflection = $this->extension->getMethod($classReflection, 'select'); - $parametersAcceptor = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants()); + $parametersAcceptor = $methodReflection->getVariants()[0]; self::assertSame('select', $methodReflection->getName()); self::assertSame($classReflection, $methodReflection->getDeclaringClass()); self::assertFalse($methodReflection->isStatic()); From 8de145d83a595d1cd3ff27a925d086188813d911 Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Mon, 30 Sep 2024 17:32:42 +0200 Subject: [PATCH 5/9] Fix after PHPStan update --- .../Dibi/DibiFluentClassReflectionExtensionTest.php | 10 +++++----- 1 file changed, 5 insertions(+), 5 deletions(-) diff --git a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php index ec57ea7..1fa5466 100644 --- a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php +++ b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php @@ -3,7 +3,7 @@ namespace PHPStan\Reflection\Dibi; use Dibi\Fluent; -use PHPStan\Broker\Broker; +use PHPStan\Reflection\ReflectionProvider; use PHPStan\Testing\PHPStanTestCase; use PHPStan\Type\VerbosityLevel; use stdClass; @@ -11,13 +11,13 @@ class DibiFluentClassReflectionExtensionTest extends PHPStanTestCase { - private Broker $broker; + private ReflectionProvider $reflectionProvider; private DibiFluentClassReflectionExtension $extension; protected function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->extension = new DibiFluentClassReflectionExtension(); } @@ -43,13 +43,13 @@ public function dataHasMethod(): array */ public function testHasMethod(string $className, bool $result): void { - $classReflection = $this->broker->getClass($className); + $classReflection = $this->reflectionProvider->getClass($className); self::assertSame($result, $this->extension->hasMethod($classReflection, 'select')); } public function testGetMethod(): void { - $classReflection = $this->broker->getClass(Fluent::class); + $classReflection = $this->reflectionProvider->getClass(Fluent::class); $methodReflection = $this->extension->getMethod($classReflection, 'select'); $parametersAcceptor = $methodReflection->getVariants()[0]; self::assertSame('select', $methodReflection->getName()); From 80c582d7a4687e6d071d1fe70a12664b9f44555a Mon Sep 17 00:00:00 2001 From: Ondrej Mirtes Date: Fri, 4 Oct 2024 14:01:49 +0200 Subject: [PATCH 6/9] Fix after PHPStan update --- src/Reflection/Dibi/DibiFluentMethodReflection.php | 4 ---- 1 file changed, 4 deletions(-) diff --git a/src/Reflection/Dibi/DibiFluentMethodReflection.php b/src/Reflection/Dibi/DibiFluentMethodReflection.php index d76ced9..220c845 100644 --- a/src/Reflection/Dibi/DibiFluentMethodReflection.php +++ b/src/Reflection/Dibi/DibiFluentMethodReflection.php @@ -6,7 +6,6 @@ use PHPStan\Reflection\ClassReflection; use PHPStan\Reflection\FunctionVariant; use PHPStan\Reflection\MethodReflection; -use PHPStan\Reflection\ParametersAcceptor; use PHPStan\TrinaryLogic; use PHPStan\Type\Generic\TemplateTypeMap; use PHPStan\Type\ObjectType; @@ -55,9 +54,6 @@ public function isPublic(): bool return true; } - /** - * @return ParametersAcceptor[] - */ public function getVariants(): array { return [ From cd7d2f2781965239463dfab874077ee568711a55 Mon Sep 17 00:00:00 2001 From: =?UTF-8?q?Ond=C5=99ej=20Mirtes?= Date: Tue, 28 Jan 2025 10:27:21 +0100 Subject: [PATCH 7/9] Update LICENSE --- LICENSE | 1 + 1 file changed, 1 insertion(+) diff --git a/LICENSE b/LICENSE index 7c0f2b7..e5f34e6 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,7 @@ MIT License Copyright (c) 2016 Ondřej Mirtes +Copyright (c) 2025 PHPStan s.r.o. Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal From e20ac3da0cdd8faa6590ffeb91f6753b22d60b85 Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 24 Mar 2025 02:07:09 +0000 Subject: [PATCH 8/9] chore(deps): update metcalfc/changelog-generator action to v4.5.0 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1a669a..be6cad0 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: Generate changelog id: changelog - uses: metcalfc/changelog-generator@v4.3.1 + uses: metcalfc/changelog-generator@v4.5.0 with: myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }} From 1351bfc633d2df62cee96356d2e05c48ba75e82a Mon Sep 17 00:00:00 2001 From: "renovate[bot]" <29139614+renovate[bot]@users.noreply.github.com> Date: Mon, 7 Apr 2025 02:15:58 +0000 Subject: [PATCH 9/9] chore(deps): update metcalfc/changelog-generator action to v4.6.2 --- .github/workflows/release.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index be6cad0..b8c96d4 100644 --- a/.github/workflows/release.yml +++ b/.github/workflows/release.yml @@ -18,7 +18,7 @@ jobs: - name: Generate changelog id: changelog - uses: metcalfc/changelog-generator@v4.5.0 + uses: metcalfc/changelog-generator@v4.6.2 with: myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }}