Skip to content

Commit 5df0023

Browse files
authored
Merge pull request #14 from grantholle/laravel-11
Add Laravel 11 support
2 parents fad7a6d + 4bbc51b commit 5df0023

File tree

24 files changed

+143
-122
lines changed

24 files changed

+143
-122
lines changed

.github/workflows/phpstan.yml

Lines changed: 0 additions & 26 deletions
This file was deleted.

.github/workflows/run-tests.yml

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -13,16 +13,19 @@ jobs:
1313
fail-fast: true
1414
matrix:
1515
os: [ubuntu-latest]
16-
php: [8.2, 8.1]
17-
laravel: [9.*, 10.*]
16+
php: [8.2, 8.3]
17+
laravel: [9.*, 10.*, 11.*]
1818
stability: [prefer-lowest, prefer-stable]
1919
include:
2020
- laravel: 9.*
2121
testbench: 7.*
2222
carbon: ^2.63
23-
- laravel: 10.*
23+
- laravel: ^10.15
2424
testbench: 8.*
2525
carbon: ^2.63
26+
- laravel: 11.*
27+
testbench: 9.*
28+
carbon: ^2.63
2629

2730
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.stability }} - ${{ matrix.os }}
2831

.github/workflows/update-changelog.yml

Lines changed: 0 additions & 28 deletions
This file was deleted.

.gitignore

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -9,3 +9,5 @@ phpstan.neon
99
testbench.yaml
1010
vendor
1111
node_modules
12+
.phpunit.cache/test-results
13+
phpunit.xml.dist.bak

composer.json

Lines changed: 32 additions & 17 deletions
Original file line numberDiff line numberDiff line change
@@ -18,47 +18,62 @@
1818
"require": {
1919
"php": "^8.1",
2020
"ext-intl": "*",
21-
"illuminate/contracts": "^9.0|^10.0",
22-
"illuminate/support": "^9.0|^10.0",
21+
"illuminate/contracts": "^9.0|^10.0|^11.0",
22+
"illuminate/support": "^9.0|^10.0|^11.0",
2323
"spatie/laravel-package-tools": "^1.14.0",
2424
"stevebauman/location": "^7.0"
2525
},
2626
"require-dev": {
2727
"laravel/pint": "^1.0",
28-
"nunomaduro/collision": "^6.0",
29-
"nunomaduro/larastan": "^2.0.1",
30-
"orchestra/testbench": "^7.0",
31-
"pestphp/pest": "^1.21",
32-
"pestphp/pest-plugin-laravel": "^1.1",
33-
"phpstan/extension-installer": "^1.1",
34-
"phpstan/phpstan-deprecation-rules": "^1.0",
35-
"phpstan/phpstan-phpunit": "^1.0",
36-
"phpunit/phpunit": "^9.5",
28+
"nunomaduro/collision": "^6.0|^7.0|^8.0",
29+
"orchestra/testbench": "^9.0",
30+
"pestphp/pest": "^1.0|^2.0",
31+
"pestphp/pest-plugin-laravel": "^1.0|^2.0",
3732
"spatie/laravel-ray": "^1.26"
3833
},
3934
"autoload": {
4035
"psr-4": {
4136
"GrantHolle\\Timezone\\": "src"
4237
},
43-
"files": ["src/helpers.php"]
38+
"files": [
39+
"src/helpers.php"
40+
]
4441
},
4542
"autoload-dev": {
4643
"psr-4": {
47-
"GrantHolle\\Timezone\\Tests\\": "tests"
44+
"GrantHolle\\Timezone\\Tests\\": "tests",
45+
"Workbench\\App\\": "workbench/app/",
46+
"Workbench\\Database\\Factories\\": "workbench/database/factories/",
47+
"Workbench\\Database\\Seeders\\": "workbench/database/seeders/"
4848
}
4949
},
5050
"scripts": {
51-
"post-autoload-dump": "@php ./vendor/bin/testbench package:discover --ansi",
51+
"post-autoload-dump": [
52+
"@clear",
53+
"@prepare",
54+
"@php ./vendor/bin/testbench package:discover --ansi"
55+
],
5256
"analyse": "vendor/bin/phpstan analyse",
5357
"test": "vendor/bin/pest",
5458
"test-coverage": "vendor/bin/pest --coverage",
55-
"format": "vendor/bin/pint"
59+
"format": "vendor/bin/pint",
60+
"clear": "@php vendor/bin/testbench package:purge-skeleton --ansi",
61+
"prepare": "@php vendor/bin/testbench package:discover --ansi",
62+
"build": "@php vendor/bin/testbench workbench:build --ansi",
63+
"serve": [
64+
"Composer\\Config::disableProcessTimeout",
65+
"@build",
66+
"@php vendor/bin/testbench serve"
67+
],
68+
"lint": [
69+
"@php vendor/bin/pint",
70+
"@php vendor/bin/phpstan analyse"
71+
]
5672
},
5773
"config": {
5874
"sort-packages": true,
5975
"allow-plugins": {
60-
"pestphp/pest-plugin": true,
61-
"phpstan/extension-installer": true
76+
"pestphp/pest-plugin": true
6277
}
6378
},
6479
"extra": {

phpunit.xml.dist

Lines changed: 21 additions & 37 deletions
Original file line numberDiff line numberDiff line change
@@ -1,39 +1,23 @@
11
<?xml version="1.0" encoding="UTF-8"?>
2-
<phpunit
3-
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
4-
xsi:noNamespaceSchemaLocation="vendor/phpunit/phpunit/phpunit.xsd"
5-
backupGlobals="false"
6-
backupStaticAttributes="false"
7-
bootstrap="vendor/autoload.php"
8-
colors="true"
9-
convertErrorsToExceptions="true"
10-
convertNoticesToExceptions="true"
11-
convertWarningsToExceptions="true"
12-
processIsolation="false"
13-
stopOnFailure="false"
14-
executionOrder="random"
15-
failOnWarning="true"
16-
failOnRisky="true"
17-
failOnEmptyTestSuite="true"
18-
beStrictAboutOutputDuringTests="true"
19-
verbose="true"
20-
>
21-
<testsuites>
22-
<testsuite name="GrantHolle Test Suite">
23-
<directory>tests</directory>
24-
</testsuite>
25-
</testsuites>
26-
<coverage>
27-
<include>
28-
<directory suffix=".php">./src</directory>
29-
</include>
30-
<report>
31-
<html outputDirectory="build/coverage"/>
32-
<text outputFile="build/coverage.txt"/>
33-
<clover outputFile="build/logs/clover.xml"/>
34-
</report>
35-
</coverage>
36-
<logging>
37-
<junit outputFile="build/report.junit.xml"/>
38-
</logging>
2+
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd" backupGlobals="false" bootstrap="vendor/autoload.php" colors="true" processIsolation="false" stopOnFailure="false" executionOrder="random" failOnWarning="true" failOnRisky="true" failOnEmptyTestSuite="true" beStrictAboutOutputDuringTests="true" cacheDirectory=".phpunit.cache" backupStaticProperties="false">
3+
<testsuites>
4+
<testsuite name="GrantHolle Test Suite">
5+
<directory>tests</directory>
6+
</testsuite>
7+
</testsuites>
8+
<coverage>
9+
<report>
10+
<html outputDirectory="build/coverage"/>
11+
<text outputFile="build/coverage.txt"/>
12+
<clover outputFile="build/logs/clover.xml"/>
13+
</report>
14+
</coverage>
15+
<logging>
16+
<junit outputFile="build/report.junit.xml"/>
17+
</logging>
18+
<source>
19+
<include>
20+
<directory suffix=".php">./src</directory>
21+
</include>
22+
</source>
3923
</phpunit>

src/Timezone.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ public function timezones(?string $timezone = null): Collection|string
4242
return $zones->get($timezone);
4343
}
4444

