Issues (16)

Branch: analysis-2ZGKmg

src/Step/AbstractStep.php (1 issue)

1
<?php
2
3
/**
4
 * This file is part of Cecil.
5
 *
6
 * (c) Arnaud Ligny <[email protected]>
7
 *
8
 * For the full copyright and license information, please view the LICENSE
9
 * file that was distributed with this source code.
10
 */
11
12
declare(strict_types=1);
13
14
namespace Cecil\Step;
15
16
use Cecil\Builder;
17
use Cecil\Config;
18
19
/**
20
 * Abstract step class.
21
 *
22
 * This class provides a base implementation for steps in the build process.
23
 * It implements the StepInterface and provides common functionality such as
24
 * initialization, checking if the step can be processed, and a constructor
25
 * that accepts a Builder instance.
26
 */
27
abstract class AbstractStep implements StepInterface
28
{
29
    /** @var Builder */
30
    protected $builder;
31
32
    /** @var Config */
33
    protected $config;
34
35
    /**
36
     * Configuration options for the step.
37
     * @var Builder::OPTIONS
38
     */
39
    protected $options;
40
41
    /** @var bool */
42
    protected $canProcess = false;
43
44
    /**
45
     * {@inheritdoc}
46
     */
47
    public function __construct(Builder $builder)
48
    {
49
        $this->builder = $builder;
50
        $this->config = $builder->getConfig();
51
    }
52
53
    /**
54
     * {@inheritdoc}
55
     */
56
    public function init(array $options): void
57
    {
58
        $this->options = $options;
0 ignored issues
show
Documentation Bug introduced by
It seems like $options of type array is incompatible with the declared type Cecil\Builder of property $options.

Our type inference engine has found an assignment to a property that is incompatible with the declared type of that property.

Either this assignment is in error or the assigned type should be added to the documentation/type hint for that property..

Loading history...
59
        $this->canProcess = true;
60
    }
61
62
    /**
63
     * {@inheritdoc}
64
     *
65
     * If init() is used, true by default.
66
     */
67
    public function canProcess(): bool
68
    {
69
        return $this->canProcess;
70
    }
71
72
    /**
73
     * {@inheritdoc}
74
     */
75
    abstract public function process(): void;
76
}
77