ソースを参照

Improve docblocks of assoc arrays.

mscherer 4 年 前
コミット
ddac51709e

+ 1 - 1
src/Form/Form.php

@@ -269,7 +269,7 @@ class Form implements EventListenerInterface, EventDispatcherInterface, Validato
      *   Defaults to `true`/`'default'`.
      *
      * @param array $data Form data.
-     * @param array $options List of options.
+     * @param array<string, mixed> $options List of options.
      * @return bool False on validation failure, otherwise returns the
      *   result of the `_execute()` method.
      */

+ 3 - 3
src/Form/FormProtector.php

@@ -269,8 +269,8 @@ class FormProtector
     /**
      * Return hash parts for the token generation
      *
-     * @param array $formData Form data.
-     * @return array
+     * @param array<string, array> $formData Form data.
+     * @return array<string, array>
      * @psalm-return array{fields: array, unlockedFields: array}
      */
     protected function extractHashParts(array $formData): array
@@ -422,7 +422,7 @@ class FormProtector
      * Generate validation hash.
      *
      * @param array $fields Fields list.
-     * @param array $unlockedFields Unlocked fields.
+     * @param array<string> $unlockedFields Unlocked fields.
      * @param string $url Form URL.
      * @param string $sessionId Session Id.
      * @return string

+ 1 - 1
tests/test_app/TestApp/Model/Table/ArticlesTable.php

@@ -33,7 +33,7 @@ class ArticlesTable extends Table
      * Find published
      *
      * @param \Cake\ORM\Query $query The query
-     * @param array $options The options
+     * @param array<string, mixed> $options The options
      */
     public function findPublished($query, array $options = []): Query
     {

+ 2 - 2
tests/test_app/TestApp/Model/Table/AuthUsersTable.php

@@ -27,7 +27,7 @@ class AuthUsersTable extends Table
      * Custom finder
      *
      * @param \Cake\ORM\Query $query The query to find with
-     * @param array $options The options to find with
+     * @param array<string, mixed> $options The options to find with
      * @return \Cake\ORM\Query The query builder
      */
     public function findAuth(Query $query, array $options): Query
@@ -44,7 +44,7 @@ class AuthUsersTable extends Table
      * Custom finder
      *
      * @param \Cake\ORM\Query $query The query to find with
-     * @param array $options The options to find with
+     * @param array<string, mixed> $options The options to find with
      * @return \Cake\ORM\Query The query builder
      */
     public function findUsername(Query $query, array $options): Query

+ 10 - 1
tests/test_app/TestApp/Model/Table/AuthorsTable.php

@@ -22,11 +22,20 @@ use Cake\ORM\Table;
  */
 class AuthorsTable extends Table
 {
+    /**
+     * @param array<string, mixed> $config
+     * @return void
+     */
     public function initialize(array $config): void
     {
         $this->hasMany('articles');
     }
 
+    /**
+     * @param \Cake\ORM\Query $query
+     * @param array<string, mixed> $options
+     * @return \Cake\ORM\Query
+     */
     public function findByAuthor(Query $query, array $options = []): Query
     {
         if (isset($options['author_id'])) {
@@ -40,7 +49,7 @@ class AuthorsTable extends Table
      * Finder that applies a formatter to test dirty associations
      *
      * @param \Cake\ORM\Query $query The query
-     * @param array $options The options
+     * @param array<string, mixed> $options The options
      */
     public function findFormatted(Query $query, array $options = []): Query
     {

+ 2 - 2
tests/test_app/TestApp/Model/Table/GreedyCommentsTable.php

@@ -26,9 +26,9 @@ class GreedyCommentsTable extends Table
      * Overload find to cause issues.
      *
      * @param string $type Find type
-     * @param array $options find options
+     * @param array<string, mixed> $options find options
      */
-    public function find(string $type = 'all', $options = []): Query
+    public function find(string $type = 'all', array $options = []): Query
     {
         if (empty($options['conditions'])) {
             $options['conditions'] = [];

+ 2 - 2
tests/test_app/TestApp/Utility/Base.php

@@ -17,9 +17,9 @@ class Base
 
     /**
      * @param string[] $properties An array of properties and the merge strategy for them.
-     * @param array $options The options to use when merging properties.
+     * @param array<string, mixed> $options The options to use when merging properties.
      */
-    public function mergeVars($properties, $options = []): void
+    public function mergeVars(array $properties, array $options = []): void
     {
         $this->_mergeVars($properties, $options);
     }