-
-
Notifications
You must be signed in to change notification settings - Fork 235
Add support for Symfony 6 #509
New issue
Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.
By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.
Already on GitHub? Sign in to your account
Changes from all commits
e4d2771
5a1779f
df73a02
cd91587
ed66a1d
0c13d04
d64405d
e5e7ed6
73278bf
2854fc9
a0889fa
File filter
Filter by extension
Conversations
Jump to
Diff view
Diff view
There are no files selected for viewing
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -15,7 +15,7 @@ jobs: | |
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: '7.4' # PHP CS Fixer isn't compatible with PHP 8 yet https://github.com/FriendsOfPHP/PHP-CS-Fixer/issues/4702 | ||
| php-version: '8.0' | ||
| tools: php-cs-fixer, cs2pr | ||
|
|
||
| - name: PHP Coding Standards Fixer | ||
|
|
@@ -58,7 +58,7 @@ jobs: | |
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| php-versions: ['7.1', '7.2', '7.3', '7.4', '8.0'] | ||
| php-versions: ['8.0'] | ||
| fail-fast: false | ||
| name: PHP ${{ matrix.php-versions }} Test on ubuntu-latest | ||
| steps: | ||
|
|
@@ -88,6 +88,43 @@ jobs: | |
| - name: Run tests | ||
| run: vendor/bin/simple-phpunit | ||
|
|
||
| phpunit-dev: | ||
| runs-on: ubuntu-latest | ||
| strategy: | ||
| matrix: | ||
| php-versions: ['8.0'] | ||
| fail-fast: false | ||
| name: PHP ${{ matrix.php-versions }} Test dev dependencies on ubuntu-latest | ||
| steps: | ||
| - name: Checkout | ||
| uses: actions/checkout@v2 | ||
|
|
||
| - name: Setup PHP | ||
| uses: shivammathur/setup-php@v2 | ||
| with: | ||
| php-version: ${{ matrix.php-versions }} | ||
| extensions: zip | ||
|
|
||
| - name: Get composer cache directory | ||
| id: composercache | ||
| run: echo "::set-output name=dir::$(composer config cache-files-dir)" | ||
|
|
||
| - name: Cache dependencies | ||
| uses: actions/cache@v2 | ||
| with: | ||
| path: ${{ steps.composercache.outputs.dir }} | ||
| key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }} | ||
| restore-keys: ${{ runner.os }}-composer- | ||
|
|
||
| - name: Allow dev dependencies | ||
| run: composer config minimum-stability dev | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Normally we have
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. A little more info. What we normally do is:
BUT, I think these are not-important details. The current builds DO test the correct stuff. I vote we merge this, and then we could potentially optimize this build file later to reduce duplication.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I think it would be nice to have a better testing of different symfony versions, as you said it can be done on another Pr. I can bring some of the workflows we use at Sonata if you dont have a standard way for all sf repositories. |
||
|
|
||
| - name: Install dependencies | ||
| run: composer install --prefer-dist | ||
|
|
||
| - name: Run tests | ||
| run: vendor/bin/simple-phpunit | ||
|
|
||
| phpunit-lowest: | ||
| runs-on: ubuntu-latest | ||
| name: PHP 8.0 (lowest) Test on ubuntu-latest | ||
|
|
||
| Original file line number | Diff line number | Diff line change |
|---|---|---|
|
|
@@ -38,7 +38,7 @@ public function __construct(array $elements = [], ?WebDriver $webDriver = null, | |
| { | ||
| $this->uri = $uri; | ||
| $this->webDriver = $webDriver; | ||
| $this->elements = $elements ?? []; | ||
| $this->elements = $elements; | ||
| } | ||
|
|
||
| public function clear(): void | ||
|
|
@@ -86,7 +86,7 @@ public function addNode(\DOMNode $node): void | |
| throw $this->createNotSupportedException(__METHOD__); | ||
| } | ||
|
|
||
| public function eq($position): self | ||
| public function eq($position): static | ||
|
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This is another spot where we can't do this... unless we're planning to drop support for PHP 7. But... maybe we are??? In order to support Symfony 6?
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. I guess the core team of Symfony should take a decision on this. I can work on both implementations. Keeping support for older php version needs main Symfony repository to be adapted before 6.0 comes out. Removing support for older php versions might need a major version of this package.
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. But indeed this one I missed when reporting here: symfony/symfony#43021 This will be a ton of changes, because all of. this class changed its return types. 😱
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Either we remove the return types from core, or we add some conditional classes/traits declarations in this bundle.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. So, should we revert these in core? If we're going to do that, I guess we should do it as quickly as we can. (I'm still very unfamiliar with the typing situation - so apologies for not having anything intelligent to add)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Yes, I am trying to fix everything here to know what types exactly should be reverted, because I wasn't taking care of static. My idea is:
For the moment I am having some trouble with PHPStan, since it is not a dependency of this project it got upgraded to 1.0 without notice and now it reports more errors.
Member
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. This makes sense to me - thank you and keep us posted :)
Contributor
Author
There was a problem hiding this comment. Choose a reason for hiding this commentThe reason will be displayed to describe this comment to others. Learn more. Im trying a little trick to patch symfony to remove its return types so we can ensure that those changes applied to Symfony 6.0 will make build pass with all versions here. So far I think it will work, The idea is to remove the last 2 commits from this PR once I do the Symfony PR to remove the return typehints wdyt? |
||
| { | ||
| if (isset($this->elements[$position])) { | ||
| return $this->createSubCrawler([$this->elements[$position]]); | ||
|
|
@@ -105,12 +105,12 @@ public function each(\Closure $closure): array | |
| return $data; | ||
| } | ||
|
|
||
| public function slice($offset = 0, $length = null): self | ||
| public function slice($offset = 0, $length = null): static | ||
| { | ||
| return $this->createSubCrawler(\array_slice($this->elements, $offset, $length)); | ||
| } | ||
|
|
||
| public function reduce(\Closure $closure): self | ||
| public function reduce(\Closure $closure): static | ||
| { | ||
| $elements = []; | ||
| foreach ($this->elements as $i => $element) { | ||
|
|
@@ -122,22 +122,22 @@ public function reduce(\Closure $closure): self | |
| return $this->createSubCrawler($elements); | ||
| } | ||
|
|
||
| public function last(): self | ||
| public function last(): static | ||
| { | ||
| return $this->eq(\count($this->elements) - 1); | ||
| } | ||
|
|
||
| public function siblings(): self | ||
| public function siblings(): static | ||
| { | ||
| return $this->createSubCrawlerFromXpath('(preceding-sibling::* | following-sibling::*)'); | ||
| } | ||
|
|
||
| public function nextAll(): self | ||
| public function nextAll(): static | ||
| { | ||
| return $this->createSubCrawlerFromXpath('following-sibling::*'); | ||
| } | ||
|
|
||
| public function previousAll(): self | ||
| public function previousAll(): static | ||
| { | ||
| return $this->createSubCrawlerFromXpath('preceding-sibling::*'); | ||
| } | ||
|
|
@@ -149,15 +149,15 @@ public function parents(): self | |
| return $this->ancestors(); | ||
| } | ||
|
|
||
| public function ancestors(): self | ||
| public function ancestors(): static | ||
| { | ||
| return $this->createSubCrawlerFromXpath('ancestor::*', true); | ||
| } | ||
|
|
||
| /** | ||
| * @see https://github.com/symfony/symfony/issues/26432 | ||
| */ | ||
| public function children(string $selector = null): self | ||
| public function children(string $selector = null): static | ||
| { | ||
| $xpath = 'child::*'; | ||
| if (null !== $selector) { | ||
|
|
@@ -219,7 +219,7 @@ public function html(string $default = null): string | |
| } | ||
| } | ||
|
|
||
| public function evaluate($xpath): self | ||
| public function evaluate($xpath): static | ||
| { | ||
| throw $this->createNotSupportedException(__METHOD__); | ||
| } | ||
|
|
@@ -241,29 +241,29 @@ public function extract($attributes): array | |
| return $data; | ||
| } | ||
|
|
||
| public function filterXPath($xpath): self | ||
| public function filterXPath($xpath): static | ||
| { | ||
| return $this->filterWebDriverBy(WebDriverBy::xpath($xpath)); | ||
| } | ||
|
|
||
| public function filter($selector): self | ||
| public function filter($selector): static | ||
| { | ||
| return $this->filterWebDriverBy(WebDriverBy::cssSelector($selector)); | ||
| } | ||
|
|
||
| public function selectLink($value): self | ||
| public function selectLink($value): static | ||
| { | ||
| return $this->selectFromXpath( | ||
| sprintf('descendant-or-self::a[contains(concat(\' \', normalize-space(string(.)), \' \'), %1$s) or ./img[contains(concat(\' \', normalize-space(string(@alt)), \' \'), %1$s)]]', self::xpathLiteral(' '.$value.' ')) | ||
| ); | ||
| } | ||
|
|
||
| public function selectImage($value): self | ||
| public function selectImage($value): static | ||
| { | ||
| return $this->selectFromXpath(sprintf('descendant-or-self::img[contains(normalize-space(string(@alt)), %s)]', self::xpathLiteral($value))); | ||
| } | ||
|
|
||
| public function selectButton($value): self | ||
| public function selectButton($value): static | ||
| { | ||
| return $this->selectFromXpath( | ||
| sprintf( | ||
|
|
||
Uh oh!
There was an error while loading. Please reload this page.