mirror of
https://github.com/danog/PHP-Parser.git
synced 2024-12-02 09:17:58 +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)));
|
|
}
|