Skip to content

Commit 8230e1c

Browse files
authored
Merge branch 'master' into fix-enforce-native-return
2 parents 2ffe369 + d36092e commit 8230e1c

File tree

8 files changed

+24
-7
lines changed

8 files changed

+24
-7
lines changed

.github/workflows/checks.yml

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: Checks
22
on:
3+
workflow_dispatch:
34
pull_request:
45
push:
56
branches:
@@ -13,7 +14,7 @@ jobs:
1314
steps:
1415
-
1516
name: Checkout code
16-
uses: actions/checkout@v4
17+
uses: actions/checkout@v6
1718
-
1819
name: Setup PHP
1920
uses: shivammathur/setup-php@v2
@@ -38,7 +39,7 @@ jobs:
3839
steps:
3940
-
4041
name: Checkout code
41-
uses: actions/checkout@v4
42+
uses: actions/checkout@v6
4243
-
4344
name: Setup PHP
4445
uses: shivammathur/setup-php@v2

.github/workflows/lint.yml

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,6 @@
11
name: phpcs.xml lint
22
on:
3+
workflow_dispatch:
34
pull_request:
45
push:
56
branches:
@@ -12,7 +13,7 @@ jobs:
1213
steps:
1314
-
1415
name: Checkout code
15-
uses: actions/checkout@v3
16+
uses: actions/checkout@v6
1617

1718
-
1819
name: Install dependencies

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@
1111
],
1212
"require": {
1313
"php": "^7.4 || ^8.0",
14-
"phpstan/phpstan": "^2.1.8"
14+
"phpstan/phpstan": "^2.1.32"
1515
},
1616
"require-dev": {
1717
"editorconfig-checker/editorconfig-checker": "^10.6.0",

composer.lock

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

src/Rule/EnforceReadonlyPublicPropertyRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function processNode(
4141
return [];
4242
}
4343

44-
if (!$node->isPublic() || $node->isReadOnly() || $node->hasHooks()) {
44+
if (!$node->isPublic() || $node->isReadOnly() || $node->hasHooks() || $node->isPrivateSet() || $node->isProtectedSet()) {
4545
return [];
4646
}
4747

src/Rule/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -244,7 +244,7 @@ private function comparePhpDocAndNativeType(
244244
return [];
245245
}
246246

247-
if ($nativeReturnType instanceof MixedType) {
247+
if ($nativeReturnType instanceof MixedType || $nativeReturnType->isVoid()->yes()) {
248248
return [];
249249
}
250250

tests/Rule/data/EnforceReadonlyPublicPropertyRule/code-84.php

Lines changed: 6 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -57,3 +57,9 @@ class ImplementingClass implements MyInterface {
5757
class ImplementingClass2 implements MyInterface {
5858
public readonly string $key;
5959
}
60+
61+
class AsymmetricVisibility {
62+
public private(set) string $privateSet;
63+
public protected(set) string $protectedSet;
64+
public public(set) string $publicSet; // error: Public property `publicSet` not marked as readonly.
65+
}

tests/Rule/data/ForbidPhpDocNullabilityMismatchWithNativeTypehintRule/code.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -2,6 +2,7 @@
22

33
namespace ForbidPhpDocNotMatchingNativeTypehintRule;
44

5+
use Exception;
56

67
class HelloWorld
78
{
@@ -105,4 +106,12 @@ public static function getStringMissingNull($stringOrNullInTemplate): ?string //
105106
return $stringOrNullInTemplate;
106107
}
107108

109+
/**
110+
* @return never
111+
*/
112+
public function throwSomeException(): void
113+
{
114+
throw new Exception();
115+
}
116+
108117
}

0 commit comments

Comments
 (0)