Skip to content

Commit

Permalink
Fixed empty namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
sorinsarca committed Dec 24, 2024
1 parent 43f795f commit 8a69282
Show file tree
Hide file tree
Showing 3 changed files with 4 additions and 2 deletions.
2 changes: 2 additions & 0 deletions src/ClosureInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -128,7 +128,9 @@ public function getFactoryPHP(bool $phpTag = true): string
\\extract({$varName}, \\EXTR_SKIP | \\EXTR_REFS);
}
unset({$varName});
// Start of serialized closure
return {$this->body};
// End of serialized closure
};";
return $code;
}
Expand Down
2 changes: 1 addition & 1 deletion src/ClosureParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -336,7 +336,7 @@ private function imports(): string
$code = self::formatImports($this->aliases, $this->hints, $ns);
}

if ($ns !== "\\") {
if ($ns) {
return "namespace {$ns};" . ($code ? "\n" : "") . $code;
}

Expand Down
2 changes: 1 addition & 1 deletion src/TokenizedFileInfo.php
Original file line number Diff line number Diff line change
Expand Up @@ -474,7 +474,7 @@ private function handleTrackComment(): void
$this->trackPrefix = ' - generated at ' . date(DATE_W3C) . ', file ' . $this->fileName . ', line ';
}
// Only append line number to track prefix
$token[1] = '// ' . trim(substr($token[1], 8)) . $this->trackPrefix . $token[2] . "\n";
$token[1] = '// ' . trim(substr($token[1], 8)) . $this->trackPrefix . $token[2];
}
}

Expand Down

0 comments on commit 8a69282

Please sign in to comment.