Skip to content
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.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
Expand Up @@ -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<mixed>`, 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
Expand Down
3 changes: 2 additions & 1 deletion src/Concerns/Aliases.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@
trait Aliases
{
/**
* @return array
* @return array<mixed>
*/
public static function getAliases()
{
Expand All @@ -28,6 +28,7 @@ public static function getAliases()
/**
* @param string $new
* @param string $old
* @return void
*/
public static function addAlias($new, $old)
{
Expand Down
6 changes: 3 additions & 3 deletions src/Concerns/MetaFields.php
Original file line number Diff line number Diff line change
Expand Up @@ -52,7 +52,7 @@ public function meta()
}

/**
* @param string|array $meta
* @param string|array<mixed> $meta
* @param mixed $value
*/
public function scopeHasMeta(Builder $query, $meta, $value = null, string $operator = '='): Builder
Expand Down Expand Up @@ -98,7 +98,7 @@ public function saveField($key, $value)
}

/**
* @param string|array $key
* @param string|array<mixed> $key
* @param mixed $value
* @return bool
*/
Expand Down Expand Up @@ -128,7 +128,7 @@ public function createField($key, $value)
}

/**
* @param string|array $key
* @param string|array<mixed> $key
* @param mixed $value
* @return Model|Collection
*/
Expand Down
10 changes: 9 additions & 1 deletion src/Concerns/Shortcodes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
trait Shortcodes
{
/**
* @var array
* @var array<mixed>
*/
protected static $shortcodes = [];

Expand All @@ -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)
{
Expand All @@ -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)
{
Expand Down Expand Up @@ -84,13 +86,19 @@ private function getShortcodeHandlerInstance(): ShortcodeFacade
});
}

/**
* @return void
*/
private function parseClassShortcodes(ShortcodeFacade $facade)
{
foreach (self::$shortcodes as $tag => $func) {
$facade->addHandler($tag, $func);
}
}

/**
* @return void
*/
private function parseConfigShortcodes(ShortcodeFacade $facade)
{
if (Colt::isLaravel()) {
Expand Down
5 changes: 4 additions & 1 deletion src/Database.php
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@
class Database
{
/**
* @var array
* @var array<mixed>
*/
protected static $baseParams = [
'driver' => 'mysql',
Expand All @@ -25,6 +25,9 @@ class Database
'prefix' => 'wp_',
];

/**
* @param array<mixed> $params connection settings, merged over the defaults
*/
public static function connect(array $params): Manager
{
$capsule = new Capsule;
Expand Down
11 changes: 10 additions & 1 deletion src/Laravel/Auth/AuthUserProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,10 +20,13 @@
class AuthUserProvider implements UserProvider
{
/**
* @var array
* @var array<mixed>
*/
protected $config = [];

/**
* @param array<mixed> $config
*/
public function __construct(array $config = [])
{
$this->config = $config;
Expand Down Expand Up @@ -74,6 +77,7 @@ public function updateRememberToken(Authenticatable $user, $token)
/**
* Retrieve a user by the given credentials.
*
* @param array<mixed> $credentials
* @return Authenticatable|null
*/
public function retrieveByCredentials(array $credentials)
Expand All @@ -95,6 +99,8 @@ public function retrieveByCredentials(array $credentials)

/**
* Validate a user against the given credentials.
*
* @param array<mixed> $credentials
*/
public function validateCredentials(Authenticatable $user, array $credentials): bool
{
Expand All @@ -106,6 +112,9 @@ public function validateCredentials(Authenticatable $user, array $credentials):
->check($credentials['password'], $user->user_pass);
}

/**
* @param array<mixed> $credentials
*/
public function rehashPasswordIfRequired(Authenticatable $user, array $credentials, bool $force = false)
{
//
Expand Down
7 changes: 7 additions & 0 deletions src/Model.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -230,6 +233,10 @@ protected function setRelationConnection($model)
}
}

/**
* @param mixed $instance the related model
* @return mixed
*/
protected function setInstanceConnection($instance)
{
return $instance->setConnection(
Expand Down
4 changes: 2 additions & 2 deletions src/Model/Attachment.php
Original file line number Diff line number Diff line change
Expand Up @@ -25,7 +25,7 @@ class Attachment extends Post
protected $postType = 'attachment';

/**
* @var array
* @var array<mixed>
*/
protected $appends = [
'title',
Expand All @@ -37,7 +37,7 @@ class Attachment extends Post
];

/**
* @var array
* @var array<mixed>
*/
protected static $aliases = [
'title' => 'post_title',
Expand Down
4 changes: 3 additions & 1 deletion src/Model/Builder/PostBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
namespace Pollora\Colt\Model\Builder;

use Carbon\Carbon;
use Illuminate\Contracts\Support\Arrayable;
use Illuminate\Database\Eloquent\Builder;

/**
Expand Down Expand Up @@ -47,6 +48,7 @@ public function type($type)
}

/**
* @param array<mixed> $types
* @return PostBuilder
*/
public function typeIn(array $types)
Expand Down Expand Up @@ -88,7 +90,7 @@ public function taxonomy($taxonomy, $terms)
}

/**
* @param mixed $term
* @param string|Arrayable<array-key, mixed>|iterable<mixed>|false|null $term words, or a list of them
* @return PostBuilder
*/
public function search($term = false)
Expand Down
1 change: 1 addition & 0 deletions src/Model/Builder/TaxonomyBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -55,6 +55,7 @@ public function slug($slug = null)
}

/**
* @param string|null $slug
* @return TaxonomyBuilder
*/
public function term($slug = null)
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Comment.php
Original file line number Diff line number Diff line change
Expand Up @@ -43,7 +43,7 @@ class Comment extends Model
protected $primaryKey = 'comment_ID';

/**
* @var array
* @var array<mixed>
*/
protected $dates = ['comment_date'];

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Menu.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class Menu extends Taxonomy
protected $taxonomy = 'nav_menu';

/**
* @var array
* @var array<mixed>
*/
protected $with = ['term', 'items'];

Expand Down
2 changes: 1 addition & 1 deletion src/Model/MenuItem.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@ class MenuItem extends Post
protected $postType = 'nav_menu_item';

/**
* @var array
* @var array<mixed>
*/
protected $instanceRelations = [
'post' => Post::class,
Expand Down
2 changes: 1 addition & 1 deletion src/Model/Meta/Meta.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class Meta extends Model
protected $primaryKey = 'meta_id';

/**
* @var array
* @var array<mixed>
*/
protected $appends = ['value'];

Expand Down
2 changes: 1 addition & 1 deletion src/Model/Meta/ThumbnailMeta.php
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ class ThumbnailMeta extends PostMeta
const SIZE_FULL = 'full';

/**
* @var array
* @var array<mixed>
*/
protected $with = ['attachment'];

Expand Down
10 changes: 5 additions & 5 deletions src/Model/Option.php
Original file line number Diff line number Diff line change
Expand Up @@ -46,7 +46,7 @@ class Option extends Model
];

/**
* @var array
* @var array<mixed>
*/
protected $appends = ['value'];

Expand Down Expand Up @@ -85,7 +85,7 @@ public static function get($name)
}

/**
* @return array
* @return array<mixed>
*
* @deprecated
*/
Expand All @@ -95,8 +95,8 @@ public static function getAll()
}

/**
* @param array $keys
* @return array
* @param array<mixed> $keys
* @return array<mixed>
*/
public static function asArray($keys = [])
{
Expand All @@ -112,7 +112,7 @@ public static function asArray($keys = [])
}

/**
* @return array
* @return array<mixed>
*/
public function toArray()
{
Expand Down
Loading