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
|
|
|
|
{
|
|
|
|
/**
|
2022-01-13 19:49:37 +01:00
|
|
|
* @return array<string,array{input:string,output:string,php_version:string,issues_to_fix:array<string>,safe_types:bool,allow_backwards_incompatible_changes?:bool}>
|
2021-06-18 00:15:45 +02:00
|
|
|
*/
|
|
|
|
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
|
|
|
],
|
|
|
|
];
|
|
|
|
}
|
|
|
|
}
|