Skip to content

Commit

Permalink
Add missing @throws in phpDocs
Browse files Browse the repository at this point in the history
  • Loading branch information
Dominik Schmelz committed Apr 16, 2018
1 parent db4a23e commit 3630964
Show file tree
Hide file tree
Showing 23 changed files with 50 additions and 11 deletions.
1 change: 1 addition & 0 deletions src/Controller/Controller.php
Expand Up @@ -881,6 +881,7 @@ public function paginate($object = null, array $settings = [])
*
* @param string $action The action to check.
* @return bool Whether or not the method is accessible from a URL.
* @throws ReflectionException
*/
public function isAction($action)
{
Expand Down
2 changes: 2 additions & 0 deletions src/Core/ObjectRegistry.php
Expand Up @@ -70,6 +70,7 @@ abstract class ObjectRegistry implements Countable, IteratorAggregate
* @param string $objectName The name/class of the object to load.
* @param array $config Additional settings to use when loading the object.
* @return mixed
* @throws \Exception
*/
public function load($objectName, $config = [])
{
Expand Down Expand Up @@ -337,6 +338,7 @@ public function set($objectName, $object)
*
* @param string $objectName The name of the object to remove from the registry.
* @return $this
* @throws \Exception
*/
public function unload($objectName)
{
Expand Down
1 change: 1 addition & 0 deletions src/Core/Retry/CommandRetry.php
Expand Up @@ -56,6 +56,7 @@ public function __construct(RetryStrategyInterface $strategy, $retries = 1)
*
* @param callable $action The callable action to execute with a retry strategy
* @return mixed The return value of the passed action callable
* @throws Exception
*/
public function run(callable $action)
{
Expand Down
10 changes: 10 additions & 0 deletions src/Database/Connection.php
Expand Up @@ -268,6 +268,7 @@ public function isConnected()
*
* @param string|\Cake\Database\Query $sql The SQL to convert into a prepared statement.
* @return \Cake\Database\StatementInterface
* @throws Exception
*/
public function prepare($sql)
{
Expand All @@ -290,6 +291,7 @@ public function prepare($sql)
* @param array $params list or associative array of params to be interpolated in $query as values
* @param array $types list or associative array of types to be used for casting values in query
* @return \Cake\Database\StatementInterface executed statement
* @throws Exception
*/
public function execute($query, array $params = [], array $types = [])
{
Expand Down Expand Up @@ -325,6 +327,7 @@ public function compileQuery(Query $query, ValueBinder $generator)
*
* @param \Cake\Database\Query $query The query to be executed
* @return \Cake\Database\StatementInterface executed statement
* @throws Exception
*/
public function run(Query $query)
{
Expand All @@ -342,6 +345,7 @@ public function run(Query $query)
*
* @param string $sql The SQL query to execute.
* @return \Cake\Database\StatementInterface
* @throws Exception
*/
public function query($sql)
{
Expand Down Expand Up @@ -421,6 +425,7 @@ public function schemaCollection(SchemaCollection $collection = null)
* @param array $data values to be inserted
* @param array $types list of associative array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
* @throws Exception
*/
public function insert($table, array $data, array $types = [])
{
Expand All @@ -442,6 +447,7 @@ public function insert($table, array $data, array $types = [])
* @param array $conditions conditions to be set for update statement
* @param array $types list of associative array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
* @throws Exception
*/
public function update($table, array $data, array $conditions = [], $types = [])
{
Expand All @@ -460,6 +466,7 @@ public function update($table, array $data, array $conditions = [], $types = [])
* @param array $conditions conditions to be set for delete statement
* @param array $types list of associative array containing the types to be used for casting
* @return \Cake\Database\StatementInterface
* @throws Exception
*/
public function delete($table, $conditions = [], $types = [])
{
Expand All @@ -474,6 +481,7 @@ public function delete($table, $conditions = [], $types = [])
* Starts a new transaction.
*
* @return void
* @throws Exception
*/
public function begin()
{
Expand Down Expand Up @@ -676,6 +684,7 @@ public function rollbackSavepoint($name)
* Run driver specific SQL to disable foreign key checks.
*
* @return void
* @throws Exception
*/
public function disableForeignKeys()
{
Expand All @@ -688,6 +697,7 @@ public function disableForeignKeys()
* Run driver specific SQL to enable foreign key checks.
*
* @return void
* @throws Exception
*/
public function enableForeignKeys()
{
Expand Down
2 changes: 2 additions & 0 deletions src/Error/BaseErrorHandler.php
Expand Up @@ -162,6 +162,7 @@ public function handleError($code, $description, $file = null, $line = null, $co
*
* @param \Exception|\Error $exception The exception to handle
* @return void
* @throws Exception
*/
public function wrapAndHandleException($exception)
{
Expand Down Expand Up @@ -210,6 +211,7 @@ protected function _stop($code)
* @param string $file File on which error occurred
* @param int $line Line that triggered the error
* @return bool
* @throws Exception
*/
public function handleFatalError($code, $description, $file, $line)
{
Expand Down
1 change: 1 addition & 0 deletions src/Error/Middleware/ErrorHandlerMiddleware.php
Expand Up @@ -110,6 +110,7 @@ public function __invoke($request, $response, $next)
* @param \Psr\Http\Message\ServerRequestInterface $request The request.
* @param \Psr\Http\Message\ResponseInterface $response The response.
* @return \Psr\Http\Message\ResponseInterface A response
* @throws Exception
*/
public function handleException($exception, $request, $response)
{
Expand Down
1 change: 1 addition & 0 deletions src/Http/ControllerFactory.php
Expand Up @@ -30,6 +30,7 @@ class ControllerFactory
* @param \Cake\Http\ServerRequest $request The request to build a controller for.
* @param \Cake\Http\Response $response The response to use.
* @return \Cake\Controller\Controller
* @throws \ReflectionException
*/
public function create(ServerRequest $request, Response $response)
{
Expand Down
3 changes: 3 additions & 0 deletions src/Http/Cookie/CookieCollection.php
Expand Up @@ -248,6 +248,7 @@ public function addToRequest(RequestInterface $request, array $extraCookies = []
* @param string $host The host to match.
* @param string $path The path to match
* @return array An array of cookie name/value pairs
* @throws \Exception
*/
protected function findMatchingCookies($scheme, $host, $path)
{
Expand Down Expand Up @@ -334,6 +335,7 @@ protected function setRequestDefaults(array $cookies, $host, $path)
*
* @param array $values List of Set-Cookie Header values.
* @return \Cake\Http\Cookie\Cookie[] An array of cookie objects
* @throws \Exception
*/
protected static function parseSetCookieHeader($values)
{
Expand Down Expand Up @@ -396,6 +398,7 @@ protected static function parseSetCookieHeader($values)
* @param string $host The host to check for expired cookies on.
* @param string $path The path to check for expired cookies on.
* @return void
* @throws \Exception
*/
protected function removeExpiredCookies($host, $path)
{
Expand Down
2 changes: 2 additions & 0 deletions src/I18n/Formatter/IcuFormatter.php
Expand Up @@ -33,6 +33,8 @@ class IcuFormatter implements FormatterInterface
* @param string|array $message The message to be translated
* @param array $vars The list of values to interpolate in the message
* @return string The formatted message
* @throws CannotFormat
* @throws CannotInstantiateFormatter
*/
public function format($locale, $message, array $vars)
{
Expand Down
1 change: 1 addition & 0 deletions src/I18n/I18n.php
Expand Up @@ -195,6 +195,7 @@ public static function setTranslator($name, callable $loader, $locale = null)
* @param string $name The domain of the translation messages.
* @param string|null $locale The locale for the translator.
* @return \Aura\Intl\TranslatorInterface The configured translator.
* @throws \Aura\Intl\Exception
*/
public static function getTranslator($name = 'default', $locale = null)
{
Expand Down
1 change: 1 addition & 0 deletions src/Mailer/Email.php
Expand Up @@ -2895,6 +2895,7 @@ public function createFromArray($config)
* Serializes the Email object.
*
* @return string
* @throws Exception
*/
public function serialize()
{
Expand Down
9 changes: 3 additions & 6 deletions src/ORM/Association/BelongsToMany.php
Expand Up @@ -886,9 +886,8 @@ protected function _saveLinks(EntityInterface $sourceEntity, $targetEntities, $o
* @param array $targetEntities list of entities belonging to the `target` side
* of this association
* @param array $options list of options to be passed to the internal `save` call
* @throws \InvalidArgumentException when any of the values in $targetEntities is
* detected to not be already persisted
* @return bool true on success, false otherwise
* @throws \Exception
*/
public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
{
Expand Down Expand Up @@ -937,9 +936,8 @@ function () use ($sourceEntity, $targetEntities, $options) {
* this association
* @param array|bool $options list of options to be passed to the internal `delete` call,
* or a `boolean`
* @throws \InvalidArgumentException if non persisted entities are passed or if
* any of them is lacking a primary key value
* @return bool Success
* @throws \Exception
*/
public function unlink(EntityInterface $sourceEntity, array $targetEntities, $options = [])
{
Expand Down Expand Up @@ -1191,9 +1189,8 @@ protected function _appendJunctionJoin($query, $conditions)
* @param array $targetEntities list of entities from the target table to be linked
* @param array $options list of options to be passed to the internal `save`/`delete` calls
* when persisting/updating new links, or deleting existing ones
* @throws \InvalidArgumentException if non persisted entities are passed or if
* any of them is lacking a primary key value
* @return bool success
* @throws \Exception
*/
public function replaceLinks(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
{
Expand Down
1 change: 1 addition & 0 deletions src/ORM/Association/HasMany.php
Expand Up @@ -282,6 +282,7 @@ protected function _saveTarget(array $foreignKeyReference, EntityInterface $pare
* of this association
* @param array $options list of options to be passed to the internal `save` call
* @return bool true on success, false otherwise
* @throws \Exception
*/
public function link(EntityInterface $sourceEntity, array $targetEntities, array $options = [])
{
Expand Down
1 change: 1 addition & 0 deletions src/ORM/Behavior.php
Expand Up @@ -365,6 +365,7 @@ public function implementedMethods()
* declared on Cake\ORM\Behavior
*
* @return array
* @throws \ReflectionException
*/
protected function _reflectionCache()
{
Expand Down
6 changes: 4 additions & 2 deletions src/ORM/Behavior/TreeBehavior.php
Expand Up @@ -548,6 +548,7 @@ public function formatTreeList(Query $query, array $options = [])
* @param \Cake\Datasource\EntityInterface $node The node to remove from the tree
* @return \Cake\Datasource\EntityInterface|false the node after being removed from the tree or
* false on error
* @throws \Exception
*/
public function removeFromTree(EntityInterface $node)
{
Expand Down Expand Up @@ -607,8 +608,8 @@ protected function _removeFromTree($node)
*
* @param \Cake\Datasource\EntityInterface $node The node to move
* @param int|bool $number How many places to move the node, or true to move to first position
* @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found
* @return \Cake\Datasource\EntityInterface|bool $node The node after being moved or false on failure
* @throws \Exception
*/
public function moveUp(EntityInterface $node, $number = 1)
{
Expand Down Expand Up @@ -697,8 +698,8 @@ protected function _moveUp($node, $number)
*
* @param \Cake\Datasource\EntityInterface $node The node to move
* @param int|bool $number How many places to move the node or true to move to last position
* @throws \Cake\Datasource\Exception\RecordNotFoundException When node was not found
* @return \Cake\Datasource\EntityInterface|bool the entity after being moved or false on failure
* @throws \Exception
*/
public function moveDown(EntityInterface $node, $number = 1)
{
Expand Down Expand Up @@ -813,6 +814,7 @@ protected function _getNode($id)
* parent column.
*
* @return void
* @throws \Exception
*/
public function recover()
{
Expand Down
2 changes: 2 additions & 0 deletions src/ORM/Table.php
Expand Up @@ -1616,6 +1616,7 @@ public function get($primaryKey, $options = [])
* @param callable $worker The worker that will run inside the transaction.
* @param bool $atomic Whether to execute the worker inside a database transaction.
* @return mixed
* @throws \Exception
*/
protected function _executeTransaction(callable $worker, $atomic = true)
{
Expand Down Expand Up @@ -2192,6 +2193,7 @@ protected function _update($entity, $data)
* @param \Cake\Datasource\EntityInterface[]|\Cake\ORM\ResultSet $entities Entities to save.
* @param array|\ArrayAccess $options Options used when calling Table::save() for each entity.
* @return bool|\Cake\Datasource\EntityInterface[]|\Cake\ORM\ResultSet False on failure, entities list on success.
* @throws \Exception
*/
public function saveMany($entities, $options = [])
{
Expand Down
1 change: 1 addition & 0 deletions src/Shell/Task/CommandTask.php
Expand Up @@ -165,6 +165,7 @@ public function commands()
*
* @param string $commandName The command you want subcommands from.
* @return array
* @throws \ReflectionException
*/
public function subCommands($commandName)
{
Expand Down
1 change: 1 addition & 0 deletions src/TestSuite/Fixture/FixtureManager.php
Expand Up @@ -363,6 +363,7 @@ public function load($test)
* @param array $fixtures A list of fixtures to operate on.
* @param callable $operation The operation to run on each connection + fixture set.
* @return void
* @throws \Exception
*/
protected function _runOperation($fixtures, $operation)
{
Expand Down
9 changes: 8 additions & 1 deletion src/TestSuite/IntegrationTestCase.php
Expand Up @@ -368,6 +368,7 @@ public function cookieEncrypted($name, $value, $encrypt = 'aes', $key = null)
*
* @param string|array $url The URL to request.
* @return void
* @throws PhpunitException
*/
public function get($url)
{
Expand All @@ -384,6 +385,7 @@ public function get($url)
* @param string|array $url The URL to request.
* @param array $data The data for the request.
* @return void
* @throws PhpunitException
*/
public function post($url, $data = [])
{
Expand All @@ -400,6 +402,7 @@ public function post($url, $data = [])
* @param string|array $url The URL to request.
* @param array $data The data for the request.
* @return void
* @throws PhpunitException
*/
public function patch($url, $data = [])
{
Expand All @@ -416,6 +419,7 @@ public function patch($url, $data = [])
* @param string|array $url The URL to request.
* @param array $data The data for the request.
* @return void
* @throws PhpunitException
*/
public function put($url, $data = [])
{
Expand All @@ -431,6 +435,7 @@ public function put($url, $data = [])
*
* @param string|array $url The URL to request.
* @return void
* @throws PhpunitException
*/
public function delete($url)
{
Expand All @@ -446,6 +451,7 @@ public function delete($url)
*
* @param string|array $url The URL to request.
* @return void
* @throws PhpunitException
*/
public function head($url)
{
Expand All @@ -461,6 +467,7 @@ public function head($url)
*
* @param string|array $url The URL to request.
* @return void
* @throws PhpunitException
*/
public function options($url)
{
Expand All @@ -476,7 +483,7 @@ public function options($url)
* @param string $method The HTTP method
* @param array|null $data The request data.
* @return void
* @throws \Exception
* @throws PhpunitException
*/
protected function _sendRequest($url, $method, $data = [])
{
Expand Down
1 change: 1 addition & 0 deletions src/Utility/Security.php
Expand Up @@ -106,6 +106,7 @@ public static function setHash($hash)
*
* @param int $length The number of bytes you want.
* @return string Random bytes in binary.
* @throws \Exception
*/
public static function randomBytes($length)
{
Expand Down
1 change: 1 addition & 0 deletions src/Validation/RulesProvider.php
Expand Up @@ -41,6 +41,7 @@ class RulesProvider
* Constructor, sets the default class to use for calling methods
*
* @param string|object $class the default class to proxy
* @throws \ReflectionException
*/
public function __construct($class = Validation::class)
{
Expand Down
1 change: 1 addition & 0 deletions src/View/Helper/TimeHelper.php
Expand Up @@ -350,6 +350,7 @@ public function gmt($string = null)
* @param bool|string $invalid Default value to display on invalid dates
* @param string|\DateTimeZone|null $timezone User's timezone string or DateTimeZone object
* @return string Formatted and translated date string
* @throws Exception
* @see \Cake\I18n\Time::i18nFormat()
*/
public function format($date, $format = null, $invalid = false, $timezone = null)
Expand Down

0 comments on commit 3630964

Please sign in to comment.