From 5487acecf6ff30b0ec5e7cfaf1ec3d6e5f0b176e Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Wed, 2 Dec 2026 16:42:52 +0100 Subject: [PATCH 1/2] docs(types): add the array value types and missing PHPDoc tags PHPStan level 6 asks for --- CHANGELOG.md | 4 ++++ src/Concerns/Aliases.php | 3 ++- src/Concerns/MetaFields.php | 6 +++--- src/Concerns/Shortcodes.php | 10 +++++++++- src/Database.php | 5 ++++- src/Laravel/Auth/AuthUserProvider.php | 11 ++++++++++- src/Model.php | 7 +++++++ src/Model/Attachment.php | 4 ++-- src/Model/Builder/PostBuilder.php | 4 +++- src/Model/Builder/TaxonomyBuilder.php | 1 + src/Model/Comment.php | 2 +- src/Model/Menu.php | 2 +- src/Model/MenuItem.php | 2 +- src/Model/Meta/Meta.php | 2 +- src/Model/Meta/ThumbnailMeta.php | 2 +- src/Model/Option.php | 10 +++++----- src/Model/Post.php | 20 ++++++++++++-------- src/Model/Taxonomy.php | 2 +- src/Model/User.php | 9 +++++---- 19 files changed, 73 insertions(+), 33 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index cf408e83..71975684 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -6,6 +6,10 @@ Earlier releases are listed on the [releases page](https://github.com/Pollora/co ## [Unreleased] +### Changed + +- PHPDoc only, no change of signature or behaviour: array value types and the missing `@return` / `@param` tags that PHPStan level 6 asks for. Array types are written `array`, so a subclass that redeclares one of these properties or methods is not held to a narrower type. The analysed level stays at 5. + ## [11.1.0] - 2026-11-19 ### Changed diff --git a/src/Concerns/Aliases.php b/src/Concerns/Aliases.php index e00f5e0e..b38c4c6a 100644 --- a/src/Concerns/Aliases.php +++ b/src/Concerns/Aliases.php @@ -14,7 +14,7 @@ trait Aliases { /** - * @return array + * @return array */ public static function getAliases() { @@ -28,6 +28,7 @@ public static function getAliases() /** * @param string $new * @param string $old + * @return void */ public static function addAlias($new, $old) { diff --git a/src/Concerns/MetaFields.php b/src/Concerns/MetaFields.php index ca3b6835..6766ecd0 100644 --- a/src/Concerns/MetaFields.php +++ b/src/Concerns/MetaFields.php @@ -52,7 +52,7 @@ public function meta() } /** - * @param string|array $meta + * @param string|array $meta * @param mixed $value */ public function scopeHasMeta(Builder $query, $meta, $value = null, string $operator = '='): Builder @@ -98,7 +98,7 @@ public function saveField($key, $value) } /** - * @param string|array $key + * @param string|array $key * @param mixed $value * @return bool */ @@ -128,7 +128,7 @@ public function createField($key, $value) } /** - * @param string|array $key + * @param string|array $key * @param mixed $value * @return Model|Collection */ diff --git a/src/Concerns/Shortcodes.php b/src/Concerns/Shortcodes.php index a875bc37..d20fb716 100644 --- a/src/Concerns/Shortcodes.php +++ b/src/Concerns/Shortcodes.php @@ -18,7 +18,7 @@ trait Shortcodes { /** - * @var array + * @var array */ protected static $shortcodes = []; @@ -28,6 +28,7 @@ trait Shortcodes /** * @param string $tag the shortcode tag * @param \Closure $function the shortcode handling function + * @return void */ public static function addShortcode($tag, $function) { @@ -38,6 +39,7 @@ public static function addShortcode($tag, $function) * Removes a shortcode handler. * * @param string $tag the shortcode tag + * @return void */ public static function removeShortcode($tag) { @@ -84,6 +86,9 @@ private function getShortcodeHandlerInstance(): ShortcodeFacade }); } + /** + * @return void + */ private function parseClassShortcodes(ShortcodeFacade $facade) { foreach (self::$shortcodes as $tag => $func) { @@ -91,6 +96,9 @@ private function parseClassShortcodes(ShortcodeFacade $facade) } } + /** + * @return void + */ private function parseConfigShortcodes(ShortcodeFacade $facade) { if (Colt::isLaravel()) { diff --git a/src/Database.php b/src/Database.php index 72d925b6..1fff1bb5 100644 --- a/src/Database.php +++ b/src/Database.php @@ -15,7 +15,7 @@ class Database { /** - * @var array + * @var array */ protected static $baseParams = [ 'driver' => 'mysql', @@ -25,6 +25,9 @@ class Database 'prefix' => 'wp_', ]; + /** + * @param array $params connection settings, merged over the defaults + */ public static function connect(array $params): Manager { $capsule = new Capsule; diff --git a/src/Laravel/Auth/AuthUserProvider.php b/src/Laravel/Auth/AuthUserProvider.php index 64bec0cc..93d54c01 100644 --- a/src/Laravel/Auth/AuthUserProvider.php +++ b/src/Laravel/Auth/AuthUserProvider.php @@ -20,10 +20,13 @@ class AuthUserProvider implements UserProvider { /** - * @var array + * @var array */ protected $config = []; + /** + * @param array $config + */ public function __construct(array $config = []) { $this->config = $config; @@ -74,6 +77,7 @@ public function updateRememberToken(Authenticatable $user, $token) /** * Retrieve a user by the given credentials. * + * @param array $credentials * @return Authenticatable|null */ public function retrieveByCredentials(array $credentials) @@ -95,6 +99,8 @@ public function retrieveByCredentials(array $credentials) /** * Validate a user against the given credentials. + * + * @param array $credentials */ public function validateCredentials(Authenticatable $user, array $credentials): bool { @@ -106,6 +112,9 @@ public function validateCredentials(Authenticatable $user, array $credentials): ->check($credentials['password'], $user->user_pass); } + /** + * @param array $credentials + */ public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false) { // diff --git a/src/Model.php b/src/Model.php index 5c131993..8f8ed6b5 100644 --- a/src/Model.php +++ b/src/Model.php @@ -222,6 +222,9 @@ public function getConnectionName() /** * Set the connection name to model. + * + * @param mixed $model anything; only Eloquent models are touched + * @return void */ protected function setRelationConnection($model) { @@ -230,6 +233,10 @@ protected function setRelationConnection($model) } } + /** + * @param mixed $instance the related model + * @return mixed + */ protected function setInstanceConnection($instance) { return $instance->setConnection( diff --git a/src/Model/Attachment.php b/src/Model/Attachment.php index bc9dfdd1..188ee712 100644 --- a/src/Model/Attachment.php +++ b/src/Model/Attachment.php @@ -25,7 +25,7 @@ class Attachment extends Post protected $postType = 'attachment'; /** - * @var array + * @var array */ protected $appends = [ 'title', @@ -37,7 +37,7 @@ class Attachment extends Post ]; /** - * @var array + * @var array */ protected static $aliases = [ 'title' => 'post_title', diff --git a/src/Model/Builder/PostBuilder.php b/src/Model/Builder/PostBuilder.php index bfd6ccfb..8b8a7514 100644 --- a/src/Model/Builder/PostBuilder.php +++ b/src/Model/Builder/PostBuilder.php @@ -5,6 +5,7 @@ namespace Pollora\Colt\Model\Builder; use Carbon\Carbon; +use Illuminate\Contracts\Support\Arrayable; use Illuminate\Database\Eloquent\Builder; /** @@ -47,6 +48,7 @@ public function type($type) } /** + * @param array $types * @return PostBuilder */ public function typeIn(array $types) @@ -88,7 +90,7 @@ public function taxonomy($taxonomy, $terms) } /** - * @param mixed $term + * @param string|Arrayable|iterable|false|null $term words, or a list of them * @return PostBuilder */ public function search($term = false) diff --git a/src/Model/Builder/TaxonomyBuilder.php b/src/Model/Builder/TaxonomyBuilder.php index aa50e6fa..512cfb52 100644 --- a/src/Model/Builder/TaxonomyBuilder.php +++ b/src/Model/Builder/TaxonomyBuilder.php @@ -55,6 +55,7 @@ public function slug($slug = null) } /** + * @param string|null $slug * @return TaxonomyBuilder */ public function term($slug = null) diff --git a/src/Model/Comment.php b/src/Model/Comment.php index e0385b32..2d691e18 100644 --- a/src/Model/Comment.php +++ b/src/Model/Comment.php @@ -43,7 +43,7 @@ class Comment extends Model protected $primaryKey = 'comment_ID'; /** - * @var array + * @var array */ protected $dates = ['comment_date']; diff --git a/src/Model/Menu.php b/src/Model/Menu.php index fb625919..8e132c62 100644 --- a/src/Model/Menu.php +++ b/src/Model/Menu.php @@ -20,7 +20,7 @@ class Menu extends Taxonomy protected $taxonomy = 'nav_menu'; /** - * @var array + * @var array */ protected $with = ['term', 'items']; diff --git a/src/Model/MenuItem.php b/src/Model/MenuItem.php index 48850d7c..33235227 100644 --- a/src/Model/MenuItem.php +++ b/src/Model/MenuItem.php @@ -20,7 +20,7 @@ class MenuItem extends Post protected $postType = 'nav_menu_item'; /** - * @var array + * @var array */ protected $instanceRelations = [ 'post' => Post::class, diff --git a/src/Model/Meta/Meta.php b/src/Model/Meta/Meta.php index 57287add..7667a7a7 100644 --- a/src/Model/Meta/Meta.php +++ b/src/Model/Meta/Meta.php @@ -31,7 +31,7 @@ abstract class Meta extends Model protected $primaryKey = 'meta_id'; /** - * @var array + * @var array */ protected $appends = ['value']; diff --git a/src/Model/Meta/ThumbnailMeta.php b/src/Model/Meta/ThumbnailMeta.php index f5048ec6..df34e2d9 100644 --- a/src/Model/Meta/ThumbnailMeta.php +++ b/src/Model/Meta/ThumbnailMeta.php @@ -26,7 +26,7 @@ class ThumbnailMeta extends PostMeta const SIZE_FULL = 'full'; /** - * @var array + * @var array */ protected $with = ['attachment']; diff --git a/src/Model/Option.php b/src/Model/Option.php index 17937fb1..c8403c3e 100644 --- a/src/Model/Option.php +++ b/src/Model/Option.php @@ -46,7 +46,7 @@ class Option extends Model ]; /** - * @var array + * @var array */ protected $appends = ['value']; @@ -85,7 +85,7 @@ public static function get($name) } /** - * @return array + * @return array * * @deprecated */ @@ -95,8 +95,8 @@ public static function getAll() } /** - * @param array $keys - * @return array + * @param array $keys + * @return array */ public static function asArray($keys = []) { @@ -112,7 +112,7 @@ public static function asArray($keys = []) } /** - * @return array + * @return array */ public function toArray() { diff --git a/src/Model/Post.php b/src/Model/Post.php index 3a7b22be..5691ad3a 100644 --- a/src/Model/Post.php +++ b/src/Model/Post.php @@ -60,17 +60,17 @@ class Post extends Model protected $primaryKey = 'ID'; /** - * @var array + * @var array */ protected $dates = ['post_date', 'post_date_gmt', 'post_modified', 'post_modified_gmt']; /** - * @var array + * @var array */ protected $with = ['meta']; /** - * @var array + * @var array */ protected static $postTypes = []; @@ -88,7 +88,7 @@ class Post extends Model ]; /** - * @var array + * @var array */ protected $appends = [ 'title', @@ -111,7 +111,7 @@ class Post extends Model ]; /** - * @var array + * @var array */ protected static $aliases = [ 'title' => 'post_title', @@ -136,7 +136,7 @@ class Post extends Model protected ?PostCollection $siblings = null; /** - * @param array $attributes + * @param array $attributes * @return static */ public function newFromBuilder($attributes = [], $connection = null) @@ -324,7 +324,7 @@ public function getImageAttribute() /** * Gets all the terms arranged taxonomy => terms[]. * - * @return array + * @return array */ public function getTermsAttribute() { @@ -358,7 +358,7 @@ public function getMainCategoryAttribute() /** * Gets the keywords as array. * - * @return array + * @return array */ public function getKeywordsAttribute() { @@ -376,6 +376,7 @@ public function getKeywordsStrAttribute(): string /** * @param string $name The post type slug * @param string $class The class to be instantiated + * @return void */ public static function registerPostType($name, $class) { @@ -384,6 +385,8 @@ public static function registerPostType($name, $class) /** * Clears any registered post types. + * + * @return void */ public static function clearRegisteredPostTypes() { @@ -428,6 +431,7 @@ public function __get($key) } /** + * @param array $attributes * @return static */ protected function getPostInstance(array $attributes) diff --git a/src/Model/Taxonomy.php b/src/Model/Taxonomy.php index 714aab9e..4e1b5d1a 100644 --- a/src/Model/Taxonomy.php +++ b/src/Model/Taxonomy.php @@ -38,7 +38,7 @@ class Taxonomy extends Model protected $primaryKey = 'term_taxonomy_id'; /** - * @var array + * @var array */ protected $with = ['term']; diff --git a/src/Model/User.php b/src/Model/User.php index 910f902e..1ec9a7e5 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -50,17 +50,17 @@ class User extends Model implements Authenticatable, CanResetPassword protected $hidden = ['user_pass']; /** - * @var array + * @var array */ protected $dates = ['user_registered']; /** - * @var array + * @var array */ protected $with = ['meta']; /** - * @var array + * @var array */ protected static $aliases = [ 'login' => 'user_login', @@ -77,7 +77,7 @@ class User extends Model implements Authenticatable, CanResetPassword /** * The accessors to append to the model's array form. * - * @var array + * @var array */ protected $appends = [ 'login', @@ -93,6 +93,7 @@ class User extends Model implements Authenticatable, CanResetPassword /** * @param mixed $value + * @return void */ public function setUpdatedAtAttribute($value) {} From 6abb14845537b8597b8c43e3d20b44ca6ad096bd Mon Sep 17 00:00:00 2001 From: Pollora maintainer Date: Wed, 2 Dec 2026 16:46:30 +0100 Subject: [PATCH 2/2] docs(types): type relations, relation factories, scopes, collections and builders in PHPDoc --- CHANGELOG.md | 1 + src/Concerns/MetaFields.php | 16 ++++++++------ src/Concerns/OrderScopes.php | 2 ++ src/Model.php | 30 ++++++++++++++++++++------- src/Model/Builder/CommentBuilder.php | 4 ++++ src/Model/Builder/PostBuilder.php | 4 ++++ src/Model/Builder/TaxonomyBuilder.php | 4 ++++ src/Model/Comment.php | 8 +++---- src/Model/MenuItem.php | 1 + src/Model/Meta/CommentMeta.php | 2 +- src/Model/Meta/PostMeta.php | 2 +- src/Model/Meta/TermMeta.php | 3 +++ src/Model/Meta/ThumbnailMeta.php | 2 +- src/Model/Meta/UserMeta.php | 2 +- src/Model/Page.php | 1 + src/Model/Post.php | 10 ++++++--- src/Model/Taxonomy.php | 8 +++---- src/Model/Term.php | 2 +- src/Model/TermRelationship.php | 4 ++-- src/Model/User.php | 4 ++-- 20 files changed, 76 insertions(+), 34 deletions(-) diff --git a/CHANGELOG.md b/CHANGELOG.md index 71975684..33a6f7d9 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -9,6 +9,7 @@ Earlier releases are listed on the [releases page](https://github.com/Pollora/co ### Changed - PHPDoc only, no change of signature or behaviour: array value types and the missing `@return` / `@param` tags that PHPStan level 6 asks for. Array types are written `array`, so a subclass that redeclares one of these properties or methods is not held to a narrower type. The analysed level stays at 5. +- PHPDoc only: generic types on most relations, on the relation factories of `Model`, on query scope parameters, collections and builders (the three builders now declare a `TModel` template with a default). Static analysis of a project that overrides one of these relations with another related model class can now report the mismatch. ## [11.1.0] - 2026-11-19 diff --git a/src/Concerns/MetaFields.php b/src/Concerns/MetaFields.php index 6766ecd0..c2e39151 100644 --- a/src/Concerns/MetaFields.php +++ b/src/Concerns/MetaFields.php @@ -10,6 +10,7 @@ use Illuminate\Support\Collection; use Pollora\Colt\Model\Comment; use Pollora\Colt\Model\Meta\CommentMeta; +use Pollora\Colt\Model\Meta\Meta; use Pollora\Colt\Model\Meta\PostMeta; use Pollora\Colt\Model\Meta\TermMeta; use Pollora\Colt\Model\Meta\UserMeta; @@ -26,7 +27,7 @@ trait MetaFields { /** - * @var array + * @var array> */ protected $builtInClasses = [ Comment::class => CommentMeta::class, @@ -36,7 +37,7 @@ trait MetaFields ]; /** - * @return HasMany + * @return HasMany */ public function fields() { @@ -44,7 +45,7 @@ public function fields() } /** - * @return HasMany + * @return HasMany */ public function meta() { @@ -52,8 +53,10 @@ public function meta() } /** + * @param Builder $query * @param string|array $meta * @param mixed $value + * @return Builder */ public function scopeHasMeta(Builder $query, $meta, $value = null, string $operator = '='): Builder { @@ -78,9 +81,10 @@ public function scopeHasMeta(Builder $query, $meta, $value = null, string $opera } /** + * @param Builder $query * @param string $meta * @param mixed $value - * @return Builder + * @return Builder */ public function scopeHasMetaLike(Builder $query, $meta, $value = null) { @@ -130,7 +134,7 @@ public function createField($key, $value) /** * @param string|array $key * @param mixed $value - * @return Model|Collection + * @return Model|Collection */ public function createMeta($key, $value = null) { @@ -155,7 +159,7 @@ public function getMeta($attribute) } /** - * @return string + * @return class-string * * @throws UnexpectedValueException */ diff --git a/src/Concerns/OrderScopes.php b/src/Concerns/OrderScopes.php index b596dfb6..19206e1a 100644 --- a/src/Concerns/OrderScopes.php +++ b/src/Concerns/OrderScopes.php @@ -14,6 +14,7 @@ trait OrderScopes { /** + * @param Builder $query * @return Builder */ public function scopeNewest(Builder $query) @@ -22,6 +23,7 @@ public function scopeNewest(Builder $query) } /** + * @param Builder $query * @return Builder */ public function scopeOldest(Builder $query) diff --git a/src/Model.php b/src/Model.php index 8f8ed6b5..ee189f6d 100644 --- a/src/Model.php +++ b/src/Model.php @@ -32,13 +32,17 @@ class Model extends Eloquent * do not load it with their query (terms, comments): reading `meta` then * loads it for the whole collection at once. First collection wins, so a * filtered copy does not narrow the batch. + * + * @var MetaSiblingsCollection|null */ protected ?MetaSiblingsCollection $metaSiblings = null; /** * Replace the original hasMany function to forward the connection name. * - * @param string $related + * @template TRelatedModel of Eloquent + * + * @param class-string $related * @param string $foreignKey * @param string $localKey * @return HasMany @@ -59,7 +63,9 @@ public function hasMany($related, $foreignKey = null, $localKey = null) /** * Replace the original hasOne function to forward the connection name. * - * @param string $related + * @template TRelatedModel of Eloquent + * + * @param class-string $related * @param string $foreignKey * @param string $localKey * @return HasOne @@ -80,11 +86,13 @@ public function hasOne($related, $foreignKey = null, $localKey = null) /** * Replace the original belongsTo function to forward the connection name. * - * @param string $related + * @template TRelatedModel of Eloquent + * + * @param class-string $related * @param string $foreignKey * @param string $otherKey * @param string $relation - * @return BelongsTo + * @return BelongsTo */ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relation = null) { @@ -109,14 +117,16 @@ public function belongsTo($related, $foreignKey = null, $otherKey = null, $relat /** * Replace the original belongsToMany function to forward the connection name. * - * @param string $related + * @template TRelatedModel of Eloquent + * + * @param class-string $related * @param string $table * @param string $foreignPivotKey * @param string $relatedPivotKey * @param string $parentKey * @param string $relatedKey * @param string $relation - * @return BelongsToMany + * @return BelongsToMany */ public function belongsToMany( $related, @@ -196,6 +206,8 @@ public function newCollection(array $models = []) /** * Remembers the collection that holds this model. * + * @param MetaSiblingsCollection $siblings + * * @internal called by MetaSiblingsCollection */ public function joinMetaSiblings(MetaSiblingsCollection $siblings): void @@ -234,8 +246,10 @@ protected function setRelationConnection($model) } /** - * @param mixed $instance the related model - * @return mixed + * @template TInstance of Eloquent + * + * @param TInstance $instance the related model + * @return TInstance */ protected function setInstanceConnection($instance) { diff --git a/src/Model/Builder/CommentBuilder.php b/src/Model/Builder/CommentBuilder.php index a24cf9cb..1b4e2aa8 100644 --- a/src/Model/Builder/CommentBuilder.php +++ b/src/Model/Builder/CommentBuilder.php @@ -10,6 +10,10 @@ * Class CommentBuilder * * @author Junior Grossi + * + * @template TModel of \Pollora\Colt\Model\Comment = \Pollora\Colt\Model\Comment + * + * @extends Builder */ class CommentBuilder extends Builder { diff --git a/src/Model/Builder/PostBuilder.php b/src/Model/Builder/PostBuilder.php index 8b8a7514..adc0ab8d 100644 --- a/src/Model/Builder/PostBuilder.php +++ b/src/Model/Builder/PostBuilder.php @@ -12,6 +12,10 @@ * Class PostBuilder * * @author Junior Grossi + * + * @template TModel of \Pollora\Colt\Model\Post = \Pollora\Colt\Model\Post + * + * @extends Builder */ class PostBuilder extends Builder { diff --git a/src/Model/Builder/TaxonomyBuilder.php b/src/Model/Builder/TaxonomyBuilder.php index 512cfb52..010a11de 100644 --- a/src/Model/Builder/TaxonomyBuilder.php +++ b/src/Model/Builder/TaxonomyBuilder.php @@ -11,6 +11,10 @@ * * @author Junior Grossi * @author Yoram de Langen + * + * @template TModel of \Pollora\Colt\Model\Taxonomy = \Pollora\Colt\Model\Taxonomy + * + * @extends Builder */ class TaxonomyBuilder extends Builder { diff --git a/src/Model/Comment.php b/src/Model/Comment.php index 2d691e18..7d7c2f57 100644 --- a/src/Model/Comment.php +++ b/src/Model/Comment.php @@ -61,7 +61,7 @@ public static function findByPostId($postId) } /** - * @return BelongsTo + * @return BelongsTo */ public function post() { @@ -69,7 +69,7 @@ public function post() } /** - * @return BelongsTo + * @return BelongsTo */ public function parent() { @@ -77,7 +77,7 @@ public function parent() } /** - * @return BelongsTo + * @return BelongsTo */ public function original() { @@ -85,7 +85,7 @@ public function original() } /** - * @return HasMany + * @return HasMany */ public function replies() { diff --git a/src/Model/MenuItem.php b/src/Model/MenuItem.php index 33235227..fed9b037 100644 --- a/src/Model/MenuItem.php +++ b/src/Model/MenuItem.php @@ -65,6 +65,7 @@ public function instance() * Items come back in a collection that batches `instance()` and `parent()`. * * @param array $models + * @return MenuItemCollection */ public function newCollection(array $models = []): MenuItemCollection { diff --git a/src/Model/Meta/CommentMeta.php b/src/Model/Meta/CommentMeta.php index 8e6ada92..1f913c99 100644 --- a/src/Model/Meta/CommentMeta.php +++ b/src/Model/Meta/CommentMeta.php @@ -25,7 +25,7 @@ class CommentMeta extends Meta protected $fillable = ['meta_key', 'meta_value', 'comment_id']; /** - * @return BelongsTo + * @return BelongsTo */ public function comment() { diff --git a/src/Model/Meta/PostMeta.php b/src/Model/Meta/PostMeta.php index e1348345..261afafe 100644 --- a/src/Model/Meta/PostMeta.php +++ b/src/Model/Meta/PostMeta.php @@ -25,7 +25,7 @@ class PostMeta extends Meta protected $fillable = ['meta_key', 'meta_value', 'post_id']; /** - * @return BelongsTo + * @return BelongsTo */ public function post() { diff --git a/src/Model/Meta/TermMeta.php b/src/Model/Meta/TermMeta.php index 62c65e21..49743180 100644 --- a/src/Model/Meta/TermMeta.php +++ b/src/Model/Meta/TermMeta.php @@ -23,6 +23,9 @@ class TermMeta extends Meta /** @var array */ protected $fillable = ['meta_key', 'meta_value', 'term_id']; + /** + * @return BelongsTo + */ public function term(): BelongsTo { return $this->belongsTo(Term::class); diff --git a/src/Model/Meta/ThumbnailMeta.php b/src/Model/Meta/ThumbnailMeta.php index df34e2d9..a4dc8d81 100644 --- a/src/Model/Meta/ThumbnailMeta.php +++ b/src/Model/Meta/ThumbnailMeta.php @@ -31,7 +31,7 @@ class ThumbnailMeta extends PostMeta protected $with = ['attachment']; /** - * @return BelongsTo + * @return BelongsTo */ public function attachment() { diff --git a/src/Model/Meta/UserMeta.php b/src/Model/Meta/UserMeta.php index 1ca62147..c7dcb3d4 100644 --- a/src/Model/Meta/UserMeta.php +++ b/src/Model/Meta/UserMeta.php @@ -31,7 +31,7 @@ class UserMeta extends Meta protected $fillable = ['meta_key', 'meta_value', 'user_id']; /** - * @return BelongsTo + * @return BelongsTo */ public function user() { diff --git a/src/Model/Page.php b/src/Model/Page.php index ca496c6d..98eb6152 100644 --- a/src/Model/Page.php +++ b/src/Model/Page.php @@ -19,6 +19,7 @@ class Page extends Post protected $postType = 'page'; /** + * @param Builder $query * @return mixed */ public function scopeHome(Builder $query) diff --git a/src/Model/Post.php b/src/Model/Post.php index 5691ad3a..1cc6b690 100644 --- a/src/Model/Post.php +++ b/src/Model/Post.php @@ -132,6 +132,8 @@ class Post extends Model * The collection this post was loaded with (the first one only: a filtered * copy must not narrow the batch). Lets the computed attributes load their * relation for all the posts at once. + * + * @var PostCollection|null */ protected ?PostCollection $siblings = null; @@ -159,6 +161,8 @@ public function newFromBuilder($attributes = [], $connection = null) /** * Remembers the collection that holds this post. * + * @param PostCollection $siblings + * * @internal called by PostCollection */ public function joinSiblings(PostCollection $siblings): void @@ -219,7 +223,7 @@ public function taxonomies() } /** - * @return HasMany + * @return HasMany */ public function comments() { @@ -227,7 +231,7 @@ public function comments() } /** - * @return BelongsTo + * @return BelongsTo */ public function author() { @@ -243,7 +247,7 @@ public function parent() } /** - * @return HasMany + * @return HasMany */ public function children() { diff --git a/src/Model/Taxonomy.php b/src/Model/Taxonomy.php index 4e1b5d1a..b04f11f1 100644 --- a/src/Model/Taxonomy.php +++ b/src/Model/Taxonomy.php @@ -43,7 +43,7 @@ class Taxonomy extends Model protected $with = ['term']; /** - * @return HasMany + * @return HasMany */ public function meta() { @@ -51,7 +51,7 @@ public function meta() } /** - * @return BelongsTo + * @return BelongsTo */ public function term() { @@ -59,7 +59,7 @@ public function term() } /** - * @return BelongsTo + * @return BelongsTo */ public function parent() { @@ -67,7 +67,7 @@ public function parent() } /** - * @return BelongsToMany + * @return BelongsToMany */ public function posts() { diff --git a/src/Model/Term.php b/src/Model/Term.php index bcc46158..99f9151a 100644 --- a/src/Model/Term.php +++ b/src/Model/Term.php @@ -36,7 +36,7 @@ class Term extends Model protected $primaryKey = 'term_id'; /** - * @return HasOne + * @return HasOne */ public function taxonomy() { diff --git a/src/Model/TermRelationship.php b/src/Model/TermRelationship.php index 7d5a7069..5f937773 100644 --- a/src/Model/TermRelationship.php +++ b/src/Model/TermRelationship.php @@ -35,7 +35,7 @@ class TermRelationship extends Model protected $primaryKey = ['object_id', 'term_taxonomy_id']; /** - * @return BelongsTo + * @return BelongsTo */ public function post() { @@ -43,7 +43,7 @@ public function post() } /** - * @return BelongsTo + * @return BelongsTo */ public function taxonomy() { diff --git a/src/Model/User.php b/src/Model/User.php index 1ec9a7e5..70cf4842 100644 --- a/src/Model/User.php +++ b/src/Model/User.php @@ -98,7 +98,7 @@ class User extends Model implements Authenticatable, CanResetPassword public function setUpdatedAtAttribute($value) {} /** - * @return HasMany + * @return HasMany */ public function posts() { @@ -106,7 +106,7 @@ public function posts() } /** - * @return HasMany + * @return HasMany */ public function comments() {