Skip to content

Commit

Permalink
chore: set proper return types on build methods (#2976)
Browse files Browse the repository at this point in the history
  • Loading branch information
Levdbas committed Apr 26, 2024
1 parent 66eabe2 commit 6b72908
Show file tree
Hide file tree
Showing 5 changed files with 5 additions and 5 deletions.
2 changes: 1 addition & 1 deletion src/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -132,7 +132,7 @@ protected function __construct()
* @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);
Expand Down
2 changes: 1 addition & 1 deletion src/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -122,7 +122,7 @@ class MenuItem extends CoreEntity
* @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 Down
2 changes: 1 addition & 1 deletion src/Post.php
Original file line number Diff line number Diff line change
Expand Up @@ -175,7 +175,7 @@ class Post extends CoreEntity implements DatedInterface, Setupable
* @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().

Expand Down
2 changes: 1 addition & 1 deletion src/Term.php
Original file line number Diff line number Diff line change
Expand Up @@ -83,7 +83,7 @@ protected function __construct()
* @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);
Expand Down
2 changes: 1 addition & 1 deletion src/User.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,7 +106,7 @@ protected function __construct()
/**
* 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);
Expand Down

0 comments on commit 6b72908

Please sign in to comment.