Completed
Pull Request — master (#834)
by
unknown
14:39
created

lib/timber.php (31 issues)

Upgrade to new PHP Analysis Engine

These results are based on our legacy PHP analysis, consider migrating to our new PHP analysis engine instead. Learn more

1
<?php
2
3
/**
4
 * Timber Class.
5
 *
6
 * Main class called Timber for this plugin.
7
 *
8
 * Usage:
9
 *  $posts = Timber::get_posts();
10
 *  $posts = Timber::get_posts('post_type = article')
11
 *  $posts = Timber::get_posts(array('post_type' => 'article', 'category_name' => 'sports')); // uses wp_query format.
12
 *  $posts = Timber::get_posts(array(23,24,35,67), 'InkwellArticle');
13
 *
14
 *  $context = Timber::get_context(); // returns wp favorites!
15
 *  $context['posts'] = $posts;
16
 *  Timber::render('index.twig', $context);
17
 */
18
class Timber {
19
20
	public static $locations;
21
	public static $dirname;
22
	public static $twig_cache = false;
23
	public static $cache = false;
24
	public static $auto_meta = true;
25
	public static $autoescape = false;
26
27
	/**
28
	 * @codeCoverageIgnore
29
	 */
30
	public function __construct() {
31
		if ( !defined('ABSPATH') ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
32
			return;
33
		}
34
		$this->test_compatibility();
35
		$this->init_constants();
36
		$this->init();
37
	}
38
39
	/**
40
	 * Tests whether we can use Timber
41
	 * @codeCoverageIgnore
42
	 * @return
43
	 */
44
	protected function test_compatibility() {
45
		if ( is_admin() || $_SERVER['PHP_SELF'] == '/wp-login.php' ) {
0 ignored issues
show
Detected usage of a non-validated input variable: $_SERVER
Loading history...
Detected usage of a non-sanitized input variable: $_SERVER
Loading history...
46
			return;
47
		}
48
		if ( version_compare( phpversion(), '5.3.0', '<' ) && !is_admin() ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
49
			trigger_error( 'Timber requires PHP 5.3.0 or greater. You have '.phpversion(), E_USER_ERROR );
50
		}
51
		if ( !class_exists( 'Twig_Autoloader' ) ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
52
			trigger_error( 'You have not run "composer install" to download required dependencies for Timber, you can read more on https://github.com/jarednova/timber#installation', E_USER_ERROR );
53
		}
54
	}
55
56
	function init_constants() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
57
		defined( "TIMBER_LOC" ) or define( "TIMBER_LOC", realpath( __DIR__ ) );
58
	}
59
60
	/**
61
	 * @codeCoverageIgnore
62
	 */
63
	protected function init() {
64
		TimberTwig::init();
65
		TimberRoutes::init( $this );
66
		TimberImageHelper::init();
67
		TimberAdmin::init();
68
		TimberIntegrations::init();
69
	}
70
71
	/* Post Retrieval Routine
72
	================================ */
73
74
	/**
75
	 * Get post.
76
	 *
77
	 * @param mixed   $query
78
	 * @param string  $PostClass
79
	 * @return array|bool|null
80
	 */
81
	public static function get_post( $query = false, $PostClass = 'TimberPost' ) {
82
		return TimberPostGetter::get_post( $query, $PostClass );
83
	}
84
85
	/**
86
	 * Get posts.
87
	 *
88
	 * @param mixed   $query
89
	 * @param string  $PostClass
90
	 * @return array|bool|null
91
	 */
92
	public static function get_posts( $query = false, $PostClass = 'TimberPost', $return_collection = false ) {
93
		return TimberPostGetter::get_posts( $query, $PostClass, $return_collection );
94
	}
95
96
	/**
97
	 * Query post.
98
	 *
99
	 * @param mixed   $query
100
	 * @param string  $PostClass
101
	 * @return array|bool|null
102
	 */
103
	public static function query_post( $query = false, $PostClass = 'TimberPost' ) {
104
		return TimberPostGetter::query_post( $query, $PostClass );
105
	}
106
107
	/**
108
	 * Query posts.
109
	 *
110
	 * @param mixed   $query
111
	 * @param string  $PostClass
112
	 * @return array|bool|null
113
	 */
114
	public static function query_posts( $query = false, $PostClass = 'TimberPost' ) {
115
		return TimberPostGetter::query_posts( $query, $PostClass );
116
	}
117
118
	/**
119
	 * Get pids.
120
	 *
121
	 * @param array|string $query
122
	 * @return array
123
	 * @deprecated since 0.20.0
124
	 */
125
	static function get_pids( $query = null ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
126
		return TimberPostGetter::get_pids( $query );
127
	}
128
129
	/**
130
	 * Get posts from loop.
131
	 *
132
	 * @param string  $PostClass
133
	 * @return array
134
	 * @deprecated since 0.20.0
135
	 */
136
	static function get_posts_from_loop( $PostClass ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
137
		return TimberPostGetter::get_posts( $PostClass );
138
	}
139
140
	/**
141
	 * Get posts from slug.
142
	 *
143
	 * @param string  $slug
144
	 * @param string  $PostClass
145
	 * @return array
146
	 * @deprecated since 0.20.0
147
	 */
148
	static function get_posts_from_slug( $slug, $PostClass = 'TimberPost' ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
149
		return TimberPostGetter::get_posts( $slug, $PostClass );
150
	}
151
152
	/**
153
	 * Get posts from WP_Query.
154
	 *
155
	 * @param array   $query
156
	 * @param string  $PostClass
157
	 * @return array
158
	 * @deprecated since 0.20.0
159
	 */
160
	static function get_posts_from_wp_query( $query = array(), $PostClass = 'TimberPost' ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
161
		return TimberPostGetter::query_posts( $query, $PostClass );
162
	}
163
164
	/**
165
	 * Get posts from array of ids.
166
	 *
167
	 * @param array   $query
168
	 * @param string  $PostClass
169
	 * @return array|null
170
	 * @deprecated since 0.20.0
171
	 */
172
	static function get_posts_from_array_of_ids( $query = array(), $PostClass = 'TimberPost' ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
173
		return TimberPostGetter::get_posts( $query, $PostClass );
174
	}
175
176
	/**
177
	 * Get pid.
178
	 *
179
	 * @param unknown $query
180
	 * @return int
181
	 * @deprecated since 0.20.0
182
	 */
183
	static function get_pid( $query ) {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
184
		$pids = TimberPostGetter::get_pids( $query );
185
		if ( is_array( $pids ) && count( $pids ) ) {
186
			return $pids[0];
187
		}
188
	}
189
190
	/**
191
	 * WP_Query has posts.
192
	 *
193
	 * @return bool
194
	 * @deprecated since 0.20.0
195
	 */
196
	static function wp_query_has_posts() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
197
		return TimberPostGetter::wp_query_has_posts();
198
	}
