Skip to content

Commit

Permalink
fix: ignore emit global namespace
Browse files Browse the repository at this point in the history
  • Loading branch information
cxtom committed Jun 4, 2019
1 parent 4227a4e commit 80b03e6
Showing 1 changed file with 5 additions and 1 deletion.
6 changes: 5 additions & 1 deletion src/emitter.ts
Original file line number Diff line number Diff line change
Expand Up @@ -110,7 +110,11 @@ export function emitFile(
state.sourceFile = (transform.transformed[0] as SourceFile);

if (state.emitHeader) {
writer.write(`<?php\nnamespace ${state.namespace};\n`);
let header = '<?php\n';
if (state.namespace && state.namespace !== '\\') {
header += `namespace ${state.namespace};\n`;
}
writer.write(header);
}

state.sourceFile.forEachChild((node: ts.Node) => {
Expand Down

0 comments on commit 80b03e6

Please sign in to comment.