@@ -24,15 +24,15 @@ class Tests_got_url_rewrite extends WP_UnitTestCase {
2424 * @param bool $iis7_perm Whether IIS7 supports permalinks (simulated).
2525 * @param bool|null $filter_val Optional value for the 'got_url_rewrite' filter.
2626 */
27- public function test_got_url_rewrite ( $ expected , $ mod_rewrite , $ is_nginx , $ is_caddy , $ iis7_perm , $ filter_val = null ) {
27+ public function test_got_url_rewrite ( $ expected , $ mod_rewrite , $ is_nginx_val , $ is_caddy_val , $ iis7_perm , $ filter_val = null ) {
2828 global $ is_nginx , $ is_caddy ;
2929
3030 // Backup globals.
3131 $ prev_nginx = $ is_nginx ;
3232 $ prev_caddy = $ is_caddy ;
3333
34- $ is_nginx = $ is_nginx ;
35- $ is_caddy = $ is_caddy ;
34+ $ is_nginx = $ is_nginx_val ;
35+ $ is_caddy = $ is_caddy_val ;
3636
3737 // Mock got_mod_rewrite and iis7_supports_permalinks via filters if possible.
3838 // However, got_url_rewrite calls got_mod_rewrite() which calls apache_mod_loaded.
@@ -58,21 +58,30 @@ public function test_got_url_rewrite( $expected, $mod_rewrite, $is_nginx, $is_ca
5858 $ is_caddy = $ prev_caddy ;
5959 }
6060
61- /**
62- * Data provider for test_got_url_rewrite.
63- *
64- * @return array[] {
65- * @type bool $expected The expected result.
66- * @type bool $mod_rewrite Whether mod_rewrite is supported.
67- * @type bool $is_nginx Whether server is nginx.
68- * @type bool $is_caddy Whether server is Caddy.
69- * @type bool $iis7_perm Whether IIS7 supports permalinks.
70- * @type bool|null $filter_val Optional filter value.
71- * }
72- */
61+ /**
62+ * Data provider for test_got_url_rewrite.
63+ *
64+ * @return array[] {
65+ * @type bool $expected The expected result.
66+ * @type bool $mod_rewrite Whether mod_rewrite is supported.
67+ * @type bool $is_nginx Whether server is nginx.
68+ * @type bool $is_caddy Whether server is Caddy.
69+ * @type bool $iis7_perm Whether IIS7 supports permalinks.
70+ * @type bool|null $filter_val Optional filter value.
71+ * }
72+ *
73+ * @phpstan-return array<string, array{
74+ * expected: bool,
75+ * mod_rewrite: bool,
76+ * is_nginx: bool,
77+ * is_caddy: bool,
78+ * iis7_perm: bool,
79+ * filter_val?: bool|null,
80+ * }>
81+ */
7382 public function data_got_url_rewrite () {
7483 return array (
75- 'All false ' => array (
84+ 'All false ' => array (
7685 'expected ' => false ,
7786 'mod_rewrite ' => false ,
7887 'is_nginx ' => false ,
@@ -86,29 +95,29 @@ public function data_got_url_rewrite() {
8695 'is_caddy ' => false ,
8796 'iis7_perm ' => false ,
8897 ),
89- 'Nginx supported ' => array (
98+ 'Nginx supported ' => array (
9099 'expected ' => true ,
91100 'mod_rewrite ' => false ,
92101 'is_nginx ' => true ,
93102 'is_caddy ' => false ,
94103 'iis7_perm ' => false ,
95104 ),
96- 'Caddy supported ' => array (
105+ 'Caddy supported ' => array (
97106 'expected ' => true ,
98107 'mod_rewrite ' => false ,
99108 'is_nginx ' => false ,
100109 'is_caddy ' => true ,
101110 'iis7_perm ' => false ,
102111 ),
103- 'Filter overrides to true ' => array (
112+ 'Filter overrides to true ' => array (
104113 'expected ' => true ,
105114 'mod_rewrite ' => false ,
106115 'is_nginx ' => false ,
107116 'is_caddy ' => false ,
108117 'iis7_perm ' => false ,
109118 'filter_val ' => true ,
110119 ),
111- 'Filter overrides to false ' => array (
120+ 'Filter overrides to false ' => array (
112121 'expected ' => false ,
113122 'mod_rewrite ' => true ,
114123 'is_nginx ' => true ,
0 commit comments