8000 Declare nullable parameter types explicitly for PHP 8.4 compatibility… · Codeception/lib-innerbrowser@12dadcf · GitHub
[go: up one dir, main page]

Skip to content

Commit 12dadcf

Browse files
authored
Declare nullable parameter types explicitly for PHP 8.4 compatibility (#70)
1 parent d9fbf1c commit 12dadcf

File tree

3 files changed

+12
-12
lines changed

3 files changed

+12
-12
lines changed

src/Codeception/Constraint/Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ protected function matches($nodes): bool
4242
* @param string $selector
4343
* @param ComparisonFailure|null $comparisonFailure
4444
*/
45-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null): never
45+
protected function fail($nodes, $selector, ?ComparisonFailure $comparisonFailure = null): never
4646
{
4747
if (!$nodes->count()) {
4848
throw new ElementNotFound($selector, 'Element located either by name, CSS or XPath');
@@ -77,7 +77,7 @@ protected function failureDescription($other): string
7777
return $description;
7878
}
7979

80-
protected function nodesList(SymfonyDomCrawler $domCrawler, string $contains = null): string
80+
protected function nodesList(SymfonyDomCrawler $domCrawler, ?string $contains = null): string
8181
{
8282
$output = '';
8383
foreach ($domCrawler as $node) {

src/Codeception/Constraint/CrawlerNot.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -24,7 +24,7 @@ protected function matches($nodes): bool
2424
* @param string $selector
2525
* @param ComparisonFailure|null $comparisonFailure
2626
*/
27-
protected function fail($nodes, $selector, ComparisonFailure $comparisonFailure = null): never
27+
protected function fail($nodes, $selector, ?ComparisonFailure $comparisonFailure = null): never
2828
{
2929
if (!$this->string) {
3030
throw new ExpectationFailedException(

src/Codeception/Lib/InnerBrowser.php

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -156,7 +156,7 @@ public function _request(
156156
array $parameters = [],
157157
array $files = [],
158158
array $server = [],
159-
string $content = null
159+
?string $content = null
160160
): ?string {
161161
$this->clientRequest($method, $uri, $parameters, $files, $server, $content);
162162
return $this->_getResponseContent();
@@ -189,7 +189,7 @@ protected function clientRequest(
189189
array $parameters = [],
190190
array $files = [],
191191
array $server = [],
192-
string $content = null,
192+
?string $content = null,
193193
bool $changeHistory = true
194194
): SymfonyCrawler {
195195
$this->debugSection("Request Headers", $this->headers);
@@ -280,7 +280,7 @@ public function _loadPage(
280280
array $parameters = [],
281281
array $files = [],
282282
array $server = [],
283-
string $content = null
283+
?string $content = null
284284
): void {
285285
$this->crawler = $this->clientRequest($method, $uri, $parameters, $files, $server, $content);
286286
$this->baseUrl = $this->retrieveBaseUrl();
@@ -562,7 +562,7 @@ public function dontSeeInSource(string $raw): void
562562
$this->assertPageSourceNotContains($raw);
563563
}
564564

565-
public function seeLink(string $text, string $url = null): void
565+
public function seeLink(string $text, ?string $url = null): void
566566
{
567567
$crawler = $this->getCrawler()->selectLink($text);
568568
if ($crawler->count() === 0) {
@@ -633,7 +633,7 @@ public function dontSeeCurrentUrlMatches(string $uri): void
633633
$this->assertNotRegExp($uri, $this->_getCurrentUri());
634634
}
635635

636-
public function grabFromCurrentUrl(string $uri = null): mixed
636+
public function grabFromCurrentUrl(?string $uri = null): mixed
637637
{
638638
if (!$uri) {
639639
return $this->_getCurrentUri();
@@ -892,7 +892,7 @@ protected function setCheckboxBoolValues(Crawler $form, array $params): array
892892
* form
893893
* @param string|null $button the name of a submit button in the form
894894
*/
895-
protected function proceedSubmitForm(Crawler $frmCrawl, array $params, string $button = null): void
895+
protected function proceedSubmitForm(Crawler $frmCrawl, array $params, ?string $button = null): void
896896
{
897897
$url = null;
898898
$form = $this->getFormFor($frmCrawl);
@@ -939,7 +939,7 @@ protected function proceedSubmitForm(Crawler $frmCrawl, array $params, string $b
939939
$this->forms = [];
940940
}
941941

942-
public function submitForm($selector, array $params, string $button = null): void
942+
public function submitForm($selector, array $params, ?string $button = null): void
943943
{
944944
$form = $this->match($selector)->first();
945945
if (count($form) === 0) {
@@ -1374,7 +1374,7 @@ protected function debugResponse($url): void
13741374
$this->debugSection('Response Headers', $this->getRunningClient()->getInternalResponse()->getHeaders());
13751375
}
13761376

1377-
public function makeHtmlSnapshot(string $name = null): void
1377+
public function makeHtmlSnapshot(?string $name = null): void
13781378
{
13791379
if (empty($name)) {
13801380
$name = uniqid(date("Y-m-d_H-i-s_"), true);
@@ -1487,7 +1487,7 @@ public function grabAttributeFrom($cssOrXpath, string $attribute): mixed
14871487
return $nodes->first()->attr($attribute);
14881488
}
14891489

1490-
public function grabMultiple($cssOrXpath, string $attribute = null): array
1490+
public function grabMultiple($cssOrXpath, ?string $attribute = null): array
14911491
{
14921492
$result = [];
14931493
$nodes = $this->match($cssOrXpath);

0 commit comments

Comments
 (0)
0