Skip to content

Commit 0712a0e

Browse files
committed
deprecated support for addDirectory($array) and excludeDirectory($array)
1 parent 44ed959 commit 0712a0e

File tree

1 file changed

+14
-6
lines changed

1 file changed

+14
-6
lines changed

src/RobotLoader/RobotLoader.php

Lines changed: 14 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -118,11 +118,15 @@ public function tryLoad(string $type): void
118118

119119
/**
120120
* Add path or paths to list.
121-
* @param string|string[] $path absolute path
121+
* @param string ...$paths absolute path
122122
*/
123-
public function addDirectory($path): self
123+
public function addDirectory(...$paths): self
124124
{
125-
$this->scanPaths = array_merge($this->scanPaths, (array) $path);
125+
if (is_array($paths[0])) {
126+
trigger_error(__METHOD__ . '() use variadics ...$paths to add an array of paths.', E_USER_WARNING);
127+
$paths = $paths[0];
128+
}
129+
$this->scanPaths = array_merge($this->scanPaths, $paths);
126130
return $this;
127131
}
128132

@@ -136,11 +140,15 @@ public function reportParseErrors(bool $on = true): self
136140

137141
/**
138142
* Excludes path or paths from list.
139-
* @param string|string[] $path absolute path
143+
* @param string ...$paths absolute path
140144
*/
141-
public function excludeDirectory($path): self
145+
public function excludeDirectory(...$paths): self
142146
{
143-
$this->excludeDirs = array_merge($this->excludeDirs, (array) $path);
147+
if (is_array($paths[0])) {
148+
trigger_error(__METHOD__ . '() use variadics ...$paths to add an array of paths.', E_USER_WARNING);
149+
$paths = $paths[0];
150+
}
151+
$this->excludeDirs = array_merge($this->excludeDirs, $paths);
144152
return $this;
145153
}
146154

0 commit comments

Comments
 (0)