Skip to content

Conversation

dkarlovi
Copy link
Contributor

@dkarlovi dkarlovi commented Jun 28, 2024

Continues #802.
Closes #760.
Closes #784.

@Korbeil this now runs CS Fixer on generated AND expected when on PHP Parser v4, the fixtures are dumped by PHP Parser v5 (which is why they're all changed now).

I needed to bump PHPUnit to v9 to be able to install CS Fixer v3. It actually makes a bunch of tests pass as is, but not all of them, you can see the diffs if you run PHPUnit with --testdox.

It should be a matter of finding the correct CS Fixer config.

cc @vdauchy

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jun 28, 2024

FYI this does complete for me in 8 minutes, but I have a beefy workstation, I expect it will run for hours on GH. The issue is there's just some gigantic examples generated (Github, Twitter, Docker API) which contain thousands of files which now all need to be processed before comparing them.

Excluding Docker API, Github and issue-445 would result in significant speedup.

@dkarlovi
Copy link
Contributor Author

I've excluded the biggest fixtures from being tested on old PHP Parser, the tests now run in 47s for me (as opposed to 8min). It's now useable again.

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 1, 2024

This should now work except for nikic/PHP-Parser#1009

Since we don't know when and if this gets fixed, the solution I've used is to NOT use ternaries in Client and BaseEndpoint. It results in slightly longer code, but who cares since it's generated. PHP Parser 5.1 got released fixing this issue, we're immediately requiring it.

@dkarlovi dkarlovi force-pushed the update-php-parser branch 2 times, most recently from 723aaac to 6d4d7af Compare July 1, 2024 15:07
@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 1, 2024

OK, I've let the v4 version of tests run without excluding the beefy fixtures locally and the result is now

Tests: 131, Assertions: 22699, Failures: 1.

It all works on both v4 and v5, except the datetime-no-format fixture as seen in the checks here too. It means we can fix that by removing the tertiary and should be able to merge.

@Korbeil is that OK with you? /cc @vdauchy

@dkarlovi dkarlovi force-pushed the update-php-parser branch from 6d4d7af to f199fa6 Compare July 2, 2024 08:05
@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 2, 2024

@Korbeil ready for review.

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 2, 2024

BTW I've also ran the entire test suite on v4 locally and it all works

Time: 07:48.009, Memory: 534.00 MB

OK (131 tests, 22699 assertions)

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 2, 2024

Ah, I need to update the composer.json files in subrepos too.

@dkarlovi dkarlovi mentioned this pull request Jul 2, 2024
@Korbeil
Copy link
Member

Korbeil commented Jul 2, 2024

I guess the fact tests-lowest takes 17min is due to CS-Fixer running ?

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 2, 2024

@Korbeil yes, it needs to fix code style for thousands of files (both fixtures and generated). This is after we've marked the six biggest fixtures as skipped.

@l-you
Copy link

l-you commented Jul 2, 2024

Great job!

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 2, 2024

@l-you thanks, all heavy lifting was done by @vdauchy 😃

Copy link
Member

@Korbeil Korbeil left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I tried to reread some part of it and it looks all good to me, thanks for the work @vdauchy & @dkarlovi 🙏

Could you add a note about this change in the CHANGELOG ? 🙏 Then I'll merge this !

@dkarlovi
Copy link
Contributor Author

dkarlovi commented Jul 3, 2024

@Korbeil done.

@Korbeil Korbeil merged commit d46a090 into janephp:next Jul 3, 2024
@dkarlovi dkarlovi deleted the update-php-parser branch July 3, 2024 12:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Bump nikic/php-parser to latest version Classes referenced as strings instead of via ::class
4 participants