45-
public function toLocal(null|Carbon|CarbonImmutable $date, string $format = null): string|CarbonImmutable
45+
public function toLocal(null|Carbon|CarbonImmutable $date, ?string $format = null): string|CarbonImmutable
4646
{
4747
$date = $date ?? now();
4848

@@ -56,7 +56,7 @@ public function toLocal(null|Carbon|CarbonImmutable $date, string $format = null
5656
return $converted->format($format);
5757
}
5858

59-
public function toLocalFormatted(null|Carbon|CarbonImmutable $date, string $format = null): string
59+
public function toLocalFormatted(null|Carbon|CarbonImmutable $date, ?string $format = null): string
6060
{
6161
$date = $date ?? now();
6262

src/helpers.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -20,14 +20,14 @@ function timezone(): string
2020
* Gets a list of all timezones
2121
* or the formatted name of the given timezone
2222
*/
23-
function timezones(string $timezone = null): Collection|string
23+
function timezones(?string $timezone = null): Collection|string
2424
{
2525
return Timezone::timezones($timezone);
2626
}
2727
}
2828

2929
if (!function_exists('to_local_timezone')) {
30-
function to_local_timezone(null|Carbon\Carbon|CarbonImmutable $date, string $format = null): string
30+
function to_local_timezone(null|Carbon\Carbon|CarbonImmutable $date, ?string $format = null): string
3131
{
3232
return Timezone::toLocalFormatted($date, $format);
3333
}

tests/Drivers/LocalTestDriver.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -9,7 +9,6 @@
99

1010
class LocalTestDriver extends Driver
1111
{
12-
1312
protected function process(Request $request): Fluent|false
1413
{
1514
return new Fluent([

tests/LocalConversionTest.php

Lines changed: 0 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -5,8 +5,6 @@
55
use GrantHolle\Timezone\Facades\Timezone;
66
use Illuminate\Support\Facades\Config;
77

8-
uses(\Illuminate\Foundation\Testing\RefreshDatabase::class);
9-
108
it('can detect user timezone', function (string $timezone) {
119
expect(timezone())->toEqual($timezone);
1210
})->with([

0 commit comments

Comments
 (0)