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

chore: set proper return types #2976

Merged
Show file tree
Hide file tree
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/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,9 +132,9 @@
* @internal
* @param WP_Comment $wp_comment a native WP_Comment instance
*/
public static function build(WP_Comment $wp_comment): self
public static function build(WP_Comment $wp_comment): static
{
$comment = new static();

Check failure on line 137 in src/Comment.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Unsafe usage of new static().
$comment->import($wp_comment);
$comment->ID = $wp_comment->comment_ID;
$comment->id = $wp_comment->comment_ID;
Expand Down
2 changes: 1 addition & 1 deletion src/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,9 +122,9 @@
* @param Menu $menu The `Menu` object the menu item is associated with.
* @return MenuItem a new MenuItem instance
*/
public static function build($data, ?Menu $menu = null): self
public static function build($data, ?Menu $menu = null): static

Check failure on line 125 in src/MenuItem.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

PHPDoc tag @return with type Timber\MenuItem is not subtype of native type static(Timber\MenuItem).
{
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
2 changes: 1 addition & 1 deletion src/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,9 +175,9 @@
* @internal
* @return Post
*/
public static function build(WP_Post $wp_post): self
public static function build(WP_Post $wp_post): static

Check failure on line 178 in src/Post.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

PHPDoc tag @return with type Timber\Post is not subtype of native type static(Timber\Post).
{
$post = new static();

Check failure on line 180 in src/Post.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Unsafe usage of new static().

$post->id = $wp_post->ID;
$post->ID = $wp_post->ID;
Expand Down
2 changes: 1 addition & 1 deletion src/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,9 +83,9 @@
* @param WP_Term $wp_term The vanilla WordPress term object to build from.
* @return Term
*/
public static function build(WP_Term $wp_term): self
public static function build(WP_Term $wp_term): static

Check failure on line 86 in src/Term.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

PHPDoc tag @return with type Timber\Term is not subtype of native type static(Timber\Term).
{
$term = new static();

Check failure on line 88 in src/Term.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Unsafe usage of new static().
$term->init($wp_term);
return $term;
}
Expand Down
2 changes: 1 addition & 1 deletion src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,9 @@
/**
* Build a new User object.
*/
public static function build(WP_User $wp_user): self
public static function build(WP_User $wp_user): static
{
$user = new static();

Check failure on line 111 in src/User.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Unsafe usage of new static().
$user->init($wp_user);

return $user;
Expand Down Expand Up @@ -228,7 +228,7 @@
* @param string $name The name of the user. Default `display_name`.
* @param User $user The user object.
*/
return \apply_filters('timber/user/name', $this->display_name, $this);

Check failure on line 231 in src/User.php

View workflow job for this annotation

GitHub Actions / PHP static analysis

Access to an undefined property Timber\User::$display_name.
}

/**
Expand Down