Skip to content

Commit

Permalink
Ignore . namespace in generators
Browse files Browse the repository at this point in the history
When someone pass path as a class name, e.g. ./foo

Fixes #5818
  • Loading branch information
Naktibalda committed Jan 2, 2021
1 parent bf2d786 commit 4773f37
Showing 1 changed file with 3 additions and 9 deletions.
12 changes: 3 additions & 9 deletions src/Codeception/Util/Shared/Namespaces.php
Expand Up @@ -5,15 +5,9 @@ trait Namespaces
{
protected function breakParts($class)
{
$class = str_replace('/', '\\', $class);
$namespaces = explode('\\', $class);
if (count($namespaces)) {
$namespaces[0] = ltrim($namespaces[0], '\\');
}
if (!$namespaces[0]) {
array_shift($namespaces);
} // remove empty namespace caused of \\
return $namespaces;
// removing leading slashes and dots first
$class = str_replace('/', '\\', ltrim($class, './\\'));
return explode('\\', $class);
}

protected function getShortClassName($class)
Expand Down

0 comments on commit 4773f37

Please sign in to comment.