You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
thrownewLogicException(sprintf('The method "%s::%s()" does not exist.', get_debug_type($subject), $method));
52
-
}
53
-
54
51
$marking = null;
55
52
try {
56
-
$marking = $subject->{$method}();
53
+
$marking = ($this->getGetter($subject))();
57
54
} catch (\Error$e) {
58
55
$unInitializedPropertyMessage = sprintf('Typed property %s::$%s must not be accessed before initialization', get_debug_type($subject), $this->property);
59
56
if ($e->getMessage() !== $unInitializedPropertyMessage) {
@@ -68,7 +65,7 @@ public function getMarking(object $subject): Marking
68
65
if ($this->singleState) {
69
66
$marking = [(string) $marking => 1];
70
67
} elseif (!\is_array($marking)) {
71
-
thrownewLogicException(sprintf('The method "%s::%s()" did not return an array and the Workflow\'s Marking store is instantiated with $singleState=false.', get_debug_type($subject), $method));
68
+
thrownewLogicException(sprintf('The marking stored in "%s::%s" is not an array and the Workflow\'s Marking store is instantiated with $singleState=false.', get_debug_type($subject), $this->property));
72
69
}
73
70
74
71
returnnewMarking($marking);
@@ -82,12 +79,64 @@ public function setMarking(object $subject, Marking $marking, array $context = [
thrownewLogicException(sprintf('The method "%s::%s()" does not exist.', get_debug_type($subject), $method));
110
+
goto property;
89
111
}
90
112
91
-
$subject->{$method}($marking, $context);
113
+
try {
114
+
$r = new \ReflectionMethod($subject, $method);
115
+
} catch (\ReflectionException) {
116
+
property:
117
+
try {
118
+
$r = new \ReflectionProperty($subject, $propertyName);
119
+
} catch (\ReflectionException) {
120
+
thrownewLogicException(sprintf('The public property "%1$s::%2$s" nor the public method "%1$s::%3$s()" exist. At least one must be declared.', get_debug_type($subject), $propertyName, $method));
121
+
}
122
+
123
+
if (!$r->isPublic()) {
124
+
thrownewLogicException(sprintf('The public method "%1$s::%3$s()" must be declared, or the property "%1$s::%2$s" must be public.', get_debug_type($subject), $propertyName, $method));
125
+
}
126
+
127
+
return MarkingStoreMethod::PROPERTY;
128
+
}
129
+
130
+
if (!$r->isPublic()) {
131
+
thrownewLogicException(sprintf('The method "%s::%s()" must be public.', get_debug_type($subject), $method));
0 commit comments