Skip to content

Commit 947e74e

Browse files
committed
ShortGetPropertyHookReturnTypeRule is no longer needed
1 parent b2c2576 commit 947e74e

File tree

5 files changed

+33
-133
lines changed

5 files changed

+33
-133
lines changed

conf/config.level3.neon

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -22,7 +22,6 @@ rules:
2222
- PHPStan\Rules\Properties\ReadOnlyPropertyAssignRefRule
2323
- PHPStan\Rules\Properties\ReadOnlyByPhpDocPropertyAssignRefRule
2424
- PHPStan\Rules\Properties\SetNonVirtualPropertyHookAssignRule
25-
- PHPStan\Rules\Properties\ShortGetPropertyHookReturnTypeRule
2625
- PHPStan\Rules\Properties\TypesAssignedToPropertiesRule
2726
- PHPStan\Rules\Variables\ParameterOutAssignedTypeRule
2827
- PHPStan\Rules\Variables\ParameterOutExecutionEndTypeRule

src/Rules/Properties/ShortGetPropertyHookReturnTypeRule.php

Lines changed: 0 additions & 75 deletions
This file was deleted.

tests/PHPStan/Rules/Methods/ReturnTypeRuleTest.php

Lines changed: 33 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -1138,4 +1138,37 @@ public function testPropertyHooks(): void
11381138
]);
11391139
}
11401140

1141+
public function testShortGetPropertyHook(): void
1142+
{
1143+
if (PHP_VERSION_ID < 80400) {
1144+
$this->markTestSkipped('Test requires PHP 8.4.');
1145+
}
1146+
1147+
$this->analyse([__DIR__ . '/data/short-get-property-hook-return.php'], [
1148+
[
1149+
'Get hook for property ShortGetPropertyHookReturn\Foo::$i should return int but returns string.',
1150+
9,
1151+
],
1152+
[
1153+
'Get hook for property ShortGetPropertyHookReturn\Foo::$s should return non-empty-string but returns \'\'.',
1154+
18,
1155+
],
1156+
[
1157+
'Get hook for property ShortGetPropertyHookReturn\GenericFoo::$a should return T of ShortGetPropertyHookReturn\Foo but returns ShortGetPropertyHookReturn\Foo.',
1158+
36,
1159+
'Type ShortGetPropertyHookReturn\Foo is not always the same as T. It breaks the contract for some argument types, typically subtypes.',
1160+
],
1161+
[
1162+
'Get hook for property ShortGetPropertyHookReturn\GenericFoo::$b should return T of ShortGetPropertyHookReturn\Foo but returns ShortGetPropertyHookReturn\Foo.',
1163+
50,
1164+
'Type ShortGetPropertyHookReturn\Foo is not always the same as T. It breaks the contract for some argument types, typically subtypes.',
1165+
],
1166+
[
1167+
'Get hook for property ShortGetPropertyHookReturn\GenericFoo::$c should return T of ShortGetPropertyHookReturn\Foo but returns ShortGetPropertyHookReturn\Foo.',
1168+
59,
1169+
'Type ShortGetPropertyHookReturn\Foo is not always the same as T. It breaks the contract for some argument types, typically subtypes.',
1170+
],
1171+
]);
1172+
}
1173+
11411174
}

tests/PHPStan/Rules/Properties/ShortGetPropertyHookReturnTypeRuleTest.php

Lines changed: 0 additions & 57 deletions
This file was deleted.

0 commit comments

Comments
 (0)