Issues (2)

src/Repositories/Post.php (1 issue)

1
<?php declare(strict_types = 1);
2
3
namespace WPSteak\Repositories;
4
5
/** @codeCoverageIgnore */
6
abstract class Post {
7
8
	/** @param \WP_Post|int $post The post object or id. */
9
	protected function get_post( $post ): ?\WP_Post {
10
		if ( $post instanceof \WP_Post ) {
11
			return $post;
12
		}
13
14
		$result = get_post( $post );
15
16
		if ( ! $result instanceof \WP_Post ) {
0 ignored issues
show
$result is always a sub-type of WP_Post.
Loading history...
17
			return null;
18
		}
19
20
		return $result;
21
	}
22
23
	/**
24
	 * @param array<string> $args Args.
25
	 * @return array<\WP_Post>|array<int>
26
	 */
27
	protected function get_posts( array $args ): array {
28
		return get_posts( $args );
29
	}
30
31
}
32