199
200
	/* Term Retrieval
201
	================================ */
202
203
	/**
204
	 * Get terms.
205
	 *
206
	 * @param string|array $args
207
	 * @param array   $maybe_args
208
	 * @param string  $TermClass
209
	 * @return mixed
210
	 */
211
	public static function get_terms( $args = null, $maybe_args = array(), $TermClass = 'TimberTerm' ) {
212
		return TimberTermGetter::get_terms( $args, $maybe_args, $TermClass );
213
	}
214
215
	/* Site Retrieval
216
	================================ */
217
218
	/**
219
	 * Get sites.
220
	 *
221
	 * @param array|bool $blog_ids
222
	 * @return array
223
	 */
224
	public static function get_sites( $blog_ids = false ) {
225
		if ( !is_array( $blog_ids ) ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
226
			global $wpdb;
227
			$blog_ids = $wpdb->get_col( "SELECT blog_id FROM $wpdb->blogs ORDER BY blog_id ASC" );
0 ignored issues
show
Usage of a direct database call is discouraged.
Loading history...
Usage of a direct database call without caching is prohibited. Use wp_cache_get / wp_cache_set.
Loading history...
228
		}
229
		$return = array();
230
		foreach ( $blog_ids as $blog_id ) {
231
			$return[] = new TimberSite( $blog_id );
232
		}
233
		return $return;
234
	}
