Reactivate php_sim in Scrutinizer and fix some minor issues
This commit is contained in:
parent
e03e121e85
commit
6ba6ed40fc
|
|
@ -18,7 +18,8 @@ tools:
|
|||
enabled: true
|
||||
timeout: 900
|
||||
php_sim:
|
||||
min_mass: 16
|
||||
enabled: true
|
||||
min_mass: 30
|
||||
php_pdepend: true
|
||||
php_analyzer: true
|
||||
sensiolabs_security_checker: true
|
||||
|
|
|
|||
|
|
@ -96,7 +96,7 @@ class XMLReader
|
|||
* @param string $path
|
||||
* @return \DOMElement|null
|
||||
*/
|
||||
public function getElement($path, \DOMElement $contextNode)
|
||||
public function getElement($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
|
|
@ -113,16 +113,17 @@ class XMLReader
|
|||
* @param string $path
|
||||
* @return string|null
|
||||
*/
|
||||
public function getAttribute($attribute, \DOMElement $contextNode, $path = null)
|
||||
public function getAttribute($attribute, \DOMElement $contextNode = null, $path = null)
|
||||
{
|
||||
if (is_null($path)) {
|
||||
$return = $contextNode->getAttribute($attribute);
|
||||
} else {
|
||||
$return = null;
|
||||
if ($path !== null) {
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
$return = $elements->item(0)->getAttribute($attribute);
|
||||
} else {
|
||||
$return = null;
|
||||
}
|
||||
} else {
|
||||
if ($contextNode !== null) {
|
||||
$return = $contextNode->getAttribute($attribute);
|
||||
}
|
||||
}
|
||||
|
||||
|
|
@ -135,7 +136,7 @@ class XMLReader
|
|||
* @param string $path
|
||||
* @return string|null
|
||||
*/
|
||||
public function getValue($path, \DOMElement $contextNode)
|
||||
public function getValue($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
if ($elements->length > 0) {
|
||||
|
|
@ -151,7 +152,7 @@ class XMLReader
|
|||
* @param string $path
|
||||
* @return integer
|
||||
*/
|
||||
public function countElements($path, \DOMElement $contextNode)
|
||||
public function countElements($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
$elements = $this->getElements($path, $contextNode);
|
||||
|
||||
|
|
@ -164,7 +165,7 @@ class XMLReader
|
|||
* @param string $path
|
||||
* @return boolean
|
||||
*/
|
||||
public function elementExists($path, \DOMElement $contextNode)
|
||||
public function elementExists($path, \DOMElement $contextNode = null)
|
||||
{
|
||||
return $this->getElements($path, $contextNode)->length > 0;
|
||||
}
|
||||
|
|
|
|||
|
|
@ -51,9 +51,9 @@ class AbstractElement extends \PhpOffice\PhpWord\Writer\HTML\Element\AbstractEle
|
|||
protected function getStyles()
|
||||
{
|
||||
/** @var \PhpOffice\PhpWord\Writer\RTF $parentWriter Scrutinizer type hint */
|
||||
/** @var \PhpOffice\PhpWord\Element\Text $element Scrutinizer type hint */
|
||||
|
||||
$parentWriter = $this->parentWriter;
|
||||
|
||||
/** @var \PhpOffice\PhpWord\Element\Text $element Scrutinizer type hint */
|
||||
$element = $this->element;
|
||||
|
||||
// Font style
|
||||
|
|
|
|||
|
|
@ -32,9 +32,8 @@ class Text extends AbstractElement
|
|||
public function write()
|
||||
{
|
||||
/** @var \PhpOffice\PhpWord\Element\Text $element Scrutinizer type hint */
|
||||
|
||||
$elementClass = str_replace('\\Writer\\RTF', '', get_class($this));
|
||||
$element = $this->element;
|
||||
$elementClass = str_replace('\\Writer\\RTF', '', get_class($this));
|
||||
if (!$element instanceof $elementClass) {
|
||||
return;
|
||||
}
|
||||
|
|
|
|||
Loading…
Reference in New Issue