2016-12-17 00:56:23 +01:00
|
|
|
<?php
|
|
|
|
namespace Psalm\Tests;
|
|
|
|
|
2017-04-25 05:45:02 +02:00
|
|
|
class AssignmentTest extends TestCase
|
2016-12-17 00:56:23 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
use Traits\FileCheckerInvalidCodeParseTestTrait;
|
|
|
|
use Traits\FileCheckerValidCodeParseTestTrait;
|
2016-12-17 00:56:23 +01:00
|
|
|
|
2017-01-13 20:07:23 +01:00
|
|
|
/**
|
2017-04-25 05:45:02 +02:00
|
|
|
* @return array
|
2017-01-13 20:07:23 +01:00
|
|
|
*/
|
2017-04-25 05:45:02 +02:00
|
|
|
public function providerFileCheckerValidCodeParse()
|
2016-12-17 00:56:23 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
return [
|
|
|
|
'nestedAssignment' => [
|
|
|
|
'<?php
|
|
|
|
$a = $b = $c = 5;',
|
|
|
|
'assertions' => [
|
2017-05-27 02:05:57 +02:00
|
|
|
['int' => '$a'],
|
|
|
|
],
|
|
|
|
],
|
2017-04-25 05:45:02 +02:00
|
|
|
];
|
2016-12-17 00:56:23 +01:00
|
|
|
}
|
|
|
|
|
|
|
|
/**
|
2017-04-25 05:45:02 +02:00
|
|
|
* @return array
|
2016-12-17 00:56:23 +01:00
|
|
|
*/
|
2017-04-25 05:45:02 +02:00
|
|
|
public function providerFileCheckerInvalidCodeParse()
|
2016-12-17 00:56:23 +01:00
|
|
|
{
|
2017-04-25 05:45:02 +02:00
|
|
|
return [
|
|
|
|
'mixedAssignment' => [
|
|
|
|
'<?php
|
|
|
|
/** @var mixed */
|
|
|
|
$a = 5;
|
|
|
|
$b = $a;',
|
2017-05-27 02:05:57 +02:00
|
|
|
'error_message' => 'MixedAssignment',
|
|
|
|
],
|
2017-04-25 05:45:02 +02:00
|
|
|
];
|
2017-02-13 00:06:18 +01:00
|
|
|
}
|
2016-12-17 00:56:23 +01:00
|
|
|
}
|