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

41 lines
834 B
PHP
Raw Normal View History

<?php
namespace Psalm\Tests;
class AssignmentTest extends TestCase
{
2018-11-06 03:57:36 +01:00
use Traits\InvalidCodeAnalysisTestTrait;
use Traits\ValidCodeAnalysisTestTrait;
2017-01-13 20:07:23 +01:00
/**
* @return array
2017-01-13 20:07:23 +01:00
*/
2018-11-06 03:57:36 +01:00
public function providerValidCodeParse()
{
return [
'nestedAssignment' => [
'<?php
$a = $b = $c = 5;',
'assertions' => [
2017-06-29 16:22:49 +02:00
'$a' => 'int',
2017-05-27 02:05:57 +02:00
],
],
];
}
/**
* @return array
*/
2018-11-06 03:57:36 +01:00
public function providerInvalidCodeParse()
{
return [
'mixedAssignment' => [
'<?php
/** @var mixed */
$a = 5;
$b = $a;',
2017-05-27 02:05:57 +02:00
'error_message' => 'MixedAssignment',
],
];
2017-02-13 00:06:18 +01:00
}
}