Skip to content

Commit

Permalink
[zendframework#4157] Generated files should use unix lineending only
Browse files Browse the repository at this point in the history
- However, anything `echo()`d to the screen can and should use `PHP_EOL`
  still.
  • Loading branch information
weierophinney committed Apr 12, 2013
1 parent 17ce26c commit 7a34a7c
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 9 deletions.
6 changes: 3 additions & 3 deletions bin/classmap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -171,15 +171,15 @@
$content = str_replace("\\'", "'", $content);

// Convert to an array and remove the first "array("
$content = explode(PHP_EOL, $content);
$content = explode("\n", $content);
array_shift($content);

// Load existing class map file and remove the closing "bracket ");" from it
$existing = file($output, FILE_IGNORE_NEW_LINES);
array_pop($existing);

// Merge
$content = implode(PHP_EOL, array_merge($existing, $content));
$content = implode("\n", array_merge($existing, $content));
} else {
// Create a file with the class/file map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
Expand Down Expand Up @@ -211,7 +211,7 @@
$content = preg_replace('(\n\s+([^=]+)=>)e', "'\n \\1' . str_repeat(' ', " . $maxWidth . " - strlen('\\1')) . '=>'", $content);

// Make the file end by EOL
$content = rtrim($content, PHP_EOL) . PHP_EOL;
$content = rtrim($content, "\n") . "\n";

// Write the contents to disk
file_put_contents($output, $content);
Expand Down
6 changes: 3 additions & 3 deletions bin/pluginmap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -146,15 +146,15 @@
$content = str_replace("\\'", "'", $content);

// Convert to an array and remove the first "array ("
$content = explode(PHP_EOL, $content);
$content = explode("\n", $content);
array_shift($content);

// Load existing class map file and remove the closing "bracket ");" from it
$existing = file($output, FILE_IGNORE_NEW_LINES);
array_pop($existing);

// Merge
$content = implode(PHP_EOL, $existing + $content);
$content = implode("\n", $existing + $content);
} else {
// Create a file with the class/file map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
Expand All @@ -169,7 +169,7 @@
}

// Make the file end by EOL
$content = rtrim($content, PHP_EOL) . PHP_EOL;
$content = rtrim($content, "\n") . "\n";

// Write the contents to disk
file_put_contents($output, $content);
Expand Down
6 changes: 3 additions & 3 deletions bin/templatemap_generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -193,15 +193,15 @@
$content = str_replace("\\'", "'", $content);

// Convert to an array and remove the first "array("
$content = explode(PHP_EOL, $content);
$content = explode("\n", $content);
array_shift($content);

// Load existing map file and remove the closing "bracket ");" from it
$existing = file($output, FILE_IGNORE_NEW_LINES);
array_pop($existing);

// Merge
$content = implode(PHP_EOL, array_merge($existing, $content));
$content = implode("\n", array_merge($existing, $content));
} else {
// Create a file with the map.
// Stupid syntax highlighters make separating < from PHP declaration necessary
Expand Down Expand Up @@ -233,7 +233,7 @@
$content = preg_replace('(\n\s+([^=]+)=>)e', "'\n \\1' . str_repeat(' ', " . $maxWidth . " - strlen('\\1')) . '=>'", $content);

// Make the file end by EOL
$content = rtrim($content, PHP_EOL) . PHP_EOL;
$content = rtrim($content, "\n") . "\n";

// Write the contents to disk
file_put_contents($output, $content);
Expand Down

0 comments on commit 7a34a7c

Please sign in to comment.