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
8 changes: 4 additions & 4 deletions .github/workflows/tests.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
runs-on: ubuntu-latest
strategy:
matrix:
php-versions: ['8.1', '8.2', '8.3']
php-versions: ['8.3']

name: Tests on PHP ${{ matrix.php-versions }}
steps:
Expand Down Expand Up @@ -41,7 +41,7 @@ jobs:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
coverage: none
- name: Load dependencies from cache
id: composer-cache
Expand All @@ -50,9 +50,9 @@ jobs:
- uses: actions/cache@v4
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-php8.1-lowest-composer-${{ hashFiles('**/composer.json') }}
key: ${{ runner.os }}-php8.3-lowest-composer-${{ hashFiles('**/composer.json') }}
restore-keys: |
${{ runner.os }}-php8.1-lowest-composer-
${{ runner.os }}-php8.3-lowest-composer-
- run: composer update --no-progress --no-suggest --prefer-lowest
- run: php vendor/bin/phpunit

9 changes: 4 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,17 +17,16 @@
],
"minimum-stability": "stable",
"require": {
"php": "^8.1",
"php": "^8.3",
"nette/utils": "^4.0",
"nikic/php-parser": "^4.3|^5.0",
"phpstan/phpstan": "^1.0"
"phpstan/phpstan": "^2.0"
},
"require-dev": {
"brainbits/phpcs-standard": "^7.0",
"php-coveralls/php-coveralls": "^2.0",
"phpstan/phpstan-php-parser": "^1.0",
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^10.5"
"phpstan/phpstan-phpunit": "^2.0",
"phpunit/phpunit": "^11.0"
},
"scripts": {
"check-all": [
Expand Down
2 changes: 1 addition & 1 deletion phpcs.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,6 @@
<!-- arg value="sp"/ -->

<!-- Use brainbits coding standard -->
<rule ref="BrainbitsCodingStandardTest">
<rule ref="Brainbits">
</rule>
</ruleset>
1 change: 0 additions & 1 deletion phpstan.neon.dist
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@ includes:
- phar://phpstan.phar/conf/config.levelmax.neon
- phar://phpstan.phar/conf/bleedingEdge.neon
- vendor/phpstan/phpstan-phpunit/extension.neon
- vendor/phpstan/phpstan-php-parser/extension.neon
- rules.neon

parameters:
Expand Down
10 changes: 5 additions & 5 deletions src/CoversClassExistsRule.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
use PhpParser\Node\Scalar\String_;
use PhpParser\Node\Stmt\Class_;
use PHPStan\Analyser\Scope;
use PHPStan\Broker\Broker;
use PHPStan\Reflection\ReflectionProvider;
use PHPStan\Rules\Rule;
use PHPStan\Rules\RuleError;
use PHPStan\Rules\RuleErrorBuilder;
Expand All @@ -28,7 +28,7 @@ final class CoversClassExistsRule implements Rule
/** @var bool[] */
private array $alreadyParsedDocComments = [];

public function __construct(private Broker $broker)
public function __construct(private ReflectionProvider $reflectionProvider)
{
}

Expand Down Expand Up @@ -74,7 +74,7 @@ public function processNodeAttribute(Class_ $node, Scope $scope): array
assert($arg->value->class instanceof Name);

$className = (string) $arg->value->class;
if ($this->broker->hasClass($className)) {
if ($this->reflectionProvider->hasClass($className)) {
continue;
}

Expand All @@ -85,7 +85,7 @@ public function processNodeAttribute(Class_ $node, Scope $scope): array

if ($arg->value instanceof String_) {
$className = (string) $arg->value->value;
if ($this->broker->hasClass($className)) {
if ($this->reflectionProvider->hasClass($className)) {
continue;
}

Expand Down Expand Up @@ -135,7 +135,7 @@ public function processNodeAnnotation(Class_ $node, Scope $scope): array
}
}

if ($this->broker->hasClass($matches['className'])) {
if ($this->reflectionProvider->hasClass($matches['className'])) {
continue;
}

Expand Down
9 changes: 4 additions & 5 deletions tests/CoversClassExistsRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
use BrainbitsPhpStan\CoversClassExistsRule;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\CoversClass;

/**
* @covers \BrainbitsPhpStan\CoversClassExistsRule
* @extends RuleTestCase<CoversClassExistsRule>
*/
/** @extends RuleTestCase<CoversClassExistsRule> */
#[CoversClass(CoversClassExistsRule::class)]
final class CoversClassExistsRuleTest extends RuleTestCase
{
public function testAttributeRule(): void
Expand All @@ -31,7 +30,7 @@ public function testAnnotationRule(): void

protected function getRule(): Rule
{
$broker = $this->createBroker();
$broker = self::createReflectionProvider();

return new CoversClassExistsRule($broker);
}
Expand Down
7 changes: 3 additions & 4 deletions tests/CoversClassPresentRuleTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,11 +7,10 @@
use BrainbitsPhpStan\CoversClassPresentRule;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
use PHPUnit\Framework\Attributes\CoversClass;

/**
* @covers \BrainbitsPhpStan\CoversClassPresentRule
* @extends RuleTestCase<CoversClassPresentRule>
*/
/** @extends RuleTestCase<CoversClassPresentRule> */
#[CoversClass(CoversClassPresentRule::class)]
final class CoversClassPresentRuleTest extends RuleTestCase
{
public function testAnnotationWithoutUnitRule(): void
Expand Down
Loading