1
0
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:
Gabriel Caruso 2017-12-12 08:55:58 -02:00 committed by Nikita Popov
parent 4fcdac40d1
commit 4dbb02c57b
2 changed files with 2 additions and 2 deletions

View File

@ -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 {

View File

@ -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];
}