From d0baffb534acb0236d690c5a48ed08d9033abf5b Mon Sep 17 00:00:00 2001 From: sasezaki Date: Fri, 11 Feb 2022 10:46:12 +0900 Subject: [PATCH 1/3] DOMElement instead of DomElement - https://php.net/DOMElement to avoid composer-require-check reports false-positive, just did - find src/ -type f -exec sed -i -e 's/DomElement/DOMElement/g' {} \; --- src/Psalm/Config.php | 6 +++--- src/Psalm/Internal/PluginManager/ConfigFile.php | 10 +++++----- 2 files changed, 8 insertions(+), 8 deletions(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index 4f8a7e104fb..edb4a061f0d 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -7,7 +7,7 @@ use Composer\Semver\VersionParser; use DOMAttr; use DOMDocument; -use DomElement; +use DOMElement; use InvalidArgumentException; use JsonException; use LogicException; @@ -764,7 +764,7 @@ private static function validateXmlConfig(string $base_dir, string $file_content $psalm_nodes = $dom_document->getElementsByTagName('psalm'); - /** @var DomElement|null */ + /** @var DOMElement|null */ $psalm_node = $psalm_nodes->item(0); if (!$psalm_node) { @@ -853,7 +853,7 @@ private static function processDeprecatedAttribute( } private static function processDeprecatedElement( - DomElement $deprecated_element_xml, + DOMElement $deprecated_element_xml, string $file_contents, self $config, string $config_path diff --git a/src/Psalm/Internal/PluginManager/ConfigFile.php b/src/Psalm/Internal/PluginManager/ConfigFile.php index 82a21354bd4..0fed0fe7987 100644 --- a/src/Psalm/Internal/PluginManager/ConfigFile.php +++ b/src/Psalm/Internal/PluginManager/ConfigFile.php @@ -3,7 +3,7 @@ namespace Psalm\Internal\PluginManager; use DOMDocument; -use DomElement; +use DOMElement; use Psalm\Config; use RuntimeException; @@ -53,7 +53,7 @@ public function getConfig(): Config public function removePlugin(string $plugin_class): void { $config_xml = $this->readXml(); - /** @var DomElement */ + /** @var DOMElement */ $psalm_root = $config_xml->getElementsByTagName('psalm')[0]; $plugins_elements = $psalm_root->getElementsByTagName('plugins'); if (!$plugins_elements->length) { @@ -61,7 +61,7 @@ public function removePlugin(string $plugin_class): void return; } - /** @var DomElement */ + /** @var DOMElement */ $plugins_element = $plugins_elements->item(0); $plugin_elements = $plugins_element->getElementsByTagName('pluginClass'); @@ -84,7 +84,7 @@ public function removePlugin(string $plugin_class): void public function addPlugin(string $plugin_class): void { $config_xml = $this->readXml(); - /** @var DomElement */ + /** @var DOMElement */ $psalm_root = $config_xml->getElementsByTagName('psalm')->item(0); $plugins_elements = $psalm_root->getElementsByTagName('plugins'); if (!$plugins_elements->length) { @@ -93,7 +93,7 @@ public function addPlugin(string $plugin_class): void $psalm_root->appendChild($plugins_element); } } else { - /** @var DomElement */ + /** @var DOMElement */ $plugins_element = $plugins_elements->item(0); } From 88dbfc7c003f0875e3244b878b667892369cfea1 Mon Sep 17 00:00:00 2001 From: sasezaki Date: Fri, 11 Feb 2022 10:50:48 +0900 Subject: [PATCH 2/3] Added Composer\Audoload\ClassLoader, it is soft dependency symbol --- bin/composer-require-checker-config.json | 3 ++- 1 file changed, 2 insertions(+), 1 deletion(-) diff --git a/bin/composer-require-checker-config.json b/bin/composer-require-checker-config.json index 268cf8c735d..753f91dd159 100644 --- a/bin/composer-require-checker-config.json +++ b/bin/composer-require-checker-config.json @@ -4,7 +4,8 @@ "static", "self", "parent", "array", "string", "int", "float", "bool", "iterable", "callable", "void", "object", "igbinary_serialize", "igbinary_unserialize", "PHP_PARSER_VERSION", "PSALM_VERSION", "runkit_object_id", - "sapi_windows_cp_is_utf8", "ReflectionUnionType" + "sapi_windows_cp_is_utf8", "ReflectionUnionType", + "Composer\\Autoload\\ClassLoader" ], "php-core-extensions" : [ "Core", From c46818ac244ac427e1fc387c6352a47c7d8069ad Mon Sep 17 00:00:00 2001 From: sasezaki Date: Fri, 11 Feb 2022 12:54:25 +0900 Subject: [PATCH 3/3] Removed unnecessary var annotation --- src/Psalm/Config.php | 1 - 1 file changed, 1 deletion(-) diff --git a/src/Psalm/Config.php b/src/Psalm/Config.php index edb4a061f0d..850303fd530 100644 --- a/src/Psalm/Config.php +++ b/src/Psalm/Config.php @@ -764,7 +764,6 @@ private static function validateXmlConfig(string $base_dir, string $file_content $psalm_nodes = $dom_document->getElementsByTagName('psalm'); - /** @var DOMElement|null */ $psalm_node = $psalm_nodes->item(0); if (!$psalm_node) {