1
0
mirror of https://github.com/danog/psalm.git synced 2024-11-27 04:45:20 +01:00
psalm/tests/AssertTest.php

55 lines
1.4 KiB
PHP
Raw Normal View History

<?php
namespace Psalm\Tests;
class AssertTest extends TestCase
{
use Traits\FileCheckerInvalidCodeParseTestTrait;
use Traits\FileCheckerValidCodeParseTestTrait;
/**
* @return array
*/
public function providerFileCheckerValidCodeParse()
{
return [
2017-10-27 00:20:35 +02:00
'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 [];
}
}