88use Yiisoft \Validator \AttributeTranslatorInterface ;
99use Yiisoft \Validator \AttributeTranslatorProviderInterface ;
1010use Yiisoft \Validator \DataSetInterface ;
11+ use Yiisoft \Validator \DataWrapperInterface ;
1112use Yiisoft \Validator \Helper \ObjectParser ;
1213use Yiisoft \Validator \RulesProvider \AttributesRulesProvider ;
1314use Yiisoft \Validator \RulesProviderInterface ;
142143 *
143144 * @link https://www.php.net/manual/en/language.attributes.overview.php
144145 */
145- final class ObjectDataSet implements RulesProviderInterface, DataSetInterface , AttributeTranslatorProviderInterface
146+ final class ObjectDataSet implements RulesProviderInterface, DataWrapperInterface , AttributeTranslatorProviderInterface
146147{
147148 /**
148149 * @var bool Whether an {@see $object} provided a data set by implementing {@see DataSetInterface}.
@@ -259,12 +260,13 @@ public function hasAttribute(string $attribute): bool
259260 }
260261
261262 /**
262- * Returns the validated data as a whole .
263+ * Returns the validated data as array .
263264 *
264- * @return mixed Validated data, has mixed type if it was provided via {@see DataSetInterface::getData()}
265- * implementation, otherwise it's always an associative array - a mapping between property names and their values.
265+ * @return array|null Result of object {@see DataSetInterface::getData()} method, if it was implemented
266+ * {@see DataSetInterface}, otherwise returns the validated data as an associative array - a mapping between
267+ * property names and their values.
266268 */
267- public function getData (): mixed
269+ public function getData (): ? array
268270 {
269271 if ($ this ->dataSetProvided ) {
270272 /** @var DataSetInterface $object */
@@ -275,6 +277,11 @@ public function getData(): mixed
275277 return $ this ->parser ->getData ();
276278 }
277279
280+ public function getSource (): object
281+ {
282+ return $ this ->object ;
283+ }
284+
278285 /**
279286 * An optional attribute names translator. It's taken from the {@see $object} when
280287 * {@see AttributeTranslatorProviderInterface} is implemented. In case of it's missing, a `null` value is returned.
0 commit comments