Skip to content

Commit 08a7843

Browse files
committed
Remove unnecessary empty usages
1 parent e5e14c8 commit 08a7843

File tree

2 files changed

+5
-5
lines changed

2 files changed

+5
-5
lines changed

Dumper.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -51,10 +51,10 @@ public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags
5151
$dumpObjectAsInlineMap = true;
5252

5353
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($input instanceof \ArrayObject || $input instanceof \stdClass)) {
54-
$dumpObjectAsInlineMap = empty((array) $input);
54+
$dumpObjectAsInlineMap = !(array) $input;
5555
}
5656

57-
if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || empty($input)) {
57+
if ($inline <= 0 || (!\is_array($input) && !$input instanceof TaggedValue && $dumpObjectAsInlineMap) || !$input) {
5858
$output .= $prefix.Inline::dump($input, $flags);
5959
} elseif ($input instanceof TaggedValue) {
6060
$output .= $this->dumpTaggedValue($input, $inline, $indent, $flags, $prefix);
@@ -121,10 +121,10 @@ public function dump(mixed $input, int $inline = 0, int $indent = 0, int $flags
121121
$dumpObjectAsInlineMap = true;
122122

123123
if (Yaml::DUMP_OBJECT_AS_MAP & $flags && ($value instanceof \ArrayObject || $value instanceof \stdClass)) {
124-
$dumpObjectAsInlineMap = empty((array) $value);
124+
$dumpObjectAsInlineMap = !(array) $value;
125125
}
126126

127-
$willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || empty($value);
127+
$willBeInlined = $inline - 1 <= 0 || !\is_array($value) && $dumpObjectAsInlineMap || !$value;
128128

129129
$output .= sprintf('%s%s%s%s',
130130
$prefix,

Parser.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -494,7 +494,7 @@ private function doParse(string $value, int $flags): mixed
494494
$data = $object;
495495
}
496496

497-
return empty($data) ? null : $data;
497+
return $data ?: null;
498498
}
499499

500500
private function parseBlock(int $offset, string $yaml, int $flags): mixed

0 commit comments

Comments
 (0)