Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Fix adding classes in MenuItem #2905

Merged
merged 1 commit into from
Feb 22, 2024
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Jump to
Jump to file
Failed to load files.
Diff view
Diff view
2 changes: 1 addition & 1 deletion src/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -124,7 +124,7 @@
*/
public static function build($data, ?Menu $menu = null): self
{
return new static($data, $menu);

Check failure on line 127 in src/MenuItem.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Unsafe usage of new static().
}

/**
Expand All @@ -140,7 +140,7 @@
/**
* @property string $title The nav menu item title.
*/
$this->title = $data->title;

Check failure on line 143 in src/MenuItem.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Access to an undefined property WP_Post::$title.

$this->import($data);
$this->import_classes($data);
Expand Down Expand Up @@ -180,7 +180,7 @@
public function add_class(string $class_name)
{
// Class name is already there
if (!\in_array($class_name, $this->classes, true)) {
if (\in_array($class_name, $this->classes, true)) {
return;
}
$this->classes[] = $class_name;
Expand Down