N°8834 - Add compatibility with PHP 8.4 (#819)

* N°8834 - Add compatibility with PHP 8.4

* Rollback of scssphp/scssphp version upgrade due to compilation error
This commit is contained in:
Lenaick
2026-02-26 10:36:32 +01:00
committed by GitHub
parent d4821b7edc
commit fc967c06ce
961 changed files with 12298 additions and 7130 deletions

View File

@@ -42,7 +42,7 @@ class XmlUtils
* @throws InvalidXmlException When parsing of XML with schema or callable produces any errors unrelated to the XML parsing itself
* @throws \RuntimeException When DOM extension is missing
*/
public static function parse(string $content, string|callable $schemaOrCallable = null): \DOMDocument
public static function parse(string $content, string|callable|null $schemaOrCallable = null): \DOMDocument
{
if (!\extension_loaded('dom')) {
throw new \LogicException('Extension DOM is required.');
@@ -84,7 +84,7 @@ class XmlUtils
} else {
libxml_use_internal_errors($internalErrors);
throw new XmlParsingException(sprintf('Invalid XSD file: "%s".', $schemaOrCallable));
throw new XmlParsingException(\sprintf('Invalid XSD file: "%s".', $schemaOrCallable));
}
if (!$valid) {
@@ -112,26 +112,26 @@ class XmlUtils
* @throws XmlParsingException When XML parsing returns any errors
* @throws \RuntimeException When DOM extension is missing
*/
public static function loadFile(string $file, string|callable $schemaOrCallable = null): \DOMDocument
public static function loadFile(string $file, string|callable|null $schemaOrCallable = null): \DOMDocument
{
if (!is_file($file)) {
throw new \InvalidArgumentException(sprintf('Resource "%s" is not a file.', $file));
throw new \InvalidArgumentException(\sprintf('Resource "%s" is not a file.', $file));
}
if (!is_readable($file)) {
throw new \InvalidArgumentException(sprintf('File "%s" is not readable.', $file));
throw new \InvalidArgumentException(\sprintf('File "%s" is not readable.', $file));
}
$content = @file_get_contents($file);
if ('' === trim($content)) {
throw new \InvalidArgumentException(sprintf('File "%s" does not contain valid XML, it is empty.', $file));
throw new \InvalidArgumentException(\sprintf('File "%s" does not contain valid XML, it is empty.', $file));
}
try {
return static::parse($content, $schemaOrCallable);
} catch (InvalidXmlException $e) {
throw new XmlParsingException(sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious());
throw new XmlParsingException(\sprintf('The XML file "%s" is not valid.', $file), 0, $e->getPrevious());
}
}
@@ -245,7 +245,7 @@ class XmlUtils
{
$errors = [];
foreach (libxml_get_errors() as $error) {
$errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
$errors[] = \sprintf('[%s %s] %s (in %s - line %d, column %d)',
\LIBXML_ERR_WARNING == $error->level ? 'WARNING' : 'ERROR',
$error->code,
trim($error->message),