Skip to content

Commit

Permalink
Update Permission.php
Browse files Browse the repository at this point in the history
namespace detection edge case resolved
  • Loading branch information
tharindarodrigo authored Jan 26, 2024
1 parent ecb11d0 commit 963724d
Showing 1 changed file with 2 additions and 4 deletions.
6 changes: 2 additions & 4 deletions src/Commands/Permission.php
Original file line number Diff line number Diff line change
Expand Up @@ -239,10 +239,8 @@ private function extractNamespace($file)
$handle = fopen($file, 'r');
if ($handle) {
while (($line = fgets($handle)) !== false) {
$line = str($line)->remove('<?php')->remove('<?')->trim();
if (str_starts_with($line, 'namespace')) {
$parts = explode(' ', $line);
$ns = rtrim(trim($parts[1]), ';');
if (preg_match('/^namespace\s+([a-zA-Z0-9\\_]+);/', $line, $matches)) {
$namespace = $matches[1];
break;
}
}
Expand Down

0 comments on commit 963724d

Please sign in to comment.