Skip to content

Commit 6cf5181

Browse files
authored
fix(term-directive): Fix warnings for @term (#55)
1 parent 1ff32b1 commit 6cf5181

File tree

1 file changed

+9
-9
lines changed

1 file changed

+9
-9
lines changed

src/Directives/WordPress.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -306,29 +306,29 @@
306306
$expression = Util::parse($expression);
307307

308308
if (! empty($expression->get(2))) {
309-
return "<?php if (collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->isNotEmpty()) : ?>" . // phpcs:ignore
310-
"<a href=\"<?= get_term_link(collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->term_ID); ?>\">" . // phpcs:ignore
311-
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name(); ?>" .
309+
return "<?php if (get_the_terms({$expression->get(1)}, {$expression->get(0)})) : ?>" . // phpcs:ignore
310+
"<a href=\"<?= get_term_link(collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->term_id); ?>\">" . // phpcs:ignore
311+
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name; ?>" .
312312
"</a>" .
313313
"<?php endif; ?>";
314314
}
315315

316316
if (! empty($expression->get(1))) {
317317
if ($expression->get(1) === 'true') {
318-
return "<?php if (collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->isNotEmpty()) : ?>" .
319-
"<a href=\"<?= get_term_link(collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->term_ID); ?>\">" . // phpcs:ignore
320-
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name(); ?>" .
318+
return "<?php if (get_the_terms(get_the_ID(), {$expression->get(0)})) : ?>" .
319+
"<a href=\"<?= get_term_link(collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->term_id); ?>\">" . // phpcs:ignore
320+
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name; ?>" .
321321
"</a>" .
322322
"<?php endif; ?>";
323323
}
324324

325-
return "<?php if (collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->isNotEmpty()) : ?>" . // phpcs:ignore
326-
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name(); ?>" .
325+
return "<?php if (get_the_terms({$expression->get(1)}, {$expression->get(0)})) : ?>" . // phpcs:ignore
326+
"<?= collect(get_the_terms({$expression->get(1)}, {$expression->get(0)}))->shift()->name; ?>" .
327327
"<?php endif; ?>";
328328
}
329329

330330
if (! empty($expression->get(0))) {
331-
return "<?php if (collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->isNotEmpty()) : ?>" .
331+
return "<?php if (get_the_terms(get_the_ID(), {$expression->get(0)})) : ?>" .
332332
"<?= collect(get_the_terms(get_the_ID(), {$expression->get(0)}))->shift()->name; ?>" .
333333
"<?php endif; ?>";
334334
}

0 commit comments

Comments
 (0)