6
6
* @since 1.0.0
7
7
*/
8
8
9
+ // @codeCoverageIgnoreStart
10
+ if ( ! defined ( 'ABSPATH ' ) ) {
11
+ exit ; // Exit if accessed directly.
12
+ }
13
+ // @codeCoverageIgnoreEnd
14
+
9
15
/**
10
16
* Class representing a view transition animation.
11
17
*
18
+ * @phpstan-type AnimationConfig array{
19
+ * aliases?: non-empty-string[],
20
+ * use_stylesheet?: bool|non-empty-string,
21
+ * use_global_transition_names?: bool|callable(string, array<string,string>):bool,
22
+ * use_post_transition_names?: bool|callable(string, array<string,string>):bool,
23
+ * get_stylesheet_callback?: callable(string, string, array<string,string>):string|null
24
+ * }
25
+ *
12
26
* @since 1.0.0
13
27
* @access private
14
28
*/
@@ -18,15 +32,15 @@ final class PLVT_View_Transition_Animation {
18
32
* The unique animation slug.
19
33
*
20
34
* @since 1.0.0
21
- * @var string
35
+ * @var non-empty- string
22
36
*/
23
37
private $ slug ;
24
38
25
39
/**
26
40
* Unique aliases for the animation, if any.
27
41
*
28
42
* @since 1.0.0
29
- * @var string[]
43
+ * @var non-empty- string[]
30
44
*/
31
45
private $ aliases = array ();
32
46
@@ -50,7 +64,7 @@ final class PLVT_View_Transition_Animation {
50
64
private $ use_global_transition_names = true ;
51
65
52
66
/**
53
- * Whether to apply the post specific view transition names while using this animation.
67
+ * Whether to apply the post- specific view transition names while using this animation.
54
68
*
55
69
* @since 1.0.0
56
70
* @var bool|callable
@@ -87,7 +101,9 @@ final class PLVT_View_Transition_Animation {
87
101
*
88
102
* @since 1.0.0
89
103
*
90
- * @param string $slug Unique animation slug.
104
+ * @phpstan-param AnimationConfig $config Animation config.
105
+ *
106
+ * @param non-empty-string $slug Unique animation slug.
91
107
* @param array<string, mixed> $config {
92
108
* Animation configuration.
93
109
*
@@ -101,7 +117,7 @@ final class PLVT_View_Transition_Animation {
101
117
* using this animation. Alternatively to a concrete value, a
102
118
* callback can be specified to determine it dynamically.
103
119
* Default true.
104
- * @type bool|callable $use_post_transition_names Whether to apply the post specific view transition names
120
+ * @type bool|callable $use_post_transition_names Whether to apply the post- specific view transition names
105
121
* while using this animation. Alternatively to a concrete
106
122
* value, a callback can be specified to determine it
107
123
* dynamically. Default true.
@@ -138,7 +154,7 @@ public function __construct( string $slug, array $config, array $default_args =
138
154
*
139
155
* @since 1.0.0
140
156
*
141
- * @return string Unique animation slug.
157
+ * @return non-empty- string Unique animation slug.
142
158
*/
143
159
public function get_slug (): string {
144
160
return $ this ->slug ;
@@ -149,7 +165,7 @@ public function get_slug(): string {
149
165
*
150
166
* @since 1.0.0
151
167
*
152
- * @return string[] Unique aliases for the animation, or empty array if none.
168
+ * @return non-empty- string[] Unique aliases for the animation, or empty array if none.
153
169
*/
154
170
public function get_aliases (): array {
155
171
return $ this ->aliases ;
@@ -216,14 +232,14 @@ public function use_global_transition_names( string $alias = '', array $args = a
216
232
}
217
233
218
234
/**
219
- * Returns whether to apply the post specific view transition names while using this animation.
235
+ * Returns whether to apply the post- specific view transition names while using this animation.
220
236
*
221
237
* @since 1.0.0
222
238
*
223
239
* @param string $alias Optional. Slug or alias to reference the animation with. May be used to alter
224
240
* the animation's behavior. Default is the animation's slug.
225
241
* @param array<string, mixed> $args Optional. Animation arguments. Default is the animation's default arguments.
226
- * @return bool True if the post specific view transition names should be applied, false otherwise.
242
+ * @return bool True if the post- specific view transition names should be applied, false otherwise.
227
243
*/
228
244
public function use_post_transition_names ( string $ alias = '' , array $ args = array () ): bool {
229
245
if ( is_bool ( $ this ->use_post_transition_names ) ) {
0 commit comments