Skip to content

Conversation

@mrcnpdlk
Copy link

@mrcnpdlk mrcnpdlk commented Dec 6, 2022

#32
I did my best to get PHP8.1 support and fix some bugs.

  • php >= 8.1
  • PhpUnit 9 upgrade
  • PhpStan for code review

@leth please review this PR.

@mrcnpdlk mrcnpdlk changed the title Issue 31 php8.1 Issue 32 - php8.1 support Dec 6, 2022
*
* @return \Leth\IPAddress\IP\Address|\Leth\IPAddress\IPv4\Address|\Leth\IPAddress\IPv6\Address An instance of a subclass of IP\Address; either IPv4\Address or IPv6\Address
*/
public static function factory(IP\Address|int|string|\Math_BigInteger $address): IP\Address|Ipv4\Address|IPv6\Address
Copy link
Collaborator

Choose a reason for hiding this comment

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

Misaligned indentation. Sorry, I legally have to point out one formatting thing during a code review.

Copy link
Author

Choose a reason for hiding this comment

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

For all code I'd like to use PHPFixer.
What do You think about it?

Copy link
Owner

Choose a reason for hiding this comment

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

I can't comment on PHPFixer itself, but I'd strongly encourage adopting automatic tooling to enforce code style; it saves everyone time, avoids a lot of nitpicky feedback which is not fun for anyone, and usually makes code easier to read and interpret correctly!

Copy link
Collaborator

Choose a reason for hiding this comment

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

Yeah same, but I think that warrants its own PR.

*
* @return \Leth\IPAddress\IPv4\NetworkAddress|\Leth\IPAddress\IP\NetworkAddress|\Leth\IPAddress\IPv6\NetworkAddress
*/
public static function factory(NetworkAddress|Address|string $address, int|string|null $cidr = NULL): IPv4\NetworkAddress|NetworkAddress|IPv6\NetworkAddress
Copy link
Collaborator

Choose a reason for hiding this comment

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

a) the indentation
b) Just musing, but would this be an opportunity to require that $cidr be an int if present? For both v4 and v6 it'll always be in the bounds of 0-128, so there's no real reason to allow a string, and it would save validation and an (int) cast below. This PR is already a BC break and new major release, so this might be the time.

Copy link
Collaborator

Choose a reason for hiding this comment

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

Okay ignore my comment regarding the parameter types, that can/should be a different PR.

Please do fix the indentation, though.

Copy link
Author

Choose a reason for hiding this comment

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

The same situation. What do you think about using PHPFixer?

Copy link
Collaborator

Choose a reason for hiding this comment

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

I'm not opposed to adding some tooling for style/formatting, but I think that should be its own PR.

@tabacco tabacco requested a review from leth December 6, 2022 16:20
@tabacco
Copy link
Collaborator

tabacco commented Dec 6, 2022

Maybe it's worth making a 2.x branch here, as an opportunity to collect other non-compatibility-related breaking changes that would improve the API.

@leth Are you okay if I start that process?

@tabacco tabacco changed the base branch from master to 2.0-dev December 7, 2022 17:00
tabacco added a commit that referenced this pull request Dec 7, 2022
@tabacco
Copy link
Collaborator

tabacco commented Dec 7, 2022

Okay I went ahead and started up a 2.0-dev branch to collect any other backwards-incompatible changes to prep for a 2.0 release, and updated this PR's base to be that branch.

@leth
Copy link
Owner

leth commented Dec 9, 2022

Maybe it's worth making a 2.x branch here, as an opportunity to collect other non-compatibility-related breaking changes that would improve the API.

@leth Are you okay if I start that process?

No objections from me, sounds wise if you have some ideas, or expect some more improvements to make it more idiomatic php8 :)

@tabacco
Copy link
Collaborator

tabacco commented Dec 9, 2022

Looks like https://github.com/leth/PHP-IPAddress/blob/master/.github/workflows/test.yml also needs to be updated to reflect the current version support.

@leth
Copy link
Owner

leth commented Jan 2, 2023

I've created a branch with (hopefully) the required changes to the github actions config.

@leth
Copy link
Owner

leth commented Jan 2, 2023

Actually, I'll push those into the 2.0-dev branch, to see if they fix the CI for this PR :)

@leth
Copy link
Owner

leth commented Jan 2, 2023

Okay, looks like that doesn't affect the CI for this PR :(
Could you please try merging the 2.0-dev branch into your PR branch!

@leth leth merged commit feb7944 into leth:2.0-dev Jan 5, 2023
@leth
Copy link
Owner

leth commented Jan 5, 2023

I figured it'd be easiest if I did that, and worked out a way to do it! I sorted out the tabs vs spaces issues too!
Thanks for the contribution, please do feel free to raise further PRs :)

@leth leth mentioned this pull request Jan 6, 2023
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