235
236
237
	/*  Template Setup and Display
238
	================================ */
239
240
	/**
241
	 * Get context.
242
	 *
243
	 * @return array
244
	 */
245
	public static function get_context() {
246
		$data = array();
247
		$data['http_host'] = 'http://' . TimberURLHelper::get_host();
248
		$data['wp_title'] = TimberHelper::get_wp_title();
249
		$data['wp_head'] = TimberHelper::function_wrapper( 'wp_head' );
250
		$data['wp_footer'] = TimberHelper::function_wrapper( 'wp_footer' );
251
		$data['body_class'] = implode( ' ', get_body_class() );
252
253
		$data['site'] = new TimberSite();
254
		$data['theme'] = $data['site']->theme;
255
		//deprecated, these should be fetched via TimberSite or TimberTheme
256
		$data['theme_dir'] = WP_CONTENT_SUBDIR.str_replace( WP_CONTENT_DIR, '', get_stylesheet_directory() );
257
		$data['language_attributes'] = TimberHelper::function_wrapper( 'language_attributes' );
258
		$data['stylesheet_uri'] = get_stylesheet_uri();
259
		$data['template_uri'] = get_template_directory_uri();
260
261
		$data['posts'] = Timber::query_posts();
262
263
		//deprecated, this should be fetched via TimberMenu
264
		if ( function_exists( 'wp_nav_menu' ) ) {
265
			$locations = get_nav_menu_locations();
266
			if ( count( $locations ) ) {
267
				$data['wp_nav_menu'] = wp_nav_menu( array( 'container_class' => 'menu-header', 'echo' => false, 'menu_class' => 'nav-menu' ) );
268
			}
269
		}
270
		$data = apply_filters( 'timber_context', $data );
271
		$data = apply_filters( 'timber/context', $data );
272
		return $data;
273
	}
274
275
	/**
276
	 * Compile function.
277
	 *
278
	 * @param array   $filenames
279
	 * @param array   $data
280
	 * @param bool    $expires
281
	 * @param string  $cache_mode
282
	 * @param bool    $via_render
283
	 * @return bool|string
284
	 */
285
	public static function compile( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT, $via_render = false ) {
286
		$caller = self::get_calling_script_dir();
287
		$caller_file = self::get_calling_script_file();
288
		$caller_file = apply_filters( 'timber_calling_php_file', $caller_file );
289
		$loader = new TimberLoader( $caller );
290
		$file = $loader->choose_template( $filenames );
291
		$output = '';
292
		if ( is_null( $data ) ) {
293
			$data = array();
294
		}
295
		if ( strlen( $file ) ) {
296
			if ( $via_render ) {
297
				$file = apply_filters( 'timber_render_file', $file );
298
				$data = apply_filters( 'timber_render_data', $data );
299
			} else {
300
				$file = apply_filters( 'timber_compile_file', $file );
301
				$data = apply_filters( 'timber_compile_data', $data );
302
			}
303
			$output = $loader->render( $file, $data, $expires, $cache_mode );
304
		}
305
		do_action( 'timber_compile_done' );
306
		return $output;
307
	}
308
309
	/**
310
	 * Compile string.
311
	 *
312
	 * @param string  $string a string with twig variables.
313
	 * @param array   $data   an array with data in it.
314
	 * @return  bool|string
315
	 */
316
	public static function compile_string( $string, $data = array() ) {
317
		$dummy_loader = new TimberLoader();
318
		$dummy_loader->get_twig();
319
		$loader = new Twig_Loader_String();
320
		$twig = new Twig_Environment( $loader );
321
		$twig = apply_filters( 'timber/twig/filters', $twig );
322
		$twig = apply_filters( 'twig_apply_filters', $twig );
323
		return $twig->render( $string, $data );
324
	}
