1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-13 01:37:23 +01:00
psalm/tests/Php55Test.php

57 lines
1.4 KiB
PHP
Raw Normal View History

<?php
2023-10-19 13:12:06 +02:00
declare(strict_types=1);
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;
public function providerValidCodeParse(): iterable
{
return [
'finally' => [
'code' => '<?php
try {
}
catch (\Exception $e) {
}
finally {
2017-05-27 02:05:57 +02:00
}',
],
'foreachList' => [
'code' => '<?php
$array = [
[1, 2],
[3, 4],
];
2017-06-29 16:22:49 +02:00
foreach ($array as list($a, $b)) {
echo "A: $a; B: $b\n";
2017-05-27 02:05:57 +02:00
}',
],
'arrayStringDereferencing' => [
'code' => '<?php
$a = [1, 2, 3][0];
$b = "PHP"[0];',
'assertions' => [
2017-06-29 16:22:49 +02:00
'$a' => 'int',
'$b' => 'string',
2017-05-27 02:05:57 +02:00
],
],
'classString' => [
'code' => '<?php
class ClassName {}
2017-06-29 16:22:49 +02:00
$a = ClassName::class;',
'assertions' => [
'$a' => 'class-string',
2017-05-27 02:05:57 +02:00
],
],
];
}
}