Skip to content

Commit

Permalink
Allow Symfony 7.0
Browse files Browse the repository at this point in the history
  • Loading branch information
kbond authored and dunglas committed Oct 31, 2023
1 parent 531fda4 commit 077a68c
Show file tree
Hide file tree
Showing 7 changed files with 23 additions and 23 deletions.
4 changes: 3 additions & 1 deletion .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -32,7 +32,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
php-version: '8.2'
tools: phpstan
tools: phpstan,flex
extensions: zip

- name: Get composer cache directory
Expand All @@ -48,6 +48,8 @@ jobs:

- name: Install dependencies
run: composer install --prefer-dist
env:
SYMFONY_REQUIRE: 7.0.*

- name: Install PHPUnit dependencies
run: vendor/bin/simple-phpunit --version
Expand Down
24 changes: 13 additions & 11 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -21,13 +21,13 @@
"ext-dom": "*",
"ext-libxml": "*",
"php-webdriver/webdriver": "^1.8.2",
"symfony/browser-kit": "^5.3 || ^6.0",
"symfony/dependency-injection": "^5.3 || ^6.0",
"symfony/browser-kit": "^5.3 || ^6.0 || ^7.0",
"symfony/dependency-injection": "^5.3 || ^6.0 || ^7.0",
"symfony/deprecation-contracts": "^2.4 || ^3",
"symfony/dom-crawler": "^5.3 || ^6.0",
"symfony/http-client": "^5.3 || ^6.0",
"symfony/http-kernel": "^5.3 || ^6.0",
"symfony/process": "^5.3 || ^6.0"
"symfony/dom-crawler": "^5.3 || ^6.0 || ^7.0",
"symfony/http-client": "^5.3 || ^6.0 || ^7.0",
"symfony/http-kernel": "^5.3 || ^6.0 || ^7.0",
"symfony/process": "^5.3 || ^6.0 || ^7.0"
},
"autoload": {
"psr-4": { "Symfony\\Component\\Panther\\": "src/" }
Expand All @@ -44,9 +44,11 @@
"sort-packages": true
},
"require-dev": {
"symfony/css-selector": "^5.3 || ^6.0",
"symfony/framework-bundle": "^5.3 || ^6.0",
"symfony/mime": "^5.3 || ^6.0",
"symfony/phpunit-bridge": "^5.3 || ^6.0"
}
"symfony/css-selector": "^5.3 || ^6.0 || ^7.0",
"symfony/framework-bundle": "^5.3 || ^6.0 || ^7.0",
"symfony/mime": "^5.3 || ^6.0 || ^7.0",
"symfony/phpunit-bridge": "^5.3 || ^6.0 || ^7.0"
},
"minimum-stability": "dev",
"prefer-stable": true
}
5 changes: 3 additions & 2 deletions src/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -197,15 +197,15 @@ public function getHistory(): History
throw new \LogicException('History is not available when using WebDriver.');
}

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

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

return parent::click($link);
return parent::click($link, $serverParameters);
}

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

$this->get($uri);

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

Expand Down
4 changes: 2 additions & 2 deletions src/DomCrawler/Crawler.php
Original file line number Diff line number Diff line change
Expand Up @@ -188,14 +188,14 @@ public function children(string $selector = null): static
return $this->createSubCrawlerFromXpath($xpath);
}

public function attr($attribute): ?string
public function attr($attribute, $default = null): ?string
{
$element = $this->getElementOrThrow();
if ('_text' === $attribute) {
return $this->text();
}

return (string) $element->getAttribute($attribute);
return $element->getAttribute($attribute) ?? $default;
}

public function nodeName(): string
Expand Down
7 changes: 0 additions & 7 deletions src/DomCrawler/Field/FileFormField.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,13 +22,6 @@ final class FileFormField extends BaseFileFormField
{
use FormFieldTrait;

/**
* @var array
*
* @phpstan-ignore-next-line
*/
protected $value;

public function getValue(): array|string|null
{
return $this->value;
Expand Down
1 change: 1 addition & 0 deletions src/DomCrawler/Form.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,6 +47,7 @@ public function __construct(WebDriverElement $element, WebDriver $webDriver)
$this->setElement($element);

$this->currentUri = $webDriver->getCurrentURL();
$this->method = null;
}

private function setElement(WebDriverElement $element): void
Expand Down
1 change: 1 addition & 0 deletions src/DomCrawler/Image.php
Original file line number Diff line number Diff line change
Expand Up @@ -34,6 +34,7 @@ public function __construct(WebDriverElement $element)

$this->element = $element;
$this->method = 'GET';
$this->currentUri = null;
}

public function getNode(): \DOMElement
Expand Down

0 comments on commit 077a68c

Please sign in to comment.