From 31d379ed84cc7cb041ce2e4ebedeeda448d0a2b3 Mon Sep 17 00:00:00 2001 From: Jordi Sala Morales Date: Sat, 30 Oct 2021 10:43:40 +0200 Subject: [PATCH] Problematic changes --- src/Client.php | 6 +----- src/DomCrawler/Field/ChoiceFormField.php | 6 +----- src/DomCrawler/Field/FileFormField.php | 6 +----- src/DomCrawler/Field/FormFieldTrait.php | 6 +----- src/DomCrawler/Form.php | 6 ++---- src/WebTestAssertionsTrait.php | 5 ++--- 6 files changed, 8 insertions(+), 27 deletions(-) diff --git a/src/Client.php b/src/Client.php index c6462e11..67c00c3b 100644 --- a/src/Client.php +++ b/src/Client.php @@ -190,11 +190,7 @@ public function setServerParameter($key, $value): void throw new \InvalidArgumentException('Server parameters cannot be set when using WebDriver.'); } - /** - * @return mixed - */ - #[\ReturnTypeWillChange] - public function getServerParameter($key, $default = '') + public function getServerParameter($key, $default = ''): mixed { throw new \InvalidArgumentException('Server parameters cannot be retrieved when using WebDriver.'); } diff --git a/src/DomCrawler/Field/ChoiceFormField.php b/src/DomCrawler/Field/ChoiceFormField.php index ee4aaa2f..e2f2994b 100644 --- a/src/DomCrawler/Field/ChoiceFormField.php +++ b/src/DomCrawler/Field/ChoiceFormField.php @@ -79,11 +79,7 @@ public function untick(): void $this->setValue(false); } - /** - * @return string|string[]|null - */ - #[\ReturnTypeWillChange] - public function getValue() + public function getValue(): array|string|null { $type = $this->element->getAttribute('type'); diff --git a/src/DomCrawler/Field/FileFormField.php b/src/DomCrawler/Field/FileFormField.php index ad93791a..a2e201a1 100644 --- a/src/DomCrawler/Field/FileFormField.php +++ b/src/DomCrawler/Field/FileFormField.php @@ -27,11 +27,7 @@ final class FileFormField extends BaseFileFormField */ protected $value; - /** - * @return string|string[]|null - */ - #[\ReturnTypeWillChange] - public function getValue() + public function getValue(): array|string|null { return $this->value; } diff --git a/src/DomCrawler/Field/FormFieldTrait.php b/src/DomCrawler/Field/FormFieldTrait.php index cb687f3a..fb5ed608 100644 --- a/src/DomCrawler/Field/FormFieldTrait.php +++ b/src/DomCrawler/Field/FormFieldTrait.php @@ -44,11 +44,7 @@ public function getName(): string return $this->element->getAttribute('name') ?? ''; } - /** - * @return string|string[]|null - */ - #[\ReturnTypeWillChange] - public function getValue() + public function getValue(): array|string|null { return $this->element->getAttribute('value'); } diff --git a/src/DomCrawler/Form.php b/src/DomCrawler/Form.php index d765caf6..071b5c22 100644 --- a/src/DomCrawler/Form.php +++ b/src/DomCrawler/Form.php @@ -215,8 +215,7 @@ public function set(FormField $field): void /** * @return FormField|FormField[]|FormField[][] */ - #[\ReturnTypeWillChange] - public function get($name) + public function get($name): FormField|array { return $this->getFormField($this->getFormElement($name)); } @@ -243,8 +242,7 @@ public function offsetExists($name): bool * * @return FormField|FormField[]|FormField[][] */ - #[\ReturnTypeWillChange] - public function offsetGet($name) + public function offsetGet($name): FormField|array { return $this->get($name); } diff --git a/src/WebTestAssertionsTrait.php b/src/WebTestAssertionsTrait.php index ac876849..49ca3fff 100644 --- a/src/WebTestAssertionsTrait.php +++ b/src/WebTestAssertionsTrait.php @@ -16,7 +16,6 @@ use Facebook\WebDriver\WebDriverElement; use Symfony\Bundle\FrameworkBundle\KernelBrowser; use Symfony\Bundle\FrameworkBundle\Test\WebTestAssertionsTrait as BaseWebTestAssertionsTrait; -use Symfony\Component\BrowserKit\AbstractBrowser; use Symfony\Component\DependencyInjection\Exception\ServiceNotFoundException; use Symfony\Component\Panther\Client as PantherClient; @@ -275,9 +274,9 @@ private static function findElement(string $locator): WebDriverElement * @param array $options An array of options to pass to the createKernel method * @param array $server An array of server parameters * - * @return AbstractBrowser A browser instance + * @return KernelBrowser A browser instance */ - protected static function createClient(array $options = [], array $server = []): AbstractBrowser + protected static function createClient(array $options = [], array $server = []): KernelBrowser { $kernel = static::bootKernel($options);