Thanks to visit codestin.com
Credit goes to github.com

Skip to content

Conversation

@jworreth
Copy link
Contributor

@jworreth jworreth commented Feb 10, 2025

  • Configure github actions
  • Fix deprecations for PHP 8.4
  • Test with all supported version of PHP
  • Use createFromMethodName instead of the constructor

Note that github action was temporarily used to test with all supported versions of PHP.
I removed the yml file configuring the github action because it will be costly at some point.

- Fix deprecations for PHP 8.4
- Test with all supported version of PHP through the github actions
pipeline which has been removed afterward
- Use createFromMethodName instead of the constructor
@jworreth
Copy link
Contributor Author

jworreth commented Mar 1, 2025

Any news about this PR ?

Could you please take a look at it ?

@rowanhill
Copy link
Owner

First, thanks for this contribution! Secondly, sorry for taking a while to get to it - I don't have much time for OSS in general, at the moment.

Now the GitHub Actions stuff is removed, this PR looks pretty good. A couple of small things though:

  1. Would you mind pulling out the createFromMethodName if/else into a method somewhere?
  2. The docs say the constructor form is deprecated from 8.4.0, so perhaps the if test should be >= to that, rather than 8.3?

@jworreth
Copy link
Contributor Author

jworreth commented Mar 3, 2025

Thanks a lot for the review ! I really appreciate it.

Your wishes are my orders :-)

Please, let me know if this solution does not fit your expectations.

- Clean the code, remove duplications
- Extract the factory method in a specific method
use ReflectionMethod;
use WireMock\Serde\SerializationException;
use WireMock\Serde\StaticFactoryMethodValidator;
use const PHP_VERSION_ID;
Copy link
Owner

Choose a reason for hiding this comment

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

I don't think we need this const any more (and ditto in a few other files)?

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Shame on me, thanks for pointing this out.

I have fixed it.

Comment on lines 26 to 33
/**
* @throws ReflectionException
*/
public static function createMethod($fqMethodName) {
return PHP_VERSION_ID >= 80400
? ReflectionMethod::createFromMethodName($fqMethodName)
: new ReflectionMethod($fqMethodName);
}
Copy link
Owner

Choose a reason for hiding this comment

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

Sorry to be a pain, but could we put this in its own file / class? Just, conceptually, it doesn't particularly belong with StaticFactoryMethodValidator (any more than it belongs with any of the other places we use it), right?

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 completly agree with you. I have then moved that method in a MethodFactory class.

Is it better this way ?

Before merging, I would love to squash my commits.

- Clean the code, fix PR comments
Copy link
Owner

@rowanhill rowanhill left a comment

Choose a reason for hiding this comment

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

Thanks for making those changes, this looks much better, now.

I'll squash and merge it in!

@rowanhill rowanhill merged commit db07e22 into rowanhill:master Mar 4, 2025
8 checks passed
@rowanhill
Copy link
Owner

This is now released as 2.35.2.

Thanks again!

@jworreth
Copy link
Contributor Author

jworreth commented Mar 4, 2025

Thanks to you for taking care of the squash and merge!

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.

2 participants