/** * @param string $from * @param string $to */ private function addLineEndingWarning($from, $to) { try { $fromEol = EOL::detect($from); $toEol = EOL::detect($to); } catch (\Exception $e) { // Comparison is useless when no line endings are found. return; } if ((string) $fromEol === (string) $toEol) { return; } $warning = sprintf('#Warning: Line ending changed from %s to %s', $fromEol->getName(), $toEol->getName()); $this->messages[] = $warning; }
/** * @expectedException \RuntimeException */ public function testDetect_WhenNoEOL_MustThrow() { EOL::detect(' xcx '); }