@@ -45,59 +45,44 @@ public function processNode(Node $node, Scope $scope): array
4545 return [];
4646 }
4747
48- if ($ classReflection ->isAbstract ()) {
49- if ($ node ->isAbstract ()) {
50- if (!$ node ->hasHooks ()) {
51- return [
52- RuleErrorBuilder::message ('Only hooked properties can be declared abstract. ' )
53- ->nonIgnorable ()
54- ->identifier ('property.abstractNonHooked ' )
55- ->build (),
56- ];
57- }
58-
59- if (!$ this ->isAtLeastOneHookBodyEmpty ($ node )) {
60- return [
61- RuleErrorBuilder::message ('Abstract properties must specify at least one abstract hook. ' )
62- ->nonIgnorable ()
63- ->identifier ('property.abstractWithoutAbstractHook ' )
64- ->build (),
65- ];
66- }
67-
68- return [];
69- }
70-
71- if (!$ this ->doAllHooksHaveBody ($ node )) {
48+ if ($ node ->isAbstract ()) {
49+ if (!$ node ->hasHooks ()) {
7250 return [
73- RuleErrorBuilder::message ('Non-abstract properties cannot include hooks without bodies . ' )
51+ RuleErrorBuilder::message ('Only hooked properties can be declared abstract . ' )
7452 ->nonIgnorable ()
75- ->identifier ('property.hookWithoutBody ' )
53+ ->identifier ('property.abstractNonHooked ' )
7654 ->build (),
7755 ];
7856 }
7957
80- return [];
81- }
82-
83- if ($ node ->hasHooks ()) {
84- if ($ node ->isAbstract ()) {
58+ if (!$ this ->isAtLeastOneHookBodyEmpty ($ node )) {
8559 return [
86- RuleErrorBuilder::message ('Non-abstract classes cannot include abstract properties . ' )
60+ RuleErrorBuilder::message ('Abstract properties must specify at least one abstract hook . ' )
8761 ->nonIgnorable ()
88- ->identifier ('property.abstract ' )
62+ ->identifier ('property.abstractWithoutAbstractHook ' )
8963 ->build (),
9064 ];
9165 }
9266
93- if (!$ this -> doAllHooksHaveBody ( $ node )) {
67+ if (!$ classReflection -> isAbstract ( )) {
9468 return [
95- RuleErrorBuilder::message ('Non-abstract properties cannot include hooks without bodies . ' )
69+ RuleErrorBuilder::message ('Non-abstract classes cannot include abstract properties . ' )
9670 ->nonIgnorable ()
97- ->identifier ('property.hookWithoutBody ' )
71+ ->identifier ('property.abstract ' )
9872 ->build (),
9973 ];
10074 }
75+
76+ return [];
77+ }
78+
79+ if (!$ this ->doAllHooksHaveBody ($ node )) {
80+ return [
81+ RuleErrorBuilder::message ('Non-abstract properties cannot include hooks without bodies. ' )
82+ ->nonIgnorable ()
83+ ->identifier ('property.hookWithoutBody ' )
84+ ->build (),
85+ ];
10186 }
10287
10388 return [];
0 commit comments