diff --git a/src/PostData.php b/src/PostData.php index 0726552..0f045aa 100644 --- a/src/PostData.php +++ b/src/PostData.php @@ -53,7 +53,7 @@ public function __construct( } } - public static function fromPost(\WP_Post $post): PostData + public static function fromPost(\WP_Post $post): static { return new (self::dataClass($post->post_type))( id: $post->ID, @@ -70,7 +70,7 @@ public static function fromPost(\WP_Post $post): PostData ); } - public static function fromCorcel(Post $post): PostData + public static function fromCorcel(Post $post): static { return new (self::dataClass($post->post_type))( id: $post->ID, @@ -88,7 +88,7 @@ public static function fromCorcel(Post $post): PostData } /** - * @return class-string + * @return class-string */ private static function dataClass(string $postType): string { @@ -112,6 +112,7 @@ private static function dataClass(string $postType): string throw new RuntimeException(sprintf('The class "%s" must extend %s.', $classFQN, PostData::class)); } + /** @var class-string $classFQN */ return $classFQN; } @@ -298,7 +299,7 @@ public function isChild(): bool return null !== $this->parent(); } - public function parent(): ?PostData + public function parent(): ?static { if (! is_post_type_hierarchical($this->postType) || ! is_numeric($this->id)) { return null;