Skip to content

Commit bfa2d10

Browse files
committed
fix: correct property name from sourcePath to sourcePaths
Fix inconsistency between property declaration and usage that was causing errors. Update all references throughout the codebase for proper functionality.
1 parent 792f001 commit bfa2d10

File tree

2 files changed

+9
-9
lines changed

2 files changed

+9
-9
lines changed

src/Console/InitCommand.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function __invoke(): int
5959
description: 'Project structure overview',
6060
outputPath: 'project-structure.md',
6161
firstSource: new TreeSource(
62-
sourcePath: ['src'],
62+
sourcePaths: ['src'],
6363
treeView: new TreeViewConfig(
6464
showCharCount: true,
6565
),

src/Source/Tree/TreeSource.php

+8-8
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
final class TreeSource extends BaseSource implements FilterableSourceInterface
1515
{
1616
/**
17-
* @param string|array<string> $sourcePath Path(s) to generate tree from
17+
* @param string|array<string> $sourcePaths Path(s) to generate tree from
1818
* @param string $description Human-readable description
1919
* @param string|array<string> $filePattern Pattern(s) to match files
2020
* @param array<string> $notPath Patterns to exclude paths
@@ -26,7 +26,7 @@ final class TreeSource extends BaseSource implements FilterableSourceInterface
2626
* @param array<non-empty-string> $tags
2727
*/
2828
public function __construct(
29-
public readonly string|array $sourcePath,
29+
public readonly string|array $sourcePaths,
3030
string $description = '',
3131
public readonly string|array $filePattern = '*',
3232
public readonly array $notPath = [],
@@ -46,12 +46,12 @@ public function __construct(
4646
public static function fromArray(array $data, string $rootPath = ''): self
4747
{
4848
if (!isset($data['sourcePaths'])) {
49-
throw new \RuntimeException('Tree source must have a "sourcePath" property');
49+
throw new \RuntimeException('Tree source must have a "sourcePaths" property');
5050
}
5151

5252
$sourcePath = $data['sourcePaths'];
5353
if (!\is_string($sourcePath) && !\is_array($sourcePath)) {
54-
throw new \RuntimeException('"sourcePath" must be a string or array in source');
54+
throw new \RuntimeException('"sourcePaths" must be a string or array in source');
5555
}
5656

5757
$sourcePath = \is_string($sourcePath) ? [$sourcePath] : $sourcePath;
@@ -106,7 +106,7 @@ public static function fromArray(array $data, string $rootPath = ''): self
106106
}
107107

108108
return new self(
109-
sourcePath: $sourcePath,
109+
sourcePaths: $sourcePath,
110110
description: $data['description'] ?? '',
111111
filePattern: $filePattern,
112112
notPath: $notPath,
@@ -167,7 +167,7 @@ public function in(): array|null
167167
{
168168
$directories = [];
169169

170-
foreach ((array) $this->sourcePath as $path) {
170+
foreach ((array) $this->sourcePaths as $path) {
171171
if (\is_dir($path)) {
172172
$directories[] = $path;
173173
}
@@ -180,7 +180,7 @@ public function files(): array|null
180180
{
181181
$files = [];
182182

183-
foreach ((array) $this->sourcePath as $path) {
183+
foreach ((array) $this->sourcePaths as $path) {
184184
if (\is_file($path)) {
185185
$files[] = $path;
186186
}
@@ -199,7 +199,7 @@ public function jsonSerialize(): array
199199
$result = [
200200
'type' => 'tree',
201201
...parent::jsonSerialize(),
202-
'sourcePaths' => $this->sourcePath,
202+
'sourcePaths' => $this->sourcePaths,
203203
'filePattern' => $this->filePattern,
204204
'notPath' => $this->notPath,
205205
'renderFormat' => $this->renderFormat,

0 commit comments

Comments
 (0)