Skip to content

Commit

Permalink
Declare classes readonly
Browse files Browse the repository at this point in the history
  • Loading branch information
sebastianbergmann committed Dec 22, 2023
1 parent 0060a1a commit 13b4120
Show file tree
Hide file tree
Showing 10 changed files with 14 additions and 14 deletions.
2 changes: 1 addition & 1 deletion src/ClassMethodUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class ClassMethodUnit extends CodeUnit
final readonly class ClassMethodUnit extends CodeUnit
{
/**
* @psalm-assert-if-true ClassMethodUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/ClassUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class ClassUnit extends CodeUnit
final readonly class ClassUnit extends CodeUnit
{
/**
* @psalm-assert-if-true ClassUnit $this
Expand Down
8 changes: 4 additions & 4 deletions src/CodeUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,22 +22,22 @@
/**
* @psalm-immutable
*/
abstract class CodeUnit
abstract readonly class CodeUnit
{
/**
* @psalm-var non-empty-string
*/
private readonly string $name;
private string $name;

/**
* @psalm-var non-empty-string
*/
private readonly string $sourceFileName;
private string $sourceFileName;

/**
* @psalm-var list<int>
*/
private readonly array $sourceLines;
private array $sourceLines;

/**
* @psalm-param class-string $className
Expand Down
4 changes: 2 additions & 2 deletions src/CodeUnitCollection.php
Original file line number Diff line number Diff line change
Expand Up @@ -19,12 +19,12 @@
*
* @psalm-immutable
*/
final class CodeUnitCollection implements Countable, IteratorAggregate
final readonly class CodeUnitCollection implements Countable, IteratorAggregate
{
/**
* @psalm-var list<CodeUnit>
*/
private readonly array $codeUnits;
private array $codeUnits;

public static function fromList(CodeUnit ...$codeUnits): self
{
Expand Down
2 changes: 1 addition & 1 deletion src/FileUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class FileUnit extends CodeUnit
final readonly class FileUnit extends CodeUnit
{
/**
* @psalm-assert-if-true FileUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/FunctionUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class FunctionUnit extends CodeUnit
final readonly class FunctionUnit extends CodeUnit
{
/**
* @psalm-assert-if-true FunctionUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/InterfaceMethodUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class InterfaceMethodUnit extends CodeUnit
final readonly class InterfaceMethodUnit extends CodeUnit
{
/**
* @psalm-assert-if-true InterfaceMethodUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/InterfaceUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class InterfaceUnit extends CodeUnit
final readonly class InterfaceUnit extends CodeUnit
{
/**
* @psalm-assert-if-true InterfaceUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/TraitMethodUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class TraitMethodUnit extends CodeUnit
final readonly class TraitMethodUnit extends CodeUnit
{
/**
* @psalm-assert-if-true TraitMethodUnit $this
Expand Down
2 changes: 1 addition & 1 deletion src/TraitUnit.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@
/**
* @psalm-immutable
*/
final class TraitUnit extends CodeUnit
final readonly class TraitUnit extends CodeUnit
{
/**
* @psalm-assert-if-true TraitUnit $this
Expand Down

0 comments on commit 13b4120

Please sign in to comment.