File tree Expand file tree Collapse file tree
Expand file tree Collapse file tree Original file line number Diff line number Diff line change @@ -137,18 +137,26 @@ public function getSupportedParameterContainedValueTypes(): array
137137
138138
139139 /**
140- * @phpstan-ignore missingType.iterableValue (We can handle mixed type using array_diff)
140+ * @param mixed $value scalar or stringable object
141+ * @param string[] $superset
141142 */
142143 public function isValueSubsetOf (mixed $ value , array $ superset ): bool
143144 {
144145 $ value = is_array ($ value ) ? $ value : [$ value ];
145146
146- return array_diff ($ value , $ superset ) === [];
147+ $ cast = static fn (mixed $ v ): string |int |float |bool |null =>
148+ is_object ($ v ) && method_exists ($ v , '__toString ' ) ? (string ) $ v : $ v ;
149+
150+ return array_diff (
151+ array_map ($ cast , $ value ),
152+ array_map ($ cast , $ superset )
153+ ) === [];
147154 }
148155
149156
150157 /**
151- * @phpstan-ignore missingType.iterableValue (We can handle mixed type using array_diff)
158+ * @param string|int|float|bool|null|object $value scalar or stringable object
159+ * @param array<string|int|float|bool|null|object> $subset
152160 */
153161 public function isValueSupersetOf (mixed $ value , array $ subset ): bool
154162 {
You can’t perform that action at this time.
0 commit comments