1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-30 04:39:00 +01:00

tests: added tests for bitwise-and, bitwise-xor, bitwise-not and boolean-not class constants

This commit is contained in:
Bitwise Operators 2022-08-04 08:52:43 +02:00
parent a5c550cea4
commit 9f6ce3059d

View File

@ -998,6 +998,60 @@ class ConstantTest extends TestCase
'$c' => 'int',
]
],
'bitwiseAndClassConstant' => [
'code' => '<?php
class X {
public const A = 1;
public const B = 2;
public const C = self::A & self::B;
}
$c = X::C;',
'assertions' => [
'$c' => 'int',
]
],
'bitwiseXorClassConstant' => [
'code' => '<?php
class X {
public const A = 1;
public const B = 2;
public const C = self::A ^ self::B;
}
$c = X::C;',
'assertions' => [
'$c' => 'int',
]
],
'bitwiseNotClassConstant' => [
'code' => '<?php
class X {
public const A = ~0;
public const B = ~"aa";
}
$a = X::A;
$b = X::B;',
'assertions' => [
'$a' => 'int',
'$b' => 'string',
]
],
'booleanNotClassConstant' => [
'code' => '<?php
class X {
public const A = !true;
public const B = !false;
}
$a = X::A;
$b = X::B;',
'assertions' => [
'$a' => 'false',
'$b' => 'true',
]
],
'protectedClassConstantAccessibilitySameNameInChild' => [
'code' => '<?php
class A {