Issues (23)

Branch: php-doc

src/Step/AbstractStep.php (2 issues)

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
 * @phpstan-import-type BuildOptions from Builder
28
 */
29
abstract class AbstractStep implements StepInterface
30
{
31
    /** @var Builder */
32
    protected $builder;
33
34
    /** @var Config */
35
    protected $config;
36
37
    /**
38
     * Configuration options for the step.
39
     * @see Builder::OPTIONS
40
     * @var BuildOptions
0 ignored issues
show
The type Cecil\Step\BuildOptions was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
41
     */
42
    protected $options;
43
44
    /** @var bool */
45
    protected $canProcess = false;
46
47 1
    /**
48
     * {@inheritdoc}
49 1
     */
50 1
    public function __construct(Builder $builder)
51
    {
52
        $this->builder = $builder;
53
        $this->config = $builder->getConfig();
54
    }
55
56 1
    /**
57
     * {@inheritdoc}
58 1
     */
59 1
    public function init(array $options): void
60
    {
61
        $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\Step\BuildOptions 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...
62
        $this->canProcess = true;
63
    }
64
65
    /**
66
     * {@inheritdoc}
67 1
     *
68
     * If init() is used, true by default.
69 1
     */
70
    public function canProcess(): bool
71
    {
72
        return $this->canProcess;
73
    }
74
75
    /**
76
     * {@inheritdoc}
77
     */
78
    abstract public function process(): void;
79
}
80