Skip to content

Commit 87e129b

Browse files
🐞 Start fix PHPStan
1 parent 2252f8e commit 87e129b

5 files changed

Lines changed: 27 additions & 6 deletions

File tree

src/Action.php

Lines changed: 9 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,15 @@
1212

1313
readonly class Action
1414
{
15+
/**
16+
* @param string $name
17+
* @param int $priority
18+
* @param int $acceptedArgs
19+
* @param mixed $classInstance
20+
* @param string $methodName
21+
* @param array<string, string[]> $dependencies
22+
* @param ActionType $actionType
23+
*/
1524
public function __construct(
1625
public string $name,
1726
public int $priority,

src/Attributes/Action.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
use Dbout\WpHook\Enums\ActionType;
1212

1313
/**
14-
* - [WP add_action](https://developer.wordpress.org/reference/functions/add_action/)
14+
* @see https://developer.wordpress.org/reference/functions/add_action/
1515
*/
1616
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]
1717
class Action implements FilterInterface
1818
{
19+
/**
20+
* @param string $name The name of the action to add the callback to.
21+
* @param int $priority Used to specify the order in which the functions associated with a particular action are executed.
22+
* @param int $acceptedArgs The number of arguments the function accepts.
23+
* @param array<string|string[]> $dependencies List of dependencies on which the action depends.
24+
*/
1925
public function __construct(
2026
protected string $name,
2127
protected int $priority = 10,

src/Attributes/Filter.php

Lines changed: 7 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,11 +11,17 @@
1111
use Dbout\WpHook\Enums\ActionType;
1212

1313
/**
14-
* - [WP add_filter](https://developer.wordpress.org/reference/functions/add_filter/)
14+
* @see https://developer.wordpress.org/reference/functions/add_filter/
1515
*/
1616
#[\Attribute(\Attribute::TARGET_METHOD | \Attribute::TARGET_CLASS)]
1717
class Filter implements FilterInterface
1818
{
19+
/**
20+
* @param string $name The name of the filter to add the callback to.
21+
* @param int $priority Used to specify the order in which the functions associated with a particular filter are executed.
22+
* @param int $acceptedArgs The number of arguments the function accepts.
23+
* @param array<string|string[]> $dependencies List of dependencies on which the action depends.
24+
*/
1925
public function __construct(
2026
protected string $name,
2127
protected int $priority = 10,

src/Attributes/FilterInterface.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,7 @@ public function getActionType(): ActionType;
4646
/**
4747
* List of dependencies on which the action depends.
4848
*
49-
* @return array
49+
* @return array<string|string[]>
5050
*/
5151
public function getDependencies(): array;
5252
}

src/HookLoader.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -20,7 +20,7 @@ class HookLoader
2020
private const CACHE_KEY = '_app_wp_autoloader_hooks';
2121

2222
/**
23-
* @param string|array $directory
23+
* @param string|array<string> $directory
2424
* @param CacheItemPoolInterface|null $cache
2525
*/
2626
public function __construct(
@@ -76,7 +76,7 @@ protected function findHooks(): array
7676

7777
/**
7878
* @throws HookException
79-
* @return array
79+
* @return array<string>
8080
*/
8181
protected function getDirectories(): array
8282
{
@@ -131,7 +131,7 @@ public function register(): void
131131

132132
/**
133133
* @param Action $action
134-
* @return array
134+
* @return array<string, mixed>
135135
*/
136136
protected function getHookArg(Action $action): array
137137
{

0 commit comments

Comments
 (0)