/** * @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; }
public function testDetectDefault_WhenNoEOL_UseDefault() { $this->assertSame(EOL::EOL_CR_LF, (string) EOL::detectDefault('a', EOL::EOL_CR_LF)); }