Skip to content

Commit 927630b

Browse files
committed
Merge branch 'master' of github.com:szepeviktor/phpstan-wordpress
2 parents c98c46d + 65c6e9f commit 927630b

File tree

3 files changed

+308
-1
lines changed

3 files changed

+308
-1
lines changed

.editorconfig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ indent_style = space
1111
indent_size = 4
1212

1313
[*.{xml,xml.dist}]
14-
indent_style = tab
14+
indent_style = space
1515
indent_size = 4
1616

1717
[*.{neon,neon.dist}]
Lines changed: 147 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,147 @@
1+
<?php
2+
/**
3+
* Value object for displaying navigation menus.
4+
*
5+
* Created to aid static analysis by PHPStan.
6+
*
7+
* @package WordPress
8+
* @see wp_nav_menu()
9+
*/
10+
11+
/**
12+
* Nav menu arguments extending stdClass.
13+
*/
14+
class WP_Nav_Menu_Args extends stdClass {
15+
16+
/**
17+
* Desired menu. Accepts a menu ID, slug, name, or object. Default empty.
18+
*
19+
* @var int|string|\WP_Term
20+
*/
21+
public $menu;
22+
23+
/**
24+
* CSS class to use for the ul element which forms the menu. Default 'menu'.
25+
*
26+
* @var string
27+
*/
28+
public $menu_class;
29+
30+
/**
31+
* The ID that is applied to the ul element which forms the menu.
32+
* Default is the menu slug, incremented.
33+
*
34+
* @var string
35+
*/
36+
public $menu_id;
37+
38+
/**
39+
* Whether to wrap the ul, and what to wrap it with. Default 'div'.
40+
*
41+
* @var string
42+
*/
43+
public $container;
44+
45+
/**
46+
* Class that is applied to the container. Default 'menu-{menu slug}-container'.
47+
*
48+
* @var string
49+
*/
50+
public $container_class;
51+
52+
/**
53+
* The ID that is applied to the container. Default empty.
54+
*
55+
* @var string
56+
*/
57+
public $container_id;
58+
59+
/**
60+
* The aria-label attribute that is applied to the container when it's a nav element.
61+
*
62+
* @var string
63+
*/
64+
public $container_aria_label;
65+
66+
/**
67+
* If the menu doesn't exists, a callback function will fire.
68+
* Default is 'wp_page_menu'. Set to false for no fallback.
69+
*
70+
* @var callable|bool
71+
*/
72+
public $fallback_cb;
73+
74+
/**
75+
* Text before the link markup. Default empty.
76+
*
77+
* @var string
78+
*/
79+
public $before;
80+
81+
/**
82+
* Text after the link markup. Default empty.
83+
*
84+
* @var string
85+
*/
86+
public $after;
87+
88+
/**
89+
* Text before the link text. Default empty.
90+
*
91+
* @var string
92+
*/
93+
public $link_before;
94+
95+
/**
96+
* Text after the link text. Default empty.
97+
*
98+
* @var string
99+
*/
100+
public $link_after;
101+
102+
/**
103+
* Whether to echo the menu or return it. Default true.
104+
*
105+
* @var bool
106+
*/
107+
public $echo;
108+
109+
/**
110+
* How many levels of the hierarchy are to be included. 0 means all.
111+
* Default 0.
112+
*
113+
* @var int
114+
*/
115+
public $depth;
116+
117+
/**
118+
* Instance of a custom walker class. Default empty.
119+
*
120+
* @var \Walker_Nav_Menu
121+
*/
122+
public $walker;
123+
124+
/**
125+
* Theme location to be used. Must be registered with register_nav_menu()
126+
* in order to be selectable by the user.
127+
*
128+
* @var string
129+
*/
130+
public $theme_location;
131+
132+
/**
133+
* How the list items should be wrapped. Default is a ul with an id and class.
134+
* Uses printf() format with numbered placeholders.
135+
*
136+
* @var string
137+
*/
138+
public $items_wrap;
139+
140+
/**
141+
* Whether to preserve whitespace within the menu's HTML. Accepts 'preserve' or 'discard'.
142+
* Default 'preserve'.
143+
*
144+
* @var string
145+
*/
146+
public $item_spacing;
147+
}
Lines changed: 160 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,160 @@
1+
<?php
2+
/**
3+
* Value object for nav menu item objects.
4+
*
5+
* Created to aid static analysis by PHPStan.
6+
*
7+
* @package WordPress
8+
* @see wp_setup_nav_menu_item()
9+
*/
10+
11+
/**
12+
* Extends *final* WP_Post class with the shared navigation menu item properties.
13+
*/
14+
class WP_Nav_Menu_Item extends WP_Post {
15+
16+
/**
17+
* The term_id if the menu item represents a taxonomy term.
18+
*
19+
* @overrides WP_Post
20+
* @var int
21+
*/
22+
public $ID;
23+
24+
/**
25+
* The title attribute of the link element for this menu item.
26+
*
27+
* @var string
28+
*/
29+
public $attr_title;
30+
31+
/**
32+
* The array of class attribute values for the link element of this menu item.
33+
*
34+
* @var array
35+
*/
36+
public $classes;
37+
38+
/**
39+
* The DB ID of this item as a nav_menu_item object, if it exists (0 if it doesn't exist).
40+
*
41+
* @var int
42+
*/
43+
public $db_id;
44+
45+
/**
46+
* The description of this menu item.
47+
*
48+
* @var string
49+
*/
50+
public $description;
51+
52+
/**
53+
* The DB ID of the nav_menu_item that is this item's menu parent, if any. 0 otherwise.
54+
*
55+
* @var int
56+
*/
57+
public $menu_item_parent;
58+
59+
/**
60+
* The type of object originally represented, such as "category," "post", or "attachment."
61+
*
62+
* @var string
63+
*/
64+
public $object;
65+
66+
/**
67+
* The DB ID of the original object this menu item represents,
68+
* e.g. ID for posts and term_id for categories.
69+
*
70+
* @var int
71+
*/
72+
public $object_id;
73+
74+
/**
75+
* The DB ID of the original object's parent object, if any (0 otherwise).
76+
*
77+
* @overrides WP_Post
78+
* @var int
79+
*/
80+
public $post_parent;
81+
82+
/**
83+
* A "no title" label if menu item represents a post that lacks a title.
84+
*
85+
* @overrides WP_Post
86+
* @var string
87+
*/
88+
public $post_title;
89+
90+
/**
91+
* The target attribute of the link element for this menu item.
92+
*
93+
* @var string
94+
*/
95+
public $target;
96+
97+
/**
98+
* The title of this menu item.
99+
*
100+
* @var string
101+
*/
102+
public $title;
103+
104+
/**
105+
* The family of objects originally represented, such as "post_type" or "taxonomy."
106+
*
107+
* @var string
108+
*/
109+
public $type;
110+
111+
/**
112+
* The singular label used to describe this type of menu item.
113+
*
114+
* @var string
115+
*/
116+
public $type_label;
117+
118+
/**
119+
* The URL to which this menu item points.
120+
*
121+
* @var string
122+
*/
123+
public $url;
124+
125+
/**
126+
* The XFN relationship expressed in the link of this menu item.
127+
*
128+
* @var string
129+
*/
130+
public $xfn;
131+
132+
/**
133+
* Whether the menu item represents an object that no longer exists.
134+
*
135+
* @var bool
136+
*/
137+
public $_invalid; // phpcs:ignore PSR2.Classes.PropertyDeclaration.Underscore
138+
139+
/**
140+
* Whether the menu item represents the active menu item.
141+
*
142+
* @var bool
143+
*/
144+
public $current;
145+
146+
/**
147+
* Whether the menu item represents an parent menu item.
148+
*
149+
* @var bool
150+
*/
151+
public $current_item_parent;
152+
153+
/**
154+
* Whether the menu item represents an ancestor menu item.
155+
*
156+
* @var bool
157+
*/
158+
public $current_item_ancestor;
159+
160+
}

0 commit comments

Comments
 (0)