Skip to content

Commit

Permalink
Merge branch 'release/v0.15.6'
Browse files Browse the repository at this point in the history
  • Loading branch information
betterthanclay committed Sep 6, 2024
2 parents abec815 + 6e7f9d0 commit 17ae2b1
Show file tree
Hide file tree
Showing 5 changed files with 27 additions and 15 deletions.
4 changes: 4 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,3 +1,7 @@
## v0.15.6 (2024-09-06)
* Updated Cosmos extension intefaces
* Added @phpstan-require-implements constraints

## v0.15.5 (2024-08-21)
* Converted consts to protected PascalCase
* Updated Veneer dependency and Stub
Expand Down
7 changes: 6 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,7 @@

"decodelabs/coercion": "^0.2",
"decodelabs/collections": "^0.9",
"decodelabs/cosmos": "^0.1.2",
"decodelabs/cosmos": "^0.2",
"decodelabs/elementary": "^0.4",
"decodelabs/exceptional": "^0.4",
"decodelabs/glitch-support": "^0.4",
Expand All @@ -41,5 +41,10 @@
}
},
"repositories": {
},
"config": {
"allow-plugins": {
"phpstan/extension-installer": true
}
}
}
3 changes: 3 additions & 0 deletions src/AssetTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,9 @@

use DecodeLabs\Collections\AttributeContainerTrait;

/**
* @phpstan-require-implements Asset
*/
trait AssetTrait
{
use AttributeContainerTrait;
Expand Down
3 changes: 3 additions & 0 deletions src/Embed/MediaTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,9 @@
use DecodeLabs\Coercion;
use DecodeLabs\Exceptional;

/**
* @phpstan-require-implements Media
*/
trait MediaTrait
{
//protected const UrlMap = [];
Expand Down
25 changes: 11 additions & 14 deletions src/Plugins/Time.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,15 +10,13 @@
namespace DecodeLabs\Tagged\Plugins;

use DateInterval;
use DateTime;
use DateTimeInterface;
use DateTimeZone;

use DecodeLabs\Cosmos\Extension\Time as TimePlugin;
use DecodeLabs\Cosmos\Extension\TimeTrait as TimePluginTrait;
use DecodeLabs\Cosmos\Locale;
use DecodeLabs\Tagged\Element;
use DecodeLabs\Tagged\Factory;

use Stringable;

/**
Expand Down Expand Up @@ -46,7 +44,7 @@ public function __construct(
* Custom format a date and wrap it
*/
public function format(
DateTime|DateInterval|string|Stringable|int|null $date,
DateTimeInterface|DateInterval|string|Stringable|int|null $date,
string $format,
DateTimeZone|string|Stringable|bool|null $timezone = true
): ?Element {
Expand All @@ -55,7 +53,7 @@ public function format(
}

return $this->wrap(
$date->format($timezone === false ? 'Y-m-d' : DateTime::W3C),
$date->format($timezone === false ? 'Y-m-d' : DateTimeInterface::W3C),
$date->format($format)
);
}
Expand All @@ -64,7 +62,7 @@ public function format(
* Custom format a date and wrap it
*/
public function formatDate(
DateTime|DateInterval|string|Stringable|int|null $date,
DateTimeInterface|DateInterval|string|Stringable|int|null $date,
string $format
): ?Element {
if (!$date = $this->prepare($date, false, true)) {
Expand All @@ -81,7 +79,7 @@ public function formatDate(
* Custom locale format a date with ICU and wrap it
*/
public function pattern(
DateTime|DateInterval|string|Stringable|int|null $date,
DateTimeInterface|DateInterval|string|Stringable|int|null $date,
string $pattern,
DateTimeZone|string|Stringable|bool|null $timezone = true,
string|Locale|null $locale = null
Expand All @@ -93,7 +91,7 @@ public function pattern(
}

return $this->wrap(
$date->format($timezone === false ? 'Y-m-d' : DateTime::W3C),
$date->format($timezone === false ? 'Y-m-d' : DateTimeInterface::W3C),
$output
);
}
Expand All @@ -102,7 +100,7 @@ public function pattern(
* Format date according to locale
*/
public function locale(
DateTime|DateInterval|string|Stringable|int|null $date,
DateTimeInterface|DateInterval|string|Stringable|int|null $date,
string|int|bool|null $dateSize = true,
string|int|bool|null $timeSize = true,
DateTimeZone|string|Stringable|bool|null $timezone = true,
Expand All @@ -124,10 +122,9 @@ public function locale(

/**
* Format interval
* @param DateTime|DateInterval|string|Stringable|int|null $date
*/
protected function formatNowInterval(
DateTime|DateInterval|string|Stringable|int|null $date,
DateTimeInterface|DateInterval|string|Stringable|int|null $date,
bool $invert,
?int $parts,
bool $short = false,
Expand All @@ -142,7 +139,7 @@ protected function formatNowInterval(
}

$output = $this->wrap(
$date->format(DateTime::W3C),
$date->format(DateTimeInterface::W3C),
$output,
$this->formatRawLocaleDate($date, true, true, true, $locale)
);
Expand Down Expand Up @@ -172,8 +169,8 @@ protected function formatNowInterval(
* Format interval until date
*/
protected function formatBetweenInterval(
DateTime|DateInterval|string|Stringable|int|null $date1,
DateTime|DateInterval|string|Stringable|int|null $date2,
DateTimeInterface|DateInterval|string|Stringable|int|null $date1,
DateTimeInterface|DateInterval|string|Stringable|int|null $date2,
?int $parts = 1,
bool $short = false,
string|Locale|null $locale = null
Expand Down

0 comments on commit 17ae2b1

Please sign in to comment.