Skip to content
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

Fix issue 414, add tests + add php8 to travis (but not composer) #415

Merged
merged 5 commits into from
Aug 25, 2021

Conversation

grymmare
Copy link

@grymmare grymmare commented Dec 15, 2020

  • Fixed bug caused by php 8 no longer returning false in some cases for substr
  • Added tests for DateTimeStringBugWorkaround
  • Added php 8 to travis as recommended by @enumag (but not composer)

Please go gentle on my, this is my first PR in the open source community. Please let me know if I can improve anything. I'd like to continue to contribute 😄

src/Internal/DateTimeStringBugWorkaround.php Outdated Show resolved Hide resolved
tests/Internal/DateTimeStringBugWorkaroundTest.php Outdated Show resolved Hide resolved
tests/Internal/DateTimeStringBugWorkaroundTest.php Outdated Show resolved Hide resolved
tests/Internal/DateTimeStringBugWorkaroundTest.php Outdated Show resolved Hide resolved
tests/Internal/DateTimeStringBugWorkaroundTest.php Outdated Show resolved Hide resolved
@enumag
Copy link
Member

enumag commented Dec 15, 2020

Please go gentle on my, this is my first PR in the open source community. Please let me know if I can improve anything. I'd like to continue to contribute 😄

@grymmare Thanks for your first opensource contribution! I added a code review for minor improvements. ;-) No worries about these minor mistakes, happens to everyone the first time. ^^

@fritz-gerneth
Copy link
Contributor

Not sure why Travis is not running on this PR. I don't think with the current setup of dependencies this is actually installable on PHP8 at the moment. See #413 for the initial discussion & errors.

@grymmare
Copy link
Author

Not sure why Travis is not running on this PR. I don't think with the current setup of dependencies this is actually installable on PHP8 at the moment. See #413 for the initial discussion & errors.

It seems to have been run now. With errors though, but they are psalm related (pure function returning member not marked as pure)

@fritz-gerneth
Copy link
Contributor

I only noticed now this is targetting the master branch (v8) and not the 7.x branch :)

- DEPENDENCIES="--ignore-platform-req=php"
- php: 8.0
env:
- DEPENDENCIES="--ignore-platform-req=php --prefer-lowest --prefer-stable"
Copy link
Contributor

Choose a reason for hiding this comment

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

I don't think we should ignore these here. Better fix these issues properly. Not doing so makes this either not installable for normal users or it forces them to use this flag on their project too.

Copy link
Author

Choose a reason for hiding this comment

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

Sure, makes sense, but without the flag, we cannot run the tests for php 8 until all dependencies supports php 8. What if we don't add php8 to composer.json, that way we don't officially support php8, but can still run tests.

The tests that fail (in addition to dependencies not supporting php8 yet) are related to the vimeo/psalm version.

  • Psalm 3.11.2 is successful
  • Psalm 3.18.2 fails. Seems that marking a class with @psalm-immutable conflicts with @psalm-pure somehow. Maybe this can be resolved by specifying a version constraint, but I guess this depends on how psalm develops, or removing all @psalm-pure annotations in classes annotated with @psalm-immutable

@prolic
Copy link
Member

prolic commented Dec 16, 2020

As php-cs-fixer can be installed with PHP 8, but it's not possible to run yet, we need to disable these checks on travis until it's supported to check on PHP 8 as well.

@grymmare
Copy link
Author

grymmare commented Dec 16, 2020

As php-cs-fixer can be installed with PHP 8, but it's not possible to run yet, we need to disable these checks on travis until it's supported to check on PHP 8 as well.

But, doesn't this only apply if we would start using php 8 features, which we cannot if we want to support 7.4?


The tests that fail are the tests that uses the latest dependencies, so if they were successful before, probably they fail now due to changes in psalm and php-cs-fixer, and so they will fail in any new commit.
image

Mostly psalm related and fails for both PHP 7.4 and PHP 8.0 (not related to this PR, but has to be fixed)
image

The php-cs-fixer failures is minor (easy to fix and is in my added test file)
image

@prolic what do you think?

EDIT: I now see that due to how travis is configured, the cs check (and test-coverage) is only done for php 7.4.

…omposer to not signal that it is supported
@grymmare grymmare changed the title Add php8 to composer/travis + fix issue 414 Fix issue 414, add tests + add php8 to travis (but not composer) Dec 17, 2020
@grymmare grymmare requested a review from enumag December 20, 2020 12:16
composer.json Outdated
@@ -28,7 +28,7 @@
"phpspec/prophecy": "^1.10.3",
"phpunit/phpunit": "^9.1",
"prooph/php-cs-fixer-config": "^0.3.1",
"vimeo/psalm": "^3.11.2"
"vimeo/psalm": "^3.11.2,<3.12"
Copy link
Member

Choose a reason for hiding this comment

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

why this <3.12 ?

Copy link
Author

Choose a reason for hiding this comment

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

Because later versions adds psalm warnings which fails the build. (see log here: https://travis-ci.com/github/prooph/event-store/jobs/461215042)

My suggestion is to fix this in another PR. If you disagree though, we need to make the psalm checks successful. I havn't found any other solution than removing all the affected @psalm-pure annotations.

Copy link
Author

Choose a reason for hiding this comment

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

Found this: vimeo/psalm#4114

Instead of @psalm-pure, use @psalm-mutation-free

I can change this throughout the code (more than 100 places I think) and fix some other psalm related stuff. Just let me know.

@prolic
Copy link
Member

prolic commented Dec 21, 2020

@grymmare
Copy link
Author

see https://github.com/prooph/php-cs-fixer-config/releases/tag/v0.4.0

Thanks. Updated to use this version

@prolic prolic merged commit be08b9d into prooph:master Aug 25, 2021
@prolic
Copy link
Member

prolic commented Aug 25, 2021

@grymmare sorry I didn't check this earlier. My bad.

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.

4 participants