2021-06-18 00:15:45 +02:00
|
|
|
<?php
|
2021-12-15 04:58:32 +01:00
|
|
|
|
2021-06-18 00:15:45 +02:00
|
|
|
namespace Psalm\Tests\FileManipulation;
|
|
|
|
|
|
|
|
class RedundantCastManipulationTest extends FileManipulationTestCase
|
|
|
|
{
|
|
|
|
/**
|
|
|
|
* @return array<string,array{string,string,string,string[],bool,5?:bool}>
|
|
|
|
*/
|
|
|
|
public function providerValidCodeParse(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'RemoveRedundantCast' => [
|
|
|
|
'<?php
|
|
|
|
$test = 1;
|
|
|
|
(int)$test;
|
|
|
|
',
|
|
|
|
'<?php
|
|
|
|
$test = 1;
|
|
|
|
$test;
|
|
|
|
',
|
|
|
|
'5.6',
|
|
|
|
['RedundantCast'],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
'RemoveRedundantCastGivenDocblockType' => [
|
|
|
|
'<?php
|
|
|
|
/** @param int $test */
|
|
|
|
function a($test){
|
|
|
|
(int)$test;
|
|
|
|
}
|
|
|
|
|
|
|
|
',
|
|
|
|
'<?php
|
|
|
|
/** @param int $test */
|
|
|
|
function a($test){
|
|
|
|
$test;
|
|
|
|
}
|
|
|
|
|
|
|
|
',
|
|
|
|
'5.6',
|
|
|
|
['RedundantCastGivenDocblockType'],
|
|
|
|
true,
|
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|