Skip to content

Commit

Permalink
Fix doc blocks and return values. Also fixed some missing typehinting.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 14, 2016
1 parent de71b2a commit 2d5c1ee
Show file tree
Hide file tree
Showing 8 changed files with 28 additions and 24 deletions.
10 changes: 5 additions & 5 deletions src/Console/ConsoleIo.php
Expand Up @@ -128,7 +128,7 @@ public function level($level = null)
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
*/
public function verbose($message, $newlines = 1)
{
Expand All @@ -140,7 +140,7 @@ public function verbose($message, $newlines = 1)
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
*/
public function quiet($message, $newlines = 1)
{
Expand All @@ -161,7 +161,7 @@ public function quiet($message, $newlines = 1)
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @param int $level The message's output level, see above.
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
*/
public function out($message = '', $newlines = 1, $level = ConsoleIo::NORMAL)
{
Expand Down Expand Up @@ -213,11 +213,11 @@ public function overwrite($message, $newlines = 1, $size = null)
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return void
* @return int|bool The number of bytes returned from writing to stderr.
*/
public function err($message = '', $newlines = 1)
{
$this->_err->write($message, $newlines);
return $this->_err->write($message, $newlines);
}

/**
Expand Down
6 changes: 3 additions & 3 deletions src/Console/ConsoleOutput.php
Expand Up @@ -170,12 +170,12 @@ public function __construct($stream = 'php://stdout')
}

/**
* Outputs a single or multiple messages to stdout. If no parameters
* Outputs a single or multiple messages to stdout or stderr. If no parameters
* are passed, outputs just a newline.
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to output.
*/
public function write($message, $newlines = 1)
{
Expand Down Expand Up @@ -244,7 +244,7 @@ protected function _replaceTags($matches)
* Writes a message to the output stream.
*
* @param string $message Message to write.
* @return bool success
* @return int|bool The number of bytes returned from writing to output.
*/
protected function _write($message)
{
Expand Down
18 changes: 9 additions & 9 deletions src/Console/Shell.php
Expand Up @@ -407,7 +407,7 @@ public function parseDispatchArguments($args)
* to be dispatched.
* Built-in extra parameter is :
* - `requested` : if used, will prevent the Shell welcome message to be displayed
* @return mixed
* @return int|bool|null
* @link http://book.cakephp.org/3.0/en/console-and-shells.html#the-cakephp-console
*/
public function runCommand($argv, $autoMethod = false, $extra = [])
Expand Down Expand Up @@ -496,7 +496,7 @@ protected function _setOutputLevel()
* Display the help in the correct format
*
* @param string $command The command to get help for.
* @return int|bool
* @return int|bool The number of bytes returned from writing to stdout.
*/
protected function _displayHelp($command)
{
Expand Down Expand Up @@ -609,7 +609,7 @@ public function wrapText($text, $options = [])
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
*/
public function verbose($message, $newlines = 1)
{
Expand All @@ -621,7 +621,7 @@ public function verbose($message, $newlines = 1)
*
* @param string|array $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
*/
public function quiet($message, $newlines = 1)
{
Expand All @@ -642,7 +642,7 @@ public function quiet($message, $newlines = 1)
* @param string|array|null $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @param int $level The message's output level, see above.
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
* @link http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::out
*/
public function out($message = null, $newlines = 1, $level = Shell::NORMAL)
Expand All @@ -656,7 +656,7 @@ public function out($message = null, $newlines = 1, $level = Shell::NORMAL)
*
* @param string|array|null $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stderr.
* @return int|bool The number of bytes returned from writing to stderr.
*/
public function err($message = null, $newlines = 1)
{
Expand All @@ -669,7 +669,7 @@ public function err($message = null, $newlines = 1)
* @param string|array|null $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @param int $level The message's output level, see above.
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
* @see http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::out
*/
public function info($message = null, $newlines = 1, $level = Shell::NORMAL)
Expand All @@ -682,7 +682,7 @@ public function info($message = null, $newlines = 1, $level = Shell::NORMAL)
*
* @param string|array|null $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @return int|bool Returns the number of bytes returned from writing to stderr.
* @return int|bool The number of bytes returned from writing to stderr.
* @see http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::err
*/
public function warn($message = null, $newlines = 1)
Expand All @@ -696,7 +696,7 @@ public function warn($message = null, $newlines = 1)
* @param string|array|null $message A string or an array of strings to output
* @param int $newlines Number of newlines to append
* @param int $level The message's output level, see above.
* @return int|bool Returns the number of bytes returned from writing to stdout.
* @return int|bool The number of bytes returned from writing to stdout.
* @see http://book.cakephp.org/3.0/en/console-and-shells.html#Shell::out
*/
public function success($message = null, $newlines = 1, $level = Shell::NORMAL)
Expand Down
1 change: 1 addition & 0 deletions src/Controller/Component/AuthComponent.php
Expand Up @@ -276,6 +276,7 @@ public function authCheck(Event $event)
return null;
}

/* @var \Cake\Controller\Controller $controller */
$controller = $event->subject();

$action = strtolower($controller->request->params['action']);
Expand Down
3 changes: 2 additions & 1 deletion src/Controller/Component/CsrfComponent.php
Expand Up @@ -81,6 +81,7 @@ public function startup(Event $event)
$response = $controller->response;
$cookieName = $this->_config['cookieName'];

/* @var \Cake\Network\Request $request */
$cookieData = $request->cookie($cookieName);
if ($cookieData) {
$request->params['_csrfToken'] = $cookieData;
Expand Down Expand Up @@ -150,7 +151,7 @@ protected function _validateToken(Request $request)
$post = $request->data($this->_config['field']);
$header = $request->header('X-CSRF-Token');

if (empty($cookie)) {
if (!$cookie) {
throw new InvalidCsrfTokenException(__d('cake', 'Missing CSRF token cookie'));
}

Expand Down
1 change: 1 addition & 0 deletions src/Controller/Component/PaginatorComponent.php
Expand Up @@ -179,6 +179,7 @@ public function paginate($object, array $settings = [])
$options['page'] = (int)$options['page'] < 1 ? 1 : (int)$options['page'];
list($finder, $options) = $this->_extractFinder($options);

/* @var \Cake\Datasource\RepositoryInterface $object */
if (empty($query)) {
$query = $object->find($finder, $options);
} else {
Expand Down
6 changes: 3 additions & 3 deletions src/Database/Expression/TupleComparison.php
Expand Up @@ -154,13 +154,13 @@ public function traverse(callable $callable)
return;
}

foreach ($value as $i => $value) {
foreach ($value as $i => $val) {
if ($this->isMulti()) {
foreach ($value as $v) {
foreach ($val as $v) {
$this->_traverseValue($v, $callable);
}
} else {
$this->_traverseValue($value, $callable);
$this->_traverseValue($val, $callable);
}
}
}
Expand Down
7 changes: 4 additions & 3 deletions src/Database/Expression/ValuesExpression.php
Expand Up @@ -52,9 +52,9 @@ class ValuesExpression implements ExpressionInterface
/**
* The Query object to use as a values expression
*
* @var \Cake\Database\Query
* @var \Cake\Database\Query|null
*/
protected $_query = false;
protected $_query = null;

/**
* Whether or not values have been casted to expressions
Expand Down Expand Up @@ -169,7 +169,7 @@ public function values($values = null)
* the currently stored query
*
* @param \Cake\Database\Query|null $query The query to set/get
* @return \Cake\Database\Query
* @return \Cake\Database\Query|null
*/
public function query(Query $query = null)
{
Expand Down Expand Up @@ -296,6 +296,7 @@ protected function _processExpressions()

foreach ($this->_values as $row => $values) {
foreach ($types as $col => $type) {
/* @var \Cake\Database\Type\ExpressionTypeInterface $type */
$this->_values[$row][$col] = $type->toExpression($values[$col]);
}
}
Expand Down

0 comments on commit 2d5c1ee

Please sign in to comment.