代码环境类似的代码块用于名称空间声明?

时间:2019-01-13 15:23:07

标签: php code-climate code-climate-cli

我正在使用代码环境来分析我正在编写的代码。最近,它在几个特征中发现了有关名称空间减速的一些重复。但是,我不确定为什么会出现问题,特征是否不声明名称空间?

例如,在此示例代码中,气候表示:Similar blocks of code found in 3 locations. Consider refactoring.在My / App / TraitA.php和其他2个位置中找到-大约需要2个小时才能解决。

TraitA

<?php

declare(strict_types=1);

namespace My\App;

class traitA{
    public function foo(){
        //do something
    }
}

特质B

<?php

declare(strict_types=1);

namespace My\App;

class traitB{
    public function bar(){
        //do something
    }
}

TraitC

<?php

declare(strict_types=1);

namespace My\App;

class traitC{
    public function baz(){
        //do something
    }
}

0 个答案:

没有答案