|
|
@@ -27,7 +27,7 @@ class FactoryLocator
|
|
|
/**
|
|
|
* A list of model factory functions.
|
|
|
*
|
|
|
- * @var callable[]
|
|
|
+ * @var (callable|\Cake\Datasource\LocatorInterface)[]
|
|
|
*/
|
|
|
protected static $_modelFactories = [];
|
|
|
|
|
|
@@ -35,10 +35,10 @@ class FactoryLocator
|
|
|
* Register a callable to generate repositories of a given type.
|
|
|
*
|
|
|
* @param string $type The name of the repository type the factory function is for.
|
|
|
- * @param callable $factory The factory function used to create instances.
|
|
|
+ * @param callable|\Cake\Datasource\LocatorInterface $factory The factory function used to create instances.
|
|
|
* @return void
|
|
|
*/
|
|
|
- public static function add(string $type, callable $factory): void
|
|
|
+ public static function add(string $type, $factory): void
|
|
|
{
|
|
|
static::$_modelFactories[$type] = $factory;
|
|
|
}
|
|
|
@@ -59,9 +59,9 @@ class FactoryLocator
|
|
|
*
|
|
|
* @param string $type The repository type to get the factory for.
|
|
|
* @throws \InvalidArgumentException If the specified repository type has no factory.
|
|
|
- * @return callable The factory for the repository type.
|
|
|
+ * @return callable|\Cake\Datasource\LocatorInterface The factory for the repository type.
|
|
|
*/
|
|
|
- public static function get(string $type): callable
|
|
|
+ public static function get(string $type)
|
|
|
{
|
|
|
if (!isset(static::$_modelFactories['Table'])) {
|
|
|
static::$_modelFactories['Table'] = [TableRegistry::getTableLocator(), 'get'];
|