Skip to content

Commit e475be7

Browse files
committed
Fix errors reported by phpstan.
1 parent 13eeb6b commit e475be7

33 files changed

+66
-62
lines changed

phpstan.neon

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -15,14 +15,13 @@ parameters:
1515
- '#Call to an undefined method Psr\\Http\\Message\\ResponseInterface::getCookies\(\)#'
1616
- '#Access to an undefined property Psr\\Http\\Message\\UriInterface::\$webroot#'
1717
- '#Access to an undefined property Psr\\Http\\Message\\UriInterface::\$base#'
18-
- '#Call to an undefined method Cake\\Collection\\Iterator\\ZipIterator::getInnerIterator\(\)#'
19-
- '#Call to an undefined method Cake\\ORM\\ResultSet::getInnerIterator\(\)#'
2018
- '#Result of method Cake\\Http\\Response::send\(\) \(void\) is used#'
2119
- '#Method Cake\\View\\Form\\ContextInterface::val\(\) invoked with 2 parameters, 1 required#'
2220
- '#Access to an undefined property Exception::\$queryString#'
2321
- '#Access to an undefined property PHPUnit\\Framework\\Test::\$fixtureManager#'
2422
- '#Method Redis::#'
2523
- '#Call to an undefined method Traversable::getArrayCopy().#'
24+
- '#Variable $config in isset\(\) is never defined#'
2625
earlyTerminatingMethodCalls:
2726
Cake\Shell\Shell:
2827
- abort

src/Cache/Engine/ApcEngine.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -14,7 +14,7 @@
1414
*/
1515
namespace Cake\Cache\Engine;
1616

17-
use APCUIterator;
17+
use APCuIterator;
1818
use Cake\Cache\CacheEngine;
1919

