Merge pull request #12503 from bancer/code-style

Improve documentation
This commit is contained in:
Mark Story 2018-08-29 13:49:00 -07:00 committed by GitHub
commit c2df84c701
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
4 changed files with 20 additions and 13 deletions

View file

@ -305,7 +305,7 @@ class Mysql extends DboSource {
* Query charset by collation * Query charset by collation
* *
* @param string $name Collation name * @param string $name Collation name
* @return string Character set name * @return string|false Character set name
*/ */
public function getCharsetName($name) { public function getCharsetName($name) {
if ((bool)version_compare($this->getVersion(), "5", "<")) { if ((bool)version_compare($this->getVersion(), "5", "<")) {
@ -391,7 +391,7 @@ class Mysql extends DboSource {
* @param array $fields The fields to update. * @param array $fields The fields to update.
* @param array $values The values to set. * @param array $values The values to set.
* @param mixed $conditions The conditions to use. * @param mixed $conditions The conditions to use.
* @return array * @return bool
*/ */
public function update(Model $model, $fields = array(), $values = null, $conditions = null) { public function update(Model $model, $fields = array(), $values = null, $conditions = null) {
if (!$this->_useAlias) { if (!$this->_useAlias) {
@ -545,7 +545,7 @@ class Mysql extends DboSource {
* *
* @param array $compare Result of a CakeSchema::compare() * @param array $compare Result of a CakeSchema::compare()
* @param string $table The table name. * @param string $table The table name.
* @return array Array of alter statements to make. * @return string|false String of alter statements to make.
*/ */
public function alterSchema($compare, $table = null) { public function alterSchema($compare, $table = null) {
if (!is_array($compare)) { if (!is_array($compare)) {

View file

@ -247,6 +247,13 @@ class DboSource extends DataSource {
*/ */
protected $_methodCacheChange = false; protected $_methodCacheChange = false;
/**
* Map of the columns contained in a result.
*
* @var array
*/
public $map = array();
/** /**
* Constructor * Constructor
* *

View file

@ -58,7 +58,7 @@ class Model extends CakeObject implements CakeEventListener {
/** /**
* Custom database table name, or null/false if no table association is desired. * Custom database table name, or null/false if no table association is desired.
* *
* @var string * @var string|false
* @link https://book.cakephp.org/2.0/en/models/model-attributes.html#usetable * @link https://book.cakephp.org/2.0/en/models/model-attributes.html#usetable
*/ */
public $useTable = null; public $useTable = null;
@ -68,7 +68,7 @@ class Model extends CakeObject implements CakeEventListener {
* *
* This field is also used in `find('list')` when called with no extra parameters in the fields list * This field is also used in `find('list')` when called with no extra parameters in the fields list
* *
* @var string * @var string|false
* @link https://book.cakephp.org/2.0/en/models/model-attributes.html#displayfield * @link https://book.cakephp.org/2.0/en/models/model-attributes.html#displayfield
*/ */
public $displayField = null; public $displayField = null;
@ -84,7 +84,7 @@ class Model extends CakeObject implements CakeEventListener {
/** /**
* Container for the data that this model gets from persistent storage (usually, a database). * Container for the data that this model gets from persistent storage (usually, a database).
* *
* @var array * @var array|false
* @link https://book.cakephp.org/2.0/en/models/model-attributes.html#data * @link https://book.cakephp.org/2.0/en/models/model-attributes.html#data
*/ */
public $data = array(); public $data = array();
@ -632,7 +632,7 @@ class Model extends CakeObject implements CakeEventListener {
/** /**
* The ID of the model record that was last inserted. * The ID of the model record that was last inserted.
* *
* @var int * @var int|string
*/ */
protected $_insertID = null; protected $_insertID = null;
@ -699,7 +699,7 @@ class Model extends CakeObject implements CakeEventListener {
* *
* @param bool|int|string|array $id Set this ID for this model on startup, * @param bool|int|string|array $id Set this ID for this model on startup,
* can also be an array of options, see above. * can also be an array of options, see above.
* @param string $table Name of database table to use. * @param string|false $table Name of database table to use.
* @param string $ds DataSource connection name. * @param string $ds DataSource connection name.
*/ */
public function __construct($id = false, $table = null, $ds = null) { public function __construct($id = false, $table = null, $ds = null) {
@ -1196,7 +1196,7 @@ class Model extends CakeObject implements CakeEventListener {
* a one-item, two-dimensional array using $one for a key and $two as its value.) * a one-item, two-dimensional array using $one for a key and $two as its value.)
* *
* @param string|array|SimpleXmlElement|DomNode $one Array or string of data * @param string|array|SimpleXmlElement|DomNode $one Array or string of data
* @param string $two Value string for the alternative indata method * @param string|false $two Value string for the alternative indata method
* @return array|null Data with all of $one's keys and values, otherwise null. * @return array|null Data with all of $one's keys and values, otherwise null.
* @link https://book.cakephp.org/2.0/en/models/saving-your-data.html * @link https://book.cakephp.org/2.0/en/models/saving-your-data.html
*/ */
@ -1614,7 +1614,7 @@ class Model extends CakeObject implements CakeEventListener {
* *
* @param string|array $fields String of single field name, or an array of field names. * @param string|array $fields String of single field name, or an array of field names.
* @param int|string $id The ID of the record to read * @param int|string $id The ID of the record to read
* @return array Array of database fields, or false if not found * @return array|false Array of database fields, or false if not found
* @link https://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read * @link https://book.cakephp.org/2.0/en/models/retrieving-your-data.html#model-read
*/ */
public function read($fields = null, $id = null) { public function read($fields = null, $id = null) {
@ -3151,7 +3151,7 @@ class Model extends CakeObject implements CakeEventListener {
* @param string $state Either "before" or "after" * @param string $state Either "before" or "after"
* @param array $query Query. * @param array $query Query.
* @param array $results Results. * @param array $results Results.
* @return int The number of records found, or false * @return int|false The number of records found, or false
* @see Model::find() * @see Model::find()
*/ */
protected function _findCount($state, $query, $results = array()) { protected function _findCount($state, $query, $results = array()) {
@ -3495,7 +3495,7 @@ class Model extends CakeObject implements CakeEventListener {
* Additionally it populates the validationErrors property of the model with the same array. * Additionally it populates the validationErrors property of the model with the same array.
* *
* @param array|string $options An optional array of custom options to be made available in the beforeValidate callback * @param array|string $options An optional array of custom options to be made available in the beforeValidate callback
* @return array Array of invalid fields and their error messages * @return array|bool Array of invalid fields and their error messages
* @see Model::validates() * @see Model::validates()
*/ */
public function invalidFields($options = array()) { public function invalidFields($options = array()) {

View file

@ -280,7 +280,7 @@ class ModelValidator implements ArrayAccess, IteratorAggregate, Countable {
* why the rule failed * why the rule failed
* *
* @param string $field The name of the field to invalidate * @param string $field The name of the field to invalidate
* @param string $message Validation message explaining why the rule failed, defaults to true. * @param string|bool $message Validation message explaining why the rule failed, defaults to true.
* @return void * @return void
*/ */
public function invalidate($field, $message = true) { public function invalidate($field, $message = true) {