Skip to content

Commit fb9cf75

Browse files
committed
Update build-cs
1 parent 1a90161 commit fb9cf75

20 files changed

+41
-61
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -56,7 +56,7 @@ jobs:
5656
with:
5757
repository: "phpstan/build-cs"
5858
path: "build-cs"
59-
ref: "1.x"
59+
ref: "2.x"
6060

6161
- name: "Install PHP"
6262
uses: "shivammathur/setup-php@v2"

Makefile

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@ lint:
1414
.PHONY: cs-install
1515
cs-install:
1616
git clone https://github.com/phpstan/build-cs.git || true
17-
git -C build-cs fetch origin && git -C build-cs reset --hard origin/1.x
17+
git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x
1818
composer install --working-dir build-cs
1919

2020
.PHONY: cs

src/Reflection/Nette/HtmlMethodReflection.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -18,11 +18,9 @@
1818
class HtmlMethodReflection implements MethodReflection
1919
{
2020

21-
/** @var string */
22-
private $name;
21+
private string $name;
2322

24-
/** @var ClassReflection */
25-
private $declaringClass;
23+
private ClassReflection $declaringClass;
2624

2725
public function __construct(string $name, ClassReflection $declaringClass)
2826
{
@@ -56,7 +54,7 @@ public function getVariants(): array
5654
TemplateTypeMap::createEmpty(),
5755
[],
5856
true,
59-
substr($this->name, 0, 3) === 'get' ? new MixedType() : new ObjectType('Nette\Utils\Html')
57+
substr($this->name, 0, 3) === 'get' ? new MixedType() : new ObjectType('Nette\Utils\Html'),
6058
),
6159
];
6260
}

src/Reflection/Nette/HtmlPropertyReflection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,9 @@
1111
class HtmlPropertyReflection implements PropertyReflection
1212
{
1313

14-
/** @var ClassReflection */
15-
private $declaringClass;
14+
private ClassReflection $declaringClass;
1615

17-
/** @var Type */
18-
private $type;
16+
private Type $type;
1917

2018
public function __construct(ClassReflection $declaringClass)
2119
{

src/Reflection/Nette/NetteObjectEventListenerMethodReflection.php

Lines changed: 3 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -15,11 +15,9 @@
1515
class NetteObjectEventListenerMethodReflection implements MethodReflection
1616
{
1717

18-
/** @var string */
19-
private $name;
18+
private string $name;
2019

21-
/** @var ClassReflection */
22-
private $declaringClass;
20+
private ClassReflection $declaringClass;
2321

2422
public function __construct(string $name, ClassReflection $declaringClass)
2523
{
@@ -58,7 +56,7 @@ public function getVariants(): array
5856
TemplateTypeMap::createEmpty(),
5957
[],
6058
true,
61-
new VoidType()
59+
new VoidType(),
6260
),
6361
];
6462
}

src/Reflection/Nette/NetteObjectPropertyReflection.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -10,11 +10,9 @@
1010
class NetteObjectPropertyReflection implements PropertyReflection
1111
{
1212

13-
/** @var ClassReflection */
14-
private $declaringClass;
13+
private ClassReflection $declaringClass;
1514

16-
/** @var Type */
17-
private $type;
15+
private Type $type;
1816

1917
public function __construct(ClassReflection $declaringClass, Type $type)
2018
{

src/Rule/Nette/DoNotExtendNetteObjectRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -34,7 +34,7 @@ public function processNode(Node $node, Scope $scope): array
3434
"Class %s extends %s - it's better to use %s trait.",
3535
$classReflection->getDisplayName(),
3636
'Nette\Object',
37-
'Nette\SmartObject'
37+
'Nette\SmartObject',
3838
))->identifier('class.extendsNetteObject')->build(),
3939
];
4040
}

src/Rule/Nette/RethrowExceptionRule.php

Lines changed: 2 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class RethrowExceptionRule implements Rule
2828
{
2929

3030
/** @var array<string, string[]> */
31-
private $methods;
31+
private array $methods;
3232

3333
/**
3434
* @param string[][] $methods
@@ -68,9 +68,7 @@ public function processNode(Node $node, Scope $scope): array
6868
foreach ($exceptions as $exceptionName) {
6969
$exceptionType = new ObjectType($exceptionName);
7070
foreach ($node->catches as $catch) {
71-
$caughtType = TypeCombinator::union(...array_map(static function (Name $class): ObjectType {
72-
return new ObjectType((string) $class);
73-
}, $catch->types));
71+
$caughtType = TypeCombinator::union(...array_map(static fn (Name $class): ObjectType => new ObjectType((string) $class), $catch->types));
7472
if (!$caughtType->isSuperTypeOf($exceptionType)->yes()) {
7573
continue;
7674
}

src/Type/Nette/ComponentGetPresenterDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
2727
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
2828
{
2929
$methodDefinition = ParametersAcceptorSelector::selectSingle(
30-
$methodReflection->getVariants()
30+
$methodReflection->getVariants(),
3131
);
3232
$defaultReturnType = $methodDefinition->getReturnType();
3333
$firstParameterExists = count($methodDefinition->getParameters()) > 0;

src/Type/Nette/ComponentLookupDynamicReturnTypeExtension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -27,7 +27,7 @@ public function isMethodSupported(MethodReflection $methodReflection): bool
2727
public function getTypeFromMethodCall(MethodReflection $methodReflection, MethodCall $methodCall, Scope $scope): Type
2828
{
2929
$defaultReturnType = ParametersAcceptorSelector::selectSingle(
30-
$methodReflection->getVariants()
30+
$methodReflection->getVariants(),
3131
)->getReturnType();
3232
if (count($methodCall->getArgs()) < 2) {
3333
return $defaultReturnType;

0 commit comments

Comments
 (0)