Sync::sync()   A
last analyzed

Complexity

Conditions 1
Paths 1

Size

Total Lines 13
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 1
eloc 5
c 1
b 0
f 1
nc 1
nop 1
dl 0
loc 13
rs 10
1
<?php
2
/**
3
 * Sync
4
 * User: moyo
5
 * Date: 03/11/2017
6
 * Time: 11:55 AM
7
 */
8
9
namespace Carno\Promise\Features;
10
11
use Carno\Promise\Promised;
12
use Throwable;
13
14
trait Sync
15
{
16
    /**
17
     * @param Promised $next
18
     * @return Promised
19
     * @throws Throwable
20
     */
21
    public function sync(Promised $next) : Promised
22
    {
23
        $this->then(static function (...$args) use ($next) {
0 ignored issues
show
Bug introduced by
It seems like then() must be provided by classes using this trait. How about adding it as abstract method to this trait? ( Ignorable by Annotation )

If this is a false-positive, you can also ignore this issue in your code via the ignore-call  annotation

23
        $this->/** @scrutinizer ignore-call */ 
24
               then(static function (...$args) use ($next) {
Loading history...
24
            $next->resolve(...$args);
25
        }, static function (...$args) use ($next) {
26
            $next->reject(...$args);
27
        });
28
29
        /**
30
         * @var Promised $this
31
         */
32
33
        return $this;
34
    }
35
}
36