@@ -119,7 +119,7 @@ public function _after(TestInterface $test)
119119 /**
120120 * @return class-string
121121 */
122- public function _conflicts ()
122+ public function _conflicts (): string
123123 {
124124 return \Codeception \Lib \Interfaces \Web::class;
125125 }
@@ -157,7 +157,7 @@ public function _request(
157157 array $ files = [],
158158 array $ server = [],
159159 string $ content = null
160- ): string {
160+ ): ? string {
161161 $ this ->clientRequest ($ method , $ uri , $ parameters , $ files , $ server , $ content );
162162 return $ this ->_getResponseContent ();
163163 }
@@ -319,7 +319,7 @@ private function getRunningClient(): AbstractBrowser
319319 return $ this ->client ;
320320 }
321321
322- public function _savePageSource ($ filename )
322+ public function _savePageSource (string $ filename ): void
323323 {
324324 file_put_contents ($ filename , $ this ->_getResponseContent ());
325325 }
@@ -386,12 +386,12 @@ public function deleteHeader(string $name): void
386386 unset($ this ->headers [$ name ]);
387387 }
388388
389- public function amOnPage ($ page )
389+ public function amOnPage (string $ page ): void
390390 {
391391 $ this ->_loadPage ('GET ' , $ page );
392392 }
393393
394- public function click ($ link , $ context = null )
394+ public function click ($ link , $ context = null ): void
395395 {
396396 if ($ context ) {
397397 $ this ->crawler = $ this ->match ($ context );
@@ -530,7 +530,7 @@ private function retrieveBaseUrl(): string
530530 return $ this ->getAbsoluteUrlFor ($ baseUrl );
531531 }
532532
533- public function see ($ text , $ selector = null )
533+ public function see (string $ text , $ selector = null ): void
534534 {
535535 if (!$ selector ) {
536536 $ this ->assertPageContains ($ text );
@@ -541,7 +541,7 @@ public function see($text, $selector = null)
541541 $ this ->assertDomContains ($ nodes , $ this ->stringifySelector ($ selector ), $ text );
542542 }
543543
544- public function dontSee ($ text , $ selector = null )
544+ public function dontSee (string $ text , $ selector = null ): void
545545 {
546546 if (!$ selector ) {
547547 $ this ->assertPageNotContains ($ text );
@@ -552,17 +552,17 @@ public function dontSee($text, $selector = null)
552552 $ this ->assertDomNotContains ($ nodes , $ this ->stringifySelector ($ selector ), $ text );
553553 }
554554
555- public function seeInSource ($ raw )
555+ public function seeInSource (string $ raw ): void
556556 {
557557 $ this ->assertPageSourceContains ($ raw );
558558 }
559559
560- public function dontSeeInSource ($ raw )
560+ public function dontSeeInSource (string $ raw ): void
561561 {
562562 $ this ->assertPageSourceNotContains ($ raw );
563563 }
564564
565- public function seeLink ($ text , $ url = null )
565+ public function seeLink (string $ text , string $ url = null ): void
566566 {
567567 $ crawler = $ this ->getCrawler ()->selectLink ($ text );
568568 if ($ crawler ->count () === 0 ) {
@@ -579,7 +579,7 @@ public function seeLink($text, $url = null)
579579 $ this ->assertTrue (true );
580580 }
581581
582- public function dontSeeLink ($ text , $ url = null )
582+ public function dontSeeLink (string $ text , string $ url = '' ): void
583583 {
584584 $ crawler = $ this ->getCrawler ()->selectLink ($ text );
585585 if (!$ url && $ crawler ->count () > 0 ) {
@@ -603,32 +603,32 @@ public function _getCurrentUri(): string
603603 return Uri::retrieveUri ($ this ->getRunningClient ()->getHistory ()->current ()->getUri ());
604604 }
605605
606- public function seeInCurrentUrl ($ uri )
606+ public function seeInCurrentUrl (string $ uri ): void
607607 {
608608 $ this ->assertStringContainsString ($ uri , $ this ->_getCurrentUri ());
609609 }
610610
611- public function dontSeeInCurrentUrl ($ uri )
611+ public function dontSeeInCurrentUrl (string $ uri ): void
612612 {
613613 $ this ->assertStringNotContainsString ($ uri , $ this ->_getCurrentUri ());
614614 }
615615
616- public function seeCurrentUrlEquals ($ uri )
616+ public function seeCurrentUrlEquals (string $ uri ): void
617617 {
618618 $ this ->assertSame (rtrim ($ uri , '/ ' ), rtrim ($ this ->_getCurrentUri (), '/ ' ));
619619 }
620620
621- public function dontSeeCurrentUrlEquals ($ uri )
621+ public function dontSeeCurrentUrlEquals (string $ uri ): void
622622 {
623623 $ this ->assertNotSame (rtrim ($ uri , '/ ' ), rtrim ($ this ->_getCurrentUri (), '/ ' ));
624624 }
625625
626- public function seeCurrentUrlMatches ($ uri )
626+ public function seeCurrentUrlMatches (string $ uri ): void
627627 {
628628 $ this ->assertRegExp ($ uri , $ this ->_getCurrentUri ());
629629 }
630630
631- public function dontSeeCurrentUrlMatches ($ uri )
631+ public function dontSeeCurrentUrlMatches (string $ uri ): void
632632 {
633633 $ this ->assertNotRegExp ($ uri , $ this ->_getCurrentUri ());
634634 }
@@ -652,36 +652,36 @@ public function grabFromCurrentUrl($uri = null)
652652 return $ matches [1 ];
653653 }
654654
655- public function seeCheckboxIsChecked ($ checkbox )
655+ public function seeCheckboxIsChecked ($ checkbox ): void
656656 {
657657 $ checkboxes = $ this ->getFieldsByLabelOrCss ($ checkbox );
658658 $ this ->assertDomContains ($ checkboxes ->filter ('input[checked=checked] ' ), 'checkbox ' );
659659 }
660660
661- public function dontSeeCheckboxIsChecked ($ checkbox )
661+ public function dontSeeCheckboxIsChecked (string $ checkbox ): void
662662 {
663663 $ checkboxes = $ this ->getFieldsByLabelOrCss ($ checkbox );
664664 $ this ->assertSame (0 , $ checkboxes ->filter ('input[checked=checked] ' )->count ());
665665 }
666666
667- public function seeInField ($ field , $ value )
667+ public function seeInField ($ field , $ value ): void
668668 {
669669 $ nodes = $ this ->getFieldsByLabelOrCss ($ field );
670670 $ this ->assert ($ this ->proceedSeeInField ($ nodes , $ value ));
671671 }
672672
673- public function dontSeeInField ($ field , $ value )
673+ public function dontSeeInField ($ field , $ value ): void
674674 {
675675 $ nodes = $ this ->getFieldsByLabelOrCss ($ field );
676676 $ this ->assertNot ($ this ->proceedSeeInField ($ nodes , $ value ));
677677 }
678678
679- public function seeInFormFields ($ formSelector , array $ params )
679+ public function seeInFormFields ($ formSelector , array $ params ): void
680680 {
681681 $ this ->proceedSeeInFormFields ($ formSelector , $ params , false );
682682 }
683683
684- public function dontSeeInFormFields ($ formSelector , array $ params )
684+ public function dontSeeInFormFields ($ formSelector , array $ params ): void
685685 {
686686 $ this ->proceedSeeInFormFields ($ formSelector , $ params , true );
687687 }
@@ -944,7 +944,7 @@ protected function proceedSubmitForm(Crawler $frmCrawl, array $params, string $b
944944 $ this ->forms = [];
945945 }
946946
947- public function submitForm ($ selector , array $ params , $ button = null )
947+ public function submitForm ($ selector , array $ params , string $ button = null ): void
948948 {
949949 $ form = $ this ->match ($ selector )->first ();
950950 if (count ($ form ) === 0 ) {
@@ -1125,7 +1125,7 @@ protected function getFormValuesFor(SymfonyForm $form): array
11251125 return $ values ;
11261126 }
11271127
1128- public function fillField ($ field , $ value )
1128+ public function fillField ($ field , $ value ): void
11291129 {
11301130 $ value = (string ) $ value ;
11311131 $ input = $ this ->getFieldByLabelOrCss ($ field );
@@ -1189,7 +1189,7 @@ protected function getFieldByLabelOrCss($field): SymfonyCrawler
11891189 return $ input ->first ();
11901190 }
11911191
1192- public function selectOption ($ select , $ option )
1192+ public function selectOption ($ select , $ option ): void
11931193 {
11941194 $ field = $ this ->getFieldByLabelOrCss ($ select );
11951195 $ form = $ this ->getFormFor ($ field );
@@ -1229,7 +1229,7 @@ public function selectOption($select, $option)
12291229 return ;
12301230 }
12311231
1232- $ formField ->select ($ this ->matchOption ($ field , $ option ));
1232+ $ formField ->select (( string ) $ this ->matchOption ($ field , $ option ));
12331233 }
12341234
12351235 /**
@@ -1267,12 +1267,12 @@ protected function matchOption(Crawler $field, $option)
12671267 return $ option ;
12681268 }
12691269
1270- public function checkOption ($ option )
1270+ public function checkOption ($ option ): void
12711271 {
12721272 $ this ->proceedCheckOption ($ option )->tick ();
12731273 }
12741274
1275- public function uncheckOption ($ option )
1275+ public function uncheckOption ($ option ): void
12761276 {
12771277 $ this ->proceedCheckOption ($ option )->untick ();
12781278 }
@@ -1299,7 +1299,7 @@ protected function proceedCheckOption($option): ChoiceFormField
12991299 return $ formField ;
13001300 }
13011301
1302- public function attachFile ($ field , $ filename )
1302+ public function attachFile ($ field , string $ filename ): void
13031303 {
13041304 $ form = $ this ->getFormFor ($ field = $ this ->getFieldByLabelOrCss ($ field ));
13051305 $ filePath = codecept_data_dir () . $ filename ;
@@ -1379,7 +1379,7 @@ protected function debugResponse($url): void
13791379 $ this ->debugSection ('Response Headers ' , $ this ->getRunningClient ()->getInternalResponse ()->getHeaders ());
13801380 }
13811381
1382- public function makeHtmlSnapshot ($ name = null )
1382+ public function makeHtmlSnapshot (string $ name = null ): void
13831383 {
13841384 if (empty ($ name )) {
13851385 $ name = uniqid (date ("Y-m-d_H-i-s_ " ), true );
@@ -1499,7 +1499,7 @@ public function grabAttributeFrom($cssOrXpath, $attribute)
14991499 return $ nodes ->first ()->attr ($ attribute );
15001500 }
15011501
1502- public function grabMultiple ($ cssOrXpath , $ attribute = null )
1502+ public function grabMultiple ($ cssOrXpath , string $ attribute = null ): array
15031503 {
15041504 $ result = [];
15051505 $ nodes = $ this ->match ($ cssOrXpath );
@@ -1584,7 +1584,7 @@ public function grabCookie($cookie, $params = [])
15841584 * @throws ModuleException if no page was opened.
15851585 * @return string Current page source code.
15861586 */
1587- public function grabPageSource ()
1587+ public function grabPageSource (): string
15881588 {
15891589 return $ this ->_getResponseContent ();
15901590 }
@@ -1619,7 +1619,7 @@ private function stringifySelector($selector): string
16191619 return $ selector ;
16201620 }
16211621
1622- public function seeElement ($ selector , $ attributes = [])
1622+ public function seeElement ($ selector , array $ attributes = []): void
16231623 {
16241624 $ nodes = $ this ->match ($ selector );
16251625 $ selector = $ this ->stringifySelector ($ selector );
@@ -1631,7 +1631,7 @@ public function seeElement($selector, $attributes = [])
16311631 $ this ->assertDomContains ($ nodes , $ selector );
16321632 }
16331633
1634- public function dontSeeElement ($ selector , $ attributes = [])
1634+ public function dontSeeElement ($ selector , array $ attributes = []): void
16351635 {
16361636 $ nodes = $ this ->match ($ selector );
16371637 $ selector = $ this ->stringifySelector ($ selector );
0 commit comments