Skip to content

[PhpBridge] add PHPUnit 7 support to SymfonyTestsListener #26024

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

Closed
wants to merge 2 commits into from

Conversation

shieldo
Copy link
Contributor

@shieldo shieldo commented Feb 2, 2018

Q A
Branch? 3.4 up to 4.0 for bug fixes
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets #26017
License MIT

Add support for the new PHPUnit 7 major release to the PHP Bridge for PHPUnit.

I wasn't sure about making a second legacy class here, or the naming of that class - but it seems like something like this would be required. Can re-name if there's a better suggested approach.

@shieldo
Copy link
Contributor Author

shieldo commented Feb 2, 2018

There's also the question of whether having return types in a file that's being parsed by <PHP 7 will cause an error even if that class isn't to be executed in that runtime. Can anyone comment on that? It might be that this is only appropriate to submit to 4.0+ branches.

@nicolas-grekas nicolas-grekas added this to the 3.4 milestone Feb 2, 2018
@nicolas-grekas
Copy link
Member

nicolas-grekas commented Feb 2, 2018

AFAIK, phpunit 7 supports not using void, isn't it? If yes, then we should just do the strict minimum to make the bridge work with phpunit 7 without using features incompatible with our lower supported PHP version, if possible.

@shieldo
Copy link
Contributor Author

shieldo commented Feb 2, 2018

My understanding is that because this class is implementing an interface defined within phpunit/phpunit and that interface defines return types, the return types cannot then be omitted in implementing classes.

I suppose conditionally requiring another file where the class is defined might work better, but that also seems quite kludgy.

@shieldo
Copy link
Contributor Author

shieldo commented Feb 2, 2018

Another option might be to use class_alias for this rather than just for both of the legacy ones.

@nicolas-grekas
Copy link
Member

nicolas-grekas commented Feb 2, 2018

Note that on v4, the bridge supports PHP 5.5. That's the special exception (same on 3, where PHP 5.3 is the min for the bridge only, this allows running the latest bridge on most supported versions.)

@shieldo
Copy link
Contributor Author

shieldo commented Feb 2, 2018

Note taken. I'll probably rework using class_alias to progressively enhance, but any other advice/ suggestions welcome.

Copy link
Contributor

@Jean85 Jean85 left a comment

Choose a reason for hiding this comment

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

I agree that an other usage of the class_alias is the only way to go for now. I would suggest to decide how long we want to support older, unsupported versions of PHPUnit in this bridge, though...

@shieldo
Copy link
Contributor Author

shieldo commented Feb 4, 2018

@Jean85 Was going to rework this PR just now to progressively enhance - i.e. to use class_alias for the new class with PHP 5.4+ (if we include traits) syntax in order not to introduce parse errors. Is it OK to rework this PR now you've approved it? It'll be the same classes more or less but in a different order.

@shieldo
Copy link
Contributor Author

shieldo commented Feb 4, 2018

@Jean85 I've added another commit to convert this to using class_alias in the case of PHPUnit 7/ PHP 7.1, in order to leave the original SymfonyTestsListener class parseable by PHP 5.3 and up. If you'd like me to squash the two commits in this PR, let me know - I didn't want to rewrite the history of what you'd already approved.

@Jean85
Copy link
Contributor

Jean85 commented Feb 5, 2018

@shieldo as you can see, my approval tick is not green, I do not have powers here 😄
BTW, contributions are normally squashed automatically afterwards, so you don't have to bother about it.

@vivekagarwal1984
Copy link

When is this getting merged?

@nicolas-grekas
Copy link
Member

Thank you @shieldo.

nicolas-grekas added a commit that referenced this pull request Feb 11, 2018
…(shieldo)

This PR was squashed before being merged into the 3.4 branch (closes #26024).

Discussion
----------

[PhpBridge] add PHPUnit 7 support to SymfonyTestsListener

| Q             | A
| ------------- | ---
| Branch?       | 3.4 up to 4.0 for bug fixes <!-- see below -->
| Bug fix?      | yes
| New feature?  | no <!-- don't forget to update src/**/CHANGELOG.md files -->
| BC breaks?    | no
| Deprecations? | no <!-- don't forget to update UPGRADE-*.md files -->
| Tests pass?   | yes
| Fixed tickets | #26017 <!-- #-prefixed issue number(s), if any -->
| License       | MIT

Add support for the new PHPUnit 7 major release to the PHP Bridge for PHPUnit.

I wasn't sure about making a second legacy class here, or the naming of that class - but it seems like something like this would be required. Can re-name if there's a better suggested approach.

Commits
-------

a175a25 [PhpBridge] add PHPUnit 7 support to SymfonyTestsListener
*
* @final
*/
class SymfonyTestsListenerWithReturnTypes implements TestListener
Copy link
Contributor

Choose a reason for hiding this comment

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

shouldn't this be marked internal as people should only interact with SymfonyTestsListener?

Copy link
Member

Choose a reason for hiding this comment

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

yes! see #26139

nicolas-grekas added a commit that referenced this pull request Feb 11, 2018
This PR was merged into the 3.4 branch.

Discussion
----------

[Bridge\PhpUnit] Cleanup BC layer

| Q             | A
| ------------- | ---
| Branch?       | 3.4
| Bug fix?      | no
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | -
| License       | MIT
| Doc PR        | -

Follow up of #26024

Commits
-------

c41681c [Bridge\PhpUnit] Cleanup BC layer
This was referenced Mar 1, 2018
@shieldo shieldo deleted the support_phpunit_7 branch October 23, 2019 09:43
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

6 participants