mirror of
https://github.com/phabelio/PHP-Parser.git
synced 2024-11-27 04:24:43 +01:00
d8312a09a3
And run the other stuff against Php5 and Php7 parsers. Also move canonicalize() from CodeTestAbstract into a free-standing function.
17 lines
345 B
PHP
17 lines
345 B
PHP
<?php
|
|
|
|
namespace PhpParser;
|
|
|
|
require __DIR__ . '/../lib/bootstrap.php';
|
|
|
|
function canonicalize($str) {
|
|
// trim from both sides
|
|
$str = trim($str);
|
|
|
|
// normalize EOL to \n
|
|
$str = str_replace(array("\r\n", "\r"), "\n", $str);
|
|
|
|
// trim right side of all lines
|
|
return implode("\n", array_map('rtrim', explode("\n", $str)));
|
|
}
|