Completed
Push — master ( 678089...988510 )
by Andrii
02:43
created

SimpleFactory::__construct()   A

Complexity

Conditions 1
Paths 1

Size

Total Lines 3
Code Lines 1

Duplication

Lines 0
Ratio 0 %

Importance

Changes 1
Bugs 0 Features 0
Metric Value
cc 1
eloc 1
nc 1
nop 1
dl 0
loc 3
rs 10
c 1
b 0
f 0
1
<?php
2
/**
3
 * PHP Billing Library
4
 *
5
 * @link      https://github.com/hiqdev/php-billing
6
 * @package   php-billing
7
 * @license   BSD-3-Clause
8
 * @copyright Copyright (c) 2017-2018, HiQDev (http://hiqdev.com/)
9
 */
10
11
namespace hiqdev\php\billing\tests\support\tools;
12
13
use hiqdev\php\billing\action\ActionFactory;
14
use hiqdev\php\billing\customer\CustomerFactory;
15
use hiqdev\php\billing\plan\PlanFactory;
16
use hiqdev\php\billing\price\PriceFactory;
17
use hiqdev\php\billing\price\SinglePrice;
18
use hiqdev\php\billing\sale\SaleFactory;
19
use hiqdev\php\billing\target\TargetFactory;
20
use hiqdev\php\billing\tools\Factory;
21
use hiqdev\php\billing\type\TypeFactory;
22
23
class SimpleFactory extends Factory
24
{
25
    public function __construct(array $factories = [])
26
    {
27
        return parent::__construct(array_merge(self::simpleFactories(), $factories));
0 ignored issues
show
Bug introduced by
Are you sure the usage of parent::__construct(arra...ctories(), $factories)) targeting hiqdev\php\billing\tools\Factory::__construct() seems to always return null.

This check looks for function or method calls that always return null and whose return value is used.

class A
{
    function getObject()
    {
        return null;
    }

}

$a = new A();
if ($a->getObject()) {

The method getObject() can return nothing but null, so it makes no sense to use the return value.

The reason is most likely that a function or method is imcomplete or has been reduced for debug purposes.

Loading history...
28
    }
29
30
    public static function simpleFactories(): array
31
    {
32
        return [
33
            'action'    => new ActionFactory(),
34
            'customer'  => new CustomerFactory(),
35
            'plan'      => new PlanFactory(),
36
            'price'     => new PriceFactory([], SinglePrice::class),
37
            'sale'      => new SaleFactory(),
38
            'target'    => new TargetFactory(),
39
            'type'      => new TypeFactory(),
40
        ];
41
    }
42
}
43