Skip to content

Commit

Permalink
update stan
Browse files Browse the repository at this point in the history
  • Loading branch information
LordSimal committed May 2, 2023
1 parent 7dadeeb commit 63c7745
Show file tree
Hide file tree
Showing 4 changed files with 46 additions and 32 deletions.
4 changes: 2 additions & 2 deletions .phive/phars.xml
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<phive xmlns="https://phar.io/phive">
<phar name="phpstan" version="1.9.12" installed="1.9.12" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.4.0" installed="5.4.0" location="./tools/psalm" copy="false"/>
<phar name="phpstan" version="1.10.14" installed="1.10.14" location="./tools/phpstan" copy="false"/>
<phar name="psalm" version="5.10.0" installed="5.10.0" location="./tools/psalm" copy="false"/>
</phive>
51 changes: 41 additions & 10 deletions psalm-baseline.xml
Original file line number Diff line number Diff line change
@@ -1,13 +1,13 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="dev-master@">
<files psalm-version="5.10.0@a5effd2d2dddd1a7ea7a0f6a051ce63ff979e356">
<file src="src/Chronos.php">
<ImpureFunctionCall occurrences="4">
<ImpureFunctionCall>
<code>array_filter</code>
<code>date_default_timezone_get</code>
<code>date_default_timezone_get</code>
<code>iterator_to_array</code>
</ImpureFunctionCall>
<ImpureMethodCall occurrences="42">
<ImpureMethodCall>
<code>diffForHumans</code>
<code>diffFormatter</code>
<code>format</code>
Expand Down Expand Up @@ -51,7 +51,7 @@
<code>tomorrow</code>
<code>yesterday</code>
</ImpureMethodCall>
<ImpureStaticProperty occurrences="13">
<ImpureStaticProperty>
<code>static::$days</code>
<code>static::$days</code>
<code>static::$days</code>
Expand All @@ -66,15 +66,35 @@
<code>static::$weekStartsAt</code>
<code>static::$weekStartsAt</code>
</ImpureStaticProperty>
<ImpureStaticVariable occurrences="1"/>
<ImpureStaticVariable>
<code><![CDATA[static $formats = [
'year' => 'Y',
'yearIso' => 'o',
'month' => 'n',
'day' => 'j',
'hour' => 'G',
'minute' => 'i',
'second' => 's',
'micro' => 'u',
'microsecond' => 'u',
'dayOfWeek' => 'N',
'dayOfYear' => 'z',
'weekOfYear' => 'W',
'daysInMonth' => 't',
'timestamp' => 'U',
];]]></code>
</ImpureStaticVariable>
<InaccessibleProperty>
<code><![CDATA[$instance->f]]></code>
</InaccessibleProperty>
</file>
<file src="src/ChronosDate.php">
<ImpureFunctionCall occurrences="3">
<ImpureFunctionCall>
<code>array_filter</code>
<code>date_default_timezone_get</code>
<code>iterator_to_array</code>
</ImpureFunctionCall>
<ImpureMethodCall occurrences="24">
<ImpureMethodCall>
<code>diffForHumans</code>
<code>diffFormatter</code>
<code>format</code>
Expand All @@ -100,7 +120,7 @@
<code>tomorrow</code>
<code>yesterday</code>
</ImpureMethodCall>
<ImpureStaticProperty occurrences="9">
<ImpureStaticProperty>
<code>static::$days</code>
<code>static::$days</code>
<code>static::$days</code>
Expand All @@ -111,10 +131,21 @@
<code>static::$days</code>
<code>static::$days</code>
</ImpureStaticProperty>
<ImpureStaticVariable occurrences="1"/>
<ImpureStaticVariable>
<code><![CDATA[static $formats = [
'year' => 'Y',
'yearIso' => 'o',
'month' => 'n',
'day' => 'j',
'dayOfWeek' => 'N',
'dayOfYear' => 'z',
'weekOfYear' => 'W',
'daysInMonth' => 't',
];]]></code>
</ImpureStaticVariable>
</file>
<file src="src/ChronosTime.php">
<ImpureMethodCall occurrences="6">
<ImpureMethodCall>
<code>format</code>
<code>mod</code>
<code>mod</code>
Expand Down
3 changes: 3 additions & 0 deletions psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -6,6 +6,9 @@
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
errorBaseline="psalm-baseline.xml"
findUnusedPsalmSuppress="true"
findUnusedBaselineEntry="true"
findUnusedCode="false"
>
<projectFiles>
<directory name="src" />
Expand Down
20 changes: 0 additions & 20 deletions src/Chronos.php
Original file line number Diff line number Diff line change
Expand Up @@ -366,26 +366,6 @@ public static function hasRelativeKeywords(?string $time): bool
return false;
}

/**
* Determines if there is no fixed date in the time string.
*
* @param \Cake\Chronos\Chronos|\Cake\Chronos\ChronosDate|\DateTimeInterface|string|null $time The time string to check
* @return bool true if doesn't contain a fixed date
*/
private static function isRelativeOnly(Chronos|ChronosDate|DateTimeInterface|string|null $time): bool
{
if ($time === null) {
return true;
}

if (!is_string($time)) {
return false;
}

// must not contain fixed date before relative keywords or time expression
return preg_match('/[0-9]{4}-[0-9]{1,2}-[0-9]{1,2}/', $time) !== 1;
}

/**
* Get weekend days
*
Expand Down

0 comments on commit 63c7745

Please sign in to comment.