Skip to content

Commit

Permalink
feat: PHP 8.3 Support (#102)
Browse files Browse the repository at this point in the history
  • Loading branch information
LastDragon-ru committed Oct 20, 2023
2 parents 3d0d504 + ab31d77 commit 8e8b97d
Show file tree
Hide file tree
Showing 14 changed files with 29 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-dom": "*",
"ext-intl": "*",
"ext-json": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/core/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-mbstring": "*",
"laravel/framework": "^9.21.0|^10.0.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/documentator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-mbstring": "*",
"composer/semver": "^3.2",
"laravel/framework": "^9.21.0|^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/eloquent/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"laravel/framework": "^9.21.0|^10.0.0",
"lastdragon-ru/lara-asp-core": "self.version"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/formatter/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-intl": "*",
"ext-mbstring": "*",
"laravel/framework": "^9.21.0|^10.0.0",
Expand Down
22 changes: 16 additions & 6 deletions packages/formatter/src/FormatterTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -9,6 +9,7 @@
use PHPUnit\Framework\Attributes\CoversClass;

use function config;
use function str_replace;

/**
* @internal
Expand Down Expand Up @@ -125,8 +126,11 @@ public function testDuration(): void {
public function testTime(): void {
$time = DateTime::createFromFormat('H:i:s', '23:24:59') ?: null;

self::assertEquals('11:24 PM', $this->formatter->time($time));
self::assertEquals('2:24 AM', $this->formatter->time($time, null, 'Europe/Moscow'));
self::assertEquals('11:24 PM', str_replace("\u{202F}", ' ', $this->formatter->time($time)));
self::assertEquals(
'2:24 AM',
str_replace("\u{202F}", ' ', $this->formatter->time($time, null, 'Europe/Moscow')),
);
}

public function testTimeConfig(): void {
Expand All @@ -136,7 +140,7 @@ public function testTimeConfig(): void {

$time = DateTime::createFromFormat('H:i:s', '23:24:59') ?: null;

self::assertEquals('11:24:59 PM', $this->formatter->time($time));
self::assertEquals('11:24:59 PM', str_replace("\u{202F}", ' ', $this->formatter->time($time)));
}

public function testTimeCustomFormat(): void {
Expand Down Expand Up @@ -185,8 +189,11 @@ public function testDateCustomFormat(): void {
public function testDatetime(): void {
$datetime = DateTime::createFromFormat('d.m.Y H:i:s', '12.05.2005 23:00:00') ?: null;

self::assertEquals('5/12/05, 11:00 PM', $this->formatter->datetime($datetime));
self::assertEquals('5/13/05, 3:00 AM', $this->formatter->datetime($datetime, null, 'Europe/Moscow'));
self::assertEquals('5/12/05, 11:00 PM', str_replace("\u{202F}", ' ', $this->formatter->datetime($datetime)));
self::assertEquals(
'5/13/05, 3:00 AM',
str_replace("\u{202F}", ' ', $this->formatter->datetime($datetime, null, 'Europe/Moscow')),
);
}

public function testDatetimeConfig(): void {
Expand All @@ -196,7 +203,10 @@ public function testDatetimeConfig(): void {

$datetime = DateTime::createFromFormat('d.m.Y H:i:s', '12.05.2005 23:00:00') ?: null;

self::assertEquals('May 12, 2005, 11:00:00 PM', $this->formatter->datetime($datetime));
self::assertEquals(
'May 12, 2005, 11:00:00 PM',
str_replace("\u{202F}", ' ', $this->formatter->datetime($datetime)),
);
}

public function testDatetimeCustomFormat(): void {
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql-printer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-mbstring": "*",
"webonyx/graphql-php": "^15.4.0"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/graphql/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-mbstring": "*",
"composer/semver": "^3.2",
"laravel/framework": "^9.21.0|^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/migrator/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -20,7 +20,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-json": "*",
"composer/semver": "^3.2",
"laravel/framework": "^9.21.0|^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/queue/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"laravel/framework": "^9.21.0|^10.0.0",
"lastdragon-ru/lara-asp-core": "self.version"
},
Expand Down
2 changes: 1 addition & 1 deletion packages/serializer/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"laravel/framework": "^9.21.0|^10.0.0",
"lastdragon-ru/lara-asp-core": "self.version",
"phpdocumentor/type-resolver": "^1.7",
Expand Down
2 changes: 1 addition & 1 deletion packages/spa/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-mbstring": "*",
"guzzlehttp/psr7": "^1.9.1|^2.4.5",
"laravel/framework": "^9.21.0|^10.0.0",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@
"forum": "https://github.com/LastDragon-ru/lara-asp/discussions"
},
"require": {
"php": "^8.1|^8.2",
"php": "^8.1|^8.2|^8.3",
"ext-json": "*",
"ext-libxml": "*",
"ext-dom": "*",
Expand Down
2 changes: 1 addition & 1 deletion packages/testing/src/Constraints/Json/Protocol.php
Original file line number Diff line number Diff line change
Expand Up @@ -47,7 +47,7 @@ public static function getUri(SplFileInfo $file, array $parameters = []): Uri {

// Build
$scheme = static::Scheme;
$query = http_build_query($parameters, encoding_type: PHP_QUERY_RFC3986);
$query = http_build_query($parameters, '', '&', PHP_QUERY_RFC3986);
$path = implode('/', array_map(rawurlencode(...), explode('/', ltrim($path, '/'))));
$uri = new Uri((array) parse_url("{$scheme}://{$host}/{$path}?{$query}"));

Expand Down

0 comments on commit 8e8b97d

Please sign in to comment.