mirror of
https://github.com/danog/psalm.git
synced 2024-11-30 04:39:00 +01:00
Drop missing issues from XSD schema (#3657)
Two unknown issues (that were only present in schema) are dropped and a test to validate that all issues are covered by XSD schema is added.
This commit is contained in:
parent
96d05ab06b
commit
e569f08f23
@ -194,7 +194,6 @@
|
||||
<xs:element name="ImplementedParamTypeMismatch" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImplementedReturnTypeMismatch" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImplicitToStringCast" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImpureArgument" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImpureByReferenceAssignment" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImpureFunctionCall" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="ImpureMethodCall" type="IssueHandlerType" minOccurs="0" />
|
||||
@ -237,7 +236,6 @@
|
||||
<xs:element name="InvalidScalarArgument" type="ArgumentIssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidScope" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidStaticInvocation" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidStaticVariable" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidStringClass" type="IssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidTemplateParam" type="FunctionIssueHandlerType" minOccurs="0" />
|
||||
<xs:element name="InvalidThrow" type="ClassIssueHandlerType" minOccurs="0" />
|
||||
|
@ -4,6 +4,7 @@ namespace Psalm\Tests;
|
||||
use function array_keys;
|
||||
use function count;
|
||||
use const DIRECTORY_SEPARATOR;
|
||||
use const LIBXML_NONET;
|
||||
use function dirname;
|
||||
use function explode;
|
||||
use function file_exists;
|
||||
@ -21,6 +22,9 @@ use function trim;
|
||||
use function glob;
|
||||
use function str_replace;
|
||||
use function array_shift;
|
||||
use DOMDocument;
|
||||
use DOMXPath;
|
||||
use DOMAttr;
|
||||
|
||||
class DocumentationTest extends TestCase
|
||||
{
|
||||
@ -90,6 +94,29 @@ class DocumentationTest extends TestCase
|
||||
$this->project_analyzer->setPhpVersion('7.3');
|
||||
}
|
||||
|
||||
public function testAllIssuesCoveredInConfigSchema(): void
|
||||
{
|
||||
$all_issues = \Psalm\Config\IssueHandler::getAllIssueTypes();
|
||||
$all_issues[] = 'PluginIssue'; // not an ordinary issue
|
||||
sort($all_issues);
|
||||
|
||||
$schema = new DOMDocument();
|
||||
$schema->load(__DIR__ . '/../config.xsd', LIBXML_NONET);
|
||||
|
||||
$xpath = new DOMXPath($schema);
|
||||
$xpath->registerNamespace('xs', 'http://www.w3.org/2001/XMLSchema');
|
||||
|
||||
/** @var iterable<mixed, DOMAttr> $handlers */
|
||||
$handlers = $xpath->query('//xs:complexType[@name="IssueHandlersType"]/xs:choice/xs:element/@name');
|
||||
$handler_types = [];
|
||||
foreach ($handlers as $handler) {
|
||||
$handler_types[] = $handler->value;
|
||||
}
|
||||
sort($handler_types);
|
||||
|
||||
$this->assertSame(implode("\n", $all_issues), implode("\n", $handler_types));
|
||||
}
|
||||
|
||||
/**
|
||||
* @return void
|
||||
*/
|
||||
|
Loading…
Reference in New Issue
Block a user