diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index aa81766..c399b73 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: @@ -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" @@ -62,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" @@ -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" diff --git a/.github/workflows/release.yml b/.github/workflows/release.yml index b1a669a..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.3.1 + uses: metcalfc/changelog-generator@v4.6.2 with: myToken: ${{ secrets.PHPSTAN_BOT_TOKEN }} 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 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/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": { diff --git a/src/Reflection/Dibi/DibiFluentMethodReflection.php b/src/Reflection/Dibi/DibiFluentMethodReflection.php index c055006..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; @@ -15,11 +14,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) { @@ -57,9 +54,6 @@ public function isPublic(): bool return true; } - /** - * @return ParametersAcceptor[] - */ public function getVariants(): array { return [ @@ -68,7 +62,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..1fa5466 100644 --- a/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php +++ b/tests/Reflection/Dibi/DibiFluentClassReflectionExtensionTest.php @@ -3,8 +3,7 @@ namespace PHPStan\Reflection\Dibi; use Dibi\Fluent; -use PHPStan\Broker\Broker; -use PHPStan\Reflection\ParametersAcceptorSelector; +use PHPStan\Reflection\ReflectionProvider; use PHPStan\Testing\PHPStanTestCase; use PHPStan\Type\VerbosityLevel; use stdClass; @@ -12,15 +11,13 @@ class DibiFluentClassReflectionExtensionTest extends PHPStanTestCase { - /** @var Broker */ - private $broker; + private ReflectionProvider $reflectionProvider; - /** @var DibiFluentClassReflectionExtension */ - private $extension; + private DibiFluentClassReflectionExtension $extension; protected function setUp(): void { - $this->broker = $this->createBroker(); + $this->reflectionProvider = $this->createReflectionProvider(); $this->extension = new DibiFluentClassReflectionExtension(); } @@ -46,15 +43,15 @@ 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 = ParametersAcceptorSelector::selectSingle($methodReflection->getVariants()); + $parametersAcceptor = $methodReflection->getVariants()[0]; self::assertSame('select', $methodReflection->getName()); self::assertSame($classReflection, $methodReflection->getDeclaringClass()); self::assertFalse($methodReflection->isStatic());