reactphp / promise

Promises/A implementation for PHP.
https://reactphp.org/promise/
MIT License
2.38k stars 146 forks source link

Describe all callable arguments with types for `Promise` and `Deferred` #253

Closed clue closed 1 year ago

clue commented 1 year ago

This changeset describes all callable arguments with types for Promise and Deferred. In particular, this makes it easier to detect incorrect usage using static analysis, such as when omitting required arguments as discussed in #213 and #138.

Builds on top of #247, #246 and others Closes #252

stof commented 1 year ago

I suggest adding checkMissingCallableSignature: true in the phpstan config, so that it reports missing callable signatures.

clue commented 1 year ago

I suggest adding checkMissingCallableSignature: true in the phpstan config, so that it reports missing callable signatures.

Go ahead, PRs welcome :+1: Tested this out locally and appears to report a number of low-priority types for internal functions and tests only, but happy to consider this if the changeset is reasonable :+1:

stof commented 1 year ago

I'll let you merge this PR first then, so that those types are already defined.