Skip to content

Commit

Permalink
PHPStan Level 6.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Jul 28, 2020
1 parent c6c3d37 commit d739a69
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 11 deletions.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
includes:
- phpstan-baseline.neon
parameters:
level: 5
level: 6
checkGenericClassInNonGenericObjectType: false
checkMissingIterableValueType: false
paths:
Expand Down
8 changes: 5 additions & 3 deletions src/Propel/Runtime/DataFetcher/AbstractDataFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,7 +8,7 @@
abstract class AbstractDataFetcher implements DataFetcherInterface
{
/**
* @var mixed
* @var mixed|null
*/
protected $dataObject;

Expand All @@ -21,15 +21,17 @@ public function __construct($dataObject)
}

/**
* @inheritDoc
* @param mixed|null $dataObject
*
* @return void
*/
public function setDataObject($dataObject)
{
$this->dataObject = $dataObject;
}

/**
* @return \Propel\Runtime\DataFetcher\PDODataFetcher
* @return mixed
*/
public function getDataObject()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Propel/Runtime/DataFetcher/PDODataFetcher.php
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ public function getStyle()
}

/**
* @param null $style
* @param int|null $style
*
* @return array|null
*/
Expand Down
10 changes: 4 additions & 6 deletions src/Propel/Runtime/Util/PropelDateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -49,20 +49,18 @@ protected static function isTimestamp($value)
if (!is_numeric($value)) {
return false;
}

if (strlen((string)$value) === 8) {
return false;
}

$stamp = strtotime($value);

$stamp = strtotime((string)$value);
if ($stamp === false) {
return true;
}

$month = (int)date('m', $value);
$day = (int)date('d', $value);
$year = (int)date('Y', $value);
$month = (int)date('m', (int)$value);
$day = (int)date('d', (int)$value);
$year = (int)date('Y', (int)$value);

return checkdate($month, $day, $year);
}
Expand Down
6 changes: 6 additions & 0 deletions tests/Propel/Tests/Runtime/Util/PropelDateTimeTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -214,6 +214,7 @@ public function testIsTimestamp()
{
$this->assertEquals(false, TestPropelDateTime::isTimestamp('20110325'));
$this->assertEquals(true, TestPropelDateTime::isTimestamp(1319580000));
$this->assertEquals(true, TestPropelDateTime::isTimestamp('1319580000'));
$this->assertEquals(false, TestPropelDateTime::isTimestamp('2011-07-20 00:00:00'));
}

Expand Down Expand Up @@ -246,6 +247,11 @@ public function testCreateHighPrecisioniTz()

class TestPropelDateTime extends PropelDateTime
{
/**
* @param mixed $value
*
* @return bool
*/
public static function isTimestamp($value)
{
return parent::isTimestamp($value);
Expand Down

0 comments on commit d739a69

Please sign in to comment.