325
326
	/**
327
	 * Fetch function.
328
	 *
329
	 * @param array   $filenames
330
	 * @param array   $data
331
	 * @param bool    $expires
332
	 * @param string  $cache_mode
333
	 * @return bool|string
334
	 */
335
	public static function fetch( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT ) {
336
		if ( $expires === true ) {
0 ignored issues
show
Found "=== true". Use Yoda Condition checks, you must
Loading history...
337
			//if this is reading as true; the user probably is using the old $echo param
338
			//so we should move all vars up by a spot
339
			$expires = $cache_mode;
340
			$cache_mode = TimberLoader::CACHE_USE_DEFAULT;
341
		}
342
		$output = self::compile( $filenames, $data, $expires, $cache_mode, true );
0 ignored issues
show
It seems like $expires defined by $cache_mode on line 339 can also be of type string; however, Timber::compile() does only seem to accept boolean, maybe add an additional type check?

If a method or function can return multiple different values and unless you are sure that you only can receive a single value in this context, we recommend to add an additional type check:

/**
 * @return array|string
 */
function returnsDifferentValues($x) {
    if ($x) {
        return 'foo';
    }

    return array();
}

$x = returnsDifferentValues($y);
if (is_array($x)) {
    // $x is an array.
}

If this a common case that PHP Analyzer should handle natively, please let us know by opening an issue.

Loading history...
343
		$output = apply_filters( 'timber_compile_result', $output );
344
		return $output;
345
	}
346
347
	/**
348
	 * Render function.
349
	 *
350
	 * @param array   $filenames
351
	 * @param array   $data
352
	 * @param bool    $expires
353
	 * @param string  $cache_mode
354
	 * @return bool|string
355
	 */
356
	public static function render( $filenames, $data = array(), $expires = false, $cache_mode = TimberLoader::CACHE_USE_DEFAULT ) {
357
		$output = static::fetch( $filenames, $data, $expires, $cache_mode );
358
		echo $output;
0 ignored issues
show
Expected next thing to be a escaping function, not '$output'
Loading history...
359
		return $output;
360
	}
361
362
	/**
363
	 * Render string.
364
	 *
365
	 * @param string  $string a string with twig variables.
366
	 * @param array   $data   an array with data in it.
367
	 * @return  bool|string
368
	 */
369
	public static function render_string( $string, $data = array() ) {
370
		$compiled = self::compile_string( $string, $data );
371
		echo $compiled;
0 ignored issues
show
Expected next thing to be a escaping function, not '$compiled'
Loading history...
372
		return $compiled;
373
	}
374
375
376
	/*  Sidebar
377
	================================ */
378
379
	/**
380
	 * Get sidebar.
381
	 *
382
	 * @param string  $sidebar
383
	 * @param array   $data
384
	 * @return bool|string
385
	 */
386
	public static function get_sidebar( $sidebar = '', $data = array() ) {
387
		if ( $sidebar == '' ) {
388
			$sidebar = 'sidebar.php';
389
		}
390
		if ( strstr( strtolower( $sidebar ), '.php' ) ) {
391
			return self::get_sidebar_from_php( $sidebar, $data );
392
		}
393
		return self::compile( $sidebar, $data );
394
	}
395
396
	/**
397
	 * Get sidebar from PHP
398
	 *
399
	 * @param string  $sidebar
400
	 * @param array   $data
401
	 * @return string
402
	 */
