Skip to content

Commit

Permalink
Changed the signature of methods to avoid strict messages.
Browse files Browse the repository at this point in the history
  • Loading branch information
jrbasso committed Jul 30, 2011
1 parent 39b4032 commit e4a1816
Show file tree
Hide file tree
Showing 9 changed files with 44 additions and 32 deletions.
2 changes: 1 addition & 1 deletion lib/Cake/Cache/Engine/XcacheEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -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) . '_',
Expand Down
2 changes: 1 addition & 1 deletion lib/Cake/Core/App.php
Original file line number Diff line number Diff line change
Expand Up @@ -682,7 +682,7 @@ public static function import($type = null, $name = null, $parent = true, $searc
* @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'])) {
Expand Down
6 changes: 3 additions & 3 deletions lib/Cake/Model/Datasource/Database/Mysql.php
Original file line number Diff line number Diff line change
Expand Up @@ -292,7 +292,7 @@ public function getCharsetName($name) {
* @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;
Expand Down Expand Up @@ -339,7 +339,7 @@ public function describe($model) {
* @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);
}
Expand Down Expand Up @@ -381,7 +381,7 @@ public function update($model, $fields = array(), $values = null, $conditions =
* @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);
}
Expand Down
24 changes: 15 additions & 9 deletions lib/Cake/Model/Datasource/Database/Oracle.php
Original file line number Diff line number Diff line change
Expand Up @@ -319,19 +319,22 @@ public function limit($limit = -1, $offset = 0) {
* 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;
}

/**
* 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);
Expand Down Expand Up @@ -375,10 +378,10 @@ protected function _execute($sql) {
/**
* 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;
Expand Down Expand Up @@ -452,9 +455,10 @@ public function createTrigger($table) {
* 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;
Expand All @@ -479,7 +483,7 @@ public function listSources() {
* @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)) {
Expand Down Expand Up @@ -885,7 +889,7 @@ public function value($data, $column = null) {
* @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";

Expand All @@ -902,18 +906,20 @@ public function lastInsertId($source) {
/**
* 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;
}

Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Datasource/Database/Postgres.php
Original file line number Diff line number Diff line change
Expand Up @@ -185,7 +185,7 @@ public function listSources($data = null) {
* @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();
Expand Down Expand Up @@ -267,7 +267,7 @@ public function describe($model) {
* @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);
}
Expand Down
4 changes: 2 additions & 2 deletions lib/Cake/Model/Datasource/Database/Sqlite.php
Original file line number Diff line number Diff line change
Expand Up @@ -162,7 +162,7 @@ public function listSources($data = null) {
* @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;
Expand Down Expand Up @@ -204,7 +204,7 @@ public function describe($model) {
* @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) {
Expand Down
14 changes: 8 additions & 6 deletions lib/Cake/Model/Datasource/Database/Sqlserver.php
Original file line number Diff line number Diff line change
Expand Up @@ -169,9 +169,10 @@ public function enabled() {
/**
* 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;
Expand Down Expand Up @@ -200,7 +201,7 @@ public function listSources() {
* @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;
Expand Down Expand Up @@ -330,7 +331,7 @@ public function fields($model, $alias = null, $fields = array(), $quote = true)
* @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);
}
Expand Down Expand Up @@ -360,7 +361,7 @@ public function create($model, $fields = null, $values = null) {
* @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);
}
Expand Down Expand Up @@ -595,7 +596,7 @@ public function value($data, $column = null) {
* @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;
Expand Down Expand Up @@ -733,9 +734,10 @@ protected function _getPrimaryKey($model) {
* 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;
Expand Down
16 changes: 9 additions & 7 deletions lib/Cake/Model/Datasource/DboSource.php
Original file line number Diff line number Diff line change
Expand Up @@ -503,9 +503,10 @@ public function lastError(PDOStatement $query = null) {
* 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();
}
Expand All @@ -516,9 +517,10 @@ public function lastAffected() {
* 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();
}

Expand Down Expand Up @@ -990,7 +992,7 @@ public function fullTableName($model, $quote = true) {
* 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) {
Expand Down Expand Up @@ -1037,7 +1039,7 @@ public function create($model, $fields = null, $values = null) {
* @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;
Expand Down Expand Up @@ -1809,7 +1811,7 @@ private function __mergeConditions($query, $assoc) {
* @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 {
Expand Down Expand Up @@ -1886,7 +1888,7 @@ protected function _prepareUpdateFields($model, $fields, $quoteValues = true, $a
* @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);
Expand Down Expand Up @@ -2131,7 +2133,7 @@ public function defaultConditions($model, $conditions, $useAlias = true) {
* @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;
}
Expand Down
4 changes: 3 additions & 1 deletion lib/Cake/View/MediaView.php
Original file line number Diff line number Diff line change
Expand Up @@ -86,9 +86,11 @@ public function __construct($controller = null) {
/**
* 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);

Expand Down

0 comments on commit e4a1816

Please sign in to comment.