|
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\Console; |
|
16
|
|
|
|
|
17
|
|
|
use Fidry\Console\IO; |
|
|
|
|
|
|
18
|
|
|
use KevinGH\Box\NotInstantiable; |
|
19
|
|
|
use Webmozart\Assert\Assert; |
|
20
|
|
|
use function array_map; |
|
21
|
|
|
use function count; |
|
22
|
|
|
use function sprintf; |
|
23
|
|
|
|
|
24
|
|
|
/** |
|
25
|
|
|
* Utility to writing on the console output the configuration recommendations and warnings. |
|
26
|
|
|
* |
|
27
|
|
|
* @private |
|
28
|
|
|
*/ |
|
29
|
|
|
final class MessageRenderer |
|
30
|
|
|
{ |
|
31
|
|
|
use NotInstantiable; |
|
32
|
|
|
|
|
33
|
|
|
/** |
|
34
|
|
|
* @param string[] $recommendations |
|
35
|
|
|
* @param string[] $warnings |
|
36
|
|
|
*/ |
|
37
|
|
|
public static function render(IO $io, array $recommendations, array $warnings): void |
|
38
|
|
|
{ |
|
39
|
|
|
Assert::allString($recommendations); |
|
40
|
|
|
Assert::allString($warnings); |
|
41
|
|
|
|
|
42
|
|
|
$renderMessage = static fn (string $message): string => " - {$message}"; |
|
43
|
|
|
|
|
44
|
|
|
if ([] === $recommendations) { |
|
45
|
|
|
$io->writeln('No recommendation found.'); |
|
46
|
|
|
} else { |
|
47
|
|
|
$io->writeln( |
|
48
|
|
|
sprintf( |
|
49
|
|
|
'💡 <recommendation>%d %s found:</recommendation>', |
|
50
|
|
|
count($recommendations), |
|
51
|
|
|
count($recommendations) > 1 ? 'recommendations' : 'recommendation', |
|
52
|
|
|
), |
|
53
|
|
|
); |
|
54
|
|
|
|
|
55
|
|
|
$io->writeln( |
|
56
|
|
|
array_map($renderMessage, $recommendations), |
|
57
|
|
|
); |
|
58
|
|
|
} |
|
59
|
|
|
|
|
60
|
|
|
if ([] === $warnings) { |
|
61
|
|
|
$io->writeln('No warning found.'); |
|
62
|
|
|
} else { |
|
63
|
|
|
$io->writeln( |
|
64
|
|
|
sprintf( |
|
65
|
|
|
'⚠️ <warning>%d %s found:</warning>', |
|
66
|
|
|
count($warnings), |
|
67
|
|
|
count($warnings) > 1 ? 'warnings' : 'warning', |
|
68
|
|
|
), |
|
69
|
|
|
); |
|
70
|
|
|
|
|
71
|
|
|
$io->writeln( |
|
72
|
|
|
array_map($renderMessage, $warnings), |
|
73
|
|
|
); |
|
74
|
|
|
} |
|
75
|
|
|
|
|
76
|
|
|
$io->newLine(); |
|
77
|
|
|
} |
|
78
|
|
|
} |
|
79
|
|
|
|
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:For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths