Skip to content

Commit b1be3f5

Browse files
impossible
1 parent 1e84097 commit b1be3f5

File tree

3 files changed

+2
-33
lines changed

3 files changed

+2
-33
lines changed

src/Rules/Properties/ExistingClassesInPropertyHookTypehintsRule.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -84,8 +84,9 @@ public function processNode(Node $node, Scope $scope): array
8484
$className,
8585
$propertyName,
8686
),
87+
// Should be impossible, property hooks do not support return types
8788
sprintf(
88-
'Attribute NoDiscard cannot be used on void %s hook for property %s::$%s.',
89+
'Impossible condition: Attribute NoDiscard cannot be used on void %s hook for property %s::$%s.',
8990
ucfirst($hookName),
9091
$className,
9192
$propertyName,

tests/PHPStan/Rules/Properties/ExistingClassesInPropertyHookTypehintsRuleTest.php

Lines changed: 0 additions & 15 deletions
Original file line numberDiff line numberDiff line change
@@ -62,19 +62,4 @@ public function testRule(): void
6262
]);
6363
}
6464

65-
#[RequiresPhp('>= 8.4')]
66-
public function testNoDiscardVoid(): void
67-
{
68-
$this->analyse([__DIR__ . '/data/property-hooks-nodiscard.php'], [
69-
[
70-
'Attribute NoDiscard cannot be used on void get hook for property ExistingClassesPropertyHooks\Demo::$foo.',
71-
9,
72-
],
73-
[
74-
'Attribute NoDiscard cannot be used on void set hook for property ExistingClassesPropertyHooks\Demo::$set.',
75-
14,
76-
],
77-
]);
78-
}
79-
8065
}

tests/PHPStan/Rules/Properties/data/property-hooks-nodiscard.php

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

0 commit comments

Comments
 (0)