2020
/**
@@ -144,8 +144,8 @@ public function clear($check)
144144
if ($check) {
145145
return true;
146146
}
147-
if (class_exists('APCUIterator', false)) {
148-
$iterator = new APCUIterator(
147+
if (class_exists('APCuIterator', false)) {
148+
$iterator = new APCuIterator(
149149
'/^' . preg_quote($this->_config['prefix'], '/') . '/',
150150
APC_ITER_NONE
151151
);

src/Console/ConsoleInputArgument.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Cake\Console;
1616

1717
use Cake\Console\Exception\ConsoleException;
18-
use SimpleXmlElement;
18+
use SimpleXMLElement;
1919

2020
/**
2121
* An object to represent a single argument used in the command line.
@@ -178,10 +178,10 @@ public function validChoice($value)
178178
/**
179179
* Append this arguments XML representation to the passed in SimpleXml object.
180180
*
181-
* @param \SimpleXmlElement $parent The parent element.
182-
* @return \SimpleXmlElement The parent with this argument appended.
181+
* @param \SimpleXMLElement $parent The parent element.
182+
* @return \SimpleXMLElement The parent with this argument appended.
183183
*/
184-
public function xml(SimpleXmlElement $parent)
184+
public function xml(SimpleXMLElement $parent)
185185
{
186186
$option = $parent->addChild('argument');
187187
$option->addAttribute('name', $this->_name);

src/Console/ConsoleInputOption.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -15,7 +15,7 @@
1515
namespace Cake\Console;
1616

1717
use Cake\Console\Exception\ConsoleException;
18-
use SimpleXmlElement;
18+
use SimpleXMLElement;
1919

2020
/**
2121
* An object to represent a single option used in the command line.
@@ -240,10 +240,10 @@ public function validChoice($value)
240240
/**
241241
* Append the option's xml into the parent.
242242
*
243-
* @param \SimpleXmlElement $parent The parent element.
244-
* @return \SimpleXmlElement The parent with this option appended.
243+
* @param \SimpleXMLElement $parent The parent element.
244+
* @return \SimpleXMLElement The parent with this option appended.
245245
*/
246-
public function xml(SimpleXmlElement $parent)
246+
public function xml(SimpleXMLElement $parent)
247247
{
248248
$option = $parent->addChild('option');
249249
$option->addAttribute('name', '--' . $this->_name);

src/Console/ConsoleInputSubcommand.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616
*/
1717
namespace Cake\Console;
1818

19-
use SimpleXmlElement;
19+
use SimpleXMLElement;
2020

2121
/**
2222
* An object to represent a single subcommand used in the command line.
@@ -126,10 +126,10 @@ public function parser()
126126
/**
127127
* Append this subcommand to the Parent element
128128
*
129-
* @param \SimpleXmlElement $parent The parent element.
130-
* @return \SimpleXmlElement The parent with this subcommand appended.
129+
* @param \SimpleXMLElement $parent The parent element.
130+
* @return \SimpleXMLElement The parent with this subcommand appended.
131131
*/
132-
public function xml(SimpleXmlElement $parent)
132+
public function xml(SimpleXMLElement $parent)
133133
{
134134
$command = $parent->addChild('command');
135135
$command->addAttribute('name', $this->_name);

src/Console/HelpFormatter.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -16,7 +16,7 @@
1616

1717
use Cake\Console\Exception\ConsoleException;
1818
use Cake\Utility\Text;
19-
use SimpleXmlElement;
19+
use SimpleXMLElement;
2020

2121
/**
2222
* HelpFormatter formats help for console shells. Can format to either
@@ -211,12 +211,12 @@ protected function _getMaxLength($collection)
211211
* Get the help as an xml string.
212212
*
213213
* @param bool $string Return the SimpleXml object or a string. Defaults to true.
214-
* @return string|\SimpleXmlElement See $string
214+
* @return string|\SimpleXMLElement See $string
215215
*/
216216
public function xml($string = true)
217217
{
218218
$parser = $this->_parser;
219-
$xml = new SimpleXmlElement('<shell></shell>');
219+
$xml = new SimpleXMLElement('<shell></shell>');
220220
$xml->addChild('command', $parser->getCommand());
221221
$xml->addChild('description', $parser->getDescription());
222222

src/Controller/Controller.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -123,15 +123,15 @@ class Controller implements EventListenerInterface, EventDispatcherInterface
123123
* This object contains all the information about a request and several methods for reading
124124
* additional information about the request.
125125
*
126-
* @var \Cake\Http\ServerRequest
126+
* @var \Cake\Http\ServerRequest|null
127127
* @link https://book.cakephp.org/3.0/en/controllers/request-response.html#request
128128
*/
129129
public $request;
130130

131131
/**
132132
* An instance of a Response object that contains information about the impending response
133133
*
134-
* @var \Cake\Http\Response
134+
* @var \Cake\Http\Response|null
135135
* @link https://book.cakephp.org/3.0/en/controllers/request-response.html#response
136136
*/
137137
public $response;

src/Core/ObjectRegistry.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -126,6 +126,7 @@ protected function _checkDuplicate($name, $config)
126126
if (empty($config)) {
127127
return;
128128
}
129+
/* @var \Cake\Core\InstanceConfigTrait $existing */
129130
$existingConfig = $existing->getConfig();
130131
unset($config['enabled'], $existingConfig['enabled']);
131132

src/Database/Connection.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -827,7 +827,7 @@ public function logger($instance = null)
827827
/**
828828
* Sets a logger
829829
*
830-
* @param object $logger Logger object
830+
* @param \Cake\Database\Log\QueryLogger $logger Logger object
831831
* @return $this
832832
*/
833833
public function setLogger($logger)
@@ -840,7 +840,7 @@ public function setLogger($logger)
840840
/**
841841
* Gets the logger object
842842
*
843-
* @return object logger instance
843+
* @return \Cake\Database\Log\QueryLogger logger instance
844844
*/
845845
public function getLogger()
846846
{

src/Database/Log/LoggingStatement.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -110,8 +110,8 @@ public function bindValue($column, $value, $type = 'string')
110110
* it returns the currently setup logger instance
111111
*
112112
* @deprecated 3.5.0 Use getLogger() and setLogger() instead.
113-
* @param object|null $instance Logger object instance.
114-
* @return object|null Logger instance
113+
* @param \Cake\Database\Log\QueryLogger|null $instance Logger object instance.
114+
* @return \Cake\Database\Log\QueryLogger|null Logger instance
115115
*/
116116
public function logger($instance = null)
117117
{
@@ -125,7 +125,7 @@ public function logger($instance = null)
125125
/**
126126
* Sets a logger
127127
*
128-
* @param object $logger Logger object
128+
* @param \Cake\Database\Log\QueryLogger $logger Logger object
129129
* @return void
130130
*/
131131
public function setLogger($logger)
@@ -136,7 +136,7 @@ public function setLogger($logger)
136136
/**
137137
* Gets the logger object
138138
*
139-
* @return object logger instance
139+
* @return \Cake\Database\Log\QueryLogger logger instance
140140
*/
141141
public function getLogger()
142142
{

0 commit comments

Comments
 (0)