403
	public static function get_sidebar_from_php( $sidebar = '', $data ) {
404
		$caller = self::get_calling_script_dir();
405
		$loader = new TimberLoader();
406
		$uris = $loader->get_locations( $caller );
407
		ob_start();
408
		$found = false;
409
		foreach ( $uris as $uri ) {
410
			if ( file_exists( trailingslashit( $uri ) . $sidebar ) ) {
411
				include trailingslashit( $uri ) . $sidebar;
412
				$found = true;
413
				break;
414
			}
415
		}
416
		if ( !$found ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
417
			TimberHelper::error_log( 'error loading your sidebar, check to make sure the file exists' );
418
		}
419
		$ret = ob_get_contents();
420
		ob_end_clean();
421
		return $ret;
422
	}
423
424
	/* Widgets
425
	================================ */
426
427
	/**
428
	 * Get widgets.
429
	 *
430
	 * @param int     $widget_id
431
	 * @return TimberFunctionWrapper
432
	 */
433
	public static function get_widgets( $widget_id ) {
434
		return TimberHelper::function_wrapper( 'dynamic_sidebar', array( $widget_id ), true );
435
	}
436
437
438
	/*  Routes
439
	================================ */
440
441
	/**
442
	 * Add route.
443
	 *
444
	 * @param string  $route
445
	 * @param callable $callback
446
	 * @param array   $args
447
	 * @deprecated since 0.20.0
448
	 */
449
	public static function add_route( $route, $callback, $args = array() ) {
450
		Routes::map( $route, $callback, $args );
451
	}
452
453
	/**
454
	 * @deprecated since 0.22.2
455
	 */
456
	public function cancel_query() {
457
		add_action( 'posts_request', array( $this, 'cancel_query_posts_request' ) );
458
	}
459
460
	/**
461
	 * @deprecated since 0.22.2
462
	 */
463
	function cancel_query_posts_request() {
0 ignored issues
show
It is generally recommended to explicitly declare the visibility for methods.

Adding explicit visibility (private, protected, or public) is generally recommend to communicate to other developers how, and from where this method is intended to be used.

Loading history...
464
		if ( is_main_query() ) {
465
			wp_reset_query();
466
		}
467
	}
468
469
	/**
470
	 * Load template.
471
	 *
472
	 * @deprecated since 0.20.0
473
	 */
474
	public static function load_template( $template, $query = false, $status_code = 200, $tparams = false ) {
475
		return Routes::load( $template, $tparams, $query, $status_code );
476
	}
477
478
	/**
479
	 * Load view.
480
	 *
481
	 * @deprecated since 0.20.2
482
	 */
483
	public static function load_view( $template, $query = false, $status_code = 200, $tparams = false ) {
484
		return Routes::load( $template, $tparams, $query, $status_code );
485
	}
486
487
488
	/*  Pagination
489
	================================ */
490
491
	/**
492
	 * Get pagination.
493
	 *
494
	 * @param array   $prefs
495
	 * @return array mixed
496
	 */
497
	public static function get_pagination( $prefs = array() ) {
498
		global $wp_query;
499
		global $paged;
500
		global $wp_rewrite;
501
		$args = array();
502
		$args['total'] = ceil( $wp_query->found_posts / $wp_query->query_vars['posts_per_page'] );
503
		if ( $wp_rewrite->using_permalinks() ) {
504
			$url = explode( '?', get_pagenum_link( 0 ) );
505
			if ( isset( $url[1] ) ) {
506
				parse_str( $url[1], $query );
507
				$args['add_args'] = $query;
508
			}
509
			$args['format'] = 'page/%#%';
510
			$args['base'] = trailingslashit( $url[0] ).'%_%';
511
		} else {
512
			$big = 999999999;
513
			$args['base'] = str_replace( $big, '%#%', esc_url( get_pagenum_link( $big ) ) );
514
		}
515
		$args['type'] = 'array';
516
		$args['current'] = max( 1, get_query_var( 'paged' ) );
517
		$args['mid_size'] = max( 9 - $args['current'], 3 );
518
		if ( is_int( $prefs ) ) {
519
			$args['mid_size'] = $prefs - 2;
520
		} else {
521
			$args = array_merge( $args, $prefs );
522
		}
523
		$data = array();
524
		$data['current'] = $args['current'];
525
		$data['total'] = $args['total'];
526
		$data['pages'] = TimberHelper::paginate_links( $args );
0 ignored issues
show
$args is of type array, but the function expects a string.

It seems like the type of the argument is not accepted by the function/method which you are calling.

In some cases, in particular if PHP’s automatic type-juggling kicks in this might be fine. In other cases, however this might be a bug.

We suggest to add an explicit type cast like in the following example:

function acceptsInteger($int) { }

$x = '123'; // string "123"

// Instead of
acceptsInteger($x);

// we recommend to use
acceptsInteger((integer) $x);
Loading history...
527
		$next = get_next_posts_page_link( $args['total'] );
528
		if ( $next ) {
529
			$data['next'] = array( 'link' => untrailingslashit( $next ), 'class' => 'page-numbers next' );
530
		}
531
		$prev = previous_posts( false );
532
		if ( $prev ) {
533
			$data['prev'] = array( 'link' => untrailingslashit( $prev ), 'class' => 'page-numbers prev' );
534
		}
535
		if ( $paged < 2 ) {
536
			$data['prev'] = '';
537
		}
538
		return $data;
539
	}
