Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commit f8092f9

Browse files
Update build-cs
1 parent f647999 commit f8092f9

File tree

47 files changed

+112
-155
lines changed

Some content is hidden

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

47 files changed

+112
-155
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
@@ -13,7 +13,7 @@ lint:
1313
.PHONY: cs-install
1414
cs-install:
1515
git clone https://github.com/phpstan/build-cs.git || true
16-
git -C build-cs fetch origin && git -C build-cs reset --hard origin/1.x
16+
git -C build-cs fetch origin && git -C build-cs reset --hard origin/2.x
1717
composer install --working-dir build-cs
1818

1919
.PHONY: cs

‎src/Rules/BooleansInConditions/BooleanInBooleanAndRule.php‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
class BooleanInBooleanAndRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

22-
/** @var bool */
23-
private $bleedingEdge;
21+
private bool $bleedingEdge;
2422

2523
public function __construct(BooleanRuleHelper $helper, bool $bleedingEdge)
2624
{
@@ -44,7 +42,7 @@ public function processNode(Node $node, Scope $scope): array
4442
$messages[] = RuleErrorBuilder::message(sprintf(
4543
'Only booleans are allowed in %s, %s given on the left side.',
4644
$nodeText,
47-
$leftType->describe(VerbosityLevel::typeOnly())
45+
$leftType->describe(VerbosityLevel::typeOnly()),
4846
))->identifier(sprintf('%s.leftNotBoolean', $identifierType))->build();
4947
}
5048

@@ -54,7 +52,7 @@ public function processNode(Node $node, Scope $scope): array
5452
$messages[] = RuleErrorBuilder::message(sprintf(
5553
'Only booleans are allowed in %s, %s given on the right side.',
5654
$nodeText,
57-
$rightType->describe(VerbosityLevel::typeOnly())
55+
$rightType->describe(VerbosityLevel::typeOnly()),
5856
))->identifier(sprintf('%s.rightNotBoolean', $identifierType))->build();
5957
}
6058

‎src/Rules/BooleansInConditions/BooleanInBooleanNotRule.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
class BooleanInBooleanNotRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

2221
public function __construct(BooleanRuleHelper $helper)
2322
{
@@ -40,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
4039
return [
4140
RuleErrorBuilder::message(sprintf(
4241
'Only booleans are allowed in a negated boolean, %s given.',
43-
$expressionType->describe(VerbosityLevel::typeOnly())
42+
$expressionType->describe(VerbosityLevel::typeOnly()),
4443
))->identifier('booleanNot.exprNotBoolean')->build(),
4544
];
4645
}

‎src/Rules/BooleansInConditions/BooleanInBooleanOrRule.php‎

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -16,11 +16,9 @@
1616
class BooleanInBooleanOrRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

22-
/** @var bool */
23-
private $bleedingEdge;
21+
private bool $bleedingEdge;
2422

2523
public function __construct(BooleanRuleHelper $helper, bool $bleedingEdge)
2624
{
@@ -44,7 +42,7 @@ public function processNode(Node $node, Scope $scope): array
4442
$messages[] = RuleErrorBuilder::message(sprintf(
4543
'Only booleans are allowed in %s, %s given on the left side.',
4644
$nodeText,
47-
$leftType->describe(VerbosityLevel::typeOnly())
45+
$leftType->describe(VerbosityLevel::typeOnly()),
4846
))->identifier(sprintf('%s.leftNotBoolean', $identifierType))->build();
4947
}
5048

@@ -54,7 +52,7 @@ public function processNode(Node $node, Scope $scope): array
5452
$messages[] = RuleErrorBuilder::message(sprintf(
5553
'Only booleans are allowed in %s, %s given on the right side.',
5654
$nodeText,
57-
$rightType->describe(VerbosityLevel::typeOnly())
55+
$rightType->describe(VerbosityLevel::typeOnly()),
5856
))->identifier(sprintf('%s.rightNotBoolean', $identifierType))->build();
5957
}
6058

