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
6 changes: 3 additions & 3 deletions .harness.json
Original file line number Diff line number Diff line change
Expand Up @@ -5,10 +5,10 @@
"framework"
],
"ratchet": {
"type_coverage": 89.1,
"phpstan_level": 5,
"phpstan_level": 8,
"phpstan_baseline": 2,
"coverage": 98.0,
"coverage": 98,
"type_coverage": 89.1,
"msi": 95
}
}
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -46,8 +46,8 @@
"test:coverage": "pest --coverage",
"test:unit": "pest --testsuite=Unit",
"test:feature": "pest --testsuite=Feature",
"phpstan": "phpstan analyse src tests --level=5",
"phpstan:ci": "phpstan analyse src tests --level=5 --no-progress",
"phpstan": "phpstan analyse src tests --level=8",
"phpstan:ci": "phpstan analyse src tests --level=8 --no-progress",
"lint": "pint",
"lint:check": "pint --test",
"qa": "@php vendor/bin/pollora-qa check",
Expand Down
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@ includes:
- vendor/pollora/harness/presets/phpstan/base.neon

parameters:
level: 5
level: 8
paths:
- src
excludePaths:
Expand Down
12 changes: 6 additions & 6 deletions src/Adapter/Out/WordPress/PostTypeRegistryAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class PostTypeRegistryAdapter implements PostTypeRegistryPort
* This is a generic method that delegates to the specific post type registration method.
*
* @param string $slug The entity slug
* @param array $args Registration arguments
* @param array $names Entity names (singular, plural)
* @param array<array-key, mixed> $args Registration arguments
* @param array<array-key, mixed> $names Entity names (singular, plural)
*/
public function register(string $slug, array $args, array $names): void
{
Expand All @@ -34,8 +34,8 @@ public function register(string $slug, array $args, array $names): void
* Uses register_extended_post_type if available, or falls back to register_post_type.
*
* @param string $slug The post type slug
* @param array $args Registration arguments
* @param array $names Post type names (singular, plural)
* @param array<array-key, mixed> $args Registration arguments
* @param array<array-key, mixed> $names Post type names (singular, plural)
*/
public function registerPostType(string $slug, array $args, array $names): void
{
Expand All @@ -56,8 +56,8 @@ public function registerPostType(string $slug, array $args, array $names): void
* Fallback to standard WordPress post type registration if extended registration fails
*
* @param string $slug Post type slug
* @param array $args Arguments for post type
* @param array $names Names for post type
* @param array<array-key, mixed> $args Arguments for post type
* @param array<array-key, mixed> $names Names for post type
*/
protected function fallbackToStandardPostTypeRegistration(string $slug, array $args, array $names): void
{
Expand Down
16 changes: 8 additions & 8 deletions src/Adapter/Out/WordPress/TaxonomyRegistryAdapter.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,8 +20,8 @@ class TaxonomyRegistryAdapter implements TaxonomyRegistryPort
* This is a generic method that delegates to the specific taxonomy registration method.
*
* @param string $slug The entity slug
* @param array $args Registration arguments
* @param array $names Entity names (singular, plural)
* @param array<array-key, mixed> $args Registration arguments
* @param array<array-key, mixed> $names Entity names (singular, plural)
*/
public function register(string $slug, array $args, array $names): void
{
Expand All @@ -40,9 +40,9 @@ public function register(string $slug, array $args, array $names): void
* Uses register_extended_taxonomy if available, or falls back to register_taxonomy.
*
* @param string $slug The taxonomy slug
* @param string|array $objectType The post type(s) the taxonomy is associated with
* @param array $args Registration arguments
* @param array $names Taxonomy names (singular, plural)
* @param string|array<array-key, mixed> $objectType The post type(s) the taxonomy is associated with
* @param array<array-key, mixed> $args Registration arguments
* @param array<array-key, mixed> $names Taxonomy names (singular, plural)
*/
public function registerTaxonomy(string $slug, string|array $objectType, array $args, array $names): void
{
Expand All @@ -58,9 +58,9 @@ public function registerTaxonomy(string $slug, string|array $objectType, array $
* Fallback to standard WordPress taxonomy registration if extended registration fails
*
* @param string $slug Taxonomy slug
* @param string|array $objectType Post type(s) to register the taxonomy for
* @param array $args Arguments for taxonomy
* @param array $names Names for taxonomy
* @param string|array<array-key, mixed> $objectType Post type(s) to register the taxonomy for
* @param array<array-key, mixed> $args Arguments for taxonomy
* @param array<array-key, mixed> $names Names for taxonomy
*/
protected function fallbackToStandardTaxonomyRegistration(string $slug, string|array $objectType, array $args, array $names): void
{
Expand Down
2 changes: 1 addition & 1 deletion src/Application/Service/EntityRegistrationService.php
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,6 @@ public function registerEntity(Entity $entity): void

$this->entityRegistry->register($entity->getSlug(), $args, $names);

}, $entity->getPriority());
}, $entity->getPriority() ?? $entity->priority);
}
}
2 changes: 1 addition & 1 deletion src/Application/Service/TaxonomyService.php
Original file line number Diff line number Diff line change
Expand Up @@ -40,7 +40,7 @@ public function register(Taxonomy $taxonomy): void
* This method creates a new taxonomy and registers it with WordPress.
*
* @param string $slug The taxonomy slug
* @param string|array $objectType The post type(s) the taxonomy is associated with
* @param string|array<array-key, mixed> $objectType The post type(s) the taxonomy is associated with
* @param string|null $singular The singular label for the taxonomy
* @param string|null $plural The plural label for the taxonomy
* @return Taxonomy The created taxonomy
Expand Down
60 changes: 31 additions & 29 deletions src/Domain/Model/Entity.php
Original file line number Diff line number Diff line change
Expand Up @@ -31,7 +31,7 @@ abstract class Entity
/**
* Labels array for this post type or taxonomy.
*
* @var array
* @var array<array-key, mixed>
*/
public $labels;

Expand All @@ -55,7 +55,7 @@ abstract class Entity
/**
* Whether queries can be performed on the front end for the post type as part of `parse_request()` for post types or whether a taxonomy is intended for use publicly either via the admin interface or by front-end users
*
* @var bool
* @var bool|null
*/
public $publiclyQueryable;

Expand All @@ -69,7 +69,7 @@ abstract class Entity
/**
* Rewrites information for this post type or taxonomy.
*
* @var array|false
* @var bool|array<array-key, mixed>
*/
public $rewrite;

Expand All @@ -78,7 +78,7 @@ abstract class Entity
*
* Default is the value of $public.
*
* @var bool
* @var bool|null
*/
public $showUi;

Expand All @@ -94,7 +94,7 @@ abstract class Entity
*
* Default is the value $public.
*
* @var bool
* @var bool|null
*/
public $showInNavMenus;

Expand Down Expand Up @@ -146,12 +146,14 @@ abstract class Entity
/**
* Post type or Taxonomy capabilities.
*
* @var array
* @var array<array-key, mixed>
*/
public $capabilities;

/**
* Whether to show this post type or taxonomy on the 'At a Glance' section of the admin dashboard.
*
* @var bool|null
*/
public $dashboardGlance;

Expand All @@ -165,7 +167,7 @@ abstract class Entity
/**
* Names of the post type or taxonomy.
*
* @var array
* @var array<array-key, mixed>
*/
public $names;

Expand Down Expand Up @@ -238,9 +240,9 @@ public function setLabel(string $label): self
/**
* Retrieves the labels associated with the entity.
*
* @return array|null Returns an object containing the labels associated with the entity.
* If labels are available, an array is returned with the label properties.
* If labels are not available, null is returned.
* @return array<array-key, mixed>|null Returns an object containing the labels associated with the entity.
* If labels are available, an array is returned with the label properties.
* If labels are not available, null is returned.
*/
public function getLabels(): ?array
{
Expand All @@ -250,7 +252,7 @@ public function getLabels(): ?array
/**
* Sets the labels for the entity.
*
* @param array $labels The labels array containing the labels for the entity.
* @param array<array-key, mixed> $labels The labels array containing the labels for the entity.
* @return static Returns an instance of the class.
*/
public function labels(array $labels): self
Expand All @@ -265,7 +267,7 @@ public function labels(array $labels): self
*
* @deprecated Use labels() instead
*
* @param array $labels The labels array containing the labels for the entity.
* @param array<array-key, mixed> $labels The labels array containing the labels for the entity.
* @return static Returns an instance of the class.
*/
public function setLabels(array $labels): self
Expand Down Expand Up @@ -748,7 +750,7 @@ public function setQueryVar(bool|string $queryVar): self
/**
* Retrieves the value of the rewrite property.
*
* @return bool|array|null The value of the rewrite property.
* @return bool|array<array-key, mixed>|null The value of the rewrite property.
*/
public function getRewrite(): bool|array|null
{
Expand All @@ -758,7 +760,7 @@ public function getRewrite(): bool|array|null
/**
* Sets the value of the rewrite property.
*
* @param bool|array $rewrite The new value for the rewrite property.
* @param bool|array<array-key, mixed> $rewrite The new value for the rewrite property.
* @return static Returns an instance of the current object.
*/
public function rewrite(bool|array $rewrite): self
Expand All @@ -773,7 +775,7 @@ public function rewrite(bool|array $rewrite): self
*
* @deprecated Use withRewrite() instead
*
* @param bool|array $rewrite The new value for the rewrite property.
* @param bool|array<array-key, mixed> $rewrite The new value for the rewrite property.
* @return static Returns an instance of the current object.
*/
public function withRewrite(bool|array $rewrite): self
Expand All @@ -786,7 +788,7 @@ public function withRewrite(bool|array $rewrite): self
*
* @deprecated Use rewrite() instead
*
* @param bool|array $rewrite The new value for the rewrite property.
* @param bool|array<array-key, mixed> $rewrite The new value for the rewrite property.
* @return static Returns an instance of the current object.
*/
public function setRewrite(bool|array $rewrite): self
Expand Down Expand Up @@ -1004,7 +1006,7 @@ public function setRestControllerClass(bool|string $restControllerClass): self
/**
* Retrieves the capabilities.
*
* @return array|null The capabilities array, or null if it is not set.
* @return array<array-key, mixed>|null The capabilities array, or null if it is not set.
*/
public function getCapabilities(): ?array
{
Expand All @@ -1014,7 +1016,7 @@ public function getCapabilities(): ?array
/**
* Sets the capability for the object.
*
* @param array $capabilities The capability to set.
* @param array<array-key, mixed> $capabilities The capability to set.
* @return static Returns a reference to the object.
*/
public function capabilities(array $capabilities): self
Expand All @@ -1029,7 +1031,7 @@ public function capabilities(array $capabilities): self
*
* @deprecated Use withCapabilities() instead
*
* @param array $capabilities The capability to set.
* @param array<array-key, mixed> $capabilities The capability to set.
* @return static Returns a reference to the object.
*/
public function withCapabilities(array $capabilities): self
Expand All @@ -1042,7 +1044,7 @@ public function withCapabilities(array $capabilities): self
*
* @deprecated Use capabilities() instead
*
* @param array $capabilities The capability to set.
* @param array<array-key, mixed> $capabilities The capability to set.
* @return static Returns a reference to the object.
*/
public function setCapabilities(array $capabilities): self
Expand Down Expand Up @@ -1179,7 +1181,7 @@ public function setSlug(?string $slug): self
/**
* Sets the names property with the given array.
*
* @param array $names The names to be set.
* @param array<array-key, mixed> $names The names to be set.
* @return $this The current instance of the class.
*/
public function names(array $names): self
Expand All @@ -1194,7 +1196,7 @@ public function names(array $names): self
*
* @deprecated Use withNames() instead
*
* @param array $names The names to be set.
* @param array<array-key, mixed> $names The names to be set.
* @return $this The current instance of the class.
*/
public function withNames(array $names): self
Expand All @@ -1207,7 +1209,7 @@ public function withNames(array $names): self
*
* @deprecated Use names() instead
*
* @param array $names The names to be set.
* @param array<array-key, mixed> $names The names to be set.
* @return $this The current instance of the class.
*/
public function setNames(array $names): self
Expand All @@ -1218,7 +1220,7 @@ public function setNames(array $names): self
/**
* Retrieves the value of the names property.
*
* @return array The value of the names property.
* @return array<array-key, mixed> The value of the names property.
*/
public function getNames(): array
{
Expand Down Expand Up @@ -1288,7 +1290,7 @@ public function setDashboardGlance(bool $dashboardGlance): self
/**
* Returns the admin columns for the current object.
*
* @return array|null The admin columns array or null if no admin columns are defined.
* @return array<array-key, mixed>|null The admin columns array or null if no admin columns are defined.
*/
public function getAdminCols(): ?array
{
Expand All @@ -1298,7 +1300,7 @@ public function getAdminCols(): ?array
/**
* Sets the value of the adminCols property.
*
* @param array $adminCols The value to set for the adminCols property.
* @param array<array-key, mixed> $adminCols The value to set for the adminCols property.
* @return static Returns this object instance.
*/
public function adminCols(array $adminCols): self
Expand All @@ -1313,7 +1315,7 @@ public function adminCols(array $adminCols): self
*
* @deprecated Use withAdminCols() instead
*
* @param array $adminCols The value to set for the adminCols property.
* @param array<array-key, mixed> $adminCols The value to set for the adminCols property.
* @return static Returns this object instance.
*/
public function withAdminCols(array $adminCols): self
Expand All @@ -1326,7 +1328,7 @@ public function withAdminCols(array $adminCols): self
*
* @deprecated Use adminCols() instead
*
* @param array $adminCols The value to set for the adminCols property.
* @param array<array-key, mixed> $adminCols The value to set for the adminCols property.
* @return static Returns this object instance.
*/
public function setAdminCols(array $adminCols): self
Expand Down Expand Up @@ -1392,7 +1394,7 @@ abstract public function init();
/**
* Get the arguments for the entity.
*
* @return array|null The arguments for the entity.
* @return array<array-key, mixed>|null The arguments for the entity.
*/
public function getArgs(): ?array
{
Expand Down
Loading