-
Notifications
You must be signed in to change notification settings - Fork 483
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
ReadOnlyPropertyRule - support for readonly classes
- Loading branch information
1 parent
3e383fc
commit c52eb57
Showing
5 changed files
with
49 additions
and
1 deletion.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
24 changes: 24 additions & 0 deletions
24
tests/PHPStan/Rules/Properties/data/read-only-property-readonly-class.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,24 @@ | ||
<?php // lint >= 8.2 | ||
|
||
namespace ReadOnlyPropertyReadonlyClass; | ||
|
||
readonly class Foo | ||
{ | ||
|
||
private int $foo; | ||
private $bar; | ||
private int $baz = 0; | ||
|
||
} | ||
|
||
readonly final class ErrorResponse | ||
{ | ||
public function __construct(public string $message = '') | ||
{ | ||
} | ||
} | ||
|
||
readonly class StaticReadonlyProperty | ||
{ | ||
private static int $foo; | ||
} |