1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-26 20:34:47 +01:00
psalm/tests/AssertTest.php
2017-10-26 18:20:35 -04:00

55 lines
1.4 KiB
PHP

<?php
namespace Psalm\Tests;
class AssertTest extends TestCase
{
use Traits\FileCheckerInvalidCodeParseTestTrait;
use Traits\FileCheckerValidCodeParseTestTrait;
/**
* @return array
*/
public function providerFileCheckerValidCodeParse()
{
return [
'SKIPPED-assertInstanceOfB' => [
'<?php
class A {}
class B extends A {
public function foo() : void {}
}
function assertInstanceOfB(A $var) : void {
if (!$var instanceof B) {
throw new \Exception();
}
}
function assertInstanceOfClass(A $var, string $class) : void {
if (!$var instanceof $class) {
throw new \Exception();
}
}
function takesA(A $a) : void {
assertInstanceOfB($a);
$a->foo();
}
function takesA(A $a) : void {
assertInstanceOfB($a);
$a->foo();
}',
],
];
}
/**
* @return array
*/
public function providerFileCheckerInvalidCodeParse()
{
return [];
}
}