PluginProbe
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More / 2.6.1
Content Control – The Ultimate Content Restriction Plugin! Restrict Content, Create Conditional Blocks & More v2.6.1
trunk 1.0.0 1.0.1 1.0.2 1.0.3 1.1.0 1.1.1 1.1.10 1.1.2 1.1.3 1.1.4 1.1.5 1.1.6 1.1.7 1.1.8 2.0.0 2.0.1 2.0.10 2.0.11 2.0.12 2.0.2 2.0.3 2.0.4 2.0.5 2.0.6 All 47 releases
← All changes | classes/Plugin/Prerequisites.php +18 -14 2.0.22.6.1 View file →
@@ -18,9 +18,9 @@
18 18
19 19 /**
20 20 * Cache accessible across instances.
21 21 *
22 - * @var array
22 + * @var array<string,array<string,mixed>>
23 23 */
24 24 public static $cache = [];
25 25
26 26 /**
@@ -25,9 +25,9 @@
25 25
26 26 /**
27 27 * Array of checks to perform.
28 28 *
29 - * @var array
29 + * @var array{type:string,version:string}[]
30 30 */
31 31 protected $checks = [];
32 32
33 33 /**
@@ -32,9 +32,9 @@
32 32
33 33 /**
34 34 * Array of detected failures.
35 35 *
36 - * @var array
36 + * @var array{type:string,version:string}[]
37 37 */
38 38 protected $failures = [];
39 39
40 40 /**
@@ -39,9 +39,9 @@
39 39
40 40 /**
41 41 * Instantiate prerequisite checker.
42 42 *
43 - * @param array $requirements Array of requirements.
43 + * @param array{type:string,version:string}[] $requirements Array of requirements.
44 44 */
45 45 public function __construct( $requirements = [] ) {
46 46 foreach ( $requirements as $arguments ) {
47 47 switch ( $arguments['type'] ) {
@@ -110,8 +110,10 @@
110 110 }
111 111
112 112 /**
113 113 * Render notices when appropriate.
114 + *
115 + * @return void
114 116 */
115 117 public function setup_notices() {
116 118 add_action( 'admin_notices', [ $this, 'render_notices' ] );
117 119 }
@@ -118,9 +120,9 @@
118 120
119 121 /**
120 122 * Handle individual checks by mapping them to methods.
121 123 *
122 - * @param array $check Requirement check arguments.
124 + * @param array{type:string,version:string} $check Requirement check arguments.
123 125 *
124 126 * @return bool
125 127 */
126 128 public function check_handler( $check ) {
@@ -129,9 +131,11 @@
129 131
130 132 /**
131 133 * Report failure notice to the queue.
132 134 *
133 - * @param array $check_args Array of check arguments.
135 + * @param array{type:string,version:string} $check_args Array of check arguments.
136 + *
137 + * @return void
134 138 */
135 139 public function report_failure( $check_args ) {
136 140 $this->failures[] = $check_args;
137 141 }
@@ -138,9 +142,9 @@
138 142
139 143 /**
140 144 * Get a list of failures.
141 145 *
142 - * @return array
146 + * @return array{type:string,version:string}[]
143 147 */
144 148 public function get_failures() {
145 149 return $this->failures;
146 150 }
@@ -147,9 +151,9 @@
147 151
148 152 /**
149 153 * Check PHP version against args.
150 154 *
151 - * @param array $check_args Array of args.
155 + * @param array{type:string,version:string} $check_args Array of args.
152 156 *
153 157 * @return bool
154 158 */
155 159 public function check_php( $check_args ) {
@@ -164,9 +168,9 @@
164 168
165 169 /**
166 170 * Check PHP version against args.
167 171 *
168 - * @param array $check_args Array of args.
172 + * @param array{type:string,version:string} $check_args Array of args.
169 173 *
170 174 * @return bool
171 175 */
172 176 public function check_wp( $check_args ) {
@@ -182,9 +186,9 @@
182 186
183 187 /**
184 188 * Check plugin requirements.
185 189 *
186 - * @param array $check_args Array of args.
190 + * @param array{type:string,version:string,name:string,slug:string,version:string,check_installed:bool,dep_label:string} $check_args Array of args.
187 191 *
188 192 * @return bool
189 193 */
190 194 public function check_plugin( $check_args ) {
@@ -201,9 +205,9 @@
201 205 * 4. If not installed
202 206 */
203 207 if ( true === $active ) {
204 208 // If required version is set & plugin is active, check that first.
205 - if ( isset( $check_args['version'] ) ) {
209 + if ( ! empty( $check_args['version'] ) ) {
206 210 $version = $this->get_plugin_data( $check_args['slug'], 'Version' );
207 211
208 212 // If its higher than the required version, we can bail now > true.
209 213 if ( version_compare( $version, $check_args['version'], '>=' ) ) {
@@ -297,9 +301,9 @@
297 301
298 302 /**
299 303 * Get php error message.
300 304 *
301 - * @param array $failed_check_args Check arguments.
305 + * @param array{type:string,version:string} $failed_check_args Check arguments.
302 306 *
303 307 * @return string
304 308 */
305 309 public function get_php_message( $failed_check_args ) {
@@ -313,9 +317,9 @@
313 317
314 318 /**
315 319 * Get wp error message.
316 320 *
317 - * @param array $failed_check_args Check arguments.
321 + * @param array{type:string,version:string} $failed_check_args Check arguments.
318 322 *
319 323 * @return string
320 324 */
321 325 public function get_wp_message( $failed_check_args ) {
@@ -330,9 +334,9 @@
330 334
331 335 /**
332 336 * Get plugin error message.
333 337 *
334 - * @param array $failed_check_args Get helpful error message.
338 + * @param array{type:string,version:string,name:string,slug:string,version:string,check_installed:bool,dep_label:string,not_activated?:bool|null,not_updated?:bool|null} $failed_check_args Get helpful error message.
335 339 *
336 340 * @return string
337 341 */
338 342 public function get_plugin_message( $failed_check_args ) {