‎src/Rules/BooleansInConditions/BooleanInElseIfConditionRule.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
class BooleanInElseIfConditionRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

2221
public function __construct(BooleanRuleHelper $helper)
2322
{
@@ -40,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
4039
return [
4140
RuleErrorBuilder::message(sprintf(
4241
'Only booleans are allowed in an elseif condition, %s given.',
43-
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
42+
$conditionExpressionType->describe(VerbosityLevel::typeOnly()),
4443
))->identifier('elseif.condNotBoolean')->build(),
4544
];
4645
}

‎src/Rules/BooleansInConditions/BooleanInIfConditionRule.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
class BooleanInIfConditionRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

2221
public function __construct(BooleanRuleHelper $helper)
2322
{
@@ -40,7 +39,7 @@ public function processNode(Node $node, Scope $scope): array
4039
return [
4140
RuleErrorBuilder::message(sprintf(
4241
'Only booleans are allowed in an if condition, %s given.',
43-
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
42+
$conditionExpressionType->describe(VerbosityLevel::typeOnly()),
4443
))->identifier('if.condNotBoolean')->build(),
4544
];
4645
}

‎src/Rules/BooleansInConditions/BooleanInTernaryOperatorRule.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,8 +16,7 @@
1616
class BooleanInTernaryOperatorRule implements Rule
1717
{
1818

19-
/** @var BooleanRuleHelper */
20-
private $helper;
19+
private BooleanRuleHelper $helper;
2120

2221
public function __construct(BooleanRuleHelper $helper)
2322
{
@@ -44,7 +43,7 @@ public function processNode(Node $node, Scope $scope): array
4443
return [
4544
RuleErrorBuilder::message(sprintf(
4645
'Only booleans are allowed in a ternary operator condition, %s given.',
47-
$conditionExpressionType->describe(VerbosityLevel::typeOnly())
46+
$conditionExpressionType->describe(VerbosityLevel::typeOnly()),
4847
))->identifier('ternary.condNotBoolean')->build(),
4948
];
5049
}

‎src/Rules/BooleansInConditions/BooleanRuleHelper.php‎

Lines changed: 2 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,7 @@
1212
class BooleanRuleHelper
1313
{
1414

15-
/** @var RuleLevelHelper */
16-
private $ruleLevelHelper;
15+
private RuleLevelHelper $ruleLevelHelper;
1716

1817
public function __construct(RuleLevelHelper $ruleLevelHelper)
1918
{
@@ -30,9 +29,7 @@ public function passesAsBoolean(Scope $scope, Expr $expr): bool
3029
$scope,
3130
$expr,
3231
'',
33-
static function (Type $type): bool {
34-
return $type->isBoolean()->yes();
35-
}
32+
static fn (Type $type): bool => $type->isBoolean()->yes(),
3633
);
3734
$foundType = $typeToCheck->getType();
3835
if ($foundType instanceof ErrorType) {

‎src/Rules/Cast/UselessCastRule.php‎

Lines changed: 2 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,8 +18,7 @@
1818
class UselessCastRule implements Rule
1919
{
2020

21-
/** @var bool */
22-
private $treatPhpDocTypesAsCertain;
21+
private bool $treatPhpDocTypesAsCertain;
2322

2423
public function __construct(bool $treatPhpDocTypesAsCertain)
2524
{
@@ -61,7 +60,7 @@ public function processNode(Node $node, Scope $scope): array
6160
$addTip(RuleErrorBuilder::message(sprintf(
6261
'Casting to %s something that\'s already %s.',
6362
$castType->describe(VerbosityLevel::typeOnly()),
64-
$expressionType->describe(VerbosityLevel::typeOnly())
63+
$expressionType->describe(VerbosityLevel::typeOnly()),
6564
)))->identifier('cast.useless')->build(),
6665
];
6766
}

0 commit comments

Comments
(0)

AltStyle によって変換されたページ (->オリジナル) /