swoft-cloud / swoft-component

📦 This is a repository of centralized management of all swoft core components
https://www.swoft.org
Apache License 2.0
97 stars 107 forks source link

PHP does not (yet) support union types #513

Closed szepeviktor closed 5 years ago

szepeviktor commented 5 years ago

...as return type hint, see https://wiki.php.net/rfc/union_types

From https://github.com/swoft-cloud/swoft/pull/968

inhere commented 5 years ago

hi @szepeviktor

I don't think we should remove the return type, it is correct.

Since the IDE can recognize the return doc, phpstan should also be able to :)

szepeviktor commented 5 years ago

1) I think IDE-s prioritize: PHPDoc, phpstan: type of actually returned self::$sessions

2) SessionInterface as type hint is different from SessionInterface|Connection, see coming https://wiki.php.net/rfc/union_types

What do you think?

szepeviktor commented 5 years ago

SessionInterface implementations differ.