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:
parent
a5c550cea4
commit
9f6ce3059d
@ -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 {
|
||||
|
Loading…
Reference in New Issue
Block a user