1
0
mirror of https://github.com/danog/psalm.git synced 2024-12-12 09:19:40 +01:00
psalm/tests/AssignmentTest.php

41 lines
872 B
PHP
Raw Normal View History

<?php
namespace Psalm\Tests;
class AssignmentTest extends TestCase
{
use Traits\FileCheckerInvalidCodeParseTestTrait;
use Traits\FileCheckerValidCodeParseTestTrait;
2017-01-13 20:07:23 +01:00
/**
* @return array
2017-01-13 20:07:23 +01:00
*/
public function providerFileCheckerValidCodeParse()
{
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
*/
public function providerFileCheckerInvalidCodeParse()
{
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
}
}