Browse Source

Merge pull request #12815 from cakephp/master-docblocks

Fix array doc blocks to be more precise where applicable.
ADmad 7 years ago
parent
commit
208559d307

+ 1 - 1
src/Console/ConsoleOptionParser.php

@@ -949,7 +949,7 @@ class ConsoleOptionParser
      * algorithm.
      * algorithm.
      *
      *
      * @param string $needle Unknown item (either a subcommand name or an option for instance) trying to be used.
      * @param string $needle Unknown item (either a subcommand name or an option for instance) trying to be used.
-     * @param array $haystack List of items available for the type $needle belongs to.
+     * @param string[] $haystack List of items available for the type $needle belongs to.
      * @return string|null The closest name to the item submitted by the user.
      * @return string|null The closest name to the item submitted by the user.
      */
      */
     protected function findClosestItem($needle, $haystack)
     protected function findClosestItem($needle, $haystack)

+ 1 - 1
src/Core/ObjectRegistry.php

@@ -184,7 +184,7 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate
     /**
     /**
      * Get the list of loaded objects.
      * Get the list of loaded objects.
      *
      *
-     * @return array List of object names.
+     * @return string[] List of object names.
      */
      */
     public function loaded()
     public function loaded()
     {
     {

+ 1 - 1
src/Core/StaticConfigTrait.php

@@ -205,7 +205,7 @@ trait StaticConfigTrait
     /**
     /**
      * Returns an array containing the named configurations
      * Returns an array containing the named configurations
      *
      *
-     * @return array Array of configurations.
+     * @return string[] Array of configurations.
      */
      */
     public static function configured()
     public static function configured()
     {
     {

+ 1 - 1
src/Database/Query.php

@@ -299,7 +299,7 @@ class Query implements ExpressionInterface, IteratorAggregate
      * ```
      * ```
      *
      *
      * @param callable $visitor A function or callable to be executed for each part
      * @param callable $visitor A function or callable to be executed for each part
-     * @param array $parts The query clauses to traverse
+     * @param string[] $parts The query clauses to traverse
      * @return $this
      * @return $this
      */
      */
     public function traverse(callable $visitor, array $parts = [])
     public function traverse(callable $visitor, array $parts = [])

+ 2 - 2
src/Database/Schema/TableSchemaInterface.php

@@ -201,7 +201,7 @@ interface TableSchemaInterface extends SchemaInterface
     /**
     /**
      * Get the names of all the indexes in the table.
      * Get the names of all the indexes in the table.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function indexes();
     public function indexes();
 
 
@@ -246,7 +246,7 @@ interface TableSchemaInterface extends SchemaInterface
     /**
     /**
      * Get the names of all the constraints in the table.
      * Get the names of all the constraints in the table.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function constraints();
     public function constraints();
 }
 }

+ 1 - 1
src/Datasource/EntityTrait.php

@@ -840,7 +840,7 @@ trait EntityTrait
     /**
     /**
      * Gets the dirty properties.
      * Gets the dirty properties.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function getDirty()
     public function getDirty()
     {
     {

+ 2 - 2
src/Datasource/SchemaInterface.php

@@ -52,7 +52,7 @@ interface SchemaInterface
      * - `comment` The comment for the column.
      * - `comment` The comment for the column.
      *
      *
      * @param string $name The name of the column
      * @param string $name The name of the column
-     * @param array $attrs The attributes for the column.
+     * @param array|string $attrs The attributes for the column.
      * @return $this
      * @return $this
      */
      */
     public function addColumn($name, $attrs);
     public function addColumn($name, $attrs);
@@ -86,7 +86,7 @@ interface SchemaInterface
     /**
     /**
      * Get the column names in the table.
      * Get the column names in the table.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function columns();
     public function columns();
 
 

+ 1 - 1
src/Form/Schema.php

@@ -89,7 +89,7 @@ class Schema
     /**
     /**
      * Get the list of fields in the schema.
      * Get the list of fields in the schema.
      *
      *
-     * @return array The list of field names.
+     * @return string[] The list of field names.
      */
      */
     public function fields()
     public function fields()
     {
     {

+ 1 - 1
src/ORM/AssociationCollection.php

@@ -143,7 +143,7 @@ class AssociationCollection implements IteratorAggregate
     /**
     /**
      * Get the names of all the associations in the collection.
      * Get the names of all the associations in the collection.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function keys()
     public function keys()
     {
     {

+ 5 - 3
src/ORM/LazyEagerLoader.php

@@ -110,7 +110,7 @@ class LazyEagerLoader
      * in the top level entities.
      * in the top level entities.
      *
      *
      * @param \Cake\ORM\Table $source The table having the top level associations
      * @param \Cake\ORM\Table $source The table having the top level associations
-     * @param array $associations The name of the top level associations
+     * @param string[] $associations The name of the top level associations
      * @return array
      * @return array
      */
      */
     protected function _getPropertyMap($source, $associations)
     protected function _getPropertyMap($source, $associations)
@@ -128,9 +128,9 @@ class LazyEagerLoader
      * Injects the results of the eager loader query into the original list of
      * Injects the results of the eager loader query into the original list of
      * entities.
      * entities.
      *
      *
-     * @param array|\Traversable $objects The original list of entities
+     * @param \Cake\Datasource\EntityInterface[]|\Traversable $objects The original list of entities
      * @param \Cake\Collection\CollectionInterface|\Cake\Database\Query $results The loaded results
      * @param \Cake\Collection\CollectionInterface|\Cake\Database\Query $results The loaded results
-     * @param array $associations The top level associations that were loaded
+     * @param string[] $associations The top level associations that were loaded
      * @param \Cake\ORM\Table $source The table where the entities came from
      * @param \Cake\ORM\Table $source The table where the entities came from
      * @return array
      * @return array
      */
      */
@@ -141,6 +141,7 @@ class LazyEagerLoader
         $primaryKey = (array)$source->getPrimaryKey();
         $primaryKey = (array)$source->getPrimaryKey();
         $results = $results
         $results = $results
             ->indexBy(function ($e) use ($primaryKey) {
             ->indexBy(function ($e) use ($primaryKey) {
+                /** @var \Cake\Datasource\EntityInterface $e */
                 return implode(';', $e->extract($primaryKey));
                 return implode(';', $e->extract($primaryKey));
             })
             })
             ->toArray();
             ->toArray();
@@ -152,6 +153,7 @@ class LazyEagerLoader
                 continue;
                 continue;
             }
             }
 
 
+            /** @var \Cake\Datasource\EntityInterface $loaded */
             $loaded = $results[$key];
             $loaded = $results[$key];
             foreach ($associations as $assoc) {
             foreach ($associations as $assoc) {
                 $property = $properties[$assoc];
                 $property = $properties[$assoc];

+ 1 - 1
src/Shell/Task/CommandTask.php

@@ -163,7 +163,7 @@ class CommandTask extends Shell
      * Return a list of subcommands for a given command
      * Return a list of subcommands for a given command
      *
      *
      * @param string $commandName The command you want subcommands from.
      * @param string $commandName The command you want subcommands from.
-     * @return array
+     * @return string[]
      * @throws \ReflectionException
      * @throws \ReflectionException
      */
      */
     public function subCommands($commandName)
     public function subCommands($commandName)

+ 2 - 2
src/Validation/Validator.php

@@ -306,7 +306,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
     /**
     /**
      * Get the list of default providers.
      * Get the list of default providers.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public static function getDefaultProviders()
     public static function getDefaultProviders()
     {
     {
@@ -343,7 +343,7 @@ class Validator implements ArrayAccess, IteratorAggregate, Countable
     /**
     /**
      * Get the list of providers in this validator.
      * Get the list of providers in this validator.
      *
      *
-     * @return array
+     * @return string[]
      */
      */
     public function providers()
     public function providers()
     {
     {

+ 1 - 1
src/View/Form/ContextInterface.php

@@ -76,7 +76,7 @@ interface ContextInterface
     /**
     /**
      * Get the fieldnames of the top level object in this context.
      * Get the fieldnames of the top level object in this context.
      *
      *
-     * @return array A list of the field names in the context.
+     * @return string[] A list of the field names in the context.
      */
      */
     public function fieldNames();
     public function fieldNames();
 
 

+ 1 - 1
src/View/View.php

@@ -934,7 +934,7 @@ class View implements EventDispatcherInterface
     /**
     /**
      * Returns a list of variables available in the current View context
      * Returns a list of variables available in the current View context
      *
      *
-     * @return array Array of the set view variable names.
+     * @return string[] Array of the set view variable names.
      */
      */
     public function getVars()
     public function getVars()
     {
     {

+ 1 - 1
src/View/ViewBlock.php

@@ -197,7 +197,7 @@ class ViewBlock
     /**
     /**
      * Get the names of all the existing blocks.
      * Get the names of all the existing blocks.
      *
      *
-     * @return array An array containing the blocks.
+     * @return string[] An array containing the blocks.
      */
      */
     public function keys()
     public function keys()
     {
     {