|
| 1 | +<?php |
| 2 | + |
| 3 | +declare(strict_types=1); |
| 4 | + |
| 5 | +namespace SzepeViktor\PHPStan\WordPress\Tests; |
| 6 | + |
| 7 | +use function PHPStan\Testing\assertType; |
| 8 | + |
| 9 | +// Default value of true |
| 10 | +assertType('void', comment_class()); |
| 11 | +assertType('void', edit_term_link()); |
| 12 | +assertType('void', get_calendar()); |
| 13 | +assertType('void', next_posts()); |
| 14 | +assertType('void', post_type_archive_title()); |
| 15 | +assertType('void', previous_posts()); |
| 16 | +assertType('void', single_cat_title()); |
| 17 | +assertType('void', single_post_title()); |
| 18 | +assertType('void', single_tag_title()); |
| 19 | +assertType('void', single_term_title()); |
| 20 | +assertType('void', the_date()); |
| 21 | +assertType('void', the_modified_date()); |
| 22 | +assertType('void', wp_loginout()); |
| 23 | +assertType('void', wp_register()); |
| 24 | +assertType('void', wp_title()); |
| 25 | + |
| 26 | +// Explicit value of true |
| 27 | +$value = true; |
| 28 | +assertType('void', comment_class('', null, null, $value)); |
| 29 | +assertType('void', edit_term_link('', '', '', null, $value)); |
| 30 | +assertType('void', get_calendar(true, $value)); |
| 31 | +assertType('void', next_posts(0, $value)); |
| 32 | +assertType('void', post_type_archive_title('', $value)); |
| 33 | +assertType('void', previous_posts($value)); |
| 34 | +assertType('void', single_cat_title('', $value)); |
| 35 | +assertType('void', single_post_title('', $value)); |
| 36 | +assertType('void', single_tag_title('', $value)); |
| 37 | +assertType('void', single_term_title('', $value)); |
| 38 | +assertType('void', the_date('', '', '', $value)); |
| 39 | +assertType('void', the_modified_date('', '', '', $value)); |
| 40 | +assertType('void', wp_loginout('', $value)); |
| 41 | +assertType('void', wp_register('', '', $value)); |
| 42 | +assertType('void', wp_title('', $value)); |
| 43 | + |
| 44 | +// Explicit value of false |
| 45 | +$value = false; |
| 46 | +assertType('string', comment_class('', null, null, $value)); |
| 47 | +assertType('string', edit_term_link('', '', '', null, $value)); |
| 48 | +assertType('string', get_calendar(true, $value)); |
| 49 | +assertType('string', next_posts(0, $value)); |
| 50 | +assertType('string', post_type_archive_title('', $value)); |
| 51 | +assertType('string', previous_posts(false)); |
| 52 | +assertType('string', single_cat_title('', $value)); |
| 53 | +assertType('string', single_post_title('', $value)); |
| 54 | +assertType('string', single_tag_title('', $value)); |
| 55 | +assertType('string', single_term_title('', $value)); |
| 56 | +assertType('string', the_date('', '', '', $value)); |
| 57 | +assertType('string', the_modified_date('', '', '', $value)); |
| 58 | +assertType('string', wp_loginout('', $value)); |
| 59 | +assertType('string', wp_register('', '', $value)); |
| 60 | +assertType('string', wp_title('', $value)); |
| 61 | + |
| 62 | +// Unknown value |
| 63 | +$value = isset($_GET['foo']); |
| 64 | +assertType('string|void', comment_class('', null, null, $value)); |
| 65 | +assertType('string|void', edit_term_link('', '', '', null, $value)); |
| 66 | +assertType('string|void', get_calendar(true, $value)); |
| 67 | +assertType('string|void', next_posts(0, $value)); |
| 68 | +assertType('string|void', post_type_archive_title('', $value)); |
| 69 | +assertType('string|void', previous_posts($value)); |
| 70 | +assertType('string|void', single_cat_title('', $value)); |
| 71 | +assertType('string|void', single_post_title('', $value)); |
| 72 | +assertType('string|void', single_tag_title('', $value)); |
| 73 | +assertType('string|void', single_term_title('', $value)); |
| 74 | +assertType('string|void', the_date('', '', '', $value)); |
| 75 | +assertType('string|void', the_modified_date('', '', '', $value)); |
| 76 | +assertType('string|void', wp_loginout('', $value)); |
| 77 | +assertType('string|void', wp_register('', '', $value)); |
| 78 | +assertType('string|void', wp_title('', $value)); |
0 commit comments