Skip to content
Permalink
Browse files

Move issue type listing

  • Loading branch information...
muglug committed May 3, 2019
1 parent 8c9d8e7 commit d1574a64a4f0862b38c3d8a0d78589f52220226a
Showing with 43 additions and 42 deletions.
  1. +38 −0 src/Psalm/Config/IssueHandler.php
  2. +1 −41 tests/ConfigTest.php
  3. +4 −1 tests/DocumentationTest.php
@@ -140,4 +140,42 @@ public function getReportingLevelForProperty($property_id)
return $this->error_level;
}
/**
* @return string[]
* @psalm-return array<mixed, string>
*/
public static function getAllIssueTypes()
{
return array_filter(
array_map(
/**
* @param string $file_name
*
* @return string
*/
function ($file_name) {
return substr($file_name, 0, -4);
},
scandir(dirname(__DIR__) . '/Issue')
),
/**
* @param string $issue_name
*
* @return bool
*/
function ($issue_name) {
return !empty($issue_name)
&& $issue_name !== 'MethodIssue'
&& $issue_name !== 'PropertyIssue'
&& $issue_name !== 'FunctionIssue'
&& $issue_name !== 'ArgumentIssue'
&& $issue_name !== 'ClassIssue'
&& $issue_name !== 'CodeIssue'
&& $issue_name !== 'PsalmInternalError'
&& $issue_name !== 'ParseError'
&& $issue_name !== 'PluginIssue';
}
);
}
}
@@ -39,42 +39,6 @@ public function setUp()
$this->file_provider = new Provider\FakeFileProvider();
}
/**
* @return string[]
* @psalm-return array<mixed, string>
*/
public static function getAllIssues()
{
return array_filter(
array_map(
/**
* @param string $file_name
*
* @return string
*/
function ($file_name) {
return substr($file_name, 0, -4);
},
scandir(dirname(__DIR__) . '/src/Psalm/Issue')
),
/**
* @param string $issue_name
*
* @return bool
*/
function ($issue_name) {
return !empty($issue_name)
&& $issue_name !== 'MethodIssue'
&& $issue_name !== 'PropertyIssue'
&& $issue_name !== 'FunctionIssue'
&& $issue_name !== 'ArgumentIssue'
&& $issue_name !== 'ClassIssue'
&& $issue_name !== 'CodeIssue'
&& $issue_name !== 'PsalmInternalError';
}
);
}
/**
* @param Config $config
*
@@ -570,13 +534,9 @@ public function testAllPossibleIssues()
* @return string
*/
function ($issue_name) {
if ($issue_name === 'ParseError' || $issue_name === 'PluginIssue') {
return '';
}
return '<' . $issue_name . ' errorLevel="suppress" />' . "\n";
},
self::getAllIssues()
\Psalm\Config\IssueHandler::getAllIssueTypes()
)
);
@@ -85,7 +85,10 @@ public function setUp()
*/
public function testAllIssuesCovered()
{
$all_issues = ConfigTest::getAllIssues();
$all_issues = \Psalm\Config\IssueHandler::getAllIssueTypes();
$all_issues[] = 'ParseError';
$all_issues[] = 'PluginIssue';
sort($all_issues);
$code_blocks = self::getCodeBlocksFromDocs();

0 comments on commit d1574a6

Please sign in to comment.
You can’t perform that action at this time.