Browse Source

Moved class-string back to psalm specific annotations

Corey Taylor 6 years ago
parent
commit
b96e0cec5e

+ 2 - 1
src/Cache/CacheRegistry.php

@@ -36,7 +36,8 @@ class CacheRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct classname or null.
+     * @return string|null Either the correct classname or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 2 - 1
src/Console/HelperRegistry.php

@@ -55,7 +55,8 @@ class HelperRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 2 - 1
src/Console/TaskRegistry.php

@@ -51,7 +51,8 @@ class TaskRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 4 - 2
src/Controller/ComponentRegistry.php

@@ -87,7 +87,8 @@ class ComponentRegistry extends ObjectRegistry implements EventDispatcherInterfa
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {
@@ -119,11 +120,12 @@ class ComponentRegistry extends ObjectRegistry implements EventDispatcherInterfa
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      * Enabled components will be registered with the event manager.
      *
-     * @param class-string $class The classname to create.
+     * @param string $class The classname to create.
      * @param string $alias The alias of the component.
      * @param array $config An array of config to use for the component.
      * @return \Cake\Controller\Component The constructed component class.
      * @psalm-suppress MoreSpecificImplementedParamType
+     * @psalm-var class-string $class
      */
     protected function _create($class, string $alias, array $config): Component
     {

+ 2 - 1
src/Controller/ControllerFactory.php

@@ -90,7 +90,8 @@ class ControllerFactory implements ControllerFactoryInterface
      * Determine the controller class name based on current request and controller param
      *
      * @param \Cake\Http\ServerRequest $request The request to build a controller for.
-     * @return class-string<\Cake\Controller\Controller>|null
+     * @return string|null
+     * @psalm-return class-string<\Cake\Controller\Controller>|null
      */
     public function getControllerClass(ServerRequest $request): ?string
     {

+ 4 - 2
src/Core/App.php

@@ -46,10 +46,12 @@ class App
      * Return the class name namespaced. This method checks if the class is defined on the
      * application/plugin, otherwise try to load from the CakePHP core
      *
-     * @param string|class-string $class Class name
+     * @param string $class Class name
      * @param string $type Type of class
      * @param string $suffix Class name suffix
-     * @return class-string|null Namespaced class name, null if the class is not found.
+     * @return string|null Namespaced class name, null if the class is not found.
+     * @psalm-return class-string|null
+     * @psalm-var class-string $class
      */
     public static function className(string $class, string $type = '', string $suffix = ''): ?string
     {

+ 2 - 1
src/Core/ObjectRegistry.php

@@ -163,7 +163,8 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate
      * Should resolve the classname for a given object type.
      *
      * @param string $class The class to resolve.
-     * @return class-string|null The resolved name or null for failure.
+     * @return string|null The resolved name or null for failure.
+     * @psalm-return class-string|null
      */
     abstract protected function _resolveClassName(string $class): ?string;
 

+ 2 - 1
src/Core/PluginCollection.php

@@ -222,10 +222,11 @@ class PluginCollection implements Iterator, Countable
     /**
      * Create a plugin instance from a name/classname and configuration.
      *
-     * @param string|class-string<\Cake\Core\PluginInterface> $name The plugin name or classname
+     * @param string $name The plugin name or classname
      * @param array $config Configuration options for the plugin.
      * @return \Cake\Core\PluginInterface
      * @throws \Cake\Core\Exception\MissingPluginException When plugin instance could not be created.
+     * @psalm-var class-string<\Cake\Core\PluginInterface> $name
      */
     public function create(string $name, array $config = []): PluginInterface
     {

+ 4 - 2
src/Database/Type/DateTimeType.php

@@ -83,7 +83,8 @@ class DateTimeType extends BaseType
     /**
      * The classname to use when creating objects.
      *
-     * @var class-string<\DateTime>|class-string<\DateTimeImmutable>
+     * @var string
+     * @psalm-var class-string<\DateTime>|class-string<\DateTimeImmutable>
      */
     protected $_className;
 
@@ -417,7 +418,8 @@ class DateTimeType extends BaseType
     /**
      * Get the classname used for building objects.
      *
-     * @return class-string<\DateTime>|class-string<\DateTimeImmutable>
+     * @return string
+     * @psalm-return class-string<\DateTime>|class-string<\DateTimeImmutable>
      */
     public function getDateTimeClassName(): string
     {

+ 2 - 1
src/Database/TypeFactory.php

@@ -28,7 +28,8 @@ class TypeFactory
      * identifier is used as key and a complete namespaced class name as value
      * representing the class that will do actual type conversions.
      *
-     * @var array<string, class-string<\Cake\Database\TypeInterface>>
+     * @var array<string, string>
+     * @psalm-var array<string, class-string<\Cake\Database\TypeInterface>>
      */
     protected static $_types = [
         'tinyinteger' => Type\IntegerType::class,

+ 2 - 1
src/Datasource/ConnectionRegistry.php

@@ -35,7 +35,8 @@ class ConnectionRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 2 - 1
src/Datasource/QueryTrait.php

@@ -552,7 +552,8 @@ trait QueryTrait
     /**
      * Returns the name of the class to be used for decorating results
      *
-     * @return class-string<\Cake\Datasource\ResultSetInterface>
+     * @return string
+     * @psalm-return class-string<\Cake\Datasource\ResultSetInterface>
      */
     protected function _decoratorClass(): string
     {

+ 2 - 1
src/I18n/TranslatorFactory.php

@@ -32,7 +32,8 @@ class TranslatorFactory extends BaseTranslatorFactory
     /**
      * The class to use for new instances.
      *
-     * @var class-string<\Cake\I18n\Translator>
+     * @var string
+     * @psalm-var class-string<\Cake\I18n\Translator>
      */
     protected $class = Translator::class;
 

+ 2 - 1
src/Log/LogEngineRegistry.php

@@ -34,7 +34,8 @@ class LogEngineRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 2 - 1
src/Mailer/TransportRegistry.php

@@ -34,7 +34,8 @@ class TransportRegistry extends ObjectRegistry
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve or transport instance.
-     * @return class-string|null Either the correct classname or null.
+     * @return string|null Either the correct classname or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 4 - 3
src/ORM/BehaviorRegistry.php

@@ -85,8 +85,8 @@ class BehaviorRegistry extends ObjectRegistry implements EventDispatcherInterfac
      * Resolve a behavior classname.
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct classname or null.
-     * @since 3.5.7
+     * @return string|null Either the correct classname or null.
+     * @psalm-return class-string|null
      */
     public static function className(string $class): ?string
     {
@@ -100,7 +100,8 @@ class BehaviorRegistry extends ObjectRegistry implements EventDispatcherInterfac
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 4 - 2
src/ORM/Table.php

@@ -230,7 +230,8 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc
     /**
      * The name of the class that represent a single row for this table
      *
-     * @var class-string<\Cake\Datasource\EntityInterface>
+     * @var string
+     * @psalm-var class-string<\Cake\Datasource\EntityInterface>
      */
     protected $_entityClass;
 
@@ -685,8 +686,9 @@ class Table implements RepositoryInterface, EventListenerInterface, EventDispatc
     /**
      * Returns the class used to hydrate rows for this table.
      *
-     * @return class-string<\Cake\Datasource\EntityInterface>
+     * @return string
      * @psalm-suppress MoreSpecificReturnType
+     * @psalm-return class-string<\Cake\Datasource\EntityInterface>
      */
     public function getEntityClass(): string
     {

+ 2 - 1
src/ORM/TableRegistry.php

@@ -67,7 +67,8 @@ class TableRegistry
     /**
      * Default LocatorInterface implementation class.
      *
-     * @var class-string<\Cake\ORM\Locator\TableLocator>
+     * @var string
+     * @psalm-var class-string<\Cake\ORM\Locator\TableLocator>
      */
     protected static $_defaultLocatorClass = Locator\TableLocator::class;
 

+ 2 - 1
src/View/HelperRegistry.php

@@ -109,7 +109,8 @@ class HelperRegistry extends ObjectRegistry implements EventDispatcherInterface
      * Part of the template method for Cake\Core\ObjectRegistry::load()
      *
      * @param string $class Partial classname to resolve.
-     * @return class-string|null Either the correct class name or null.
+     * @return string|null Either the correct class name or null.
+     * @psalm-return class-string|null
      */
     protected function _resolveClassName(string $class): ?string
     {

+ 2 - 1
src/View/ViewBuilder.php

@@ -97,7 +97,8 @@ class ViewBuilder implements JsonSerializable, Serializable
      * Can either use plugin notation, a short name
      * or a fully namespaced classname.
      *
-     * @var class-string<\Cake\View\View>|string|null
+     * @var string|null
+     * @psalm-var class-string<\Cake\View\View>|string|null
      */
     protected $_className;