1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 12:55:26 +01:00
psalm/tests/TraceTest.php
2021-12-04 21:55:53 +01:00

48 lines
1.3 KiB
PHP

<?php
namespace Psalm\Tests;
use Psalm\Tests\Traits\InvalidCodeAnalysisTestTrait;
class TraceTest extends TestCase
{
use InvalidCodeAnalysisTestTrait;
/**
* @return iterable<string,array{string,error_message:string,1?:string[],2?:bool,3?:string}>
*/
public function providerInvalidCodeParse(): iterable
{
return [
'traceVariable' => [
'<?php
/** @psalm-trace $a */
$a = getmypid();',
'error_message' => 'Trace',
],
'traceVariables' => [
'<?php
/** @psalm-trace $a $b */
$a = getmypid();
$b = getmypid();',
'error_message' => 'Trace',
],
'traceVariablesComma' => [
'<?php
/** @psalm-trace $a, $b */
$a = getmypid();
$b = getmypid();',
'error_message' => 'Trace',
],
'undefinedTraceVariable' => [
'<?php
/** @psalm-trace $b */
echo 1;',
'error_message' => 'UndefinedTrace',
'error_levels' => [
'MixedAssignment',
],
]
];
}
}