-
Notifications
You must be signed in to change notification settings - Fork 119
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #680 from emacs-php/feature/php81-readonly-keyword
Add PHP 8.1 readonly keyword
- Loading branch information
Showing
4 changed files
with
107 additions
and
2 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,20 @@ | ||
<?php | ||
|
||
class Foo | ||
{ | ||
private readonly string $p1; | ||
public readonly int $p2; | ||
|
||
public function __construct( | ||
private readonly string $a1, | ||
public readonly int $a2, | ||
) {} | ||
} | ||
|
||
__halt_compiler(); | ||
|
||
claas Err | ||
{ | ||
/** Readonly property must have type */ | ||
public readonly $e1; | ||
} |
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,84 @@ | ||
;; -*- mode: emacs-lisp -*- | ||
(("<?php" . php-php-tag) | ||
(" | ||
") | ||
("class" . php-class-declaration) | ||
(" ") | ||
("Foo" . font-lock-type-face) | ||
(" | ||
{ | ||
") | ||
("private" . php-keyword) | ||
(" ") | ||
("readonly" . php-keyword) | ||
(" ") | ||
("string" . font-lock-type-face) | ||
(" ") | ||
("$" . php-variable-sigil) | ||
("p1" . php-variable-name) | ||
("; | ||
") | ||
("public" . php-keyword) | ||
(" ") | ||
("readonly" . php-keyword) | ||
(" ") | ||
("int" . font-lock-type-face) | ||
(" ") | ||
("$" . php-variable-sigil) | ||
("p2" . php-variable-name) | ||
("; | ||
") | ||
("public" . php-keyword) | ||
(" ") | ||
("function" . php-keyword) | ||
(" ") | ||
("__construct" . php-function-name) | ||
("( | ||
") | ||
("private" . php-keyword) | ||
(" ") | ||
("readonly" . php-keyword) | ||
(" ") | ||
("string" . font-lock-type-face) | ||
(" ") | ||
("$" . php-variable-sigil) | ||
("a1" . php-variable-name) | ||
(", | ||
") | ||
("public" . php-keyword) | ||
(" ") | ||
("readonly" . php-keyword) | ||
(" ") | ||
("int" . font-lock-type-face) | ||
(" ") | ||
("$" . php-variable-sigil) | ||
("a2" . php-variable-name) | ||
(", | ||
) {} | ||
} | ||
") | ||
("__halt_compiler" . php-keyword) | ||
("(); | ||
") | ||
("claas" . font-lock-type-face) | ||
(" ") | ||
("Err" . font-lock-variable-name-face) | ||
(" | ||
{ | ||
") | ||
("/** Readonly property must have type */" . font-lock-doc-face) | ||
(" | ||
") | ||
("public" . php-keyword) | ||
(" ") | ||
("readonly" . php-class) | ||
(" ") | ||
("$" . php-variable-sigil) | ||
("e1" . php-variable-name) | ||
("; | ||
} | ||
")) |
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