1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00

Merge pull request #9443 from weirdan/require-php-tag-in-tests

This commit is contained in:
Bruce Weirdan 2023-03-03 03:06:38 -04:00 committed by GitHub
commit b1b20106ad
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
2 changed files with 10 additions and 0 deletions

View File

@ -51,6 +51,11 @@ trait InvalidCodeAnalysisTestTrait
$this->markTestSkipped('Skipped due to a bug.');
}
// sanity check - do we have a PHP tag?
if (strpos($code, '<?php') === false) {
$this->fail('Test case must have a <?php tag');
}
if (strtoupper(substr(PHP_OS, 0, 3)) === 'WIN') {
$code = str_replace("\n", "\r\n", $code);
}

View File

@ -55,6 +55,11 @@ trait ValidCodeAnalysisTestTrait
$this->markTestSkipped('Skipped due to a bug.');
}
// sanity check - do we have a PHP tag?
if (strpos($code, '<?php') === false) {
$this->fail('Test case must have a <?php tag');
}
foreach ($ignored_issues as $issue_name) {
Config::getInstance()->setCustomErrorLevel($issue_name, Config::REPORT_SUPPRESS);
}