Issues (224)

src/Configuration/ConfigurationLogger.php (3 issues)

1
<?php
2
3
declare(strict_types=1);
4
5
/*
6
 * This file is part of the box project.
7
 *
8
 * (c) Kevin Herrera <[email protected]>
9
 *     Théo Fidry <[email protected]>
10
 *
11
 * This source file is subject to the MIT license that is bundled
12
 * with this source code in the file LICENSE.
13
 */
14
15
namespace KevinGH\Box\Configuration;
16
17
use Webmozart\Assert\Assert;
18
use function array_keys;
19
use function trim;
20
21
/**
22
 * @private
23
 */
24
final class ConfigurationLogger
25
{
26
    /**
27
     * @var array<string, true>
28
     */
29
    private array $recommendations = [];
30
31
    /**
32
     * @var array<string, true>
33
     */
34
    private array $warnings = [];
35
36
    public function addRecommendation(string $message): void
37
    {
38
        $message = trim($message);
39
40
        Assert::false('' === $message, 'Expected to have a message but a blank string was given instead.');
41
42
        $this->recommendations[$message] = true;
43
    }
44
45
    /**
46
     * @return list<string>
0 ignored issues
show
The type KevinGH\Box\Configuration\list 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...
47
     */
48
    public function getRecommendations(): array
49
    {
50
        return array_keys($this->recommendations);
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_keys($this->recommendations) returns the type array which is incompatible with the documented return type KevinGH\Box\Configuration\list.
Loading history...
51
    }
52
53
    public function addWarning(string $message): void
54
    {
55
        $message = trim($message);
56
57
        Assert::false('' === $message, 'Expected to have a message but a blank string was given instead.');
58
59
        $this->warnings[$message] = true;
60
    }
61
62
    /**
63
     * @return list<string>
64
     */
65
    public function getWarnings(): array
66
    {
67
        return array_keys($this->warnings);
0 ignored issues
show
Bug Best Practice introduced by
The expression return array_keys($this->warnings) returns the type array which is incompatible with the documented return type KevinGH\Box\Configuration\list.
Loading history...
68
    }
69
}
70