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

Add native types to public API #225

Open
wants to merge 1 commit into
base: 3.x
Choose a base branch
from

Conversation

WyriHaximus
Copy link
Member

This changeset adds native types to the public API as discussed in #219.

Once merged, I'm planning to add PHPStan in a follow-up PR which would take advantage of these types.

Builds on top of #222, #223 and reactphp/cache#60

@WyriHaximus WyriHaximus added this to the v3.0.0 milestone May 27, 2024
@WyriHaximus WyriHaximus marked this pull request as ready for review May 27, 2024 16:42
@WyriHaximus WyriHaximus changed the title [WIP] Add native types to public API Add native types to public API May 27, 2024
Copy link
Member

@SimonFrings SimonFrings left a comment

Choose a reason for hiding this comment

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

First round of review is done, found a few things that I commented on. I also went through all classes to be sure we don't miss anything and noticed that these following classes are missing types on their public functions:

  • Model/Message
  • Protocol/BinaryDumper
  • Protocol/Parser
  • Query/Query
  • Query/RetryExecutor

src/Config/HostsFile.php Outdated Show resolved Hide resolved
src/Config/HostsFile.php Show resolved Hide resolved
src/Config/HostsFile.php Outdated Show resolved Hide resolved
src/Config/HostsFile.php Outdated Show resolved Hide resolved
src/Config/HostsFile.php Outdated Show resolved Hide resolved
src/Model/Record.php Outdated Show resolved Hide resolved
src/Query/CachingExecutor.php Outdated Show resolved Hide resolved
src/Query/TcpTransportExecutor.php Outdated Show resolved Hide resolved
src/Query/TcpTransportExecutor.php Outdated Show resolved Hide resolved
src/Query/UdpTransportExecutor.php Show resolved Hide resolved
@WyriHaximus
Copy link
Member Author

WyriHaximus commented Jun 12, 2024

First round of review is done, found a few things that I commented on.

Sweet, thanks! Made all the updates locally. But will push them all in one go once I've also done your other comment.

I also went through all classes to be sure we don't miss anything and noticed that these following classes are missing types on their public functions:

  • Model/Message
  • Protocol/BinaryDumper
  • Protocol/Parser
  • Query/Query
  • Query/RetryExecutor

Last time I checked, those classes aren't part of our public API, except the Query/RetryExecutor. 🤣🤐🤦(But yes I'll add public types to those as well.)

@SimonFrings
Copy link
Member

Last time I checked, those classes aren't part of our public API, except the Query/RetryExecutor. 🤣🤐🤦(But yes I'll add public types to those as well.)

@WyriHaximus Yeah, I also talked with @clue what would count as public API and I think everything that isn't marked as internal or private. Except we recommend not using certain public functions in our README, but didn't find anything about this in our documentation.

Maybe there were some decisions made back in the days but never documented, which makes it hard for me to differentiate it from the rest of the public API.

@WyriHaximus
Copy link
Member Author

Last time I checked, those classes aren't part of our public API, except the Query/RetryExecutor. 🤣🤐🤦(But yes I'll add public types to those as well.)

@WyriHaximus Yeah, I also talked with @clue what would count as public API and I think everything that isn't marked as internal or private. Except we recommend not using certain public functions in our README, but didn't find anything about this in our documentation.

That was my assumption. But it's fine, it would have been added in the followup PR anyway.

Maybe there were some decisions made back in the days but never documented, which makes it hard for me to differentiate it from the rest of the public API.

Not really, it was an assumption, and the previous packages where so small everything was the public API in both ways.

@WyriHaximus WyriHaximus force-pushed the 3.x-public-API-types branch 3 times, most recently from 7e4dfbf to ab9fc67 Compare June 13, 2024 16:23
Copy link
Member

@SimonFrings SimonFrings 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 the updates, found a few minor things, should be quick fixes 👍

src/Model/Message.php Outdated Show resolved Hide resolved
src/Model/Message.php Outdated Show resolved Hide resolved
src/Model/Record.php Show resolved Hide resolved
src/Query/TcpTransportExecutor.php Outdated Show resolved Hide resolved
This changeset adds native types to the public API as discussed in reactphp#219.

Once merged, I'm planning to add PHPStan in a follow-up PR which would take advantage of these types.

Builds on top of reactphp#222, reactphp#223 and reactphp/cache#60
Copy link
Member

@SimonFrings SimonFrings left a comment

Choose a reason for hiding this comment

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

Nice work, PR looks good to me 👍

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.

2 participants