Skip to content

Commit c079db4

Browse files
Use ??= more
1 parent 6816bea commit c079db4

File tree

2 files changed

+2
-6
lines changed

2 files changed

+2
-6
lines changed

Crawler.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -281,9 +281,7 @@ public function addNode(\DOMNode $node)
281281
throw new \InvalidArgumentException('Attaching DOM nodes from multiple documents in the same crawler is forbidden.');
282282
}
283283

284-
if (null === $this->document) {
285-
$this->document = $node->ownerDocument;
286-
}
284+
$this->document ??= $node->ownerDocument;
287285

288286
// Don't add duplicate nodes in the Crawler
289287
if (\in_array($node, $this->nodes, true)) {

Tests/FormTest.php

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -902,9 +902,7 @@ protected function createForm($form, $method = null, $currentUri = null)
902902
$xPath = new \DOMXPath($dom);
903903
$nodes = $xPath->query('//input | //button');
904904

905-
if (null === $currentUri) {
906-
$currentUri = 'http://example.com/';
907-
}
905+
$currentUri ??= 'http://example.com/';
908906

909907
return new Form($nodes->item($nodes->length - 1), $currentUri, $method);
910908
}

0 commit comments

Comments
 (0)