Skip to content

Commit a69e794

Browse files
committed
PhpDepend: added little protection against bad files (syntax errors, etc.)
Signed-off-by: Jan Pecha <[email protected]>
1 parent b4cb868 commit a69e794

File tree

1 file changed

+12
-2
lines changed

1 file changed

+12
-2
lines changed

src/PhpDepend.php

Lines changed: 12 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -195,7 +195,12 @@ private function addClass($class)
195195

196196
foreach($class as $name)
197197
{
198-
$this->classes[] = trim($name, '\\');
198+
$name = trim($name, '\\');
199+
200+
if($name !== '')
201+
{
202+
$this->classes[] = $name;
203+
}
199204
}
200205
}
201206

@@ -219,7 +224,12 @@ private function addDependency($class)
219224

220225
foreach($class as $name)
221226
{
222-
$this->dependencies[trim($name, '\\')] = TRUE;
227+
$name = trim($name, '\\');
228+
229+
if($name !== '')
230+
{
231+
$this->dependencies[$name] = TRUE;
232+
}
223233
}
224234
}
225235

0 commit comments

Comments
 (0)