for testing and deploying your application
for finding and fixing issues
for empowering human code reviews
<?php
namespace PhpOffice\PhpSpreadsheetTests;
class SettingsTest extends \PHPUnit_Framework_TestCase
{
/**
* @var string
*/
protected $prevValue;
public function setUp()
$this->prevValue = libxml_disable_entity_loader();
$prevValue
string
libxml_disable_entity_loader()
boolean
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.
$answer = 42; $correct = false; $correct = (bool) $answer;
libxml_disable_entity_loader(false); // Enable entity loader
}
protected function tearDown()
libxml_disable_entity_loader($this->prevValue);
public function testGetXMLSettings()
$result = \PhpOffice\PhpSpreadsheet\Settings::getLibXmlLoaderOptions();
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR) & $result));
$this->assertFalse(libxml_disable_entity_loader());
public function testSetXMLSettings()
\PhpOffice\PhpSpreadsheet\Settings::setLibXmlLoaderOptions(LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID);
$this->assertTrue((bool) ((LIBXML_DTDLOAD | LIBXML_DTDATTR | LIBXML_DTDVALID) & $result));
This check looks for assignments to scalar types that may be of the wrong type.
To ensure the code behaves as expected, it may be a good idea to add an explicit type cast.