@@ -35,7 +35,7 @@ public function __construct(
3535 public function then (
3636 callable $ onFulfilled = null ,
3737 callable $ onRejected = null
38- ) {
38+ ): PromiseInterface {
3939 if ($ this ->state === self ::PENDING ) {
4040 $ p = new Promise (null , [$ this , 'cancel ' ]);
4141 $ this ->handlers [] = [$ p , $ onFulfilled , $ onRejected ];
@@ -59,12 +59,12 @@ public function then(
5959 return $ onRejected ? $ rejection ->then (null , $ onRejected ) : $ rejection ;
6060 }
6161
62- public function otherwise (callable $ onRejected )
62+ public function otherwise (callable $ onRejected ): PromiseInterface
6363 {
6464 return $ this ->then (null , $ onRejected );
6565 }
6666
67- public function wait ($ unwrap = true )
67+ public function wait (bool $ unwrap = true )
6868 {
6969 $ this ->waitIfPending ();
7070
@@ -80,7 +80,7 @@ public function wait($unwrap = true)
8080 }
8181 }
8282
83- public function getState ()
83+ public function getState (): string
8484 {
8585 return $ this ->state ;
8686 }
@@ -120,7 +120,7 @@ public function reject($reason): void
120120 $ this ->settle (self ::REJECTED , $ reason );
121121 }
122122
123- private function settle ($ state , $ value ): void
123+ private function settle (string $ state , $ value ): void
124124 {
125125 if ($ this ->state !== self ::PENDING ) {
126126 // Ignore calls with the same resolution.
@@ -185,7 +185,7 @@ static function ($reason) use ($handlers): void {
185185 * @param mixed $value Value to pass to the callback.
186186 * @param array $handler Array of handler data (promise and callbacks).
187187 */
188- private static function callHandler ($ index , $ value , array $ handler ): void
188+ private static function callHandler (int $ index , $ value , array $ handler ): void
189189 {
190190 /** @var PromiseInterface $promise */
191191 $ promise = $ handler [0 ];
0 commit comments