Skip to content
Open
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
37 commits
Select commit Hold shift + click to select a range
48f9089
ob get clean phpstan
srtfisher Oct 7, 2025
96fbdc7
Work on phpstan
srtfisher Oct 7, 2025
f10229a
PHPStan for assets
srtfisher Oct 7, 2025
3d790cf
phpstan for cache
srtfisher Oct 7, 2025
2c2c370
contd phpstan
srtfisher Oct 7, 2025
ca3a13a
phpstan
srtfisher Oct 7, 2025
8d2a88d
Lightweight dispatcher phpstan
srtfisher Oct 7, 2025
d1e25c6
Adding mixed option
srtfisher Oct 7, 2025
8e62854
phpstan Pending_Testable_Request
srtfisher Oct 7, 2025
c661b11
phpstan Pending_Testable_Request
srtfisher Oct 7, 2025
71cf8e7
restfield
srtfisher Oct 7, 2025
2d7dc64
restfield
srtfisher Oct 7, 2025
20edfb4
restfield
srtfisher Oct 7, 2025
ea74a78
restfield
srtfisher Oct 7, 2025
ad294e0
restfield
srtfisher Oct 7, 2025
64449a0
restfield
srtfisher Oct 7, 2025
0fbe33a
Reflector phpstan
srtfisher Oct 7, 2025
45bd4a1
Lint fix, fixing reflector generic
srtfisher Oct 8, 2025
485e716
Interacts_With_Container
srtfisher Oct 8, 2025
d4b0b58
Interacts_With_Cron
srtfisher Oct 8, 2025
91cf3e2
Interacts_With_Requests
srtfisher Oct 8, 2025
de679f6
Reads_Annotations
srtfisher Oct 8, 2025
e11678c
Simplify helpers-core-objects
srtfisher Oct 8, 2025
da34797
Simplify helpers-core-objects
srtfisher Oct 8, 2025
15559ad
Simplify helpers-core-objects
srtfisher Oct 8, 2025
4404d3f
service provider
srtfisher Oct 8, 2025
5d2372a
URI
srtfisher Oct 8, 2025
342a94c
Collect
srtfisher Oct 8, 2025
67e7d8d
wpdb
srtfisher Oct 8, 2025
f223b70
wpdb
srtfisher Oct 8, 2025
70f9f6c
http client
srtfisher Oct 8, 2025
9d727b7
Wrapping up this pass
srtfisher Oct 8, 2025
44a6ef7
[1.10] PHPStan Level 7: Part 2 (#789)
srtfisher Oct 10, 2025
fac05e3
Merge branch '1.x' into feature/phpstan-7
srtfisher Oct 10, 2025
6a518ca
Merge branch '1.x' into feature/phpstan-7
srtfisher Oct 13, 2025
d02ebf6
Disable error
srtfisher Oct 14, 2025
8035a75
Merge branch '1.x' into feature/phpstan-7
srtfisher Oct 21, 2025
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
205 changes: 0 additions & 205 deletions phpstan-baseline.neon

This file was deleted.

21 changes: 16 additions & 5 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,9 +1,6 @@
includes:
- phpstan-baseline.neon

parameters:
# Goal of max.
level: 6
level: 7

paths:
- src/mantle
Expand Down Expand Up @@ -52,14 +49,22 @@ parameters:
- "#interface ArrayAccess but does not specify#"
- "#ReflectionClass does not specify its types#"
- "#ReflectionAttribute does not specify its types#"
- "#ReflectionAttribute but does not specify its types#"
- "#@return is not subtype of template type TKey#"
- "#WP_REST_Request does not specify its types#"
- "#WP_REST_Request but does not specify its types#"
- "#query of method wpdb::prepare#"
-
identifier: method.childReturnType
paths:
- src/mantle/http-client/class-pooled-pending-request.php
-
identifier: argument.type
paths:
- src/mantle/support/class-collection.php
-
identifier: return.type
paths:
- src/mantle/support/class-collection.php

scanFiles:
- %rootDir%/../../php-stubs/wp-cli-stubs/wp-cli-stubs.php
Expand All @@ -69,13 +74,19 @@ parameters:

excludePaths:
- src/mantle/blocks
- src/mantle/container/class-bound-method.php
- src/mantle/database/factory
- src/mantle/framework/console/class-hook-usage-command.php
- src/mantle/framework/console/generators
- src/mantle/query-monitor
- src/mantle/queue/providers/wordpress/admin/class-queue-jobs-table.php
- src/mantle/queue/providers/wordpress/admin/class-service-provider.php
- src/mantle/support/interface-enumerable.php
- src/mantle/support/traits/trait-conditionable.php
- src/mantle/testing/class-mock-action.php
- src/mantle/testing/install-wordpress.php
- src/mantle/testing/preload.php
- src/mantle/testing/wordpress-bootstrap.php

# Files that need to be fixed and re-added.
- src/mantle/queue/class-queue-fake.php
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ public function register_configured_providers(): void {
$providers = $providers->filter(
fn ( string $provider ) => in_array(
Isolated_Service_Provider::class,
class_implements( $provider ),
class_implements( $provider ) ?: [],
true,
)
);
Expand Down
6 changes: 6 additions & 0 deletions src/mantle/assets/autoload.php
Original file line number Diff line number Diff line change
Expand Up @@ -28,7 +28,13 @@ function asset(): Asset_Manager {
/**
* Retrieve an instance of the Asset Loader OR the URL for a given asset.
*
* @template TPath of string|null
*
* @param string|null $path Optional. The asset path to retrieve the URL for. If null, returns the Asset Loader instance.
* @return \Mantle\Assets\Asset_Loader|string|null Returns the asset loader instance or the URL if a path is provided.
*
* @phpstan-param TPath $path
* @phpstan-return (TPath is null ? \Mantle\Assets\Asset_Loader : string|null)
*/
function asset_loader( ?string $path = null ): Asset_Loader|string|null {
if ( $path ) {
Expand Down
16 changes: 9 additions & 7 deletions src/mantle/cache/class-repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,6 +7,8 @@
* phpcs:disable WordPress.NamingConventions.ValidFunctionName.MethodNameInvalid
*/

declare(strict_types=1);

namespace Mantle\Cache;

use Closure;
Expand Down Expand Up @@ -54,19 +56,19 @@ abstract public function flexible( string $key, int|\DateInterval|\DateTimeInter
/**
* Set a cache item.
*
* @param string $key Cache key.
* @param mixed $value Item value.
* @param null|int|\DateInterval $ttl TTL.
* @param string $key Cache key.
* @param mixed $value Item value.
* @param int|\DateInterval|\DateTimeInterface|null $ttl TTL.
*/
abstract public function set( string $key, mixed $value, int|\DateInterval|null $ttl = null ): bool;
abstract public function set( string $key, mixed $value, int|\DateInterval|\DateTimeInterface|null $ttl = null ): bool;

/**
* Set multiple keys.
*
* @param iterable<string, mixed> $values Key value pair of values to set.
* @param null|int|\DateInterval $ttl Cache TTL.
* @param iterable<string, mixed> $values Key value pair of values to set.
* @param int|\DateInterval|\DateTimeInterface|null $ttl Cache TTL.
*/
abstract public function set_multiple( iterable $values, null|int|\DateInterval $ttl = null ): bool;
abstract public function set_multiple( iterable $values, int|\DateInterval|\DateTimeInterface|null $ttl = null ): bool;

/**
* Delete a cache key.
Expand Down
8 changes: 5 additions & 3 deletions src/mantle/cache/class-wordpress-cache-repository.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,8 @@
* @package Mantle
*/

declare(strict_types=1);

namespace Mantle\Cache;

use Mantle\Contracts\Application;
Expand Down Expand Up @@ -46,7 +48,7 @@ public function get( string $key, mixed $default = null ): mixed {
* @return iterable<string, mixed>
*/
public function get_multiple( iterable $keys, mixed $default = null ): iterable {
return \wp_cache_get_multiple( $keys, $this->prefix );
return \wp_cache_get_multiple( is_array( $keys ) ? $keys : iterator_to_array( $keys ), $this->prefix );
}

/**
Expand Down Expand Up @@ -135,7 +137,7 @@ public function set( string $key, mixed $value, int|\DateInterval|\DateTimeInter
* @param null|int|\DateInterval|\DateTimeInterface $ttl Cache TTL.
*/
public function set_multiple( iterable $values, null|int|\DateInterval|\DateTimeInterface $ttl = null ): bool {
$result = \wp_cache_set_multiple( $values, $this->prefix, $this->normalize_ttl( $ttl ) ); // phpcs:ignore WordPressVIPMinimum.Performance.LowExpiryCacheTime.CacheTimeUndetermined
$result = \wp_cache_set_multiple( is_array( $values ) ? $values : iterator_to_array( $values ), $this->prefix, $this->normalize_ttl( $ttl ) ); // phpcs:ignore WordPressVIPMinimum.Performance.LowExpiryCacheTime.CacheTimeUndetermined

return ! in_array( false, $result, true );
}
Expand Down Expand Up @@ -175,7 +177,7 @@ public function delete( string $key ): bool {
* @param iterable<string> $keys Cache keys.
*/
public function delete_multiple( iterable $keys ): bool {
$result = \wp_cache_delete_multiple( $keys, $this->prefix );
$result = \wp_cache_delete_multiple( is_array( $keys ) ? $keys : iterator_to_array( $keys ), $this->prefix );

return ! in_array( false, $result, true );
}
Expand Down
Loading
Loading