Skip to content

Commit c2cab70

Browse files
committed
Fix linter issues: Revert back missing docblock types
1 parent 058facc commit c2cab70

7 files changed

Lines changed: 211 additions & 38 deletions

File tree

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -33,8 +33,8 @@
3333
},
3434
"extra": {
3535
"branch-alias": {
36-
"dev-master": "0.13.x-dev",
37-
"dev-main": "0.13.x-dev"
36+
"dev-master": "0.14.x-dev",
37+
"dev-main": "0.14.x-dev"
3838
}
3939
},
4040
"config": {

resources/boson.schema.json

Lines changed: 66 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -72,16 +72,76 @@
7272
"type": "object",
7373
"additionalProperties": false,
7474
"description": "Finder inclusion configuration",
75+
"required": ["directory"],
7576
"properties": {
7677
"directory": {
77-
"type": "string",
78-
"description": "The directory in which the files will be searched",
79-
"minLength": 1
78+
"oneOf": [
79+
{
80+
"type": "string",
81+
"description": "The directory in which the files will be searched",
82+
"minLength": 1
83+
},
84+
{
85+
"type": "array",
86+
"minLength": 1,
87+
"items": {
88+
"type": "string",
89+
"description": "The directory in which the files will be searched",
90+
"minLength": 1
91+
}
92+
}
93+
]
94+
},
95+
"not-directory": {
96+
"oneOf": [
97+
{
98+
"type": "string",
99+
"description": "The directory exclusion filter",
100+
"minLength": 1
101+
},
102+
{
103+
"type": "array",
104+
"items": {
105+
"type": "string",
106+
"description": "The directory exclusion filter",
107+
"minLength": 1
108+
}
109+
}
110+
]
80111
},
81112
"name": {
82-
"type": "string",
83-
"description": "The name filter for files",
84-
"minLength": 1
113+
"oneOf": [
114+
{
115+
"type": "string",
116+
"description": "The name filter for files",
117+
"minLength": 1
118+
},
119+
{
120+
"type": "array",
121+
"items": {
122+
"type": "string",
123+
"description": "The name filter for files",
124+
"minLength": 1
125+
}
126+
}
127+
]
128+
},
129+
"not-name": {
130+
"oneOf": [
131+
{
132+
"type": "string",
133+
"description": "The name exclusion filter for files",
134+
"minLength": 1
135+
},
136+
{
137+
"type": "array",
138+
"items": {
139+
"type": "string",
140+
"description": "The name exclusion filter for files",
141+
"minLength": 1
142+
}
143+
}
144+
]
85145
}
86146
}
87147
}

src/Action/CreateBoxConfigAction.php

Lines changed: 21 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -28,32 +28,43 @@ public function process(Configuration $config): iterable
2828

2929
/**
3030
* @return list<array{
31-
* name?: non-empty-string,
32-
* in?: non-empty-string
31+
* in: non-empty-list<non-empty-string>,
32+
* name?: list<non-empty-string>,
33+
* exclude?: list<non-empty-string>,
34+
* notName?: list<non-empty-string>,
3335
* }>
3436
*/
3537
private function getBoxFinderConfig(Configuration $config): array
3638
{
3739
$finder = [];
3840

3941
foreach ($config->build as $inclusion) {
40-
$section = [];
41-
4242
if (!$inclusion instanceof FinderIncludeConfiguration) {
4343
continue;
4444
}
4545

46-
if ($inclusion->name !== null) {
47-
$section['name'] = $inclusion->name;
46+
if ($inclusion->directories === []) {
47+
throw new \InvalidArgumentException(\sprintf(
48+
'Directories list cannot be empty in "build.finder[%s].directories" config section',
49+
\count($finder),
50+
));
4851
}
4952

50-
if ($inclusion->directory !== null) {
51-
$section['in'] = $inclusion->directory;
53+
$section = ['in' => $inclusion->directories];
54+
55+
if ($inclusion->notDirectories !== []) {
56+
$section['exclude'] = $inclusion->notDirectories;
5257
}
5358

54-
if ($section !== []) {
55-
$finder[] = $section;
59+
if ($inclusion->names !== []) {
60+
$section['name'] = $inclusion->names;
5661
}
62+
63+
if ($inclusion->notNames !== []) {
64+
$section['notName'] = $inclusion->notNames;
65+
}
66+
67+
$finder[] = $section;
5768
}
5869

5970
return $finder;

src/Action/PackBoxAction.php

Lines changed: 11 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -30,12 +30,22 @@ public function process(Configuration $config): iterable
3030
}
3131

3232
if (!$process->isSuccessful()) {
33-
throw new \RuntimeException(\trim($error));
33+
throw new \RuntimeException($this->formatErrorMessage($error));
3434
}
3535

3636
yield PackBoxStatus::Packed;
3737
}
3838

39+
private function formatErrorMessage(string $message): string
40+
{
41+
$message = \str_replace("\r\n", "\n", $message);
42+
$message = (string) \preg_replace('/^\h*In.+?line\h+\d+:\h*$/isum', '', $message);
43+
$message = (string) \preg_replace('/^\h*compile \[.+?WORKING-DIR]/isum', '', $message);
44+
45+
return 'An error occurred while executing "humbug/box" compile command: '
46+
. \trim($message);
47+
}
48+
3949
private function createProcess(Configuration $config): Process
4050
{
4151
return new Process(

0 commit comments

Comments
 (0)