Skip to content

Commit

Permalink
Remove redundant code and import qualifiers (#142)
Browse files Browse the repository at this point in the history
* Type cast is redundant

* Qualifier can be replaced with an import
  • Loading branch information
thefrosty authored Dec 2, 2024
1 parent 1c42baa commit 2eac70a
Showing 1 changed file with 6 additions and 5 deletions.
11 changes: 6 additions & 5 deletions src/functions.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,8 +4,9 @@

namespace TheFrosty\WpUtilities;

use function boolval;
use function get_bloginfo;
use function is_array;
use function version_compare;

/**
* 6.3.0 Stub fpr PHP 8.0+.
Expand Down Expand Up @@ -41,11 +42,11 @@ function wp_register_script(
): bool {
if (!is_array($args)) {
$args = [
'in_footer' => boolval($args),
'in_footer' => $args,
];
}

if (\version_compare(\get_bloginfo('version'), '6.3') >= 0) {
if (version_compare(get_bloginfo('version'), '6.3') >= 0) {
return \wp_register_script($handle, $src, $deps, $ver, $args);
}

Expand Down Expand Up @@ -82,11 +83,11 @@ function wp_enqueue_script(
): void {
if (!is_array($args)) {
$args = [
'in_footer' => boolval($args),
'in_footer' => $args,
];
}

if (\version_compare(\get_bloginfo('version'), '6.3') >= 0) {
if (version_compare(get_bloginfo('version'), '6.3') >= 0) {
\wp_enqueue_script($handle, $src, $deps, $ver, $args);

return;
Expand Down

0 comments on commit 2eac70a

Please sign in to comment.