Skip to content

Commit

Permalink
MissingClassConstType
Browse files Browse the repository at this point in the history
  • Loading branch information
jack-worman committed Mar 14, 2024
1 parent 42dfc1e commit 2ff5c92
Showing 1 changed file with 24 additions and 14 deletions.
38 changes: 24 additions & 14 deletions tests/Config/PluginTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,14 +133,20 @@ public function testStringAnalyzerPluginWithClassConstant(): void

$file_path = getcwd() . '/src/somefile.php';


$this->addFile(
$file_path,
'<?php
class A {
const C = [
"foo" => "Psalm\Internal\Analyzer\ProjectAnalyzer",
];
}',
sprintf(
<<<'PHP'
<?php
class A {
const %s C = [
"foo" => "Psalm\Internal\Analyzer\ProjectAnalyzer",
];
}
PHP,
$this->project_analyzer->getCodebase()->analysis_php_version_id >= 8_03_00 ? 'array' : '',
),
);

$this->analyzeFile($file_path, new Context());
Expand Down Expand Up @@ -173,14 +179,18 @@ public function testStringAnalyzerPluginWithClassConstantConcat(): void

$this->addFile(
$file_path,
'<?php
namespace Psalm;
class A {
const C = [
"foo" => \Psalm\Internal\Analyzer\ProjectAnalyzer::class . "::foo",
];
}',
sprintf(
<<<'PHP'
<?php
namespace Psalm;
class A {
const %s C = [
"foo" => \Psalm\Internal\Analyzer\ProjectAnalyzer::class . "::foo",
];
}
PHP,
$this->project_analyzer->getCodebase()->analysis_php_version_id >= 8_03_00 ? 'array' : '',
),
);

$this->analyzeFile($file_path, new Context());
Expand Down

0 comments on commit 2ff5c92

Please sign in to comment.