Skip to content

Commit

Permalink
used promoted property
Browse files Browse the repository at this point in the history
  • Loading branch information
dg committed Jan 13, 2023
1 parent 3914f3d commit ad41785
Show file tree
Hide file tree
Showing 8 changed files with 30 additions and 55 deletions.
14 changes: 5 additions & 9 deletions src/Neon/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,15 +15,11 @@
*/
final class Entity extends \stdClass
{
public mixed $value;
/** @var mixed[] */
public array $attributes;


public function __construct($value, array $attrs = [])
{
$this->value = $value;
$this->attributes = $attrs;
public function __construct(
public mixed $value,
/** @var mixed[] */
public array $attributes = [],
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Neon/Node/BlockArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
/** @internal */
final class BlockArrayNode extends ArrayNode
{
public string $indentation;


public function __construct(string $indentation = '')
{
$this->indentation = $indentation;
public function __construct(
public string $indentation = '',
) {
}


Expand Down
11 changes: 4 additions & 7 deletions src/Neon/Node/EntityChainNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,10 @@
/** @internal */
final class EntityChainNode extends Node
{
/** @var EntityNode[] */
public array $chain = [];


public function __construct(array $chain = [])
{
$this->chain = $chain;
public function __construct(
/** @var EntityNode[] */
public array $chain = [],
) {
}


Expand Down
15 changes: 5 additions & 10 deletions src/Neon/Node/EntityNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,16 +16,11 @@
/** @internal */
final class EntityNode extends Node
{
public Node $value;

/** @var ArrayItemNode[] */
public array $attributes;


public function __construct(Node $value, array $attributes = [])
{
$this->value = $value;
$this->attributes = $attributes;
public function __construct(
public Node $value,
/** @var ArrayItemNode[] */
public array $attributes = [],
) {
}


Expand Down
9 changes: 3 additions & 6 deletions src/Neon/Node/InlineArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,12 +13,9 @@
/** @internal */
final class InlineArrayNode extends ArrayNode
{
public string $bracket;


public function __construct(string $bracket)
{
$this->bracket = $bracket;
public function __construct(
public string $bracket,
) {
}


Expand Down
8 changes: 3 additions & 5 deletions src/Neon/Node/LiteralNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,12 +28,10 @@ final class LiteralNode extends Node
private const PatternOctal = '#0o[0-7]++$#DA';
private const PatternBinary = '#0b[0-1]++$#DA';

public mixed $value;


public function __construct($value)
{
$this->value = $value;
public function __construct(
public mixed $value,
) {
}


Expand Down
8 changes: 3 additions & 5 deletions src/Neon/Node/StringNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,12 +20,10 @@ final class StringNode extends Node
't' => "\t", 'n' => "\n", 'r' => "\r", 'f' => "\x0C", 'b' => "\x08", '"' => '"', '\\' => '\\', '/' => '/', '_' => "\u{A0}",
];

public string $value;


public function __construct(string $value)
{
$this->value = $value;
public function __construct(
public string $value,
) {
}


Expand Down
11 changes: 4 additions & 7 deletions src/Neon/Token.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,13 +20,10 @@ final class Token
public const Newline = 4;
public const Whitespace = 5;

public string $value;
public int|string $type;


public function __construct(string $value, $type)
{
$this->value = $value;
$this->type = $type;
public function __construct(
public string $value,
public int|string $type,
) {
}
}

0 comments on commit ad41785

Please sign in to comment.