Skip to content

Commit

Permalink
fix psalm internal errors reported by new checks
Browse files Browse the repository at this point in the history
  • Loading branch information
kkmuffme committed Sep 8, 2022
1 parent 1a10654 commit d0984f4
Show file tree
Hide file tree
Showing 3 changed files with 6 additions and 15 deletions.
3 changes: 1 addition & 2 deletions src/Psalm/Config.php
Expand Up @@ -6,7 +6,7 @@
use Composer\Semver\Constraint\Constraint;
use Composer\Semver\VersionParser;
use DOMDocument;
use DomElement;
use DOMElement;
use InvalidArgumentException;
use LogicException;
use OutOfBoundsException;
Expand Down Expand Up @@ -752,7 +752,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) {
Expand Down
8 changes: 0 additions & 8 deletions src/Psalm/Internal/Codebase/ClassLikes.php
Expand Up @@ -784,14 +784,6 @@ public function traitHasCorrectCase(string $fq_trait_name): bool
return isset($this->existing_traits[$fq_trait_name]);
}

/**
* @param lowercase-string $fq_class_name
*/
public function isUserDefined(string $fq_class_name): bool
{
return $this->classlike_storage_provider->get($fq_class_name)->user_defined;
}

public function getTraitNode(string $fq_trait_name): PhpParser\Node\Stmt\Trait_
{
$fq_trait_name_lc = strtolower($fq_trait_name);
Expand Down
10 changes: 5 additions & 5 deletions src/Psalm/Internal/PluginManager/ConfigFile.php
Expand Up @@ -3,7 +3,7 @@
namespace Psalm\Internal\PluginManager;

use DOMDocument;
use DomElement;
use DOMElement;
use Psalm\Config;
use RuntimeException;

Expand Down Expand Up @@ -51,15 +51,15 @@ 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) {
// no plugins, nothing to remove
return;
}

/** @var DomElement */
/** @var DOMElement */
$plugins_element = $plugins_elements->item(0);

$plugin_elements = $plugins_element->getElementsByTagName('pluginClass');
Expand All @@ -82,7 +82,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) {
Expand All @@ -91,7 +91,7 @@ public function addPlugin(string $plugin_class): void
$psalm_root->appendChild($plugins_element);
}
} else {
/** @var DomElement */
/** @var DOMElement */
$plugins_element = $plugins_elements->item(0);
}

Expand Down

0 comments on commit d0984f4

Please sign in to comment.