mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-11-30 04:19:30 +01:00
Use Null Coalesce Operator
This commit is contained in:
parent
4fcdac40d1
commit
4dbb02c57b
@ -17,7 +17,7 @@ class Trait_ extends ClassLike
|
||||
public function __construct($name, array $subNodes = [], array $attributes = []) {
|
||||
parent::__construct($attributes);
|
||||
$this->name = \is_string($name) ? new Node\Identifier($name) : $name;
|
||||
$this->stmts = isset($subNodes['stmts']) ? $subNodes['stmts'] : [];
|
||||
$this->stmts = $subNodes['stmts'] ?? [];
|
||||
}
|
||||
|
||||
public function getSubNodeNames() : array {
|
||||
|
@ -102,7 +102,7 @@ class PrettyPrinterTest extends CodeTestAbstract
|
||||
|
||||
private function parseModeLine($modeLine) {
|
||||
$parts = explode(' ', (string) $modeLine, 2);
|
||||
$version = isset($parts[0]) ? $parts[0] : 'both';
|
||||
$version = $parts[0] ?? 'both';
|
||||
$options = isset($parts[1]) ? json_decode($parts[1], true) : [];
|
||||
return [$version, $options];
|
||||
}
|
||||
|
Loading…
Reference in New Issue
Block a user