@@ -81,7 +81,7 @@ class EnumBehavior extends Behavior
8181 /**
8282 * Class map.
8383 *
84- * @var array
84+ * @var array<string, class-string<\CakeDC\Enum\Model\Behavior\Strategy\StrategyInterface>>
8585 */
8686 protected array $ classMap = [
8787 'lookup ' => LookupStrategy::class,
@@ -92,14 +92,14 @@ class EnumBehavior extends Behavior
9292 /**
9393 * Stack of strategies in use.
9494 *
95- * @var array
95+ * @var array<string, \CakeDC\Enum\Model\Behavior\Strategy\StrategyInterface>
9696 */
9797 protected array $ strategies = [];
9898
9999 /**
100100 * Initializes the behavior.
101101 *
102- * @param array $config Strategy's configuration.
102+ * @param array<string, mixed> $config Strategy's configuration.
103103 * @return void
104104 */
105105 public function initialize (array $ config ): void
@@ -181,8 +181,8 @@ protected function normalizeConfig(): void
181181 }
182182
183183 /**
184- * @param array|string|null $alias Defined list's alias/name.
185- * @return array
184+ * @param array<int, string> |string|null $alias Defined list's alias/name.
185+ * @return array<string, mixed>
186186 * @throws \CakeDC\Enum\Model\Behavior\Exception\MissingEnumConfigurationException
187187 */
188188 public function enum (array |string |null $ alias = null ): array
@@ -211,8 +211,8 @@ public function enum(array|string|null $alias = null): array
211211
212212 /**
213213 * @param string $alias List alias.
214- * @param array $config Config
215- * @return array
214+ * @param array<string, mixed> $config Config
215+ * @return array<string, mixed>
216216 */
217217 protected function enumList (string $ alias , array $ config ): array
218218 {
@@ -226,7 +226,7 @@ protected function enumList(string $alias, array $config): array
226226 $ return ,
227227 function (mixed &$ item , mixed $ val ): void {
228228 $ item = ['value ' => $ val , 'text ' => $ item ];
229- }
229+ },
230230 );
231231
232232 $ return = array_values ($ return );
@@ -238,22 +238,22 @@ function (mixed &$item, mixed $val): void {
238238 /**
239239 * Translate list values.
240240 *
241- * @param array $list List.
242- * @return array
241+ * @param array<string, mixed> $list List.
242+ * @return array<string, mixed>
243243 */
244244 protected function translate (array $ list ): array
245245 {
246246 $ domain = $ this ->getConfig ('translationDomain ' );
247247
248- return array_map (fn ($ value ) => __d ($ domain , $ value ), $ list );
248+ return array_map (fn ($ value ) => __d ($ domain , $ value ), $ list );
249249 }
250250
251251 /**
252- * @param \Cake\Event\EventInterface $event Event.
252+ * @param \Cake\Event\EventInterface<\Cake\ORM\Table> $event Event.
253253 * @param \Cake\ORM\RulesChecker $rules Rules checker.
254- * @return \Cake\ORM\RulesChecker
254+ * @return void
255255 */
256- public function buildRules (EventInterface $ event , RulesChecker $ rules ): RulesChecker
256+ public function buildRules (EventInterface $ event , RulesChecker $ rules ): void
257257 {
258258 foreach ($ this ->getConfig ('lists ' ) as $ alias => $ config ) {
259259 if (Hash::get ($ config , 'applicationRules ' ) === false ) {
@@ -267,14 +267,14 @@ public function buildRules(EventInterface $event, RulesChecker $rules): RulesChe
267267 ]);
268268 }
269269
270- return $ rules ;
270+ $ event -> setResult ( $ rules) ;
271271 }
272272
273273 /**
274274 * Universal validation rule for lists.
275275 *
276276 * @param string $method Method name.
277- * @param array $args Method's arguments.
277+ * @param array<int, mixed> $args Method's arguments.
278278 * @return bool
279279 * @throws \BadMethodCallException
280280 * @throws \CakeDC\Enum\Model\Behavior\Exception\MissingEnumConfigurationException
@@ -293,7 +293,7 @@ public function __call(string $method, array $args): bool
293293 throw new MissingEnumConfigurationException ([$ alias ]);
294294 }
295295
296- if ($ entity ->isEmpty ($ config ['field ' ]) && Hash::get ($ config , 'allowEmpty ' ) === true ) {
296+ if (! $ entity ->hasValue ($ config ['field ' ]) && Hash::get ($ config , 'allowEmpty ' ) === true ) {
297297 return true ;
298298 }
299299 $ value = $ entity ->{$ config ['field ' ]};
@@ -307,9 +307,9 @@ public function __call(string $method, array $args): bool
307307 }
308308
309309 /**
310- * @param \Cake\Event\EventInterface $event The beforeFind event that was fired.
311- * @param \Cake\ORM\Query\SelectQuery $query Query
312- * @param \ArrayObject $options The options for the query
310+ * @param \Cake\Event\EventInterface<\Cake\ORM\Table> $event The beforeFind event that was fired.
311+ * @param \Cake\ORM\Query\SelectQuery<\Cake\Datasource\EntityInterface> $query Query
312+ * @param \ArrayObject<string, mixed> $options The options for the query
313313 * @return void
314314 */
315315 public function beforeFind (EventInterface $ event , SelectQuery $ query , ArrayObject $ options ): void
0 commit comments