@@ -22,14 +22,17 @@ trait MarkupAssertionsTrait
2222 *
2323 * @since 1.0.0
2424 *
25- * @param string $selector A query selector for the element to find .
26- * @param string $markup The output that should contain the $selector.
27- * @param string $message A message to display if the assertion fails.
25+ * @param string|array<string, scalar> $selector A query selector to search for .
26+ * @param string $markup The output that should contain the $selector.
27+ * @param string $message A message to display if the assertion fails.
2828 *
2929 * @return void
3030 */
31- public function assertContainsSelector ($ selector , $ markup = '' , $ message = '' )
32- {
31+ public function assertContainsSelector (
32+ $ selector ,
33+ string $ markup = '' ,
34+ string $ message = ''
35+ ) {
3336 $ constraint = new ContainsSelector (new Selector ($ selector ));
3437
3538 static ::assertThat ($ markup , $ constraint , $ message );
@@ -40,14 +43,17 @@ public function assertContainsSelector($selector, $markup = '', $message = '')
4043 *
4144 * @since 1.0.0
4245 *
43- * @param string $selector A query selector for the element to find .
44- * @param string $markup The output that should not contain the $selector.
45- * @param string $message A message to display if the assertion fails.
46+ * @param string|array<string, scalar> $selector A query selector to search for .
47+ * @param string $markup The output that should not contain the $selector.
48+ * @param string $message A message to display if the assertion fails.
4649 *
4750 * @return void
4851 */
49- public function assertNotContainsSelector ($ selector , $ markup = '' , $ message = '' )
50- {
52+ public function assertNotContainsSelector (
53+ $ selector ,
54+ string $ markup = '' ,
55+ string $ message = ''
56+ ) {
5157 $ constraint = new LogicalNot (new ContainsSelector (new Selector ($ selector )));
5258
5359 static ::assertThat ($ markup , $ constraint , $ message );
@@ -58,15 +64,19 @@ public function assertNotContainsSelector($selector, $markup = '', $message = ''
5864 *
5965 * @since 1.0.0
6066 *
61- * @param int $count The number of matching elements expected.
62- * @param string $selector A query selector for the element to find .
63- * @param string $markup The markup to run the assertion against.
64- * @param string $message A message to display if the assertion fails.
67+ * @param int $count The number of matching elements expected.
68+ * @param string|array<string, scalar> $selector A query selector to search for .
69+ * @param string $markup The markup to run the assertion against.
70+ * @param string $message A message to display if the assertion fails.
6571 *
6672 * @return void
6773 */
68- public function assertSelectorCount ($ count , $ selector , $ markup = '' , $ message = '' )
69- {
74+ public function assertSelectorCount (
75+ int $ count ,
76+ $ selector ,
77+ string $ markup = '' ,
78+ string $ message = ''
79+ ) {
7080 $ constraint = new SelectorCount (new Selector ($ selector ), $ count );
7181
7282 static ::assertThat ($ markup , $ constraint , $ message );
@@ -85,8 +95,11 @@ public function assertSelectorCount($count, $selector, $markup = '', $message =
8595 *
8696 * @return void
8797 */
88- public function assertHasElementWithAttributes ($ attributes = [], $ markup = '' , $ message = '' )
89- {
98+ public function assertHasElementWithAttributes (
99+ array $ attributes = [],
100+ string $ markup = '' ,
101+ string $ message = ''
102+ ) {
90103 $ constraint = new ContainsSelector (new Selector ($ attributes ));
91104
92105 static ::assertThat ($ markup , $ constraint , $ message );
@@ -105,8 +118,11 @@ public function assertHasElementWithAttributes($attributes = [], $markup = '', $
105118 *
106119 * @return void
107120 */
108- public function assertNotHasElementWithAttributes ($ attributes = [], $ markup = '' , $ message = '' )
109- {
121+ public function assertNotHasElementWithAttributes (
122+ $ attributes = [],
123+ $ markup = '' ,
124+ $ message = ''
125+ ) {
110126 $ constraint = new LogicalNot (new ContainsSelector (new Selector ($ attributes )));
111127
112128 static ::assertThat ($ markup , $ constraint , $ message );
@@ -117,15 +133,19 @@ public function assertNotHasElementWithAttributes($attributes = [], $markup = ''
117133 *
118134 * @since 1.1.0
119135 *
120- * @param string $contents The string to look for within the DOM node's contents.
121- * @param string $selector A query selector for the element to find .
122- * @param string $markup The output that should contain the $selector.
123- * @param string $message A message to display if the assertion fails.
136+ * @param string $contents The string to look for within the DOM node's contents.
137+ * @param string|array<string, scalar> $selector A query selector to search for .
138+ * @param string $markup The output that should contain the $selector.
139+ * @param string $message A message to display if the assertion fails.
124140 *
125141 * @return void
126142 */
127- public function assertElementContains ($ contents , $ selector = '' , $ markup = '' , $ message = '' )
128- {
143+ public function assertElementContains (
144+ string $ contents ,
145+ $ selector = '' ,
146+ string $ markup = '' ,
147+ string $ message = ''
148+ ) {
129149 $ constraint = new ElementContainsString (new Selector ($ selector ), $ contents );
130150
131151 static ::assertThat ($ markup , $ constraint , $ message );
@@ -136,15 +156,19 @@ public function assertElementContains($contents, $selector = '', $markup = '', $
136156 *
137157 * @since 1.1.0
138158 *
139- * @param string $contents The string to look for within the DOM node's contents.
140- * @param string $selector A query selector for the element to find .
141- * @param string $markup The output that should not contain the $selector.
142- * @param string $message A message to display if the assertion fails.
159+ * @param string $contents The string to look for within the DOM node's contents.
160+ * @param string|array<string, scalar> $selector A query selector to search for .
161+ * @param string $markup The output that should not contain the $selector.
162+ * @param string $message A message to display if the assertion fails.
143163 *
144164 * @return void
145165 */
146- public function assertElementNotContains ($ contents , $ selector = '' , $ markup = '' , $ message = '' )
147- {
166+ public function assertElementNotContains (
167+ string $ contents ,
168+ $ selector = '' ,
169+ string $ markup = '' ,
170+ string $ message = ''
171+ ) {
148172 $ constraint = new LogicalNot (new ElementContainsString (new Selector ($ selector ), $ contents ));
149173
150174 static ::assertThat ($ markup , $ constraint , $ message );
@@ -155,15 +179,19 @@ public function assertElementNotContains($contents, $selector = '', $markup = ''
155179 *
156180 * @since 1.1.0
157181 *
158- * @param string $regexp The regular expression pattern to look for within the DOM node.
159- * @param string $selector A query selector for the element to find .
160- * @param string $markup The output that should contain the $selector.
161- * @param string $message A message to display if the assertion fails.
182+ * @param string $regexp The regular expression pattern to look for within the DOM node.
183+ * @param string|array<string, scalar> $selector A query selector to search for .
184+ * @param string $markup The output that should contain the $selector.
185+ * @param string $message A message to display if the assertion fails.
162186 *
163187 * @return void
164188 */
165- public function assertElementRegExp ($ regexp , $ selector = '' , $ markup = '' , $ message = '' )
166- {
189+ public function assertElementRegExp (
190+ string $ regexp ,
191+ $ selector = '' ,
192+ string $ markup = '' ,
193+ string $ message = ''
194+ ) {
167195 $ constraint = new ElementMatchesRegExp (new Selector ($ selector ), $ regexp );
168196
169197 static ::assertThat ($ markup , $ constraint , $ message );
@@ -174,15 +202,19 @@ public function assertElementRegExp($regexp, $selector = '', $markup = '', $mess
174202 *
175203 * @since 1.1.0
176204 *
177- * @param string $regexp The regular expression pattern to look for within the DOM node.
178- * @param string $selector A query selector for the element to find .
179- * @param string $markup The output that should not contain the $selector.
180- * @param string $message A message to display if the assertion fails.
205+ * @param string $regexp The regular expression pattern to look for within the DOM node.
206+ * @param string|array<string, scalar> $selector A query selector to search for .
207+ * @param string $markup The output that should not contain the $selector.
208+ * @param string $message A message to display if the assertion fails.
181209 *
182210 * @return void
183211 */
184- public function assertElementNotRegExp ($ regexp , $ selector = '' , $ markup = '' , $ message = '' )
185- {
212+ public function assertElementNotRegExp (
213+ string $ regexp ,
214+ $ selector = '' ,
215+ string $ markup = '' ,
216+ string $ message = ''
217+ ) {
186218 $ constraint = new LogicalNot (new ElementMatchesRegExp (new Selector ($ selector ), $ regexp ));
187219
188220 static ::assertThat ($ markup , $ constraint , $ message );
0 commit comments