@@ -119,7 +119,7 @@ public function _after(TestInterface $test)
119
119
/**
120
120
* @return class-string
121
121
*/
122
- public function _conflicts ()
122
+ public function _conflicts (): string
123
123
{
124
124
return \Codeception \Lib \Interfaces \Web::class;
125
125
}
@@ -157,7 +157,7 @@ public function _request(
157
157
array $ files = [],
158
158
array $ server = [],
159
159
string $ content = null
160
- ): string {
160
+ ): ? string {
161
161
$ this ->clientRequest ($ method , $ uri , $ parameters , $ files , $ server , $ content );
162
162
return $ this ->_getResponseContent ();
163
163
}
@@ -319,7 +319,7 @@ private function getRunningClient(): AbstractBrowser
319
319
return $ this ->client ;
320
320
}
321
321
322
- public function _savePageSource ($ filename )
322
+ public function _savePageSource (string $ filename ): void
323
323
{
324
324
file_put_contents ($ filename , $ this ->_getResponseContent ());
325
325
}
@@ -386,12 +386,12 @@ public function deleteHeader(string $name): void
386
386
unset($ this ->headers [$ name ]);
387
387
}
388
388
389
- public function amOnPage ($ page )
389
+ public function amOnPage (string $ page ): void
390
390
{
391
391
$ this ->_loadPage ('GET ' , $ page );
392
392
}
393
393
394
- public function click ($ link , $ context = null )
394
+ public function click ($ link , $ context = null ): void
395
395
{
396
396
if ($ context ) {
397
397
$ this ->crawler = $ this ->match ($ context );
@@ -530,7 +530,7 @@ private function retrieveBaseUrl(): string
530
530
return $ this ->getAbsoluteUrlFor ($ baseUrl );
531
531
}
532
532
533
- public function see ($ text , $ selector = null )
533
+ public function see (string $ text , $ selector = null ): void
534
534
{
535
535
if (!$ selector ) {
536
536
$ this ->assertPageContains ($ text );
@@ -541,7 +541,7 @@ public function see($text, $selector = null)
541
541
$ this ->assertDomContains ($ nodes , $ this ->stringifySelector ($ selector ), $ text );
542
542
}
543
543
544
- public function dontSee ($ text , $ selector = null )
544
+ public function dontSee (string $ text , $ selector = null ): void
545
545
{
546
546
if (!$ selector ) {
547
547
$ this ->assertPageNotContains ($ text );
@@ -552,17 +552,17 @@ public function dontSee($text, $selector = null)
552
552
$ this ->assertDomNotContains ($ nodes , $ this ->stringifySelector ($ selector ), $ text );
553
553
}
554
554
555
- public function seeInSource ($ raw )
555
+ public function seeInSource (string $ raw ): void
556
556
{
557
557
$ this ->assertPageSourceContains ($ raw );
558
558
}
559
559
560
- public function dontSeeInSource ($ raw )
560
+ public function dontSeeInSource (string $ raw ): void
561
561
{
562
562
$ this ->assertPageSourceNotContains ($ raw );
563
563
}
564
564
565
- public function seeLink ($ text , $ url = null )
565
+ public function seeLink (string $ text , string $ url = null ): void
566
566
{
567
567
$ crawler = $ this ->getCrawler ()->selectLink ($ text );
568
568
if ($ crawler ->count () === 0 ) {
@@ -579,7 +579,7 @@ public function seeLink($text, $url = null)
579
579
$ this ->assertTrue (true );
580
580
}
581
581
582
- public function dontSeeLink ($ text , $ url = null )
582
+ public function dontSeeLink (string $ text , string $ url = '' ): void
583
583
{
584
584
$ crawler = $ this ->getCrawler ()->selectLink ($ text );
585
585
if (!$ url && $ crawler ->count () > 0 ) {
@@ -603,32 +603,32 @@ public function _getCurrentUri(): string
603
603
return Uri::retrieveUri ($ this ->getRunningClient ()->getHistory ()->current ()->getUri ());
604
604
}
605
605
606
- public function seeInCurrentUrl ($ uri )
606
+ public function seeInCurrentUrl (string $ uri ): void
607
607
{
608
608
$ this ->assertStringContainsString ($ uri , $ this ->_getCurrentUri ());
609
609
}
610
610
611
- public function dontSeeInCurrentUrl ($ uri )
611
+ public function dontSeeInCurrentUrl (string $ uri ): void
612
612
{
613
613
$ this ->assertStringNotContainsString ($ uri , $ this ->_getCurrentUri ());
614
614
}
615
615
616
- public function seeCurrentUrlEquals ($ uri )
616
+ public function seeCurrentUrlEquals (string $ uri ): void
617
617
{
618
618
$ this ->assertSame (rtrim ($ uri , '/ ' ), rtrim ($ this ->_getCurrentUri (), '/ ' ));
619
619
}
620
620
621
- public function dontSeeCurrentUrlEquals ($ uri )
621
+ public function dontSeeCurrentUrlEquals (string $ uri ): void
622
622
{
623
623
$ this ->assertNotSame (rtrim ($ uri , '/ ' ), rtrim ($ this ->_getCurrentUri (), '/ ' ));
624
624
}
625
625
626
- public function seeCurrentUrlMatches ($ uri )
626
+ public function seeCurrentUrlMatches (string $ uri ): void
627
627
{
628
628
$ this ->assertRegExp ($ uri , $ this ->_getCurrentUri ());
629
629
}
630
630
631
- public function dontSeeCurrentUrlMatches ($ uri )
631
+ public function dontSeeCurrentUrlMatches (string $ uri ): void
632
632
{
633
633
$ this ->assertNotRegExp ($ uri , $ this ->_getCurrentUri ());
634
634
}
@@ -652,36 +652,36 @@ public function grabFromCurrentUrl($uri = null)
652
652
return $ matches [1 ];
653
653
}
654
654
655
- public function seeCheckboxIsChecked ($ checkbox )
655
+ public function seeCheckboxIsChecked ($ checkbox ): void
656
656
{
657
657
$ checkboxes = $ this ->getFieldsByLabelOrCss ($ checkbox );
658
658
$ this ->assertDomContains ($ checkboxes ->filter ('input[checked=checked] ' ), 'checkbox ' );
659
659
}
660
660
661
- public function dontSeeCheckboxIsChecked ($ checkbox )
661
+ public function dontSeeCheckboxIsChecked (string $ checkbox ): void
662
662
{
663
663
$ checkboxes = $ this ->getFieldsByLabelOrCss ($ checkbox );
664
664
$ this ->assertSame (0 , $ checkboxes ->filter ('input[checked=checked] ' )->count ());
665
665
}
666
666
667
- public function seeInField ($ field , $ value )
667
+ public function seeInField ($ field , $ value ): void
668
668
{
669
669
$ nodes = $ this ->getFieldsByLabelOrCss ($ field );
670
670
$ this ->assert ($ this ->proceedSeeInField ($ nodes , $ value ));
671
671
}
672
672
673
- public function dontSeeInField ($ field , $ value )
673
+ public function dontSeeInField ($ field , $ value ): void
674
674
{
675
675
$ nodes = $ this ->getFieldsByLabelOrCss ($ field );
676
676
$ this ->assertNot ($ this ->proceedSeeInField ($ nodes , $ value ));
677
677
}
678
678
679
- public function seeInFormFields ($ formSelector , array $ params )
679
+ public function seeInFormFields ($ formSelector , array $ params ): void
680
680
{
681
681
$ this ->proceedSeeInFormFields ($ formSelector , $ params , false );
682
682
}
683
683
684
- public function dontSeeInFormFields ($ formSelector , array $ params )
684
+ public function dontSeeInFormFields ($ formSelector , array $ params ): void
685
685
{
686
686
$ this ->proceedSeeInFormFields ($ formSelector , $ params , true );
687
687
}
@@ -944,7 +944,7 @@ protected function proceedSubmitForm(Crawler $frmCrawl, array $params, string $b
944
944
$ this ->forms = [];
945
945
}
946
946
947
- public function submitForm ($ selector , array $ params , $ button = null )
947
+ public function submitForm ($ selector , array $ params , string $ button = null ): void
948
948
{
949
949
$ form = $ this ->match ($ selector )->first ();
950
950
if (count ($ form ) === 0 ) {
@@ -1125,7 +1125,7 @@ protected function getFormValuesFor(SymfonyForm $form): array
1125
1125
return $ values ;
1126
1126
}
1127
1127
1128
- public function fillField ($ field , $ value )
1128
+ public function fillField ($ field , $ value ): void
1129
1129
{
1130
1130
$ value = (string ) $ value ;
1131
1131
$ input = $ this ->getFieldByLabelOrCss ($ field );
@@ -1189,7 +1189,7 @@ protected function getFieldByLabelOrCss($field): SymfonyCrawler
1189
1189
return $ input ->first ();
1190
1190
}
1191
1191
1192
- public function selectOption ($ select , $ option )
1192
+ public function selectOption ($ select , $ option ): void
1193
1193
{
1194
1194
$ field = $ this ->getFieldByLabelOrCss ($ select );
1195
1195
$ form = $ this ->getFormFor ($ field );
@@ -1229,7 +1229,7 @@ public function selectOption($select, $option)
1229
1229
return ;
1230
1230
}
1231
1231
1232
- $ formField ->select ($ this ->matchOption ($ field , $ option ));
1232
+ $ formField ->select (( string ) $ this ->matchOption ($ field , $ option ));
1233
1233
}
1234
1234
1235
1235
/**
@@ -1267,12 +1267,12 @@ protected function matchOption(Crawler $field, $option)
1267
1267
return $ option ;
1268
1268
}
1269
1269
1270
- public function checkOption ($ option )
1270
+ public function checkOption ($ option ): void
1271
1271
{
1272
1272
$ this ->proceedCheckOption ($ option )->tick ();
1273
1273
}
1274
1274
1275
- public function uncheckOption ($ option )
1275
+ public function uncheckOption ($ option ): void
1276
1276
{
1277
1277
$ this ->proceedCheckOption ($ option )->untick ();
1278
1278
}
@@ -1299,7 +1299,7 @@ protected function proceedCheckOption($option): ChoiceFormField
1299
1299
return $ formField ;
1300
1300
}
1301
1301
1302
- public function attachFile ($ field , $ filename )
1302
+ public function attachFile ($ field , string $ filename ): void
1303
1303
{
1304
1304
$ form = $ this ->getFormFor ($ field = $ this ->getFieldByLabelOrCss ($ field ));
1305
1305
$ filePath = codecept_data_dir () . $ filename ;
@@ -1379,7 +1379,7 @@ protected function debugResponse($url): void
1379
1379
$ this ->debugSection ('Response Headers ' , $ this ->getRunningClient ()->getInternalResponse ()->getHeaders ());
1380
1380
}
1381
1381
1382
- public function makeHtmlSnapshot ($ name = null )
1382
+ public function makeHtmlSnapshot (string $ name = null ): void
1383
1383
{
1384
1384
if (empty ($ name )) {
1385
1385
$ name = uniqid (date ("Y-m-d_H-i-s_ " ), true );
@@ -1499,7 +1499,7 @@ public function grabAttributeFrom($cssOrXpath, $attribute)
1499
1499
return $ nodes ->first ()->attr ($ attribute );
1500
1500
}
1501
1501
1502
- public function grabMultiple ($ cssOrXpath , $ attribute = null )
1502
+ public function grabMultiple ($ cssOrXpath , string $ attribute = null ): array
1503
1503
{
1504
1504
$ result = [];
1505
1505
$ nodes = $ this ->match ($ cssOrXpath );
@@ -1584,7 +1584,7 @@ public function grabCookie($cookie, $params = [])
1584
1584
* @throws ModuleException if no page was opened.
1585
1585
* @return string Current page source code.
1586
1586
*/
1587
- public function grabPageSource ()
1587
+ public function grabPageSource (): string
1588
1588
{
1589
1589
return $ this ->_getResponseContent ();
1590
1590
}
@@ -1619,7 +1619,7 @@ private function stringifySelector($selector): string
1619
1619
return $ selector ;
1620
1620
}
1621
1621
1622
- public function seeElement ($ selector , $ attributes = [])
1622
+ public function seeElement ($ selector , array $ attributes = []): void
1623
1623
{
1624
1624
$ nodes = $ this ->match ($ selector );
1625
1625
$ selector = $ this ->stringifySelector ($ selector );
@@ -1631,7 +1631,7 @@ public function seeElement($selector, $attributes = [])
1631
1631
$ this ->assertDomContains ($ nodes , $ selector );
1632
1632
}
1633
1633
1634
- public function dontSeeElement ($ selector , $ attributes = [])
1634
+ public function dontSeeElement ($ selector , array $ attributes = []): void
1635
1635
{
1636
1636
$ nodes = $ this ->match ($ selector );
1637
1637
$ selector = $ this ->stringifySelector ($ selector );
0 commit comments