Skip to content

Commit b98bb10

Browse files
committed
narrow return object type
1 parent d5ef3f8 commit b98bb10

File tree

41 files changed

+47
-86
lines changed

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

41 files changed

+47
-86
lines changed

composer.json

Lines changed: 7 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -5,23 +5,24 @@
55
"license": "MIT",
66
"require": {
77
"php": ">=8.2",
8-
"webmozart/assert": "^1.11",
8+
"webmozart/assert": "^1.12",
99
"phpstan/phpstan": "^2.1.30",
10-
"nette/utils": "^3.2|^4.0",
10+
"nette/utils": "^4.0",
1111
"phpstan/phpdoc-parser": "^2.3"
1212
},
1313
"require-dev": {
1414
"nikic/php-parser": "^5.6",
1515
"phpunit/phpunit": "^11.5",
1616
"symfony/framework-bundle": "6.1.*",
17-
"phpecs/phpecs": "^2.1",
18-
"tomasvotruba/class-leak": "^2.0",
17+
"phpecs/phpecs": "^2.2",
18+
"tomasvotruba/class-leak": "^2.1",
1919
"rector/rector": "^2.2",
2020
"phpstan/extension-installer": "^1.4",
2121
"symplify/phpstan-extensions": "^12.0",
22-
"tomasvotruba/unused-public": "^2.0",
22+
"tomasvotruba/unused-public": "^2.1",
2323
"tomasvotruba/type-coverage": "^2.0",
24-
"shipmonk/composer-dependency-analyser": "^1.8"
24+
"shipmonk/composer-dependency-analyser": "^1.8",
25+
"rector/jack": "^0.4.0"
2526
},
2627
"autoload": {
2728
"psr-4": {

tests/Rules/Doctrine/NoDoctrineListenerWithoutContractRule/NoDoctrineListenerWithoutContractRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\NoDoctrineListenerWithoutContractRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Doctrine\NoDoctrineListenerWithoutContractRule;
@@ -32,7 +31,7 @@ public static function provideData(): Iterator
3231
]]];
3332
}
3433

35-
protected function getRule(): Rule
34+
protected function getRule(): NoDoctrineListenerWithoutContractRule
3635
{
3736
return new NoDoctrineListenerWithoutContractRule();
3837
}

tests/Rules/Doctrine/NoGetRepositoryOnServiceRepositoryEntityRule/NoGetRepositoryOnServiceRepositoryEntityRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,6 @@
66

77
use Iterator;
88
use PHPStan\Reflection\ReflectionProvider;
9-
use PHPStan\Rules\Rule;
109
use PHPStan\Testing\RuleTestCase;
1110
use PHPUnit\Framework\Attributes\DataProvider;
1211
use Symplify\PHPStanRules\Rules\Doctrine\NoGetRepositoryOnServiceRepositoryEntityRule;
@@ -40,7 +39,7 @@ public static function provideData(): Iterator
4039
yield [__DIR__ . '/Fixture/SkipGetRepositoryOnNormalRepository.php', []];
4140
}
4241

43-
protected function getRule(): Rule
42+
protected function getRule(): NoGetRepositoryOnServiceRepositoryEntityRule
4443
{
4544
$reflectionProvider = self::getContainer()->getByType(ReflectionProvider::class);
4645

tests/Rules/Doctrine/NoGetRepositoryOutsideServiceRule/NoGetRepositoryOutsideServiceRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\NoGetRepositoryOutsideServiceRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Doctrine\NoGetRepositoryOutsideServiceRule;
@@ -38,7 +37,7 @@ public static function provideData(): Iterator
3837
yield [__DIR__ . '/Fixture/SkipDynamicClassConstFetch.php', []];
3938
}
4039

41-
protected function getRule(): Rule
40+
protected function getRule(): NoGetRepositoryOutsideServiceRule
4241
{
4342
return new NoGetRepositoryOutsideServiceRule();
4443
}

