Skip to content

Conversation

@TomasVotruba
Copy link

@TomasVotruba TomasVotruba commented Feb 8, 2017

Ref #24

Here are few suggestions to improve code. I noticed there is lot of dead code.
Also mixed PSR-0 and PSR-4 structures was fixed.

And add usage of short arrays [], isset operator ??, return type hints, strict type hints.

What do you think about this? Feel free to comment particular commits.

@johnkary johnkary mentioned this pull request Feb 9, 2017

use PHPUnit\Framework\TestCase;

final class SlowTest extends TestCase
Copy link

Choose a reason for hiding this comment

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

why is this final? (and SpeedTrapListener)

Copy link
Author

Choose a reason for hiding this comment

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

The best practice to prevent inheritance. Do you need it?

I learn a lot from this post: http://ocramius.github.io/blog/when-to-declare-classes-final/

Choose a reason for hiding this comment

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

interesting article. no i don't need inheritance from SpeedTrapListener, though if the class is final then the only way to change behaviour is to fork your own version because there is no way to inject new behaviour (eg to change output format).
i wonder if ocramius' comments apply more to code within a larger project rather than packages/components? but thats a philosophical debate for another time... no reason to hold up release.
thanks for all you have done here BTW. nice work.

Copy link
Author

Choose a reason for hiding this comment

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

Finally, thank you!

@johnkary
Copy link
Owner

@TomasVotruba Thanks again for showing off all the small improvements we could make! I have merged PHPUnit 6.0 support to master branch. If you're still interested in adding some of these ideas could you open smaller more focused PR's against latest master?

Based on the work in this PR we could do these changes in separate PRs:

  • Support PSR-4 autoloading
  • PHP 7 language enhancements (short-array syntax, null-coalescing operator, strict types, scalar type hinting)

Let's preserve the direction the master branch is in regarding phpunit.xml, Travis config, classes are not defined final, class method and property visibility remains the same, etc. Feel free to focus on the above PRs!

@TomasVotruba
Copy link
Author

@johnkary Thanks for the message. I realize I made too many changes.

I'll look on those 2 PRs. Or could you send them? I'm in a bit lack of free time now.

@johnkary
Copy link
Owner

@TomasVotruba I will focus on two new features for slowness threshold per-testsuite and per-group. If you have not had time to work on them by then I'll submit PRs. Thanks!

@TomasVotruba
Copy link
Author

@johnkary Thank you!

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.

3 participants