Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
3 changes: 3 additions & 0 deletions lib/rouge/lexers/php.rb
Original file line number Diff line number Diff line change
Expand Up @@ -280,6 +280,9 @@ def builtins
end

state :in_const do
rule %r/(\??#{id})(\s+)(#{id})/i do
groups Keyword::Type, Text, Name::Constant
end
rule id, Name::Constant
rule %r/=/, Operator, :in_assign
mixin :escape
Expand Down
6 changes: 6 additions & 0 deletions spec/visual/samples/php
Original file line number Diff line number Diff line change
Expand Up @@ -190,6 +190,12 @@ class C {
public static ?string $a = "";
public static int $b = 0;

const bool CONST_1 = true;
public const int CONST_2 = 1;
protected const float CONST_3 = 1.0;
private const string CONST_4 = "foo";
const ?array CONST_5 = [];

public function __construct(
public $foo,
protected readonly $bar,
Expand Down