tests/Rules/Doctrine/NoParentRepositoryRule/NoParentRepositoryRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\NoParentRepositoryRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Doctrine\NoParentRepositoryRule;
@@ -23,7 +22,7 @@ public static function provideData(): Iterator
2322
yield [__DIR__ . '/Fixture/SomeRepository.php', [[NoParentRepositoryRule::ERROR_MESSAGE, 9]]];
2423
}
2524

26-
protected function getRule(): Rule
25+
protected function getRule(): NoParentRepositoryRule
2726
{
2827
return new NoParentRepositoryRule();
2928
}

tests/Rules/Doctrine/NoRepositoryCallInDataFixtureRule/NoRepositoryCallInDataFixtureRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\NoRepositoryCallInDataFixtureRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Doctrine\NoRepositoryCallInDataFixtureRule;
@@ -31,7 +30,7 @@ public static function provideData(): Iterator
3130
yield [__DIR__ . '/Fixture/SkipNonFixtureClass.php', []];
3231
}
3332

34-
protected function getRule(): Rule
33+
protected function getRule(): NoRepositoryCallInDataFixtureRule
3534
{
3635
return new NoRepositoryCallInDataFixtureRule();
3736
}

tests/Rules/Doctrine/RequireQueryBuilderOnRepositoryRule/RequireQueryBuilderOnRepositoryRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\RequireQueryBuilderOnRepositoryRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Doctrine\RequireQueryBuilderOnRepositoryRule;
@@ -33,7 +32,7 @@ public static function provideData(): Iterator
3332
]];
3433
}
3534

36-
protected function getRule(): Rule
35+
protected function getRule(): RequireQueryBuilderOnRepositoryRule
3736
{
3837
return new RequireQueryBuilderOnRepositoryRule();
3938
}

tests/Rules/Doctrine/RequireServiceRepositoryParentRule/RequireServiceRepositoryParentRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Doctrine\RequireServiceRepositoryParentRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Enum\DoctrineClass;
@@ -29,7 +28,7 @@ public static function provideData(): Iterator
2928
yield [__DIR__ . '/Fixture/SkipContractImplementingRepository.php', []];
3029
}
3130

32-
protected function getRule(): Rule
31+
protected function getRule(): RequireServiceRepositoryParentRule
3332
{
3433
return new RequireServiceRepositoryParentRule();
3534
}

tests/Rules/Explicit/NoProtectedClassStmtRule/NoProtectedClassStmtRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\Explicit\NoProtectedClassStmtRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\Explicit\NoProtectedClassStmtRule;
@@ -29,7 +28,7 @@ public static function provideData(): Iterator
2928
yield [__DIR__ . '/Fixture/SkipAbstractWithProtected.php', []];
3029
}
3130

32-
protected function getRule(): Rule
31+
protected function getRule(): NoProtectedClassStmtRule
3332
{
3433
return new NoProtectedClassStmtRule();
3534
}

tests/Rules/PHPUnit/NoAssertFuncCallInTestsRule/NoAssertFuncCallInTestsRuleTest.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,7 +5,6 @@
55
namespace Symplify\PHPStanRules\Tests\Rules\PHPUnit\NoAssertFuncCallInTestsRule;
66

77
use Iterator;
8-
use PHPStan\Rules\Rule;
98
use PHPStan\Testing\RuleTestCase;
109
use PHPUnit\Framework\Attributes\DataProvider;
1110
use Symplify\PHPStanRules\Rules\PHPUnit\NoAssertFuncCallInTestsRule;
@@ -25,7 +24,7 @@ public static function provideData(): Iterator
2524
yield [__DIR__ . '/Fixture/SkipTestOutside.php', []];
2625
}
2726

28-
protected function getRule(): Rule
27+
protected function getRule(): NoAssertFuncCallInTestsRule
2928
{
3029
return new NoAssertFuncCallInTestsRule();
3130
}

0 commit comments

Comments
 (0)