Fusion::fusion()   A
last analyzed

Complexity

Conditions 2
Paths 1

Size

Total Lines 15
Code Lines 5

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 1
Metric Value
cc 2
eloc 5
c 1
b 0
f 1
nc 1
nop 0
dl 0
loc 15
rs 10
1
<?php
2
/**
3
 * Fusion
4
 * User: moyo
5
 * Date: 2018/4/3
6
 * Time: 10:32 PM
7
 */
8
9
namespace Carno\Promise\Features;
10
11
use Carno\Promise\Promised;
12
use Throwable;
13
14
trait Fusion
15
{
16
    /**
17
     * @var bool
18
     */
19
    private $fusion = false;
20
21
    /**
22
     * @return Promised
23
     */
24
    public function fusion() : Promised
25
    {
26
        $this->fusion = true;
27
28
        $this->catch(static function (Throwable $e = null) {
0 ignored issues
show
Bug introduced by
It seems like catch() 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

28
        $this->/** @scrutinizer ignore-call */ 
29
               catch(static function (Throwable $e = null) {
Loading history...
29
            if ($e) {
30
                throw $e;
31
            }
32
        });
33
34
        /**
35
         * @var Promised $this
36
         */
37
38
        return $this;
39
    }
40
}
41