diff --git a/Definition/ArrayNode.php b/Definition/ArrayNode.php index 83bab205e..59a0af879 100644 --- a/Definition/ArrayNode.php +++ b/Definition/ArrayNode.php @@ -235,7 +235,7 @@ protected function finalizeValue($value) } if ($child->isDeprecated()) { - @trigger_error($child->getDeprecationMessage($name, $this->getPath()), E_USER_DEPRECATED); + @trigger_error($child->getDeprecationMessage($name, $this->getPath()), \E_USER_DEPRECATED); } try { diff --git a/Definition/Builder/ArrayNodeDefinition.php b/Definition/Builder/ArrayNodeDefinition.php index 29d1e154f..da4ebf627 100644 --- a/Definition/Builder/ArrayNodeDefinition.php +++ b/Definition/Builder/ArrayNodeDefinition.php @@ -413,7 +413,7 @@ protected function createNode() } if (false === $this->allowEmptyValue) { - @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), E_USER_DEPRECATED); + @trigger_error(sprintf('Using %s::cannotBeEmpty() at path "%s" has no effect, consider requiresAtLeastOneElement() instead. In 4.0 both methods will behave the same.', __CLASS__, $node->getPath()), \E_USER_DEPRECATED); } if (true === $this->atLeastOne) { @@ -476,7 +476,7 @@ protected function validateConcreteNode(ArrayNode $node) } if (false === $this->allowEmptyValue) { - @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), E_USER_DEPRECATED); + @trigger_error(sprintf('->cannotBeEmpty() is not applicable to concrete nodes at path "%s". In 4.0 it will throw an exception.', $path), \E_USER_DEPRECATED); } if (true === $this->atLeastOne) { diff --git a/Definition/Dumper/XmlReferenceDumper.php b/Definition/Dumper/XmlReferenceDumper.php index 744f15fd8..7f8639908 100644 --- a/Definition/Dumper/XmlReferenceDumper.php +++ b/Definition/Dumper/XmlReferenceDumper.php @@ -193,7 +193,7 @@ private function writeNode(NodeInterface $node, $depth = 0, $root = false, $name $commentDepth = $depth + 4 + \strlen($attrName) + 2; $commentLines = explode("\n", $comment); $multiline = (\count($commentLines) > 1); - $comment = implode(PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); + $comment = implode(\PHP_EOL.str_repeat(' ', $commentDepth), $commentLines); if ($multiline) { $this->writeLine(' diff --git a/Tests/Definition/ScalarNodeTest.php b/Tests/Definition/ScalarNodeTest.php index 4413baf3c..ac2d9376f 100644 --- a/Tests/Definition/ScalarNodeTest.php +++ b/Tests/Definition/ScalarNodeTest.php @@ -54,7 +54,7 @@ public function testSetDeprecated() $deprecationTriggered = 0; $deprecationHandler = function ($level, $message, $file, $line) use (&$prevErrorHandler, &$deprecationTriggered) { - if (E_USER_DEPRECATED === $level) { + if (\E_USER_DEPRECATED === $level) { return ++$deprecationTriggered; } diff --git a/Tests/Loader/LoaderTest.php b/Tests/Loader/LoaderTest.php index 35a911ef3..79ddf00f6 100644 --- a/Tests/Loader/LoaderTest.php +++ b/Tests/Loader/LoaderTest.php @@ -107,7 +107,7 @@ public function load($resource, $type = null) public function supports($resource, $type = null) { - return \is_string($resource) && 'foo' === pathinfo($resource, PATHINFO_EXTENSION); + return \is_string($resource) && 'foo' === pathinfo($resource, \PATHINFO_EXTENSION); } public function getType() diff --git a/Tests/Util/XmlUtilsTest.php b/Tests/Util/XmlUtilsTest.php index a82e939d9..f0b77ae6f 100644 --- a/Tests/Util/XmlUtilsTest.php +++ b/Tests/Util/XmlUtilsTest.php @@ -199,7 +199,7 @@ public function testLoadEmptyXmlFile() // test for issue https://github.com/symfony/symfony/issues/9731 public function testLoadWrongEmptyXMLWithErrorHandler() { - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $originalDisableEntities = libxml_disable_entity_loader(false); } $errorReporting = error_reporting(-1); @@ -221,7 +221,7 @@ public function testLoadWrongEmptyXMLWithErrorHandler() error_reporting($errorReporting); } - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); libxml_disable_entity_loader($disableEntities); diff --git a/Util/XmlUtils.php b/Util/XmlUtils.php index 203741ad1..d833c428e 100644 --- a/Util/XmlUtils.php +++ b/Util/XmlUtils.php @@ -51,15 +51,15 @@ public static function parse($content, $schemaOrCallable = null) } $internalErrors = libxml_use_internal_errors(true); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { $disableEntities = libxml_disable_entity_loader(true); } libxml_clear_errors(); $dom = new \DOMDocument(); $dom->validateOnParse = true; - if (!$dom->loadXML($content, LIBXML_NONET | (\defined('LIBXML_COMPACT') ? LIBXML_COMPACT : 0))) { - if (LIBXML_VERSION < 20900) { + if (!$dom->loadXML($content, \LIBXML_NONET | (\defined('LIBXML_COMPACT') ? \LIBXML_COMPACT : 0))) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } @@ -69,12 +69,12 @@ public static function parse($content, $schemaOrCallable = null) $dom->normalizeDocument(); libxml_use_internal_errors($internalErrors); - if (LIBXML_VERSION < 20900) { + if (\LIBXML_VERSION < 20900) { libxml_disable_entity_loader($disableEntities); } foreach ($dom->childNodes as $child) { - if (XML_DOCUMENT_TYPE_NODE === $child->nodeType) { + if (\XML_DOCUMENT_TYPE_NODE === $child->nodeType) { throw new XmlParsingException('Document types are not allowed.'); } } @@ -267,7 +267,7 @@ protected static function getXmlErrors($internalErrors) $errors = []; foreach (libxml_get_errors() as $error) { $errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)', - LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', + \LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR', $error->code, trim($error->message), $error->file ?: 'n/a',