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:
parent
678d4e5286
commit
20b7ff1f9d
@ -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;
|
||||
}'
|
||||
|
||||
]
|
||||
];
|
||||
}
|
||||
|
||||
|
@ -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',
|
||||
],
|
||||
];
|
||||
}
|
||||
}
|
||||
|
Loading…
x
Reference in New Issue
Block a user