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