1
0
mirror of https://github.com/danog/psalm.git synced 2025-01-22 05:41:20 +01:00

Add unused test

This commit is contained in:
Matthew Brown 2019-07-04 22:25:49 -04:00
parent 678d4e5286
commit 20b7ff1f9d
2 changed files with 40 additions and 0 deletions

View File

@ -2244,6 +2244,32 @@ class ClassTemplateExtendsTest extends TestCase
foreach ($c->getIterator() as $k => $v) { atan($v); strlen($k); }',
],
'traitInImplicitExtendedClass' => [
'<?php
/**
* @template T
*/
interface Foo {
/**
* @return T
*/
public static function getItem();
}
trait FooTrait {
public static function getItem() {
return "hello";
}
}
/**
* @template-implements Foo<string>
*/
class Bar implements Foo {
use FooTrait;
}'
]
];
}

View File

@ -1666,6 +1666,20 @@ class UnusedVariableTest extends TestCase
}',
'error_message' => 'UnusedVariable',
],
'detectRedundancyAfterLoopWithContinue' => [
'<?php
$gap = null;
foreach ([1, 2, 3] as $_) {
if (rand(0, 1)) {
continue;
}
$gap = "asa";
throw new \Exception($gap);
}',
'error_message' => 'UnusedVariable',
],
];
}
}