Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Commit 0418f90

Browse files
committed
use constructor property promotion
1 parent 25d716e commit 0418f90

File tree

2 files changed

+9
-13
lines changed

2 files changed

+9
-13
lines changed

Node/ConstantNode.php

Lines changed: 5 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -20,13 +20,11 @@
2020
*/
2121
class ConstantNode extends Node
2222
{
23-
public readonly bool $isNullSafe;
24-
private bool $isIdentifier;
25-
26-
public function __construct(mixed $value, bool $isIdentifier = false, bool $isNullSafe = false)
27-
{
28-
$this->isIdentifier = $isIdentifier;
29-
$this->isNullSafe = $isNullSafe;
23+
public function __construct(
24+
mixed $value,
25+
private bool $isIdentifier = false,
26+
public readonly bool $isNullSafe = false,
27+
) {
3028
parent::__construct(
3129
[],
3230
['value' => $value]

TokenStream.php

Lines changed: 4 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -20,15 +20,13 @@ class TokenStream
2020
{
2121
public Token $current;
2222

23-
private array $tokens;
2423
private int $position = 0;
25-
private string $expression;
2624

27-
public function __construct(array $tokens, string $expression = '')
28-
{
29-
$this->tokens = $tokens;
25+
public function __construct(
26+
private array $tokens,
27+
private string $expression = '',
28+
) {
3029
$this->current = $tokens[0];
31-
$this->expression = $expression;
3230
}
3331

3432
/**

0 commit comments

Comments
 (0)