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
PHP 8 Support #828
PHP 8 Support #828
Conversation
Currently waiting on sminnee/phpunit-mock-objects#6 to be merged and tagged before continuing here. |
You may wish to run your php 8 build with --ignore-platform-reqs. Without dropping PHP 5.6 and 7.0 support, any upgrading to at least phpunit 7 || 8 || 9, you'll likely run into issues. If you're looking to patch my phpunit forks, please test the new packages against phpunit/phpunit first, and confirm that the tests pass - this is what I got blocked on trying to upgrade some of the dependencies. |
@sminnee I've added "sminnee/phpunit" which indeed works thanks. I'm a bit stuck atm... For some bizar reason when I only run the build for PHP 8 it succeeds (see this build and my second to last commit) but when I re-enable all the other builds it fails and claims it cannot install PHP CS Fixer even though I've added |
Also the PHP Code Style Github Action fails atm but I suspect that has nothing to do with the current PR (since it's run on PHP 7.4). I believe when you trigger it on main it'll also fail. Probably something got changed on phpstan's side. |
I think I'm a little closer at figuring it out. As you can see below there's two nightly builds, one that fails and one that passes. I'm sure that the one that passes has the There's two questions:
|
Okay this one is ready for review now. Please note that I had to disable code coverage for PHP 8 for now because of an issue with PHPUnit and xdebug. See https://travis-ci.com/github/php-webdriver/php-webdriver/builds/197177332 This was fixed in a newer version of PHPUnit later on but I guess In general I want to suggest for this project to drop support for older PHP versions so you can remove the PHPUnit dependency overrides. As most of these PHP versions are EoL I don't think it makes sense in maintaining them anymore. However, I understand that this is a personal choice of the maintainer of course. Anyway, would appreciate a review, merge and tag so we can finally patch Laravel Dusk. Let me know if anything else needs to be done. Thanks all! 🙂 |
For some bizar reason the PHP 5.6 til 7.2 builds are now failing after my last commit... https://github.com/php-webdriver/php-webdriver/pull/828/checks?check_run_id=1343276205 |
This comment has been minimized.
This comment has been minimized.
Hi @OndraM ! I upgraded things and did fix everything that was red. |
@williamdes fantastic work 🙌 |
I can not do that because phpcs will report me to use some phpunit asserts that are not right. |
LGTM, thanks everyone! The final question is how to rebase & fixup those 25 commits to keep the changes contained. Any preferences @driesvints @williamdes? |
Done, I did a reset soft and created 2 commits from the changes. WTF: phpstan broken ?? https://github.com/php-webdriver/php-webdriver/pull/828/checks?check_run_id=1406013380#step:6:37 |
@williamdes can you try to retrigger the static analysis github action? It might just be a hiccup. |
Hi @ondrejmirtes |
So maybe we can temporarily add constrain to composer.json to avoid latest PHPStan version(s)? |
It'd be easier to:
|
@ondrejmirtes AFAIK this whole codebase is UTF-8. Is there a way how to find out which file causes the trouble? I also tried this and find no non-UTF-8 files... https://gist.github.com/rmetzler/2947828 |
I tried on my local workstation: composer analyse
# fails
vendor/bin/phpstan.phar analyze ./lib ./tests --level 2 -c phpstan.neon --ansi
# fails
vendor/bin/phpstan.phar analyze ./lib ./tests --level 2 -c phpstan.neon --ansi
# fails
vendor/bin/phpstan.phar analyze ./lib ./tests --level 2 -c phpstan.neon --ansi --debug -vvv
# SUCCESS
vendor/bin/phpstan.phar analyze ./lib ./tests --level 2 -c phpstan.neon --ansi
# SUCCESS, WTF
rm -rf /tmp/phpstan
vendor/bin/phpstan.phar analyze ./lib ./tests --level 2 -c phpstan.neon --ansi
# fails @ondrejmirtes |
The reason why it fails are these two commits: So it's not a new bug, it just surfaces an error condition that was failing silently before, possibly causing error reports to be missed. |
@OndraM @williamdes is there any way we can work around this for now so we can merge this PR? Afaik this has nothing to do with this PR and it'll probably also fail on the main branch? |
From what I found, the cause is in WebDriveKeys. However we need to declare WebDriver key codes there... Doing this is nothing invalid from PHP point of view. @ondrejmirtes So this error is caused by clue/reactphp-ndjson#21 , which is used by PHPStan, and which causes non-unicode characters to break JSON parsing used internally in PHPStan? |
Yes, will probably do this. I just wanted to know what is the root cause for this and whether it is related to this PR. |
Workaround for the PHPStan issue here: #830 |
phpstan.neon
Outdated
@@ -7,8 +7,6 @@ parameters: | |||
ignoreErrors: | |||
# To be fixed: | |||
- '#Call to an undefined method Facebook\\WebDriver\\WebDriver::getTouch\(\)#' | |||
- '#Call to an undefined method Facebook\\WebDriver\\WebDriverElement::getCoordinates\(\)#' | |||
- '#Call to an undefined method Facebook\\WebDriver\\WebDriverElement::equals\(\)#' |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
And now those needs to be put back 🙃 .
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Thank you !
Happy you did point that out because I was searching why the error was occurring ^^
Co-Authored-By: Dries Vints <dries@vints.io>
@ondrejmirtes @OndraM @williamdes thanks all! 🙂 |
PHP 8 support is now merged to
This will have to be 1.9.0, as we already have other new feature in |
@ondrejmirtes @OndraM @williamdes awesome work. Looking forward to that |
Hey @OndraM. Is there anything blocking the 1.9.0 tag? We'd really like to patch Dusk soon since it's currently blocking a lot of other projects from shipping PHP 8 support. Let me know if there's anything I can do to help out. |
@driesvints Sorry for the delay, I'd like to finish one other PR (#556) to get it merged into the 1.9.0 release. Should be finished once CI builds are done, and the release will be just afterwards :) |
@OndraM no sorry needed. Awesome, looking forward to it :) |
📢 1.9.0 with PHP 8 support was just released. |
@OndraM amazing! |
sed -i 's/function runBare(): void/function runBare()/g' tests/functional/WebDriverTestCase.php; | ||
|
||
# Return back to original dir | ||
cd - > /dev/null |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
@OndraM @williamdes would it be okay with you two if I used this script for algolia/algoliasearch-client-php#644 as well?
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Yes you can copy it :)
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
👍
Working on providing full PHP 8 support for php-webdriver. We'll need this for Laravel Dusk.
Currently using this PR to run the builds.