Skip to content

Commit 8b8fa56

Browse files
committed
Remove unnecessary empty usages
1 parent e881358 commit 8b8fa56

File tree

4 files changed

+6
-6
lines changed

4 files changed

+6
-6
lines changed

Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -130,7 +130,7 @@ public function add(\DOMNodeList|\DOMNode|array|string|null $node): void
130130
*/
131131
public function addContent(string $content, ?string $type = null): void
132132
{
133-
if (empty($type)) {
133+
if (!$type) {
134134
$type = str_starts_with($content, '<?xml') ? 'application/xml' : 'text/html';
135135
}
136136

@@ -176,7 +176,7 @@ public function addHtmlContent(string $content, string $charset = 'UTF-8'): void
176176
$base = $this->filterRelativeXPath('descendant-or-self::base')->extract(['href']);
177177

178178
$baseHref = current($base);
179-
if (\count($base) && !empty($baseHref)) {
179+
if (\count($base) && $baseHref) {
180180
if ($this->baseHref) {
181181
$linkNode = $dom->createElement('a');
182182
$linkNode->setAttribute('href', $baseHref);

Field/ChoiceFormField.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -236,7 +236,7 @@ private function buildOptionValue(\DOMElement $node): array
236236
$option = [];
237237

238238
$defaultDefaultValue = 'select' === $this->node->nodeName ? '' : 'on';
239-
$defaultValue = (isset($node->nodeValue) && !empty($node->nodeValue)) ? $node->nodeValue : $defaultDefaultValue;
239+
$defaultValue = (isset($node->nodeValue) && $node->nodeValue) ? $node->nodeValue : $defaultDefaultValue;
240240
$option['value'] = $node->hasAttribute('value') ? $node->getAttribute('value') : $defaultValue;
241241
$option['disabled'] = $node->hasAttribute('disabled');
242242

Form.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -121,7 +121,7 @@ public function getPhpValues(): array
121121
$values = [];
122122
foreach ($this->getValues() as $name => $value) {
123123
$qs = http_build_query([$name => $value], '', '&');
124-
if (!empty($qs)) {
124+
if ($qs) {
125125
parse_str($qs, $expandedValue);
126126
$varName = substr($name, 0, \strlen(key($expandedValue)));
127127
$values[] = [$varName => current($expandedValue)];
@@ -146,7 +146,7 @@ public function getPhpFiles(): array
146146
$values = [];
147147
foreach ($this->getFiles() as $name => $value) {
148148
$qs = http_build_query([$name => $value], '', '&');
149-
if (!empty($qs)) {
149+
if ($qs) {
150150
parse_str($qs, $expandedValue);
151151
$varName = substr($name, 0, \strlen(key($expandedValue)));
152152

FormFieldRegistry.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -136,7 +136,7 @@ public function all(): array
136136
private function walk(array $array, ?string $base = '', array &$output = []): array
137137
{
138138
foreach ($array as $k => $v) {
139-
$path = empty($base) ? $k : sprintf('%s[%s]', $base, $k);
139+
$path = $base ? sprintf('%s[%s]', $base, $k) : $k;
140140
if (\is_array($v)) {
141141
$this->walk($v, $path, $output);
142142
} else {

0 commit comments

Comments
 (0)