From e475be71eecf2eac83595f216d737cbbccd73ade Mon Sep 17 00:00:00 2001 From: ADmad Date: Wed, 29 Nov 2017 19:57:28 +0530 Subject: [PATCH] Fix errors reported by phpstan. --- phpstan.neon | 3 +-- src/Cache/Engine/ApcEngine.php | 6 +++--- src/Console/ConsoleInputArgument.php | 8 ++++---- src/Console/ConsoleInputOption.php | 8 ++++---- src/Console/ConsoleInputSubcommand.php | 8 ++++---- src/Console/HelpFormatter.php | 6 +++--- src/Controller/Controller.php | 4 ++-- src/Core/ObjectRegistry.php | 1 + src/Database/Connection.php | 4 ++-- src/Database/Log/LoggingStatement.php | 8 ++++---- src/Event/EventManager.php | 2 +- src/Http/Cookie/Cookie.php | 8 ++++---- src/Http/Middleware/CsrfProtectionMiddleware.php | 2 +- src/Http/Server.php | 2 +- src/I18n/I18n.php | 2 +- src/I18n/RelativeTimeFormatter.php | 8 ++++---- src/Mailer/Email.php | 6 +++--- src/ORM/Association.php | 2 +- src/ORM/EagerLoadable.php | 2 +- src/ORM/Query.php | 2 +- src/ORM/TableRegistry.php | 2 +- src/Routing/RouteCollection.php | 2 +- src/Shell/CommandListShell.php | 4 ++-- src/Shell/HelpShell.php | 4 ++-- src/Shell/OrmCacheShell.php | 2 +- src/TestSuite/Fixture/TestFixture.php | 4 ++-- src/TestSuite/TestCase.php | 3 ++- src/Utility/Hash.php | 1 + src/Utility/Security.php | 4 ++-- src/Utility/Xml.php | 4 ++-- src/Validation/Validation.php | 2 +- src/View/Form/EntityContext.php | 2 ++ src/View/Helper/HtmlHelper.php | 2 +- 33 files changed, 66 insertions(+), 62 deletions(-) diff --git a/phpstan.neon b/phpstan.neon index fb048720aea..20e86de6cf5 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -15,14 +15,13 @@ parameters: - '#Call to an undefined method Psr\\Http\\Message\\ResponseInterface::getCookies\(\)#' - '#Access to an undefined property Psr\\Http\\Message\\UriInterface::\$webroot#' - '#Access to an undefined property Psr\\Http\\Message\\UriInterface::\$base#' - - '#Call to an undefined method Cake\\Collection\\Iterator\\ZipIterator::getInnerIterator\(\)#' - - '#Call to an undefined method Cake\\ORM\\ResultSet::getInnerIterator\(\)#' - '#Result of method Cake\\Http\\Response::send\(\) \(void\) is used#' - '#Method Cake\\View\\Form\\ContextInterface::val\(\) invoked with 2 parameters, 1 required#' - '#Access to an undefined property Exception::\$queryString#' - '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#' - '#Method Redis::#' - '#Call to an undefined method Traversable::getArrayCopy().#' + - '#Variable $config in isset\(\) is never defined#' earlyTerminatingMethodCalls: Cake\Shell\Shell: - abort diff --git a/src/Cache/Engine/ApcEngine.php b/src/Cache/Engine/ApcEngine.php index 5bf72fa2efa..7800d0d2501 100644 --- a/src/Cache/Engine/ApcEngine.php +++ b/src/Cache/Engine/ApcEngine.php @@ -14,7 +14,7 @@ */ namespace Cake\Cache\Engine; -use APCUIterator; +use APCuIterator; use Cake\Cache\CacheEngine; /** @@ -144,8 +144,8 @@ public function clear($check) if ($check) { return true; } - if (class_exists('APCUIterator', false)) { - $iterator = new APCUIterator( + if (class_exists('APCuIterator', false)) { + $iterator = new APCuIterator( '/^' . preg_quote($this->_config['prefix'], '/') . '/', APC_ITER_NONE ); diff --git a/src/Console/ConsoleInputArgument.php b/src/Console/ConsoleInputArgument.php index 13095c11e7a..bc0314dfd9f 100644 --- a/src/Console/ConsoleInputArgument.php +++ b/src/Console/ConsoleInputArgument.php @@ -15,7 +15,7 @@ namespace Cake\Console; use Cake\Console\Exception\ConsoleException; -use SimpleXmlElement; +use SimpleXMLElement; /** * An object to represent a single argument used in the command line. @@ -178,10 +178,10 @@ public function validChoice($value) /** * Append this arguments XML representation to the passed in SimpleXml object. * - * @param \SimpleXmlElement $parent The parent element. - * @return \SimpleXmlElement The parent with this argument appended. + * @param \SimpleXMLElement $parent The parent element. + * @return \SimpleXMLElement The parent with this argument appended. */ - public function xml(SimpleXmlElement $parent) + public function xml(SimpleXMLElement $parent) { $option = $parent->addChild('argument'); $option->addAttribute('name', $this->_name); diff --git a/src/Console/ConsoleInputOption.php b/src/Console/ConsoleInputOption.php index 3c2265d91c7..87d280a9725 100644 --- a/src/Console/ConsoleInputOption.php +++ b/src/Console/ConsoleInputOption.php @@ -15,7 +15,7 @@ namespace Cake\Console; use Cake\Console\Exception\ConsoleException; -use SimpleXmlElement; +use SimpleXMLElement; /** * An object to represent a single option used in the command line. @@ -240,10 +240,10 @@ public function validChoice($value) /** * Append the option's xml into the parent. * - * @param \SimpleXmlElement $parent The parent element. - * @return \SimpleXmlElement The parent with this option appended. + * @param \SimpleXMLElement $parent The parent element. + * @return \SimpleXMLElement The parent with this option appended. */ - public function xml(SimpleXmlElement $parent) + public function xml(SimpleXMLElement $parent) { $option = $parent->addChild('option'); $option->addAttribute('name', '--' . $this->_name); diff --git a/src/Console/ConsoleInputSubcommand.php b/src/Console/ConsoleInputSubcommand.php index 27900911feb..1330098c367 100644 --- a/src/Console/ConsoleInputSubcommand.php +++ b/src/Console/ConsoleInputSubcommand.php @@ -16,7 +16,7 @@ */ namespace Cake\Console; -use SimpleXmlElement; +use SimpleXMLElement; /** * An object to represent a single subcommand used in the command line. @@ -126,10 +126,10 @@ public function parser() /** * Append this subcommand to the Parent element * - * @param \SimpleXmlElement $parent The parent element. - * @return \SimpleXmlElement The parent with this subcommand appended. + * @param \SimpleXMLElement $parent The parent element. + * @return \SimpleXMLElement The parent with this subcommand appended. */ - public function xml(SimpleXmlElement $parent) + public function xml(SimpleXMLElement $parent) { $command = $parent->addChild('command'); $command->addAttribute('name', $this->_name); diff --git a/src/Console/HelpFormatter.php b/src/Console/HelpFormatter.php index 0c355ba4673..faeff5eea60 100644 --- a/src/Console/HelpFormatter.php +++ b/src/Console/HelpFormatter.php @@ -16,7 +16,7 @@ use Cake\Console\Exception\ConsoleException; use Cake\Utility\Text; -use SimpleXmlElement; +use SimpleXMLElement; /** * HelpFormatter formats help for console shells. Can format to either @@ -211,12 +211,12 @@ protected function _getMaxLength($collection) * Get the help as an xml string. * * @param bool $string Return the SimpleXml object or a string. Defaults to true. - * @return string|\SimpleXmlElement See $string + * @return string|\SimpleXMLElement See $string */ public function xml($string = true) { $parser = $this->_parser; - $xml = new SimpleXmlElement(''); + $xml = new SimpleXMLElement(''); $xml->addChild('command', $parser->getCommand()); $xml->addChild('description', $parser->getDescription()); diff --git a/src/Controller/Controller.php b/src/Controller/Controller.php index 70a812f9940..b3cb310d88f 100644 --- a/src/Controller/Controller.php +++ b/src/Controller/Controller.php @@ -123,7 +123,7 @@ class Controller implements EventListenerInterface, EventDispatcherInterface * This object contains all the information about a request and several methods for reading * additional information about the request. * - * @var \Cake\Http\ServerRequest + * @var \Cake\Http\ServerRequest|null * @link https://book.cakephp.org/3.0/en/controllers/request-response.html#request */ public $request; @@ -131,7 +131,7 @@ class Controller implements EventListenerInterface, EventDispatcherInterface /** * An instance of a Response object that contains information about the impending response * - * @var \Cake\Http\Response + * @var \Cake\Http\Response|null * @link https://book.cakephp.org/3.0/en/controllers/request-response.html#response */ public $response; diff --git a/src/Core/ObjectRegistry.php b/src/Core/ObjectRegistry.php index ccd999bc8fc..905a0a804c8 100644 --- a/src/Core/ObjectRegistry.php +++ b/src/Core/ObjectRegistry.php @@ -126,6 +126,7 @@ protected function _checkDuplicate($name, $config) if (empty($config)) { return; } + /* @var \Cake\Core\InstanceConfigTrait $existing */ $existingConfig = $existing->getConfig(); unset($config['enabled'], $existingConfig['enabled']); diff --git a/src/Database/Connection.php b/src/Database/Connection.php index c82d316d0e9..6c43d0e06dd 100644 --- a/src/Database/Connection.php +++ b/src/Database/Connection.php @@ -827,7 +827,7 @@ public function logger($instance = null) /** * Sets a logger * - * @param object $logger Logger object + * @param \Cake\Database\Log\QueryLogger $logger Logger object * @return $this */ public function setLogger($logger) @@ -840,7 +840,7 @@ public function setLogger($logger) /** * Gets the logger object * - * @return object logger instance + * @return \Cake\Database\Log\QueryLogger logger instance */ public function getLogger() { diff --git a/src/Database/Log/LoggingStatement.php b/src/Database/Log/LoggingStatement.php index 372c0d170ce..11dce68c734 100644 --- a/src/Database/Log/LoggingStatement.php +++ b/src/Database/Log/LoggingStatement.php @@ -110,8 +110,8 @@ public function bindValue($column, $value, $type = 'string') * it returns the currently setup logger instance * * @deprecated 3.5.0 Use getLogger() and setLogger() instead. - * @param object|null $instance Logger object instance. - * @return object|null Logger instance + * @param \Cake\Database\Log\QueryLogger|null $instance Logger object instance. + * @return \Cake\Database\Log\QueryLogger|null Logger instance */ public function logger($instance = null) { @@ -125,7 +125,7 @@ public function logger($instance = null) /** * Sets a logger * - * @param object $logger Logger object + * @param \Cake\Database\Log\QueryLogger $logger Logger object * @return void */ public function setLogger($logger) @@ -136,7 +136,7 @@ public function setLogger($logger) /** * Gets the logger object * - * @return object logger instance + * @return \Cake\Database\Log\QueryLogger logger instance */ public function getLogger() { diff --git a/src/Event/EventManager.php b/src/Event/EventManager.php index bc33cb02596..8ac1dcadab5 100644 --- a/src/Event/EventManager.php +++ b/src/Event/EventManager.php @@ -63,7 +63,7 @@ class EventManager /** * Enables automatic adding of events to the event list object if it is present. * - * @param bool + * @var bool */ protected $_trackEvents = false; diff --git a/src/Http/Cookie/Cookie.php b/src/Http/Cookie/Cookie.php index 0d88363ad36..a565c1159cb 100644 --- a/src/Http/Cookie/Cookie.php +++ b/src/Http/Cookie/Cookie.php @@ -16,7 +16,7 @@ use Cake\Chronos\Chronos; use Cake\Utility\Hash; use DateTimeImmutable; -use DateTimezone; +use DateTimeZone; use InvalidArgumentException; /** @@ -146,7 +146,7 @@ public function __construct( $this->validateBool($secure); $this->secure = $secure; if ($expiresAt) { - $expiresAt = $expiresAt->setTimezone(new DateTimezone('GMT')); + $expiresAt = $expiresAt->setTimezone(new DateTimeZone('GMT')); } $this->expiresAt = $expiresAt; } @@ -397,7 +397,7 @@ public function isHttpOnly() public function withExpiry($dateTime) { $new = clone $this; - $new->expiresAt = $dateTime->setTimezone(new DateTimezone('GMT')); + $new->expiresAt = $dateTime->setTimezone(new DateTimeZone('GMT')); return $new; } @@ -439,7 +439,7 @@ public function getFormattedExpires() */ public function isExpired($time = null) { - $time = $time ?: new DateTimeImmutable('now', new DateTimezone('UTC')); + $time = $time ?: new DateTimeImmutable('now', new DateTimeZone('UTC')); if (!$this->expiresAt) { return false; } diff --git a/src/Http/Middleware/CsrfProtectionMiddleware.php b/src/Http/Middleware/CsrfProtectionMiddleware.php index 35ac42fa8d0..70a4d18afcc 100644 --- a/src/Http/Middleware/CsrfProtectionMiddleware.php +++ b/src/Http/Middleware/CsrfProtectionMiddleware.php @@ -157,7 +157,7 @@ protected function _addTokenToRequest($token, ServerRequest $request) * @param string $token The token to add. * @param \Cake\Http\ServerRequest $request The request to validate against. * @param \Cake\Http\Response $response The response. - * @return @param \Cake\Http\Response $response Modified response. + * @return \Cake\Http\Response $response Modified response. */ protected function _addTokenCookie($token, ServerRequest $request, Response $response) { diff --git a/src/Http/Server.php b/src/Http/Server.php index ad11ba130d4..993a230f2f3 100644 --- a/src/Http/Server.php +++ b/src/Http/Server.php @@ -109,7 +109,7 @@ public function emit(ResponseInterface $response, EmitterInterface $emitter = nu /** * Set the application. * - * @param Cake\Core\HttpApplicationInterface $app The application to set. + * @param \Cake\Core\HttpApplicationInterface $app The application to set. * @return $this */ public function setApp(HttpApplicationInterface $app) diff --git a/src/I18n/I18n.php b/src/I18n/I18n.php index 0c7ade44697..68a99e5ec6a 100644 --- a/src/I18n/I18n.php +++ b/src/I18n/I18n.php @@ -168,7 +168,7 @@ public static function translator($name = 'default', $locale = null, callable $l * ``` * * @param string $name The domain of the translation messages. - * @param callable|null $loader A callback function or callable class responsible for + * @param callable $loader A callback function or callable class responsible for * constructing a translations package instance. * @param string|null $locale The locale for the translator. * @return void diff --git a/src/I18n/RelativeTimeFormatter.php b/src/I18n/RelativeTimeFormatter.php index 7cf103090a0..8d2d7d58f54 100644 --- a/src/I18n/RelativeTimeFormatter.php +++ b/src/I18n/RelativeTimeFormatter.php @@ -15,7 +15,7 @@ namespace Cake\I18n; use Cake\Chronos\ChronosInterface; -use DatetimeInterface; +use DateTimeInterface; /** * Helper class for formatting relative dates & times. @@ -91,7 +91,7 @@ public function diffForHumans(ChronosInterface $date, ChronosInterface $other = * @return string Relative time string. * @see \Cake\I18n\Time::timeAgoInWords() */ - public function timeAgoInWords(DatetimeInterface $time, array $options = []) + public function timeAgoInWords(DateTimeInterface $time, array $options = []) { $options = $this->_options($options, FrozenTime::class); if ($options['timezone'] && $time instanceof ChronosInterface) { @@ -276,12 +276,12 @@ protected function _diffData($futureTime, $pastTime, $backwards, $options) /** * Format a into a relative date string. * - * @param \DatetimeInterface $date The date to format. + * @param \DateTimeInterface $date The date to format. * @param array $options Array of options. * @return string Relative date string. * @see \Cake\I18n\Date::timeAgoInWords() */ - public function dateAgoInWords(DatetimeInterface $date, array $options = []) + public function dateAgoInWords(DateTimeInterface $date, array $options = []) { $options = $this->_options($options, FrozenDate::class); if ($options['timezone'] && $date instanceof ChronosInterface) { diff --git a/src/Mailer/Email.php b/src/Mailer/Email.php index 709df673f67..c10ed4d612f 100644 --- a/src/Mailer/Email.php +++ b/src/Mailer/Email.php @@ -33,7 +33,7 @@ use PDO; use RuntimeException; use Serializable; -use SimpleXmlElement; +use SimpleXMLElement; /** * CakePHP Email class. @@ -2694,7 +2694,7 @@ protected function _getContentTypeCharset() * It has certain limitations for viewVars that are good to know: * * - ORM\Query executed and stored as resultset - * - SimpleXmlElements stored as associative array + * - SimpleXMLElements stored as associative array * - Exceptions stored as strings * - Resources, \Closure and \PDO are not supported. * @@ -2784,7 +2784,7 @@ public function serialize() { $array = $this->jsonSerialize(); array_walk_recursive($array, function (&$item, $key) { - if ($item instanceof SimpleXmlElement) { + if ($item instanceof SimpleXMLElement) { $item = json_decode(json_encode((array)$item), true); } }); diff --git a/src/ORM/Association.php b/src/ORM/Association.php index 865e67881a1..f9300a2f0d9 100644 --- a/src/ORM/Association.php +++ b/src/ORM/Association.php @@ -1431,7 +1431,7 @@ abstract public function isOwningSide(Table $side); * the saving operation to the target table. * * @param \Cake\Datasource\EntityInterface $entity the data to be saved - * @param array|\ArrayObject $options The options for saving associated data. + * @param array $options The options for saving associated data. * @return bool|\Cake\Datasource\EntityInterface false if $entity could not be saved, otherwise it returns * the saved entity * @see \Cake\ORM\Table::save() diff --git a/src/ORM/EagerLoadable.php b/src/ORM/EagerLoadable.php index c9c4f612bc7..1e7a1d483b5 100644 --- a/src/ORM/EagerLoadable.php +++ b/src/ORM/EagerLoadable.php @@ -35,7 +35,7 @@ class EagerLoadable /** * A list of other associations to load from this level. * - * @var \Cake\Orm\EagerLoadable[] + * @var \Cake\ORM\EagerLoadable[] */ protected $_associations = []; diff --git a/src/ORM/Query.php b/src/ORM/Query.php index d592999d953..47cb2c788de 100644 --- a/src/ORM/Query.php +++ b/src/ORM/Query.php @@ -424,7 +424,7 @@ public function clearContain() * Used to recursively add contained association column types to * the query. * - * @param \Cake\ORM\Table|\Cake\Datasource\RepositoryInterface $table The table instance to pluck associations from. + * @param \Cake\ORM\Table $table The table instance to pluck associations from. * @param \Cake\Database\TypeMap $typeMap The typemap to check for columns in. * This typemap is indirectly mutated via Cake\ORM\Query::addDefaultTypes() * @param array $associations The nested tree of associations to walk. diff --git a/src/ORM/TableRegistry.php b/src/ORM/TableRegistry.php index 217de563ad4..38d589e5408 100644 --- a/src/ORM/TableRegistry.php +++ b/src/ORM/TableRegistry.php @@ -97,7 +97,7 @@ public static function getTableLocator() /** * Sets singleton instance of LocatorInterface implementation. * - * @param \Cake\ORM\Locator\LocatorInterface|null $tableLocator Instance of a locator to use. + * @param \Cake\ORM\Locator\LocatorInterface $tableLocator Instance of a locator to use. * @return void */ public static function setTableLocator(LocatorInterface $tableLocator) diff --git a/src/Routing/RouteCollection.php b/src/Routing/RouteCollection.php index f0ffe00fb4e..291e1b7f303 100644 --- a/src/Routing/RouteCollection.php +++ b/src/Routing/RouteCollection.php @@ -181,7 +181,7 @@ public function parse($url, $method = '') /** * Takes the ServerRequestInterface, iterates the routes until one is able to parse the route. * - * @param \Psr\Http\Messages\ServerRequestInterface $request The request to parse route data from. + * @param \Psr\Http\Message\ServerRequestInterface $request The request to parse route data from. * @return array An array of request parameters parsed from the URL. * @throws \Cake\Routing\Exception\MissingRouteException When a URL has no matching route. */ diff --git a/src/Shell/CommandListShell.php b/src/Shell/CommandListShell.php index bfb6512d47b..b08684f0c84 100644 --- a/src/Shell/CommandListShell.php +++ b/src/Shell/CommandListShell.php @@ -19,7 +19,7 @@ use Cake\Core\Configure; use Cake\Core\Plugin; use Cake\Utility\Inflector; -use SimpleXmlElement; +use SimpleXMLElement; /** * Shows a list of commands available from the console. @@ -128,7 +128,7 @@ protected function _asText($shellList) protected function _asXml($shellList) { $plugins = Plugin::loaded(); - $shells = new SimpleXmlElement(''); + $shells = new SimpleXMLElement(''); foreach ($shellList as $plugin => $commands) { foreach ($commands as $command) { $callable = $command; diff --git a/src/Shell/HelpShell.php b/src/Shell/HelpShell.php index 613ee7a2087..babc5cf0c8b 100644 --- a/src/Shell/HelpShell.php +++ b/src/Shell/HelpShell.php @@ -21,7 +21,7 @@ use Cake\Console\Shell; use Cake\Shell\Task\CommandTask; use Cake\Utility\Inflector; -use SimpleXmlElement; +use SimpleXMLElement; /** * Print out command list @@ -139,7 +139,7 @@ protected function asText($commands) */ protected function asXml($commands) { - $shells = new SimpleXmlElement(''); + $shells = new SimpleXMLElement(''); foreach ($commands as $name => $class) { $shell = $shells->addChild('shell'); $shell->addAttribute('name', $name); diff --git a/src/Shell/OrmCacheShell.php b/src/Shell/OrmCacheShell.php index b1bf5b48eec..db7a28d2cf3 100644 --- a/src/Shell/OrmCacheShell.php +++ b/src/Shell/OrmCacheShell.php @@ -90,7 +90,7 @@ public function clear($name = null) /** * Helper method to get the schema collection. * - * @return false|\Cake\Database\Schema\Collection|\Cake\Database\Schema\CachedCollection + * @return false|\Cake\Database\Schema\CachedCollection */ protected function _getSchema() { diff --git a/src/TestSuite/Fixture/TestFixture.php b/src/TestSuite/Fixture/TestFixture.php index 63ff5196745..e8c0d2b353f 100644 --- a/src/TestSuite/Fixture/TestFixture.php +++ b/src/TestSuite/Fixture/TestFixture.php @@ -264,8 +264,8 @@ protected function _schemaFromReflection() /** * Gets/Sets the TableSchema instance used by this fixture. * - * @param \Cake\Database\Schema\TableSchema|\Cake\Database\Schema\TableSchemaInterface|null $schema The table to set. - * @return \Cake\Database\Schema\TableSchema|\Cake\Database\Schema\TableSchemaInterface|null + * @param \Cake\Database\Schema\TableSchema|null $schema The table to set. + * @return \Cake\Database\Schema\TableSchema|null * @deprecated 3.5.0 Use getTableSchema/setTableSchema instead. */ public function schema(TableSchema $schema = null) diff --git a/src/TestSuite/TestCase.php b/src/TestSuite/TestCase.php index 3481501ca62..44a1a2b14eb 100644 --- a/src/TestSuite/TestCase.php +++ b/src/TestSuite/TestCase.php @@ -638,7 +638,7 @@ protected function skipUnless($condition, $message = '') * Mock a model, maintain fixtures and table association * * @param string $alias The model to get a mock for. - * @param mixed $methods The list of methods to mock + * @param array $methods The list of methods to mock * @param array $options The config data for the mock's constructor. * @throws \Cake\ORM\Exception\MissingTableClassException * @return \Cake\ORM\Table|\PHPUnit_Framework_MockObject_MockObject @@ -661,6 +661,7 @@ public function getMockForModel($alias, array $methods = [], array $options = [] $options += ['alias' => $baseClass, 'connection' => $connection]; $options += TableRegistry::config($alias); + /* @var \Cake\ORM\Table $mock */ $mock = $this->getMockBuilder($options['className']) ->setMethods($methods) ->setConstructorArgs([$options]) diff --git a/src/Utility/Hash.php b/src/Utility/Hash.php index 39426aa4402..db4f1b6596b 100644 --- a/src/Utility/Hash.php +++ b/src/Utility/Hash.php @@ -160,6 +160,7 @@ public static function extract($data, $path) foreach ($context[$_key] as $item) { if (is_object($item) && method_exists($item, 'toArray')) { + /* @var \Cake\Datasource\EntityInterface $item */ $item = $item->toArray(); } foreach ((array)$item as $k => $v) { diff --git a/src/Utility/Security.php b/src/Utility/Security.php index 3ce0c3cc5e3..2169199d498 100644 --- a/src/Utility/Security.php +++ b/src/Utility/Security.php @@ -152,8 +152,8 @@ public static function insecureRandomBytes($length) * * You can use this method to forcibly decide between mcrypt/openssl/custom implementations. * - * @param object|null $instance The crypto instance to use. - * @return object Crypto instance. + * @param \Cake\Utility\Crypto\OpenSsl|\Cake\Utility\Crypto\Mcrypt|null $instance The crypto instance to use. + * @return \Cake\Utility\Crypto\OpenSsl|\Cake\Utility\Crypto\Mcrypt Crypto instance. * @throws \InvalidArgumentException When no compatible crypto extension is available. */ public static function engine($instance = null) diff --git a/src/Utility/Xml.php b/src/Utility/Xml.php index d300124e85b..faf7a7aa879 100644 --- a/src/Utility/Xml.php +++ b/src/Utility/Xml.php @@ -97,7 +97,7 @@ class Xml * If using array as input, you can pass `options` from Xml::fromArray. * * @param string|array $input XML string, a path to a file, a URL or an array - * @param string|array $options The options to use + * @param array $options The options to use * @return \SimpleXMLElement|\DOMDocument SimpleXMLElement or DOMDocument * @throws \Cake\Utility\Exception\XmlException */ @@ -135,7 +135,7 @@ public static function build($input, array $options = []) * * @param string $input The input to load. * @param array $options The options to use. See Xml::build() - * @return \SimpleXmlElement|\DOMDocument + * @return \SimpleXMLElement|\DOMDocument * @throws \Cake\Utility\Exception\XmlException */ protected static function _loadXml($input, $options) diff --git a/src/Validation/Validation.php b/src/Validation/Validation.php index dcb1a04ca1b..94846a156e9 100644 --- a/src/Validation/Validation.php +++ b/src/Validation/Validation.php @@ -527,7 +527,7 @@ public static function localizedTime($check, $type = 'datetime', $format = null) * The list of what is considered to be boolean values, may be set via $booleanValues. * * @param bool|int|string $check Value to check. - * @param string $booleanValues List of valid boolean values, defaults to `[true, false, 0, 1, '0', '1']`. + * @param array $booleanValues List of valid boolean values, defaults to `[true, false, 0, 1, '0', '1']`. * @return bool Success. */ public static function boolean($check, array $booleanValues = []) diff --git a/src/View/Form/EntityContext.php b/src/View/Form/EntityContext.php index a53d01f4ccf..df3e7dab46a 100644 --- a/src/View/Form/EntityContext.php +++ b/src/View/Form/EntityContext.php @@ -156,6 +156,8 @@ protected function _prepare() is_array($entity) || $entity instanceof Traversable ); + + /* @var \Cake\Datasource\RepositoryInterface $table */ $alias = $this->_rootName = $table->getAlias(); $this->_tables[$alias] = $table; } diff --git a/src/View/Helper/HtmlHelper.php b/src/View/Helper/HtmlHelper.php index 18d51423857..8de52557f7c 100644 --- a/src/View/Helper/HtmlHelper.php +++ b/src/View/Helper/HtmlHelper.php @@ -150,7 +150,7 @@ public function __construct(View $View, array $config = []) * * @param string $name Text for link * @param string|array|null $link URL for link (if empty it won't be a link) - * @param string|array $options Link attributes e.g. ['id' => 'selected'] + * @param array $options Link attributes e.g. ['id' => 'selected'] * @return $this * @see \Cake\View\Helper\HtmlHelper::link() for details on $options that can be used. * @link https://book.cakephp.org/3.0/en/views/helpers/html.html#creating-breadcrumb-trails-with-htmlhelper