1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 22:01:48 +01:00
psalm/tests/Php55Test.php

58 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace Psalm\Tests;
2021-12-04 21:55:53 +01:00
use Psalm\Tests\Traits\ValidCodeAnalysisTestTrait;
class Php55Test extends TestCase
{
2021-12-04 21:55:53 +01:00
use ValidCodeAnalysisTestTrait;
2017-01-13 14:07:23 -05:00
/**
2019-03-01 22:55:20 +02:00
* @return iterable<string,array{string,assertions?:array<string,string>,error_levels?:string[]}>
2017-01-13 14:07:23 -05:00
*/
public function providerValidCodeParse(): iterable
{
return [
'finally' => [
'<?php
try {
}
catch (\Exception $e) {
}
finally {
2017-05-26 20:05:57 -04:00
}',
],
'foreachList' => [
'<?php
$array = [
[1, 2],
[3, 4],
];
2017-06-29 10:22:49 -04:00
foreach ($array as list($a, $b)) {
echo "A: $a; B: $b\n";
2017-05-26 20:05:57 -04:00
}',
],
'arrayStringDereferencing' => [
'<?php
$a = [1, 2, 3][0];
$b = "PHP"[0];',
'assertions' => [
2017-06-29 10:22:49 -04:00
'$a' => 'int',
'$b' => 'string',
2017-05-26 20:05:57 -04:00
],
],
'classString' => [
'<?php
class ClassName {}
2017-06-29 10:22:49 -04:00
$a = ClassName::class;',
'assertions' => [
'$a' => 'class-string',
2017-05-26 20:05:57 -04:00
],
],
];
}
}