-
Notifications
You must be signed in to change notification settings - Fork 72
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
Add support for Laravel 9 #213
Conversation
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.
Good initiative, but I would suggest only adding 9.x
to the illuminate_version
matrix for now.
Previously, the tests were testing the lowest and highest version of each Laravel major version, but I don't think the status quo of this PR still does that.
illuminate_version: [6.*, 8.*] | ||
composer_flags: ['', '--prefer-lowest'] | ||
illuminate_version: [6.*, 7.*, 8.*, 9.*] | ||
stability: [prefer-lowest, prefer-stable] |
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.
--prefer-stable
is not the opposite of --prefer-lowest
, it also makes sense in combination.
Actually, I think that --prefer-stable
is even the default, but I'm not totally sure.
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.
Indeed, both can be used in combination I think. prefer-stable
will check for packages with minimum-stability
set to stable. But I don't think it's the default (and if so, it's still explicit this way). It's just an extra check to see if this package is easily installable, feel free to improve if possible!
I think we need to remove restrictions of |
Indeed, this seems to be the big blocker going forward. As an alternative, #204 discusses supporting the latest laravel-ide-helper and mentions a fork which achieved that. However, that fork has not been updated since August 2021. Due to limited resources, I will probably have to migrate at least one of my Laravel projects to larastan (maintained by Nuno who works for Laravel), because it requires Laravel 9 asap. |
@caugner Larastan now (^2.0) has several nasty bugs with generics. :| We use phpstan and psalm together because it increases global code quality. Nowadays the functionality difference between |
What are those nasty bugs? Maybe we can fix them if you open an issue 😊 |
@canvural sorry. I meant phpstan issues, e.g.: phpstan/phpstan#6505 And if I update Larastan to |
Any timeline on when Laravel 9 will be supported? |
@HDVinnie if a PR is made with green CI, I'll happily merge! I don't have the time to figure it out myself right now |
2f8390a
to
6096cf0
Compare
Status update
Hopefully if this is fixed, all the dependency issues are solved and we can work on proper Laravel 9 compatibility. |
This is really unfortunate. You are a maintainer of this project and yet you are essentially abandoning it and moving to phpstan because you don't have the time to maintain it. I'm not trying to start a fight here but it was rather shocking to read that. To not have time to maintain this is one thing but to just abandon even trying to fix it and move to another product is a whole other thing and compromises the ability for people to use Psalm in Laravel which ultimately hurts Psalm in the end. The fork (https://github.com/brokeyourbike/psalm-plugin-laravel) itself exists because #204 is still not solved (and for some reason the fork shows up on the Psalm site as a supported plugin which is further confusing and fragmenting to the community as a whole). #204 should have been solved a while ago. Maintain two separate versions. The fork exists because the fork dropped support for Laravel 6. This project could do the same by just maintaining two separate versions. I mean heck there hasn't even been a release of this in the last 8 months so it really doesn't effect anyone to have two versions of this. The longer this process drags out (Not supporting the new IDE helper/writing your own) and not supporting Laravel 9 the more this plugin prevents people from using Psalm with Laravel. Laravel already supports PHPStan because a core developer of Laravel wrote the plugin himself. To me the outcome is obvious. If you want to use Laravel 9 then do not use Psalm, use phpstan. Or wait until someone does another fork that supports Laravel 9...then 10 and so forth.
I'm sorry but the
This project hasn't had a release since July 2021. Why does this matter? Open Source is hard. Especially when you aren't getting paid. But watching the outcome of #204 thus far (which was essentially "we need to write our own and not use ide-helper but we don't have time") and that going no-where worries me for when this will support Laravel 9 (if ever) |
So basically you are disappointed that someone no longer has (unpaid) time to support an open source project you rely on and you feel the need to let that person know that it shocks you? 🙃 |
No. It's shocking that one of the maintainers said he has no time to work on this so he's going to use another project instead. That should not have been said. Anyone who comes here for help will see that and think to themselves why use this" If the maintainer no longer has time then they should say "we need more help". Instead it's "we don't have time. patches welcome if you get CI to pass!" Do you not see an issue with that? Both maintainers said they have no time to maintain the project they are maintaining. CI literally isn't even passing on the master branch and it hasn't for a while. The fact that a maintainer said patches welcome if you get CI to be green is strange because it's not even green right now There have been several proposed fixes to support new ide helper and all have been rejected because of the continued need to support laravel 6.0 even though one could just do a sem ver release of a new major version. The fork that exists is also an issue because it violates packagist.org guidelines which state that one should not publish packages that are forks. Yet it exists in packagist.org and additionally it's listed on the psalm site. The reasoning the fork exists in the first place is because this project can't find a solution for a long standing issue in regards to ide helper. That's a big big issue in itself. That guy went off and forked it because he say that a solution was unattainable in this project. This will keep happening I'm sure. Especially with laravel 9. I'm trying to bring awareness that saying "I'm moving to phpstan" will just cause more of these forks. I work on the language server engine for psalm and also I'm the maintainer for the vscode plug-in for psalm. So I do my fair share of unpaid open source development. I'm just confused by responses like "I'm moving to phpstan. Patches welcome" from a maintainer. I wouldn't have even commented on this if the comment about "I'm switching to phpstan" from a maintainer wasn't said. |
I don't think @caugner is a maintainer of this project. He just contributes a lot. So it's totally fine if he says he will not work on this. |
@canvural and then yes. I am totally wrong. I accept that and I apologize. The appearance from issues and PRs is that he was a maintainer not just a contributor. However maybe this project needs more than one maintainer if the solution from a very active contributor is "I'm moving to phpstan" I think I've stirred the pot a bit much here and I'm sorry for that. Thanks for your work here @Nielsvanpach and for the packages @spatie provides. |
@Nielsvanpach Ok this PR (Nielsvanpach#2) fixes the tests (except for 1 or 2....maybe?) and also fixes the merge conflict with master |
Ok so this should be a little easier for someone to fix (if not me). The failing tests are due to php 8.1 incpompatibilies when using prefer-lowest because the issues were made in as a non-breaking change in the same release. Additionally in Laravel 9 more specific models are returned rather than just Model itself so the tests need to be adjusted to reflect that for Laravel 9 as opposed to 8 |
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.
Is there any specific reason why the tests for firstOrCreate()
, firstOrNew()
and factory()
were removed? These can still be used in Laravel 9.
Edit: Now I see that the tests no longer make sense because of the removed Laravel versions.
I created a PR to this branch that should fix the remaining failing tests. Does anyone have a better idea to fix the PHP 8.1 issues than to |
Thanks @mzur ! |
Fix failing tests for firstOrCreate, firstOrNew and PHP 8.1
All checks are green now so this may be ready to merge? |
@mzur thanks for getting it the final way there! |
use RuntimeException; | ||
|
||
/** | ||
* Duplicate of https://github.com/psalm/codeception-psalm-module |
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.
Hey could you help me understand why we need this duplicated? Do we need some changes merged upstream to codeception-psalm-module
? @weirdan has been great at merging prs fast! Let me know
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.
It's duplicated because of the changes to codeception. Doing the PR against https://github.com/psalm/codeception-psalm-module would require a newer version of codeception which doesnt support PHP 7.x.
See: https://www.diffchecker.com/kbix1BTd
Specifically params that were strings are now PyStringNode
object and additionally, exit codes are now integers instead of strings
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.
I just went through https://github.com/psalm/codeception-psalm-module and unfortunately even checking it out and running the tests there without doing any code modifications there are 13 unit test failures.
The issue is with the deprecated usage of totallyTyped
and yes usually Weirdan is quick on PR changes but @mzur already did a PR for this back in February which is still not merged. psalm/codeception-psalm-module#39
@@ -8,40 +8,11 @@ jobs: | |||
strategy: | |||
fail-fast: false | |||
matrix: | |||
php: [7.3, 7.4, 8.0, 8.1] | |||
illuminate_version: [6.*, 8.*] |
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.
It would be great if we could support all versions in the same major release (1.x) -- Could you help me understand what might be a breaking change not allowing us to support these still? (I want to continue supporting laravel 6 til EOL, which is in september).
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.
I don't think it' possible to add Laravel 9 support without dropping 7.3 and 7.4 support.
Laravel 6 won't work well on php 8. It's certainly not supported. That's why I believe laravel 6 support was dropped.
Is there a major issue with just issuing a 2.0 release for this PR? I don't understand the hesitation at doing a split release as has been already mentioned in this PR previously. See: #213 (comment)
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.
Larastan (Laravel plugin for PHPStan) also released a new major version for Laravel 9.
Main reason we have a major version increase is we dropped support for Laravel versions older than 9. Because now all the Collection stubs Larastan had are moved to the Laravel core!
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.
My hesitation is just more maintenance overhead -- I would think we could solve that by adjusting the test matrix to not run laravel 6 on php 8 (like we are already doing with other tests) .
It's not a blocker, would just like to understand what exactly is causing the need for multiple versions
Thanks for the hard work everyone! Give me a day or two to figure out how best to merge + maintain this, but expect it to be merged + released soon :) |
"slevomat/coding-standard": "^6.2" | ||
"phpoption/phpoption": "^1.8.0", | ||
"symfony/http-foundation": "^5.3.7 || ^6.0", | ||
"ramsey/collection": "^1.2.0" |
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.
curious what we need this for? I don't see it referenced in the code
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.
I know that if ramsey/collection
is less than 1.2.0 it blows up on PHP 8.1 tests because Return Type will Change errors.
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.
These were all the packages that didn't work with PHP 8.1 at prefer-lowest
. I didn't know any better than to require the versions compatible with PHP 8.1 to fix the failing tests. The main issue is the breaking change of return type checks in the minor release of PHP and all these packages claiming to work with PHP ^8.0
although they are not.
composer.json
Outdated
@@ -46,6 +50,7 @@ | |||
}, | |||
"scripts": { | |||
"analyze": "psalm", | |||
"analyse": "psalm", |
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.
this looks accidental
Fix accidental script declaration in composer.json
Thanks for the PR! cutting a new major release, 2.0 |
I don't think it' possible to add Laravel 9 support without dropping 7.3 and 7.4 support.
Current issues
symfony/finder v6 is used in Laravel 9.
https://github.com/vimeo/psalm/blob/4.18.x/composer.json#L36
Hopefully if this is fixed, all the dependency issues are solved and we can work on proper Laravel 9 compatibility.