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
Symfony 6 support (without Flex dependency) #1402
Conversation
These Psalm issues may have been resolved in the #1397 branch, and that commit could be cherry-picked |
@ciaranmcnulty I was looking the errors on the CI and I was wondering if you want to keep the support of php < 8.0. |
Symfony 6 supports PHP >= 8.0.2, support for Symfony 6 requires dropping support for PHP < 8.0.2. It's not really a question of whether you want to drop support for PHP < 8 but more of a realisation that this is, as far as I understand, dropping support for PHP < 8 is an unavoidable requirement. In order to support Symfony 6, is there any other choice other than to drop support for PHP < 8? |
@webignition Yes I think this is ok with keeping PHP 7 support. I think I was wrong with the issue encountered. |
@ciaranmcnulty Could you approve running the CI build please? |
@@ -31,7 +32,7 @@ | |||
*/ | |||
final class RunCommand extends Command | |||
{ | |||
public function getApplication() : Application | |||
public function getApplication() : ?BaseApplication |
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 method needs to return an instance of PhpSpec\Console\Application
instead of Symfony\Component\Console\Application
due to needing to subsequently call getContainer()
which is a method of the former but not a method of the latter.
Is this change necessary? I'm not saying it isn't, just curious given the impact this change makes.
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've tried this out in my own attempt to get Symfony 6.0 working and I can't see the need for this.
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.
Maybe I have to try again without these change...
But this is a different return typehint than the Symfony one and I'm not sure it can work.
Maybe just an assertion can be enough on phpspec 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.
Returning PhpSpec\Console\Application
not only works but is necessary for the command to call PhpSpec\Console\Application::getContainer()
.
You are correct in saying that the return type is different. An instance of PhpSpec\Console\Application
is acceptable to return here as it is a child type of (i.e. extends) Symfony\Component\Console\Application
. Technically speaking, this is a covariant return type and support was introduced in PHP 7.4.
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're right. But "we" have to drop support for PHP 7.3 then.
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 I think we can drop support for Symfony 3 too... It is not maintained anymore.
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.
@ciaranmcnulty Are you ok to drop both PHP 7.3 and Symfony 3 support?
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.
The PHP 7.3 concern is a valid point that I completely failed to consider and that does complicate things somewhat. But with PHP 7.3 now being EOL, I don't think it's fully unwise to consider dropping support.
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 think we should keep this returning Application
, then do a runtime assertion in the code that it's a BaseApplication
we got 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.
I think we can keep the existing code code, cause on PHP lower than 8.0 we have not symfony 6 downloaded so this still works with no return type on symfony lower than 6.
CI should be fixed before with that PR and Psalm error too |
4b87b9e
to
04628c7
Compare
@webignition @ciaranmcnulty do you think guys this PR can get merged soon, I can help if any other blocker 👼 |
@shouze There's nothing in particular that I can do to help speed things along other than suggest what might need to happen next. Which is, in the following order:
@ciaranmcnulty Does this seem like a good approach? |
@webignition I would add the PHP 8.1 support PR between first and second steps |
@ciaranmcnulty I will work on this PR this week now you merged the other needed PRs. Thx a lot |
45a4efa
to
9f5e246
Compare
@ciaranmcnulty Do you really want to maintain PHP 7.3 support? But if we keep PHP 7.3 support, we have to change this typehint and adding an extra check on the method. |
@ciaranmcnulty Could you run the CI on this one please? |
I don't mind dropping 7.3 support, it'll just mean a new major (only because that's the convention we established) - it should drop unmaintained Symfony too |
Great, in this current PR? CI is green for other PHP versions. |
I've updated the Can you target this PR against that branch please? |
I got another chance to think about this; I think we should support PHP 7.3. The next major will be 8.0+ and that will leave Symfony users who want to use SF 6.0 but are stuck on PHP 7.4 without a version to use. (commented inline in code how we can support 7.3) |
Do you have an Idea to solve the last error. It seems to need some investigation but this is not related to this PR imho. |
It's fixed on main, please rebase |
dcf9fa2
to
47fe0d1
Compare
done |
Thank you, I plan to do a release of PhpSpec 7 and then 8 (from |
Thank you too @ciaranmcnulty 🎉 |
No description provided.