1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00

added testcases with undefined constant concatination

This commit is contained in:
ebakulin 2023-02-27 22:00:36 +07:00
parent 8f98539e0a
commit a9b9d386a9

View File

@ -489,6 +489,30 @@ class BinaryOperationTest extends TestCase
foobar($foo . $bar); foobar($foo . $bar);
', ',
], ],
'concatenateNonFalsyStringWithUndefinedConstant' => [
'code' => '<?php
/**
* @param non-falsy-string $arg
* @return non-falsy-string
*/
function foo( $arg ) {
/** @psalm-suppress UndefinedConstant */
return FOO . $arg;
}
',
],
'concatenateNonEmptyStringWithUndefinedConstant' => [
'code' => '<?php
/**
* @param non-empty-string $arg
* @return non-empty-string
*/
function foo( $arg ) {
/** @psalm-suppress UndefinedConstant */
return FOO . $arg;
}
',
],
'possiblyInvalidAdditionOnBothSides' => [ 'possiblyInvalidAdditionOnBothSides' => [
'code' => '<?php 'code' => '<?php
function foo(string $s) : int { function foo(string $s) : int {