Skip to content

feat: Support Symfony 7 #445

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

Merged
merged 1 commit into from
Dec 6, 2023
Merged

feat: Support Symfony 7 #445

merged 1 commit into from
Dec 6, 2023

Conversation

KDederichs
Copy link
Contributor

Q A
Bug fix? no
New feature? yes
BC breaks? no
Deprecations? no
Related tickets fixes #444
License MIT

What's in this PR?

Support for Symfony 7

Why?

Because it got released

Checklist

  • Updated CHANGELOG.md to describe BC breaks / deprecations | new feature | bugfix

@KDederichs KDederichs force-pushed the sf7_1.x branch 2 times, most recently from 4e40422 to cec9447 Compare December 5, 2023 15:31
@ostrolucky
Copy link
Collaborator

Have you tried this in a real project?

@KDederichs
Copy link
Contributor Author

So far not no, I'm kind of relying on the tests here.

Copy link
Collaborator

@dbu dbu left a comment

Choose a reason for hiding this comment

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

thanks a lot!

i checked in the build output, we indeed build with symfony 7 when we don't restrict the version. so this is looking good!

i don't fully trust the CI on this, would be glad if you can try your branch in a project to see if it really works.

(if you can run your tests locally, the easiest is to rm -r vendor/php-http/httplug-bundle && composer install --prefer-source and then you can use git commands inside the folder to add your repo as additional remote and checkout your branch.)

@@ -134,7 +134,8 @@ protected static function bootKernel(array $options = []): KernelInterface
$dispatcher = static::$kernel->getContainer()->get('event_dispatcher');

$class = (Kernel::MAJOR_VERSION >= 5) ? RequestEvent::class : GetResponseEvent::class;
$event = new $class(static::$kernel, SymfonyRequest::create('/'), HttpKernelInterface::MASTER_REQUEST);
$requestType = (Kernel::MAJOR_VERSION >= 7) ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST;
Copy link
Collaborator

Choose a reason for hiding this comment

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

Suggested change
$requestType = (Kernel::MAJOR_VERSION >= 7) ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST;
$requestType = (Kernel::MAJOR_VERSION >= 6) ? HttpKernelInterface::MAIN_REQUEST : HttpKernelInterface::MASTER_REQUEST;

main was introduced in symfony 5.3, and master is deprecated since then. lets use it from symfony 6 on.

@KDederichs
Copy link
Contributor Author

thanks a lot!

i checked in the build output, we indeed build with symfony 7 when we don't restrict the version. so this is looking good!

i don't fully trust the CI on this, would be glad if you can try your branch in a project to see if it really works.

(if you can run your tests locally, the easiest is to rm -r vendor/php-http/httplug-bundle && composer install --prefer-source and then you can use git commands inside the folder to add your repo as additional remote and checkout your branch.)

If you're fine with some skeleton app testing, I don't have a SF7 ready project atm (still waiting on/need to commit to some other bundles so I can update them)

@dbu
Copy link
Collaborator

dbu commented Dec 5, 2023

glad if you can give it a quick spin in a skeleton, yes. then at least we notice if something obvious is broken.

after that, we can release bugfix versions if something more complicated comes up.

@KDederichs
Copy link
Contributor Author

@dbu Seems to work fine.

I made a symfony HTTP Methods client with it:

            http_methods_client: true
            factory: 'httplug.factory.symfony'

added some plugins (host, headers) and then did a get request I copied over from another project of mine.

No errors, got the expected results and profiler works as well.

@dbu dbu merged commit b49bf25 into php-http:1.x Dec 6, 2023
@dbu
Copy link
Collaborator

dbu commented Dec 6, 2023

thanks a lot for checking it up!

released https://github.com/php-http/HttplugBundle/releases/tag/1.32.0

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.

Support Symfony 7
3 participants