Skip to content

Commit d39cc49

Browse files
committed
regression: DateTimeInterface not avail in PHP 5.4 / prefer === false vs "!"
1 parent c1413fb commit d39cc49

29 files changed

Lines changed: 47 additions & 43 deletions

.github/workflows/phpunit.yml

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -55,7 +55,9 @@ jobs:
5555
restore-keys: |
5656
${{ runner.os }}-php-
5757
- name: Install dependencies
58-
run: composer install --prefer-dist --no-progress
58+
run: |
59+
composer --version
60+
composer install --prefer-dist --no-progress
5961
- name: Unit test
6062
run: composer run test
6163
- name: Publish code coverage

src/Backtrace/SkipInternal.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -52,7 +52,7 @@ public static function addInternalClass($classes, $level = 0)
5252
if (\is_int($level) === false) {
5353
throw new InvalidArgumentException(\sprintf('level must be an integer'));
5454
}
55-
if (!\is_array($classes)) {
55+
if (\is_array($classes) === false) {
5656
$classes = array($classes => $level);
5757
}
5858
foreach ($classes as $key => $val) {

src/Debug/Abstraction/AbstractObject.php

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -233,7 +233,9 @@ public static function buildObjValues($values = array())
233233
public function onStart(Abstraction $abs)
234234
{
235235
$obj = $abs->getSubject();
236-
if ($obj instanceof \DateTimeInterface) {
236+
if ($obj instanceof \DateTime || $obj instanceof \DateTimeImmutable) {
237+
// check for both DateTime and DateTimeImmutable
238+
// DateTimeInterface (and DateTimeImmutable) not available until Php 5.5
237239
$abs['isTraverseOnly'] = false;
238240
$abs['stringified'] = $obj->format(\DateTime::ISO8601);
239241
} elseif ($obj instanceof \mysqli) {

src/Debug/Abstraction/AbstractObjectMethodParams.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -285,7 +285,7 @@ private function phpDocConstant($defaultValue, $className, $matches)
285285
*/
286286
private function phpDocParamValue($param, $className = null)
287287
{
288-
if (!\array_key_exists('defaultValue', $param)) {
288+
if (\array_key_exists('defaultValue', $param) === false) {
289289
return Abstracter::UNDEFINED;
290290
}
291291
$defaultValue = $param['defaultValue'];

src/Debug/Abstraction/AbstractString.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -247,7 +247,7 @@ private function getMaxLen($cat, $strlen)
247247
$maxlen = \array_key_exists($cat, $stringMaxLen)
248248
? $stringMaxLen[$cat]
249249
: $stringMaxLen['other'];
250-
if (!\is_array($maxlen)) {
250+
if (\is_array($maxlen) === false) {
251251
return $maxlen !== null
252252
? $maxlen
253253
: -1;

src/Debug/Abstraction/Abstracter.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -465,7 +465,7 @@ protected function postSetCfg($cfg = array(), $prev = array())
465465
$cfg['objectsExclude'] = $this->cfg['objectsExclude'];
466466
}
467467
if (isset($cfg['stringMaxLen'])) {
468-
if (!\is_array($cfg['stringMaxLen'])) {
468+
if (\is_array($cfg['stringMaxLen']) === false) {
469469
$cfg['stringMaxLen'] = array(
470470
'other' => $cfg['stringMaxLen'],
471471
);

src/Debug/Debug.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -845,7 +845,7 @@ public static function meta()
845845
$args[0]['debug'] = self::META;
846846
return $args[0];
847847
}
848-
if (!\is_string($args[0])) {
848+
if (\is_string($args[0]) === false) {
849849
// invalid / return empty meta array
850850
return array('debug' => self::META);
851851
}

src/Debug/Dump/Html/HtmlObject.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -257,7 +257,7 @@ protected function dumpPhpDoc(Abstraction $abs)
257257
{
258258
$str = '<dt>phpDoc</dt>' . "\n";
259259
foreach ($abs['phpDoc'] as $tagName => $values) {
260-
if (!\is_array($values)) {
260+
if (\is_array($values) === false) {
261261
continue;
262262
}
263263
foreach ($values as $tagData) {

src/Debug/Dump/Substitution.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -54,7 +54,7 @@ public function __construct(Dumper $dumper)
5454
*/
5555
public function process($args, $options = array())
5656
{
57-
if (!\is_string($args[0])) {
57+
if (\is_string($args[0]) === false) {
5858
return $args;
5959
}
6060
$this->subInfo = array(
@@ -97,7 +97,7 @@ private function processSubsCallback($matches)
9797
{
9898
$index = ++$this->subInfo['index'];
9999
$replace = $matches[0];
100-
if (!\array_key_exists($index, $this->subInfo['args'])) {
100+
if (\array_key_exists($index, $this->subInfo['args']) === false) {
101101
return $replace;
102102
}
103103
$arg = $this->subInfo['args'][$index];

src/Debug/Framework/Yii2/Module.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -259,7 +259,7 @@ protected function collectEvent()
259259
$this->module->getVersion() returns the application "module" version vs framework version ¯\_(ツ)_/¯
260260
*/
261261
$yiiVersion = Yii::getVersion(); // Framework version
262-
if (!\version_compare($yiiVersion, '2.0.14', '>=')) {
262+
if (\version_compare($yiiVersion, '2.0.14', '<')) {
263263
return;
264264
}
265265
YiiEvent::on('*', '*', function (YiiEvent $event) {

0 commit comments

Comments
 (0)