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

Symfony 5 support #97

Merged
merged 11 commits into from
Feb 10, 2020
Merged

Symfony 5 support #97

merged 11 commits into from
Feb 10, 2020

Conversation

KDederichs
Copy link
Contributor

@KDederichs KDederichs commented Jan 30, 2020

Added Symfony 5 support and also implemented contracts events (with BC)

@KDederichs
Copy link
Contributor Author

I'm a bit unsure what to do with the Failure on 4.2 which seems to be the odd one out of the bunch, if someone has a suggestion I'd like to hear it.

Copy link
Collaborator

@goetas goetas left a comment

Choose a reason for hiding this comment

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

I think is good, but suggested some improvements


private function dispatch($eventName, $event)
{
if (get_class($this->eventDispatcher) === 'Symfony\\Contracts\\EventDispatcher\\EventDispatcherInterface') {
Copy link
Collaborator

Choose a reason for hiding this comment

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

You should use here instanceof instead of get class. There are multiple types of event dispatchers

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Ah my bad I somehow had it stuck in my mind that that only works with the ::class constant, which doesn't exist on PHP 5.4, so I went with that instead

@@ -2,6 +2,18 @@

namespace Noxlogic\RateLimitBundle\Tests;

class TestCase extends \PHPUnit_Framework_TestCase
{
if (!class_exists('\\PHPUnit\\Framework\\TestCase')) {
Copy link
Collaborator

Choose a reason for hiding this comment

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

Can't we just drop old phpunit? Anyway is an dev dependency

Copy link
Contributor Author

@KDederichs KDederichs Jan 31, 2020

Choose a reason for hiding this comment

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

same problem as above I guess, the need for php 5.x kinda locks you into the old phpunit...

Copy link
Owner

Choose a reason for hiding this comment

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

I think we need to create a new major version if we want to drop 5.x support?

Copy link
Contributor Author

@KDederichs KDederichs Jan 31, 2020

Choose a reason for hiding this comment

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

I mean I could move it to PHP 7.2 (since phpunit 7 will reach End of life next week)

Copy link
Collaborator

Choose a reason for hiding this comment

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

A major is not required here since php unit is a dev dependency, users are not impacted by it at all.

Consider also this post by the doctrine team that explains why dropping old versions is not considered a BC brak
https://www.doctrine-project.org/2017/07/25/php-7.1-requirement-and-composer.html

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Not sure if that counts as major version upgrade though

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Tbh at that point I'd go as far as limiting it to >= 4.3 since 4.2 can't seem to decide which event/dispatcher systems it wants.

Copy link
Collaborator

Choose a reason for hiding this comment

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

4.2 is not supported anymore and upgrading to 4.4 should be trivial so for me is a big +1

Copy link
Collaborator

Choose a reason for hiding this comment

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

If was up to me will do 3.4, 4.4 and 5.0

Copy link
Contributor Author

Choose a reason for hiding this comment

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

I made it 3.4 and >= 4.3 only and now the only things that fail are the tests flagged prefer-lowest and the SF5 one (cause the oauth server bundle isn't there yet) so allowed those to fail for now

Copy link
Collaborator

@goetas goetas left a comment

Choose a reason for hiding this comment

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

3.4 is still maintained, and is a LTS, https://symfony.com/releases/3.4 why dropping it?

@KDederichs
Copy link
Contributor Author

KDederichs commented Jan 31, 2020

I wanted to see if the 4.3 framework still worked with the 3.4 version since it allows 3.4 in its composer file, turns out it does not work. (tried to get rid of the failures on prefer-lowest which are caused by type incompatibilities in the Phpunit methods)

put it back in though and now tests for 3.4 are fine

@jaytaph
Copy link
Owner

jaytaph commented Feb 5, 2020

@goetas @mcfedr Looks good to me

Copy link
Collaborator

@goetas goetas left a comment

Choose a reason for hiding this comment

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

green light from my side

@mcfedr
Copy link
Collaborator

mcfedr commented Feb 6, 2020

LGMT - Shall I go ahead and make a new release - I think it can be a minor version bump - the composer.json requires will limit its install to people that need it - I dont see any breaking changes for the user

@sapila
Copy link

sapila commented Feb 10, 2020

Looks good 👍

@dsuurlant
Copy link

Looking forward to seeing this merged! :)

@jaytaph jaytaph merged commit b9e4e86 into jaytaph:master Feb 10, 2020
@KDederichs
Copy link
Contributor Author

@jaytaph ok now that it's live and I ran it against production code tests it breaks....
you might wanna revert it for now cause it's giving me nice Type errors....
TypeError: Argument 1 passed to Noxlogic\RateLimitBundle\EventListener\RateLimitAnnotationListener::onKernelController() must be an instance of Noxlogic\RateLimitBundle\Events\ProxyFilterControllerEvent, instance of Symfony\Component\HttpKernel\Event\ControllerEvent given

@KDederichs
Copy link
Contributor Author

Actually I made a PR that fixes it see #100

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.

6 participants