Use PHP 8 property promotion for Syntax class
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
Some checks failed
timw4mail/php-kilo/pipeline/head There was a failure building this commit
This commit is contained in:
parent
113cc1a0a1
commit
a952226b92
@ -6,39 +6,39 @@ class Syntax {
|
||||
public const HIGHLIGHT_NUMBERS = (1 << 0);
|
||||
public const HIGHLIGHT_STRINGS = (1 << 1);
|
||||
|
||||
public string $filetype = '';
|
||||
public array $filematch = [];
|
||||
|
||||
public string $singleLineCommentStart = '//';
|
||||
public string $multiLineCommentStart = '/*';
|
||||
public string $multiLineCommentEnd = '*/';
|
||||
|
||||
public array $keywords1 = [];
|
||||
public array $keywords2 = [];
|
||||
|
||||
// Tokens for PHP files
|
||||
public array $tokens = [];
|
||||
|
||||
public int $flags = 0;
|
||||
|
||||
public static function new(string $name, array $extList, array $keywords1, array $keywords2, string $slcs, string $mcs, string $mce, int $flags): self
|
||||
public static function new(
|
||||
string $name,
|
||||
array $extList = [],
|
||||
array $keywords1 = [],
|
||||
array $keywords2 = [],
|
||||
string $slcs = '//',
|
||||
string $mcs = '/*',
|
||||
string $mce = '*/',
|
||||
int $flags = 0,
|
||||
): self
|
||||
{
|
||||
$self = new self();
|
||||
|
||||
$self->filetype = $name;
|
||||
$self->filematch = $extList;
|
||||
|
||||
$self->keywords1 = $keywords1;
|
||||
$self->keywords2 = $keywords2;
|
||||
|
||||
$self->singleLineCommentStart = $slcs;
|
||||
$self->multiLineCommentStart = $mcs;
|
||||
$self->multiLineCommentEnd = $mce;
|
||||
|
||||
$self->flags = $flags;
|
||||
|
||||
return $self;
|
||||
return new self($name, $extList, $keywords1, $keywords2, $slcs, $mcs, $mce, $flags);
|
||||
}
|
||||
|
||||
private function __construct() {}
|
||||
private function __construct(
|
||||
/** The name of the programming language */
|
||||
public string $filetype,
|
||||
/** Relevant file extensions for the specified language */
|
||||
public array $filematch,
|
||||
/** Primary set of language keywords */
|
||||
public array $keywords1,
|
||||
/** Secondary set of language keywords */
|
||||
public array $keywords2,
|
||||
/** Syntax to start a single line comment */
|
||||
public string $singleLineCommentStart,
|
||||
/** Syntax to start a multi-line comment */
|
||||
public string $multiLineCommentStart,
|
||||
/** Syntax to end a multi-line commment */
|
||||
public string $multiLineCommentStart,
|
||||
/** Bitflags configuring the specified language syntax */
|
||||
public int $flags,
|
||||
) {}
|
||||
}
|
Loading…
Reference in New Issue
Block a user