diff --git a/src/ClosureInfo.php b/src/ClosureInfo.php index ba53994..fa901d9 100644 --- a/src/ClosureInfo.php +++ b/src/ClosureInfo.php @@ -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; } diff --git a/src/ClosureParser.php b/src/ClosureParser.php index 0f20432..78ea339 100644 --- a/src/ClosureParser.php +++ b/src/ClosureParser.php @@ -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; } diff --git a/src/TokenizedFileInfo.php b/src/TokenizedFileInfo.php index b96320f..f75fa39 100644 --- a/src/TokenizedFileInfo.php +++ b/src/TokenizedFileInfo.php @@ -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]; } }