Skip to content

Commit 077a68c

Browse files
kbonddunglas
authored andcommitted
Allow Symfony 7.0
1 parent 531fda4 commit 077a68c

File tree

7 files changed

+23
-23
lines changed

7 files changed

+23
-23
lines changed

.github/workflows/ci.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -32,7 +32,7 @@ jobs:
3232
uses: shivammathur/setup-php@v2
3333
with:
3434
php-version: '8.2'
35-
tools: phpstan
35+
tools: phpstan,flex
3636
extensions: zip
3737

3838
- name: Get composer cache directory
@@ -48,6 +48,8 @@ jobs:
4848

4949
- name: Install dependencies
5050
run: composer install --prefer-dist
51+
env:
52+
SYMFONY_REQUIRE: 7.0.*
5153

5254
- name: Install PHPUnit dependencies
5355
run: vendor/bin/simple-phpunit --version

composer.json

Lines changed: 13 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -21,13 +21,13 @@
2121
"ext-dom": "*",
2222
"ext-libxml": "*",
2323
"php-webdriver/webdriver": "^1.8.2",
24-
"symfony/browser-kit": "^5.3 || ^6.0",
25-
"symfony/dependency-injection": "^5.3 || ^6.0",
24+
"symfony/browser-kit": "^5.3 || ^6.0 || ^7.0",
25+
"symfony/dependency-injection": "^5.3 || ^6.0 || ^7.0",
2626
"symfony/deprecation-contracts": "^2.4 || ^3",
27-
"symfony/dom-crawler": "^5.3 || ^6.0",
28-
"symfony/http-client": "^5.3 || ^6.0",
29-
"symfony/http-kernel": "^5.3 || ^6.0",
30-
"symfony/process": "^5.3 || ^6.0"
27+
"symfony/dom-crawler": "^5.3 || ^6.0 || ^7.0",
28+
"symfony/http-client": "^5.3 || ^6.0 || ^7.0",
29+
"symfony/http-kernel": "^5.3 || ^6.0 || ^7.0",
30+
"symfony/process": "^5.3 || ^6.0 || ^7.0"
3131
},
3232
"autoload": {
3333
"psr-4": { "Symfony\\Component\\Panther\\": "src/" }
@@ -44,9 +44,11 @@
4444
"sort-packages": true
4545
},
4646
"require-dev": {
47-
"symfony/css-selector": "^5.3 || ^6.0",
48-
"symfony/framework-bundle": "^5.3 || ^6.0",
49-
"symfony/mime": "^5.3 || ^6.0",
50-
"symfony/phpunit-bridge": "^5.3 || ^6.0"
51-
}
47+
"symfony/css-selector": "^5.3 || ^6.0 || ^7.0",
48+
"symfony/framework-bundle": "^5.3 || ^6.0 || ^7.0",
49+
"symfony/mime": "^5.3 || ^6.0 || ^7.0",
50+
"symfony/phpunit-bridge": "^5.3 || ^6.0 || ^7.0"
51+
},
52+
"minimum-stability": "dev",
53+
"prefer-stable": true
5254
}

src/Client.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -197,15 +197,15 @@ public function getHistory(): History
197197
throw new \LogicException('History is not available when using WebDriver.');
198198
}
199199

200-
public function click(Link $link): Crawler
200+
public function click(Link $link, array $serverParameters = []): Crawler
201201
{
202202
if ($link instanceof PantherLink) {
203203
$link->getElement()->click();
204204

205205
return $this->crawler = $this->createCrawler();
206206
}
207207

208-
return parent::click($link);
208+
return parent::click($link, $serverParameters);
209209
}
210210

211211
public function submit(Form $form, array $values = [], array $serverParameters = []): Crawler
@@ -272,6 +272,7 @@ public function request(string $method, string $uri, array $parameters = [], arr
272272

273273
$this->get($uri);
274274

275+
// @phpstan-ignore-next-line The above call to get() sets the proper crawler
275276
return $this->crawler;
276277
}
277278

src/DomCrawler/Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -188,14 +188,14 @@ public function children(string $selector = null): static
188188
return $this->createSubCrawlerFromXpath($xpath);
189189
}
190190

191-
public function attr($attribute): ?string
191+
public function attr($attribute, $default = null): ?string
192192
{
193193
$element = $this->getElementOrThrow();
194194
if ('_text' === $attribute) {
195195
return $this->text();
196196
}
197197

198-
return (string) $element->getAttribute($attribute);
198+
return $element->getAttribute($attribute) ?? $default;
199199
}
200200

201201
public function nodeName(): string

src/DomCrawler/Field/FileFormField.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -22,13 +22,6 @@ final class FileFormField extends BaseFileFormField
2222
{
2323
use FormFieldTrait;
2424

25-
/**
26-
* @var array
27-
*
28-
* @phpstan-ignore-next-line
29-
*/
30-
protected $value;
31-
3225
public function getValue(): array|string|null
3326
{
3427
return $this->value;

src/DomCrawler/Form.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -47,6 +47,7 @@ public function __construct(WebDriverElement $element, WebDriver $webDriver)
4747
$this->setElement($element);
4848

4949
$this->currentUri = $webDriver->getCurrentURL();
50+
$this->method = null;
5051
}
5152

5253
private function setElement(WebDriverElement $element): void

src/DomCrawler/Image.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -34,6 +34,7 @@ public function __construct(WebDriverElement $element)
3434

3535
$this->element = $element;
3636
$this->method = 'GET';
37+
$this->currentUri = null;
3738
}
3839

3940
public function getNode(): \DOMElement

0 commit comments

Comments
 (0)