@@ -26,7 +26,7 @@ class Condition extends AbstractScope
2626 /** @var mixed */
2727 public $ value ;
2828
29- protected $ system = false ;
29+ protected bool $ system = false ;
3030
3131 public const OPERATOR_EQUALS = '= ' ;
3232 public const OPERATOR_DOESNOT_EQUAL = '!= ' ;
@@ -151,7 +151,7 @@ public function __construct($key, $operator = null, $value = null)
151151 }
152152 }
153153
154- protected function setSystem ($ system = true )
154+ protected function setSystem (bool $ system = true )
155155 {
156156 $ this ->system = $ system ;
157157
@@ -165,7 +165,7 @@ protected function onChangeModel(): void
165165 // if we have a definitive equal condition set the value as default value for field
166166 // new records will automatically get this value assigned for the field
167167 // TODO: fix when condition is part of OR scope
168- if ($ this ->system && $ this ->setsDefiniteValue ()) {
168+ if ($ this ->system && $ this ->isDefiniteValue ()) {
169169 // key containing '/' means chained references and it is handled in toQueryArguments method
170170 $ field = $ this ->key ;
171171 if (is_string ($ field ) && !str_contains ($ field , '/ ' )) {
@@ -271,9 +271,11 @@ public function isEmpty(): bool
271271 /**
272272 * Checks if condition sets a definitive scalar value for a field.
273273 */
274- protected function setsDefiniteValue (): bool
274+ protected function isDefiniteValue (): bool
275275 {
276- return $ this ->operator === self ::OPERATOR_EQUALS && !is_object ($ this ->value ) && !is_array ($ this ->value );
276+ return $ this ->operator === self ::OPERATOR_EQUALS && !is_array ($ this ->value )
277+ && !$ this ->value instanceof Expressionable
278+ && !$ this ->value instanceof Persistence \Array_ \Action; // needed to pass hintable tests
277279 }
278280
279281 public function clear ()
0 commit comments