1 | <?php |
||
24 | abstract class AbstractDependencyHandler implements DependencyHandlerInterface { |
||
25 | |||
26 | use FunctionInvokerTrait; |
||
27 | |||
28 | /** |
||
29 | * Register the dependency's assets. |
||
30 | * |
||
31 | * @since 0.1.0 |
||
32 | * |
||
33 | * @param array $args Optional. Array of arguments that is |
||
|
|||
34 | * passed to the registration function. |
||
35 | * @throws InvalidArgumentException If the register function could not be |
||
36 | * called. |
||
37 | */ |
||
38 | public function register( $args = null ) { |
||
41 | |||
42 | /** |
||
43 | * Get the name of the function that is used for registering the dependency. |
||
44 | * |
||
45 | * @since 0.1.0 |
||
46 | * |
||
47 | * @return string Function name. |
||
48 | */ |
||
49 | abstract protected function get_register_function(); |
||
50 | |||
51 | /** |
||
52 | * Enqueue the dependency's assets. |
||
53 | * |
||
54 | * @since 0.1.0 |
||
55 | * |
||
56 | * @param array $args Optional. Array of arguments that is |
||
57 | * passed to the enqueueing function. |
||
58 | * @throws InvalidArgumentException If the register function could not be |
||
59 | * called. |
||
60 | */ |
||
61 | public function enqueue( $args = null ) { |
||
64 | |||
65 | /** |
||
66 | * Get the name of the function that is used for enqueueing the dependency. |
||
67 | * |
||
68 | * @since 0.1.0 |
||
69 | * |
||
70 | * @return string Function name. |
||
71 | */ |
||
72 | abstract protected function get_enqueue_function(); |
||
73 | |||
74 | /** |
||
75 | * Maybe enqueue a dependency that has been registered outside of the |
||
76 | * Dependency Manager. |
||
77 | * |
||
78 | * @since 0.2.3 |
||
79 | * |
||
80 | * @param string $handle Handle of the dependency to enqueue. |
||
81 | */ |
||
82 | public function maybe_enqueue( $handle ) { |
||
88 | |||
89 | /** |
||
90 | * Check whether a specific handle has been registered. |
||
91 | * |
||
92 | * @since 0.2.3 |
||
93 | * |
||
94 | * @param string $handle The handle to check |
||
95 | * @return bool Whether it is registered or not. |
||
96 | */ |
||
97 | abstract protected function is_registered( $handle ); |
||
98 | } |
||
99 |
This check looks for
@param
annotations where the type inferred by our type inference engine differs from the declared type.It makes a suggestion as to what type it considers more descriptive. In addition it looks for parameters that have the generic type
array
and suggests a stricter type likearray<String>
.Most often this is a case of a parameter that can be null in addition to its declared types.