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
|
|
|
|
{
|
|
|
|
public function providerValidCodeParse(): array
|
|
|
|
{
|
|
|
|
return [
|
|
|
|
'RemoveRedundantCast' => [
|
2022-01-13 19:49:37 +01:00
|
|
|
'input' => '<?php
|
2021-06-18 00:15:45 +02:00
|
|
|
$test = 1;
|
|
|
|
(int)$test;
|
|
|
|
',
|
2022-01-13 19:49:37 +01:00
|
|
|
'output' => '<?php
|
2021-06-18 00:15:45 +02:00
|
|
|
$test = 1;
|
|
|
|
$test;
|
|
|
|
',
|
2022-01-13 19:49:37 +01:00
|
|
|
'php_version' => '5.6',
|
|
|
|
'issues_to_fix' => ['RedundantCast'],
|
|
|
|
'safe_types' => true,
|
2021-06-18 00:15:45 +02:00
|
|
|
],
|
|
|
|
'RemoveRedundantCastGivenDocblockType' => [
|
2022-01-13 19:49:37 +01:00
|
|
|
'input' => '<?php
|
2021-06-18 00:15:45 +02:00
|
|
|
/** @param int $test */
|
|
|
|
function a($test){
|
|
|
|
(int)$test;
|
|
|
|
}
|
|
|
|
|
|
|
|
',
|
2022-01-13 19:49:37 +01:00
|
|
|
'output' => '<?php
|
2021-06-18 00:15:45 +02:00
|
|
|
/** @param int $test */
|
|
|
|
function a($test){
|
|
|
|
$test;
|
|
|
|
}
|
|
|
|
|
|
|
|
',
|
2022-01-13 19:49:37 +01:00
|
|
|
'php_version' => '5.6',
|
|
|
|
'issues_to_fix' => ['RedundantCastGivenDocblockType'],
|
|
|
|
'safe_types' => true,
|
2021-06-18 00:15:45 +02:00
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|