Skip to content
Permalink
Browse files

Fixing a few code smells detected by phpstan.

  • Loading branch information...
dereuromark committed Dec 18, 2016
1 parent cc1e2b5 commit 4703815169a5c072fe3242853bf628b7569f9d90
@@ -32,8 +32,7 @@ class PDOStatement extends StatementDecorator
*/
public function __construct(Statement $statement = null, $driver = null)
{
$this->_statement = $statement;
$this->_driver = $driver;
parent::__construct($statement, $driver);
}
/**
@@ -29,23 +29,6 @@
class BinaryType extends Type implements TypeInterface
{
/**
* Identifier name for this type
*
* @var string|null
*/
protected $_name = null;
/**
* Constructor
*
* @param string|null $name The name identifying this type
*/
public function __construct($name = null)
{
$this->_name = $name;
}
/**
* Convert binary data into the database format.
*
@@ -28,23 +28,6 @@
class BoolType extends Type implements TypeInterface
{
/**
* Identifier name for this type
*
* @var string|null
*/
protected $_name = null;
/**
* Constructor
*
* @param string|null $name The name identifying this type
*/
public function __construct($name = null)
{
$this->_name = $name;
}
/**
* Convert bool data into the database format.
*
@@ -78,19 +78,13 @@ class DateTimeType extends Type implements TypeInterface
*/
protected $_className;
/**
* Identifier name for this type
*
* @var string|null
*/
protected $_name = null;
/**
* {@inheritDoc}
*/
public function __construct($name = null)
{
$this->_name = $name;
parent::__construct($name);
$this->_setClassName(static::$dateTimeClass, 'DateTime');
}
@@ -290,6 +284,7 @@ public function useMutable()
*/
protected function _parseValue($value)
{
/* @var \Cake\I18n\Time $class */
$class = $this->_className;
return $class::parseDateTime($value, $this->_localeFormat);
@@ -100,6 +100,7 @@ public function toPHP($value, Driver $driver)
*/
protected function _parseValue($value)
{
/* @var \Cake\I18n\Time $class */
$class = $this->_className;
return $class::parseDate($value, $this->_localeFormat);
@@ -29,23 +29,6 @@
class DecimalType extends Type implements TypeInterface
{
/**
* Identifier name for this type
*
* @var string|null
*/
protected $_name = null;
/**
* Constructor
*
* @param string|null $name The name identifying this type
*/
public function __construct($name = null)
{
$this->_name = $name;
}
/**
* The class to use for representing number objects
*
@@ -89,7 +72,7 @@ public function toDatabase($value, Driver $driver)
*
* @param null|string|resource $value The value to convert.
* @param \Cake\Database\Driver $driver The driver instance to convert with.
* @return resource
* @return float
* @throws \Cake\Core\Exception\Exception
*/
public function toPHP($value, Driver $driver)
@@ -172,6 +155,7 @@ public function useLocaleParser($enable = true)
*/
protected function _parseValue($value)
{
/* @var \Cake\I18n\Number $class */
$class = static::$numberClass;
return $class::parseFloat($value);
@@ -28,23 +28,6 @@
class FloatType extends Type implements TypeInterface
{
/**
* Identifier name for this type
*
* @var string|null
*/
protected $_name = null;
/**
* Constructor
*
* @param string|null $name The name identifying this type
*/
public function __construct($name = null)
{
$this->_name = $name;
}
/**
* The class to use for representing number objects
*
@@ -34,6 +34,7 @@ class TimeType extends DateTimeType
*/
protected function _parseValue($value)
{
/* @var \Cake\I18n\Time $class */
$class = $this->_className;
return $class::parseTime($value, $this->_localeFormat);
@@ -54,6 +54,8 @@ public function __construct(Table $table, array $options = [])
{
$this->_table = $table;
$this->parseArrayOptions($options);
parent::__construct();
}
/**
@@ -47,7 +47,7 @@ public function main()
* Checks a url for the route that will be applied.
*
* @param string $url The URL to parse
* @return null|false
* @return bool Success
*/
public function check($url)
{
@@ -74,13 +74,15 @@ public function check($url)
return false;
}
return true;
}
/**
* Generate a URL based on a set of parameters
*
* Takes variadic arguments of key/value pairs.
* @return null|false
* @return bool Success
*/
public function generate()
{
@@ -95,6 +97,8 @@ public function generate()
return false;
}
return true;
}
/**

0 comments on commit 4703815

Please sign in to comment.
You can’t perform that action at this time.