1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 13:51:54 +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-05 21:57:36 -05:00
use Traits\InvalidCodeAnalysisTestTrait;
use Traits\ValidCodeAnalysisTestTrait;
2017-01-13 14:07:23 -05:00
/**
* @return array
2017-01-13 14:07:23 -05:00
*/
2018-11-05 21:57:36 -05:00
public function providerValidCodeParse()
{
return [
'nestedAssignment' => [
'<?php
$a = $b = $c = 5;',
'assertions' => [
2017-06-29 10:22:49 -04:00
'$a' => 'int',
2017-05-26 20:05:57 -04:00
],
],
];
}
/**
* @return array
*/
2018-11-05 21:57:36 -05:00
public function providerInvalidCodeParse()
{
return [
'mixedAssignment' => [
'<?php
/** @var mixed */
$a = 5;
$b = $a;',
2017-05-26 20:05:57 -04:00
'error_message' => 'MixedAssignment',
],
];
2017-02-12 18:06:18 -05:00
}
}