Browse Source

Included @throws in API that was missing.

Juan Basso 14 years ago
parent
commit
fedadc091c

+ 2 - 1
lib/Cake/Cache/Cache.php

@@ -145,7 +145,8 @@ class Cache {
  * Finds and builds the instance of the required engine class.
  *
  * @param string $name Name of the config array that needs an engine instance built
- * @return void
+ * @return boolean
+ * @throws CacheException
  */
 	protected static function _buildEngine($name) {
 		$config = self::$_config[$name];

+ 1 - 0
lib/Cake/Configure/IniReader.php

@@ -85,6 +85,7 @@ class IniReader implements ConfigReaderInterface {
  * @param string $file Name of the file to read. The chosen file
  *    must be on the reader's path.
  * @return array
+ * @throws ConfigureException
  */
 	public function read($file) {
 		$filename = $this->_path . $file;

+ 1 - 0
lib/Cake/Console/Command/TestsuiteShell.php

@@ -165,6 +165,7 @@ class TestsuiteShell extends Shell {
  * Initialization method installs PHPUnit and loads all plugins
  *
  * @return void
+ * @throws Exception
  */
 	public function initialize() {
 		$this->_dispatcher = new CakeTestSuiteDispatcher();

+ 3 - 2
lib/Cake/Console/ConsoleOptionParser.php

@@ -442,8 +442,7 @@ class ConsoleOptionParser {
  * @param string $command The subcommand to use.  If this parameter is a subcommand, that has a parser,
  *    That parser will be used to parse $argv instead.
  * @return Array array($params, $args)
- * @throws InvalidArgumentException When an invalid parameter is encountered.
- *   RuntimeException when required arguments are not supplied.
+ * @throws ConsoleException When an invalid parameter is encountered.
  */
 	public function parse($argv, $command = null) {
 		if (isset($this->_subcommands[$command]) && $this->_subcommands[$command]->parser()) {
@@ -555,6 +554,7 @@ class ConsoleOptionParser {
  * @param string $name The name to parse.
  * @param array $params The params to append the parsed value into
  * @return array Params with $option added in.
+ * @throws ConsoleException
  */
 	protected function _parseOption($name, $params) {
 		if (!isset($this->_options[$name])) {
@@ -584,6 +584,7 @@ class ConsoleOptionParser {
  * @param string $argument The argument to append
  * @param array $args The array of parsed args to append to.
  * @return array Args
+ * @throws ConsoleException
  */
 	protected function _parseArg($argument, $args) {
 		if (empty($this->_args)) {

+ 2 - 0
lib/Cake/Console/ShellDispatcher.php

@@ -96,6 +96,7 @@ class ShellDispatcher {
  * Defines current working environment.
  *
  * @return void
+ * @throws CakeException
  */
 	protected function _initEnvironment() {
 		if (!$this->__bootstrap()) {
@@ -149,6 +150,7 @@ class ShellDispatcher {
  * Dispatches a CLI request
  *
  * @return boolean
+ * @throws MissingShellMethodException
  */
 	public function dispatch() {
 		$shell = $this->shiftArgs();

+ 2 - 1
lib/Cake/Controller/Component/Auth/BaseAuthorize.php

@@ -84,7 +84,8 @@ abstract class BaseAuthorize {
  * Accessor to the controller object.
  *
  * @param mixed $controller null to get, a controller to set.
- * @return mixed.
+ * @return mixed
+ * @throws CakeException
  */
 	public function controller($controller = null) {
 		if ($controller) {

+ 2 - 1
lib/Cake/Controller/Component/Auth/ControllerAuthorize.php

@@ -41,7 +41,8 @@ class ControllerAuthorize extends BaseAuthorize {
  * Get/set the controller this authorize object will be working with.  Also checks that isAuthorized is implemented.
  *
  * @param mixed $controller null to get, a controller to set.
- * @return mixed.
+ * @return mixed
+ * @throws CakeException
  */
 	public function controller($controller = null) {
 		if ($controller) {

+ 2 - 0
lib/Cake/Controller/Component/AuthComponent.php

@@ -385,6 +385,7 @@ class AuthComponent extends Component {
  * Loads the authorization objects configured.
  *
  * @return mixed Either null when authorize is empty, or the loaded authorization objects.
+ * @throws CakeException
  */
 	public function constructAuthorize() {
 		if (empty($this->authorize)) {
@@ -632,6 +633,7 @@ class AuthComponent extends Component {
  * loads the configured authentication objects.
  *
  * @return mixed either null on empty authenticate value, or an array of loaded objects.
+ * @throws CakeException
  */
 	public function constructAuthenticate() {
 		if (empty($this->authenticate)) {

+ 1 - 0
lib/Cake/Controller/Component/PaginatorComponent.php

@@ -104,6 +104,7 @@ class PaginatorComponent extends Component {
  * @param array $whitelist List of allowed fields for ordering.  This allows you to prevent ordering 
  *   on non-indexed, or undesirable columns.
  * @return array Model query results
+ * @throws MissingModelException
  */
 	public function paginate($object = null, $scope = array(), $whitelist = array()) {
 		if (is_array($object)) {

+ 1 - 0
lib/Cake/Controller/Component/RequestHandlerComponent.php

@@ -660,6 +660,7 @@ class RequestHandlerComponent extends Component {
  *    be the handling callback, all other arguments should be additional parameters
  *    for the handler.
  * @return void
+ * @throws CakeException
  */
 	public function addInputType($type, $handler) {
 		if (!is_array($handler) || !isset($handler[0]) || !is_callable($handler[0])) {

+ 2 - 1
lib/Cake/Controller/Controller.php

@@ -451,7 +451,8 @@ class Controller extends Object {
  * exists and isn't private.
  *
  * @param CakeRequest $request
- * @return The resulting response.
+ * @return mixed The resulting response.
+ * @throws PrivateActionException, MissingActionException
  */
 	public function invokeAction(CakeRequest $request) {
 		$reflection = new ReflectionClass($this);

+ 5 - 1
lib/Cake/Controller/Scaffold.php

@@ -102,6 +102,7 @@ class Scaffold {
  *
  * @param Controller $controller Controller to scaffold
  * @param CakeRequest $request Request parameters.
+ * @throws MissingModelException
  */
 	public function __construct(Controller $controller, CakeRequest $request) {
 		$this->controller = $controller;
@@ -154,6 +155,7 @@ class Scaffold {
  *
  * @param CakeRequest $request Request Object for scaffolding
  * @return mixed A rendered view of a row from Models database table
+ * @throws NotFoundException
  */
 	protected function _scaffoldView(CakeRequest $request) {
 		if ($this->controller->_beforeScaffold('view')) {
@@ -212,6 +214,7 @@ class Scaffold {
  * @param CakeRequest $request Request Object for scaffolding
  * @param string $action add or edt
  * @return mixed Success on save/update, add/edit form if data is empty or error if save or update fails
+ * @throws NotFoundException
  */
 	protected function _scaffoldSave(CakeRequest $request, $action = 'edit') {
 		$formAction = 'edit';
@@ -284,7 +287,7 @@ class Scaffold {
  *
  * @param CareRequest $request Request for scaffolding
  * @return mixed Success on delete, error if delete fails
- * @throws NotFoundException
+ * @throws MethodNotAllowedException, NotFoundException
  */
 	protected function _scaffoldDelete(CakeRequest $request) {
 		if ($this->controller->_beforeScaffold('delete')) {
@@ -347,6 +350,7 @@ class Scaffold {
  *
  * @param CakeRequest $request Request object for scaffolding
  * @return mixed A rendered view of scaffold action, or showing the error
+ * @throws MissingActionException, MissingDatabaseException
  */
 	protected function _scaffold(CakeRequest $request) {
 		$db = ConnectionManager::getDataSource($this->ScaffoldModel->useDbConfig);

+ 1 - 0
lib/Cake/Log/CakeLog.php

@@ -103,6 +103,7 @@ class CakeLog {
  *
  * @param string $loggerName the plugin.className of the logger class you want to build.
  * @return mixed boolean false on any failures, string of classname to use if search was successful.
+ * @throws CakeLogException
  */
 	protected static function _getLogger($loggerName) {
 		list($plugin, $loggerName) = pluginSplit($loggerName, true);

+ 1 - 0
lib/Cake/Model/Datasource/CakeSession.php

@@ -510,6 +510,7 @@ class CakeSession {
  *
  * @param string $handler
  * @return void
+ * @throws CakeSessionException
  */
 	protected static function _getHandler($handler) {
 		list($plugin, $class) = pluginSplit($handler, true);

+ 2 - 0
lib/Cake/Model/Datasource/Database/Mysql.php

@@ -133,6 +133,7 @@ class Mysql extends DboSource {
  * Connects to the database using options in the given configuration array.
  *
  * @return boolean True if the database could be connected, else false
+ * @throws MissingConnectionException
  */
 	public function connect() {
 		$config = $this->config;
@@ -287,6 +288,7 @@ class Mysql extends DboSource {
  *
  * @param Model $model Name of database table to inspect or model instance
  * @return array Fields in table. Keys are name and type
+ * @throws CakeException
  */
 	public function describe(Model $model) {
 		$cache = parent::describe($model);

+ 2 - 1
lib/Cake/Model/Datasource/Database/Postgres.php

@@ -103,7 +103,8 @@ class Postgres extends DboSource {
 /**
  * Connects to the database using options in the given configuration array.
  *
- * @return True if successfully connected.
+ * @return boolean True if successfully connected.
+ * @throws MissingConnectionException
  */
 	public function connect() {
 		$config = $this->config;

+ 1 - 0
lib/Cake/Model/Datasource/Database/Sqlite.php

@@ -100,6 +100,7 @@ class Sqlite extends DboSource {
  * Connects to the database using config['database'] as a filename.
  *
  * @return boolean
+ * @throws MissingConnectionException
  */
 	public function connect() {
 		$config = $this->config;

+ 2 - 0
lib/Cake/Model/Datasource/Database/Sqlserver.php

@@ -133,6 +133,7 @@ class Sqlserver extends DboSource {
  * Connects to the database using options in the given configuration array.
  *
  * @return boolean True if the database could be connected, else false
+ * @throws MissingConnectionException
  */
 	public function connect() {
 		$config = $this->config;
@@ -200,6 +201,7 @@ class Sqlserver extends DboSource {
  *
  * @param Model $model Model object to describe
  * @return array Fields in table. Keys are name and type
+ * @throws CakeException
  */
 	public function describe(Model $model) {
 		$cache = parent::describe($model);

+ 1 - 0
lib/Cake/Model/Model.php

@@ -2888,6 +2888,7 @@ class Model extends Object {
  *
  * @param string $dataSource The name of the DataSource, as defined in app/Config/database.php
  * @return boolean True on success
+ * @throws MissingConnectionException
  */
 	public function setDataSource($dataSource = null) {
 		$oldConfig = $this->useDbConfig;

+ 1 - 1
lib/Cake/Network/CakeRequest.php

@@ -384,7 +384,7 @@ class CakeRequest implements ArrayAccess {
  * @param string $name The method called
  * @param array $params Array of parameters for the method call
  * @return mixed
- * @throws BadMethodCallException when an invalid method is called.
+ * @throws CakeException when an invalid method is called.
  */
 	public function __call($name, $params) {
 		if (strpos($name, 'is') === 0) {

+ 3 - 1
lib/Cake/Network/Email/CakeEmail.php

@@ -471,7 +471,7 @@ class CakeEmail {
  * @param string $name
  * @param string $throwMessage
  * @return object $this
- * @throws SocketExpceiton
+ * @throws SocketException
  */
 	protected function _setEmailSingle($varName, $email, $name, $throwMessage) {
 		$current = $this->{$varName};
@@ -490,6 +490,7 @@ class CakeEmail {
  * @param mixed $email
  * @param mixed $name
  * @return object $this
+ * @throws SocketException
  */
 	protected function _addEmail($varName, $email, $name) {
 		if (!is_array($email)) {
@@ -987,6 +988,7 @@ class CakeEmail {
  * @param mixed $transportConfig String to use config from EmailConfig or array with configs
  * @param boolean $send Send the email or just return the instance pre-configured
  * @return object Instance of CakeEmail
+ * @throws SocketException
  */
 	public static function deliver($to = null, $subject = null, $message = null, $transportConfig = 'fast', $send = true) {
 		$class = __CLASS__;

+ 1 - 1
lib/Cake/Network/Http/HttpResponse.php

@@ -124,7 +124,7 @@ class HttpResponse implements ArrayAccess {
  *
  * @param string $message Message to parse
  * @return void
- * @throw SocketException
+ * @throws SocketException
  */
 	public function parseResponse($message) {
 		if (!is_string($message)) {

+ 2 - 1
lib/Cake/Network/Http/HttpSocket.php

@@ -203,7 +203,7 @@ class HttpSocket extends CakeSocket {
  *
  * @param mixed $resource Resource or false to disable the resource use
  * @return void
- * @throw SocketException
+ * @throws SocketException
  */
 	public function setContentResource($resource) {
 		if ($resource === false) {
@@ -222,6 +222,7 @@ class HttpSocket extends CakeSocket {
  *
  * @param mixed $request Either an URI string, or an array defining host/uri
  * @return mixed false on error, HttpResponse on success
+ * @throws SocketException
  */
 	public function request($request = array()) {
 		$this->reset(false);

+ 1 - 0
lib/Cake/Utility/Xml.php

@@ -180,6 +180,7 @@ class Xml {
  * @param array $data Array of data to append to the $node.
  * @param string $format Either 'attribute' or 'tags'.  This determines where nested keys go.
  * @return void
+ * @throws XmlException
  */
 	protected static function _fromArray($dom, $node, &$data, $format) {
 		if (empty($data) || !is_array($data)) {

+ 1 - 0
lib/Cake/View/Helper/HtmlHelper.php

@@ -905,6 +905,7 @@ class HtmlHelper extends AppHelper {
  * @param mixed $configFile String with the config file (load using PhpReader) or an array with file and reader name
  * @param string $path Path with config file
  * @return mixed False to error or loaded configs
+ * @throws ConfigureException
  */
 	public function loadConfig($configFile, $path = null) {
 		if (!$path) {

+ 1 - 1
lib/Cake/View/Helper/TimeHelper.php

@@ -722,7 +722,7 @@ class TimeHelper extends AppHelper {
  * @param string $format strftime format string.
  * @param boolean $invalid flag to ignore results of fromString == false
  * @param int $userOffset User's offset from GMT (in hours)
- * @return string Formatted and translated date string @access public
+ * @return string Formatted and translated date string
  */
 	public function i18nFormat($date, $format = null, $invalid = false, $userOffset = null) {
 		$date = $this->fromString($date, $userOffset);

+ 1 - 0
lib/Cake/View/MediaView.php

@@ -89,6 +89,7 @@ class MediaView extends View {
  * @param string $view Not used
  * @param string $layout Not used
  * @return mixed
+ * @throws NotFoundException
  */
 	public function render($view = null, $layout = null) {
 		$name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null;

+ 1 - 0
lib/Cake/View/ScaffoldView.php

@@ -32,6 +32,7 @@ class ScaffoldView extends ThemeView {
  *
  * @param string $name name of the view file to get.
  * @return string action
+ * @throws MissingViewException
  */
 	protected function _getViewFileName($name = null) {
 		if ($name === null) {