"Fossies" - the Fresh Open Source Software Archive  

Source code changes of the file "src/Util/Printer.php" between
phpunit-9.0.0.tar.gz and phpunit-9.0.1.tar.gz

About: PHPUnit is a unit testing software framework for software written in PHP.

Printer.php  (phpunit-9.0.0):Printer.php  (phpunit-9.0.1)
skipping to change at line 18 skipping to change at line 18
* file that was distributed with this source code. * file that was distributed with this source code.
*/ */
namespace PHPUnit\Util; namespace PHPUnit\Util;
/** /**
* @internal This class is not covered by the backward compatibility promise for PHPUnit * @internal This class is not covered by the backward compatibility promise for PHPUnit
*/ */
class Printer class Printer
{ {
/** /**
* @var resource * @var closed-resource|resource
*/ */
private $stream; private $stream;
/** /**
* @var bool * @var bool
*/ */
private $isPhpStream; private $isPhpStream;
/** /**
* @param null|resource|string $out * @param null|resource|string $out
skipping to change at line 77 skipping to change at line 77
); );
} }
$this->stream = \fopen($out, 'wb'); $this->stream = \fopen($out, 'wb');
$this->isPhpStream = \strncmp($out, 'php://', 6) !== 0; $this->isPhpStream = \strncmp($out, 'php://', 6) !== 0;
} }
public function write(string $buffer): void public function write(string $buffer): void
{ {
if ($this->stream) { if ($this->stream) {
\assert(\is_resource($this->stream));
\fwrite($this->stream, $buffer); \fwrite($this->stream, $buffer);
} else { } else {
if (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg') { if (\PHP_SAPI !== 'cli' && \PHP_SAPI !== 'phpdbg') {
$buffer = \htmlspecialchars($buffer, \ENT_COMPAT | \ENT_SUBSTITU TE); $buffer = \htmlspecialchars($buffer, \ENT_COMPAT | \ENT_SUBSTITU TE);
} }
print $buffer; print $buffer;
} }
} }
public function flush(): void public function flush(): void
{ {
if ($this->stream && $this->isPhpStream) { if ($this->stream && $this->isPhpStream) {
\assert(\is_resource($this->stream));
\fclose($this->stream); \fclose($this->stream);
} }
} }
} }
 End of changes. 3 change blocks. 
1 lines changed or deleted 5 lines changed or added

Home  |  About  |  Features  |  All  |  Newest  |  Dox  |  Diffs  |  RSS Feeds  |  Screenshots  |  Comments  |  Imprint  |  Privacy  |  HTTP(S)