540
541
	/*  Utility
542
	================================ */
543
544
	/**
545
	 * Get calling script path.
546
	 *
547
	 * @param int     $offset
548
	 * @return string
549
	 * @deprecated since 0.20.0
550
	 */
551
	public static function get_calling_script_path( $offset = 0 ) {
552
		$dir = self::get_calling_script_dir( $offset );
553
		return str_replace( ABSPATH, '', realpath( $dir ) );
554
	}
555
556
	/**
557
	 * Get calling script dir.
558
	 *
559
	 * @return string
560
	 */
561
	public static function get_calling_script_dir( $offset = 0 ) {
562
		$caller = self::get_calling_script_file( $offset );
0 ignored issues
show
Deprecated Code introduced by
The method Timber::get_calling_script_file() has been deprecated with message: since 0.20.0

This method has been deprecated. The supplier of the class has supplied an explanatory message.

The explanatory message should give you some clue as to whether and when the method will be removed from the class and what other method or class to use instead.

Loading history...
563
		if ( !is_null( $caller ) ) {
0 ignored issues
show
Expected 1 space after "!"; 0 found
Loading history...
564
			$pathinfo = pathinfo( $caller );
565
			$dir = $pathinfo['dirname'];
566
			return $dir;
567
		}
568
	}
569
570
	/**
571
	 * Get calling script file.
572
	 *
573
	 * @param int     $offset
574
	 * @return string|null
575
	 * @deprecated since 0.20.0
576
	 */
577
	public static function get_calling_script_file( $offset = 0 ) {
578
		$caller = null;
579
		$backtrace = debug_backtrace();
580
		$i = 0;
581
		foreach ( $backtrace as $trace ) {
582
			if ( array_key_exists('file', $trace) && $trace['file'] != __FILE__ ) {
0 ignored issues
show
Expected 1 spaces after opening bracket; 0 found
Loading history...
Expected 1 spaces before closing bracket; 0 found
Loading history...
583
				$caller = $trace['file'];
584
				break;
585
			}
586
			$i++;
587
		}
588
		if ( $offset ) {
589
			$caller = $backtrace[$i + $offset]['file'];
0 ignored issues
show
Array keys should be surrounded by spaces unless they contain a string or an integer.
Loading history...
590
		}
591
		return $caller;
592
	}
593
594
	/**
595
	 * Is post class or class map.
596
	 *
597
	 * @param string|array $args
598
	 * @return bool
0 ignored issues
show
Should the return type not be boolean|null?

This check compares the return type specified in the @return annotation of a function or method doc comment with the types returned by the function and raises an issue if they mismatch.

Loading history...
599
	 * @deprecated since 0.20.0
600
	 */
601
	public static function is_post_class_or_class_map( $args ) {
602
		return TimberPostGetter::is_post_class_or_class_map( $args );
603
	}
604
605
}
606