mirror of
https://github.com/danog/psalm.git
synced 2024-11-27 04:45:20 +01:00
67f9adb33c
Ref #4036
46 lines
1.3 KiB
PHP
46 lines
1.3 KiB
PHP
<?php
|
|
namespace Psalm\Tests\FileManipulation;
|
|
|
|
class PureAnnotationAdditionTest extends FileManipulationTest
|
|
{
|
|
/**
|
|
* @return array<string,array{string,string,string,string[],bool}>
|
|
*/
|
|
public function providerValidCodeParse()
|
|
{
|
|
return [
|
|
'addPureAnnotationToFunction' => [
|
|
'<?php
|
|
function foo(string $s): string {
|
|
return $s;
|
|
}',
|
|
'<?php
|
|
/**
|
|
* @psalm-pure
|
|
*/
|
|
function foo(string $s): string {
|
|
return $s;
|
|
}',
|
|
'7.4',
|
|
['MissingPureAnnotation'],
|
|
true,
|
|
],
|
|
'dontAddPureAnnotationToImpureFunction' => [
|
|
'<?php
|
|
function foo(string $s): string {
|
|
echo $s;
|
|
return $s;
|
|
}',
|
|
'<?php
|
|
function foo(string $s): string {
|
|
echo $s;
|
|
return $s;
|
|
}',
|
|
'7.4',
|
|
['MissingPureAnnotation'],
|
|
true,
|
|
],
|
|
];
|
|
}
|
|
}
|