Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
[PHP 8.2] Add readonly class support (#834)
RFC: https://wiki.php.net/rfc/readonly_classes PHP implementation: php/php-src#7305
- Loading branch information
1 parent
5d83adc
commit 678ccbe
Showing
12 changed files
with
1,130 additions
and
929 deletions.
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
Large diffs are not rendered by default.
Oops, something went wrong.
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
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -1521,4 +1521,4 @@ array( | |
) | ||
) | ||
) | ||
) | ||
) |
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 |
---|---|---|
|
@@ -150,4 +150,4 @@ array( | |
) | ||
) | ||
) | ||
) | ||
) |
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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,68 @@ | ||
Readonly class | ||
----- | ||
<?php | ||
|
||
readonly class A { | ||
} | ||
----- | ||
!!php7 | ||
array( | ||
0: Stmt_Class( | ||
attrGroups: array( | ||
) | ||
flags: MODIFIER_READONLY (64) | ||
name: Identifier( | ||
name: A | ||
) | ||
extends: null | ||
implements: array( | ||
) | ||
stmts: array( | ||
) | ||
) | ||
) | ||
----- | ||
<?php | ||
|
||
readonly class A { | ||
} | ||
----- | ||
!!php5 | ||
Syntax error, unexpected T_READONLY from 3:1 to 3:8 | ||
array( | ||
0: Stmt_Class( | ||
attrGroups: array( | ||
) | ||
flags: 0 | ||
name: Identifier( | ||
name: A | ||
) | ||
extends: null | ||
implements: array( | ||
) | ||
stmts: array( | ||
) | ||
) | ||
) | ||
----- | ||
<?php | ||
|
||
final readonly class A { | ||
} | ||
----- | ||
!!php7 | ||
array( | ||
0: Stmt_Class( | ||
attrGroups: array( | ||
) | ||
flags: MODIFIER_FINAL | MODIFIER_READONLY (96) | ||
name: Identifier( | ||
name: A | ||
) | ||
extends: null | ||
implements: array( | ||
) | ||
stmts: array( | ||
) | ||
) | ||
) |
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,12 @@ | ||
Readonly class | ||
----- | ||
<?php | ||
|
||
readonly class Foo | ||
{ | ||
} | ||
----- | ||
!!php7 | ||
readonly class Foo | ||
{ | ||
} |