Skip to content

Conversation

tomas-novotny
Copy link
Contributor

Use phpstan conditional return types to better typehint of returned values.

Ignoring phpcs rule SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation for

/**
 * @return false
 */
public function connectionCloseOk(): bool

I would use connectionCloseOk(): false, but it can be used as standalone type only since PHP 8.2.

@WyriHaximus WyriHaximus added this to the v0.6.0 milestone Mar 12, 2025
@WyriHaximus WyriHaximus self-requested a review March 14, 2025 20:45
@WyriHaximus
Copy link
Collaborator

Use phpstan conditional return types to better typehint of returned values.

Ignoring phpcs rule SlevomatCodingStandard.TypeHints.ReturnTypeHint.UselessAnnotation for

/**
 * @return false
 */
public function connectionCloseOk(): bool

Awesome! Thanks for all the typing work you've done! What do you think about adding a types testing file so we are sure all public types work as intended? For example: https://github.com/reactphp-parallel/reactphp-parallel/blob/2.x/tests/Types.php

I would use connectionCloseOk(): false, but it can be used as standalone type only since PHP 8.2.

Planning to do the same as I did with ReactPHP Parallel; keep it at 8.1 for the 0.6 release and then bump it after for the next release.

@WyriHaximus WyriHaximus merged commit 8a0f316 into jakubkulhan:0.6.x Mar 15, 2025
110 checks passed
@tomas-novotny tomas-novotny deleted the 0.6.x-typehint branch March 20, 2025 10:08
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