From e4a18165576273f5912a1fdad3df0a65044b8dab Mon Sep 17 00:00:00 2001 From: Juan Basso Date: Sat, 30 Jul 2011 19:17:20 -0400 Subject: [PATCH] Changed the signature of methods to avoid strict messages. --- lib/Cake/Cache/Engine/XcacheEngine.php | 2 +- lib/Cake/Core/App.php | 2 +- lib/Cake/Model/Datasource/Database/Mysql.php | 6 ++--- lib/Cake/Model/Datasource/Database/Oracle.php | 24 ++++++++++++------- .../Model/Datasource/Database/Postgres.php | 4 ++-- lib/Cake/Model/Datasource/Database/Sqlite.php | 4 ++-- .../Model/Datasource/Database/Sqlserver.php | 14 ++++++----- lib/Cake/Model/Datasource/DboSource.php | 16 +++++++------ lib/Cake/View/MediaView.php | 4 +++- 9 files changed, 44 insertions(+), 32 deletions(-) diff --git a/lib/Cake/Cache/Engine/XcacheEngine.php b/lib/Cake/Cache/Engine/XcacheEngine.php index 21d0f308c..784923f3e 100644 --- a/lib/Cake/Cache/Engine/XcacheEngine.php +++ b/lib/Cake/Cache/Engine/XcacheEngine.php @@ -45,7 +45,7 @@ class XcacheEngine extends CacheEngine { * @param array $settings array of setting for the engine * @return boolean True if the engine has been successfully initialized, false if not */ - public function init($settings) { + public function init($settings = array()) { parent::init(array_merge(array( 'engine' => 'Xcache', 'prefix' => Inflector::slug(APP_DIR) . '_', diff --git a/lib/Cake/Core/App.php b/lib/Cake/Core/App.php index ff88f4b84..052aefbe3 100644 --- a/lib/Cake/Core/App.php +++ b/lib/Cake/Core/App.php @@ -682,7 +682,7 @@ class App { * @param boolean $parent whether to load the class parent or not * @return boolean true indicating the successful load and existence of the class */ - private function _loadClass($name, $plugin, $type, $originalType, $parent) { + private static function _loadClass($name, $plugin, $type, $originalType, $parent) { if ($type == 'Console/Command' && $name == 'Shell') { $type = 'Console'; } else if (isset(self::$types[$originalType]['suffix'])) { diff --git a/lib/Cake/Model/Datasource/Database/Mysql.php b/lib/Cake/Model/Datasource/Database/Mysql.php index a120f16aa..75402f272 100644 --- a/lib/Cake/Model/Datasource/Database/Mysql.php +++ b/lib/Cake/Model/Datasource/Database/Mysql.php @@ -292,7 +292,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 */ - public function describe($model) { + public function describe(Model $model) { $cache = parent::describe($model); if ($cache != null) { return $cache; @@ -339,7 +339,7 @@ class Mysql extends DboSource { * @param mixed $conditions * @return array */ - public function update($model, $fields = array(), $values = null, $conditions = null) { + public function update(Model $model, $fields = array(), $values = null, $conditions = null) { if (!$this->_useAlias) { return parent::update($model, $fields, $values, $conditions); } @@ -381,7 +381,7 @@ class Mysql extends DboSource { * @param mixed $conditions * @return boolean Success */ - public function delete($model, $conditions = null) { + public function delete(Model $model, $conditions = null) { if (!$this->_useAlias) { return parent::delete($model, $conditions); } diff --git a/lib/Cake/Model/Datasource/Database/Oracle.php b/lib/Cake/Model/Datasource/Database/Oracle.php index 4f3362dc3..b84b6c427 100644 --- a/lib/Cake/Model/Datasource/Database/Oracle.php +++ b/lib/Cake/Model/Datasource/Database/Oracle.php @@ -319,9 +319,10 @@ class DboOracle extends DboSource { * Returns number of rows in previous resultset. If no previous resultset exists, * this returns false. * + * @param mixed $source * @return integer Number of rows in resultset */ - public function lastNumRows() { + public function lastNumRows($source = null) { return $this->_numRows; } @@ -329,9 +330,11 @@ class DboOracle extends DboSource { * Executes given SQL statement. This is an overloaded method. * * @param string $sql SQL statement + * @param array $params list of params to be bound to query + * @param array $prepareOptions Options to be used in the prepare statement * @return resource Result resource identifier or null */ - protected function _execute($sql) { + protected function _execute($sql, $params = array(), $prepareOptions = array()) { $this->_statementId = @ociparse($this->connection, $sql); if (!$this->_statementId) { $this->_setError($this->connection); @@ -375,10 +378,10 @@ class DboOracle extends DboSource { /** * Fetch result row * + * @param string $sql * @return array - * @access public */ - public function fetchRow() { + public function fetchRow($sql = null) { if ($this->_currentRow >= $this->_numRows) { ocifreestatement($this->_statementId); $this->_map = null; @@ -452,9 +455,10 @@ class DboOracle extends DboSource { * Returns an array of tables in the database. If there are no tables, an error is * raised and the application exits. * + * @param mixed $source * @return array tablenames in the database */ - public function listSources() { + public function listSources($source = null) { $cache = parent::listSources(); if ($cache != null) { return $cache; @@ -479,7 +483,7 @@ class DboOracle extends DboSource { * @param Model $model instance of a model to inspect * @return array Fields in table. Keys are name and type */ - public function describe($model) { + public function describe(Model $model) { $table = $this->fullTableName($model, false); if (!empty($model->sequence)) { @@ -885,7 +889,7 @@ class DboOracle extends DboSource { * @param string $source * @return integer|boolean */ - public function lastInsertId($source) { + public function lastInsertId($source = null) { $sequence = $this->_sequenceMap[$source]; $sql = "SELECT $sequence.currval FROM dual"; @@ -902,18 +906,20 @@ class DboOracle extends DboSource { /** * Returns a formatted error message from previous database operation. * + * @param PDOStatement $query the query to extract the error from if any * @return string Error message with error number */ - public function lastError() { + public function lastError(PDOStatement $query = null) { return $this->_error; } /** * Returns number of affected rows in previous database operation. If no previous operation exists, this returns false. * + * @param mixed $source * @return int Number of affected rows */ - public function lastAffected() { + public function lastAffected($source = null) { return $this->_statementId ? ocirowcount($this->_statementId): false; } diff --git a/lib/Cake/Model/Datasource/Database/Postgres.php b/lib/Cake/Model/Datasource/Database/Postgres.php index 09139c704..c9b2521eb 100644 --- a/lib/Cake/Model/Datasource/Database/Postgres.php +++ b/lib/Cake/Model/Datasource/Database/Postgres.php @@ -185,7 +185,7 @@ class Postgres extends DboSource { * @param Model $model Name of database table to inspect * @return array Fields in table. Keys are name and type */ - public function describe($model) { + public function describe(Model $model) { $fields = parent::describe($model); $table = $this->fullTableName($model, false); $this->_sequenceMap[$table] = array(); @@ -267,7 +267,7 @@ class Postgres extends DboSource { * @param string $field Name of the ID database field. Defaults to "id" * @return integer */ - public function lastInsertId($source, $field = 'id') { + public function lastInsertId($source = null, $field = 'id') { $seq = $this->getSequence($source, $field); return $this->_connection->lastInsertId($seq); } diff --git a/lib/Cake/Model/Datasource/Database/Sqlite.php b/lib/Cake/Model/Datasource/Database/Sqlite.php index dd2159d8e..0c5e2167d 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlite.php +++ b/lib/Cake/Model/Datasource/Database/Sqlite.php @@ -162,7 +162,7 @@ class Sqlite extends DboSource { * @param Model $model * @return array Fields in table. Keys are name and type */ - public function describe($model) { + public function describe(Model $model) { $cache = parent::describe($model); if ($cache != null) { return $cache; @@ -204,7 +204,7 @@ class Sqlite extends DboSource { * @return array * @access public */ - public function update($model, $fields = array(), $values = null, $conditions = null) { + public function update(Model $model, $fields = array(), $values = null, $conditions = null) { if (empty($values) && !empty($fields)) { foreach ($fields as $field => $value) { if (strpos($field, $model->alias . '.') !== false) { diff --git a/lib/Cake/Model/Datasource/Database/Sqlserver.php b/lib/Cake/Model/Datasource/Database/Sqlserver.php index fa4e561aa..3fe331ced 100644 --- a/lib/Cake/Model/Datasource/Database/Sqlserver.php +++ b/lib/Cake/Model/Datasource/Database/Sqlserver.php @@ -169,9 +169,10 @@ class Sqlserver extends DboSource { /** * Returns an array of sources (tables) in the database. * + * @param mixed $data * @return array Array of tablenames in the database */ - public function listSources() { + public function listSources($data = null) { $cache = parent::listSources(); if ($cache !== null) { return $cache; @@ -200,7 +201,7 @@ class Sqlserver extends DboSource { * @param Model $model Model object to describe * @return array Fields in table. Keys are name and type */ - public function describe($model) { + public function describe(Model $model) { $cache = parent::describe($model); if ($cache != null) { return $cache; @@ -330,7 +331,7 @@ class Sqlserver extends DboSource { * @param array $values * @return array */ - public function create($model, $fields = null, $values = null) { + public function create(Model $model, $fields = null, $values = null) { if (!empty($values)) { $fields = array_combine($fields, $values); } @@ -360,7 +361,7 @@ class Sqlserver extends DboSource { * @param mixed $conditions * @return array */ - public function update($model, $fields = array(), $values = null, $conditions = null) { + public function update(Model $model, $fields = array(), $values = null, $conditions = null) { if (!empty($values)) { $fields = array_combine($fields, $values); } @@ -595,7 +596,7 @@ class Sqlserver extends DboSource { * @param integer $recursive * @return array Array of resultset rows, or false if no rows matched */ - public function read($model, $queryData = array(), $recursive = null) { + public function read(Model $model, $queryData = array(), $recursive = null) { $results = parent::read($model, $queryData, $recursive); $this->_fieldMappings = array(); return $results; @@ -733,9 +734,10 @@ class Sqlserver extends DboSource { * Returns number of affected rows in previous database operation. If no previous operation exists, * this returns false. * + * @param mixed $source * @return integer Number of affected rows */ - public function lastAffected() { + public function lastAffected($source = null) { $affected = parent::lastAffected(); if ($affected === null && $this->_lastAffected !== false) { return $this->_lastAffected; diff --git a/lib/Cake/Model/Datasource/DboSource.php b/lib/Cake/Model/Datasource/DboSource.php index 062f824dc..99de99f07 100644 --- a/lib/Cake/Model/Datasource/DboSource.php +++ b/lib/Cake/Model/Datasource/DboSource.php @@ -503,9 +503,10 @@ class DboSource extends DataSource { * Returns number of affected rows in previous database operation. If no previous operation exists, * this returns false. * + * @param mixed $source * @return integer Number of affected rows */ - public function lastAffected() { + public function lastAffected($source = null) { if ($this->hasResult()) { return $this->_result->rowCount(); } @@ -516,9 +517,10 @@ class DboSource extends DataSource { * Returns number of rows in previous resultset. If no previous resultset exists, * this returns false. * + * @param mixed $source Not used * @return integer Number of rows in resultset */ - public function lastNumRows() { + public function lastNumRows($source = null) { return $this->lastAffected(); } @@ -990,7 +992,7 @@ class DboSource extends DataSource { * be used to generate values. * @return boolean Success */ - public function create($model, $fields = null, $values = null) { + public function create(Model $model, $fields = null, $values = null) { $id = null; if ($fields == null) { @@ -1037,7 +1039,7 @@ class DboSource extends DataSource { * @param integer $recursive Number of levels of association * @return mixed boolean false on error/failure. An array of results on success. */ - public function read($model, $queryData = array(), $recursive = null) { + public function read(Model $model, $queryData = array(), $recursive = null) { $queryData = $this->__scrubQueryData($queryData); $null = null; @@ -1809,7 +1811,7 @@ class DboSource extends DataSource { * @param mixed $conditions * @return boolean Success */ - public function update($model, $fields = array(), $values = null, $conditions = null) { + public function update(Model $model, $fields = array(), $values = null, $conditions = null) { if ($values == null) { $combined = $fields; } else { @@ -1886,7 +1888,7 @@ class DboSource extends DataSource { * @param mixed $conditions * @return boolean Success */ - public function delete($model, $conditions = null) { + public function delete(Model $model, $conditions = null) { $alias = $joins = null; $table = $this->fullTableName($model); $conditions = $this->_matchRecords($model, $conditions); @@ -2131,7 +2133,7 @@ class DboSource extends DataSource { * @param string $assoc * @return string */ - public function resolveKey($model, $key, $assoc = null) { + public function resolveKey(Model $model, $key, $assoc = null) { if (empty($assoc)) { $assoc = $model->alias; } diff --git a/lib/Cake/View/MediaView.php b/lib/Cake/View/MediaView.php index e9b23f1e6..d95105f07 100644 --- a/lib/Cake/View/MediaView.php +++ b/lib/Cake/View/MediaView.php @@ -86,9 +86,11 @@ class MediaView extends View { /** * Display or download the given file * + * @param string $view Not used + * @param string $layout Not used * @return mixed */ - public function render() { + public function render($view = null, $layout = null) { $name = $download = $extension = $id = $modified = $path = $cache = $mimeType = $compress = null; extract($this->viewVars, EXTR_OVERWRITE);