Skip to content

Commit

Permalink
Fixing a few code smells detected by phpstan.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Dec 18, 2016
1 parent cc1e2b5 commit 4703815
Show file tree
Hide file tree
Showing 10 changed files with 16 additions and 81 deletions.
3 changes: 1 addition & 2 deletions src/Database/Statement/PDOStatement.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
}

/**
Expand Down
17 changes: 0 additions & 17 deletions src/Database/Type/BinaryType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
17 changes: 0 additions & 17 deletions src/Database/Type/BoolType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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.
*
Expand Down
11 changes: 3 additions & 8 deletions src/Database/Type/DateTimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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');
}

Expand Down Expand Up @@ -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);
Expand Down
1 change: 1 addition & 0 deletions src/Database/Type/DateType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
20 changes: 2 additions & 18 deletions src/Database/Type/DecimalType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down Expand Up @@ -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)
Expand Down Expand Up @@ -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);
Expand Down
17 changes: 0 additions & 17 deletions src/Database/Type/FloatType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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
*
Expand Down
1 change: 1 addition & 0 deletions src/Database/Type/TimeType.php
Original file line number Diff line number Diff line change
Expand Up @@ -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);
Expand Down
2 changes: 2 additions & 0 deletions src/ORM/SaveOptionsBuilder.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,6 +54,8 @@ public function __construct(Table $table, array $options = [])
{
$this->_table = $table;
$this->parseArrayOptions($options);

parent::__construct();
}

/**
Expand Down
8 changes: 6 additions & 2 deletions src/Shell/RoutesShell.php
Original file line number Diff line number Diff line change
Expand Up @@ -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)
{
Expand All @@ -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()
{
Expand All @@ -95,6 +97,8 @@ public function generate()

return false;
}

return true;
}

/**
Expand Down

0 comments on commit 4703815

Please sign in to comment.