-
Notifications
You must be signed in to change notification settings - Fork 23
Expand file tree
/
Copy pathTypeHintDeprecatedInClassMethodSignatureRuleTest.php
More file actions
41 lines (35 loc) · 2.44 KB
/
TypeHintDeprecatedInClassMethodSignatureRuleTest.php
File metadata and controls
41 lines (35 loc) · 2.44 KB
1
2
3
4
5
6
7
8
9
10
11
12
13
14
15
16
17
18
19
20
21
22
23
24
25
26
27
28
29
30
31
32
33
34
35
36
37
38
39
40
41
<?php declare(strict_types = 1);
namespace PHPStan\Rules\Deprecations;
use PHPStan\Rules\Rule;
use PHPStan\Testing\RuleTestCase;
/**
* @extends RuleTestCase<TypeHintDeprecatedInClassMethodSignatureRule>
*/
class TypeHintDeprecatedInClassMethodSignatureRuleTest extends RuleTestCase
{
protected function getRule(): Rule
{
return new TypeHintDeprecatedInClassMethodSignatureRule(
new DeprecatedClassHelper($this->createReflectionProvider()),
new DeprecatedScopeHelper([new DefaultDeprecatedScopeResolver()]),
);
}
public function test(): void
{
require_once __DIR__ . '/data/typehint-class-method-deprecated-class-definition.php';
$this->analyse(
[__DIR__ . '/data/typehint-class-method-deprecated-class.php'],
[
['Parameter $property of method TypeHintDeprecatedInClassMethodSignature\Foo::setProperties() has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 13],
['Parameter $property2 of method TypeHintDeprecatedInClassMethodSignature\Foo::setProperties() has typehint with deprecated interface TypeHintDeprecatedInClassMethodSignature\DeprecatedInterface.', 13],
["Parameter \$property4 of method TypeHintDeprecatedInClassMethodSignature\Foo::setProperties() has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\VerboseDeprecatedProperty:\nI'll be back", 13],
['Parameter $property6 of method TypeHintDeprecatedInClassMethodSignature\Foo::setProperties() has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 13],
['Return type of method TypeHintDeprecatedInClassMethodSignature\Foo::setProperties() has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 13],
['Parameter $property of method TypeHintDeprecatedInClassMethodSignature\FooImplNoOverride::oops() has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 50],
['Parameter $property of method __construct() in anonymous class has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 71],
['Return type of method getProperty() in anonymous class has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 76],
['Return type of method methodWithAttribute() in anonymous class has typehint with deprecated class TypeHintDeprecatedInClassMethodSignature\DeprecatedProperty.', 82],
],
);
}
}