Skip to content

Commit

Permalink
modernize package
Browse files Browse the repository at this point in the history
  • Loading branch information
freekmurze committed Dec 23, 2024
1 parent 5f23e7d commit 6827981
Show file tree
Hide file tree
Showing 5 changed files with 19 additions and 36 deletions.
10 changes: 2 additions & 8 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -9,20 +9,14 @@ jobs:
fail-fast: true
matrix:
os: [ubuntu-latest, windows-latest]
php: [8.1, 8.0, 7.4]
php: [8.5, 8.4, 8.3]
dependency-version: [prefer-lowest, prefer-stable]

name: P${{ matrix.php }} - ${{ matrix.dependency-version }} - ${{ matrix.os }}

steps:
- name: Checkout code
uses: actions/checkout@v1

- name: Cache dependencies
uses: actions/cache@v1
with:
path: ~/.composer/cache/files
key: php-${{ matrix.php }}-composer-${{ hashFiles('composer.json') }}
uses: actions/checkout@v2

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand Down
1 change: 1 addition & 0 deletions .phpunit.cache/test-results
Original file line number Diff line number Diff line change
@@ -0,0 +1 @@
{"version":"pest_3.7.1","defects":[],"times":{"P\\Tests\\SunTest::__pest_evaluable_it_can_determine_if_the_sun_is_up_now":0.006}}
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,13 +16,13 @@
}
],
"require": {
"php": "^8.0|^7.4",
"nesbot/carbon": "^2.32"
"php": "^8.3",
"nesbot/carbon": "^2.32|^3.0"
},
"require-dev": {
"pestphp/pest": "^1.0",
"spatie/test-time": "^1.2",
"symfony/var-dumper": "^4.3"
"pestphp/pest": "^3.0",
"spatie/test-time": "^1.2|^2.0",
"symfony/var-dumper": "^4.3|^5.0"
},
"autoload": {
"psr-4": {
Expand Down
26 changes: 7 additions & 19 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,28 +1,16 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<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">
<testsuites>
<testsuite name="Spatie Test Suite">
<directory>tests</directory>
</testsuite>
</testsuites>
<filter>
<whitelist>
<directory suffix=".php">src/</directory>
</whitelist>
</filter>
<logging>
<log type="junit" target="build/report.junit.xml"/>
<log type="coverage-html" target="build/coverage"/>
<log type="coverage-text" target="build/coverage.txt"/>
<log type="coverage-clover" target="build/logs/clover.xml"/>
<junit outputFile="build/report.junit.xml"/>
</logging>
<source>
<include>
<directory suffix=".php">./src</directory>
</include>
</source>
</phpunit>
8 changes: 4 additions & 4 deletions src/Sun.php
Original file line number Diff line number Diff line change
Expand Up @@ -17,7 +17,7 @@ public function __construct(float $lat, float $lng)
$this->lng = $lng;
}

public function sunIsUp(Carbon $onDay = null): bool
public function sunIsUp(?Carbon $onDay = null): bool
{
$onDay = $onDay ?? Carbon::now();

Expand All @@ -27,7 +27,7 @@ public function sunIsUp(Carbon $onDay = null): bool
return $onDay->between($sunrise, $sunset);
}

public function sunrise(Carbon $onDay = null): Carbon
public function sunrise(?Carbon $onDay = null): Carbon
{
$onDay = $onDay ?? Carbon::now();

Expand All @@ -40,7 +40,7 @@ public function sunrise(Carbon $onDay = null): Carbon
return Carbon::createFromTimestamp($sunriseTimestamp);
}

public function zenith(Carbon $onDay = null): Carbon
public function zenith(?Carbon $onDay = null): Carbon
{
$onDay = $onDay ?? Carbon::now();

Expand All @@ -53,7 +53,7 @@ public function zenith(Carbon $onDay = null): Carbon
return Carbon::createFromTimestamp($sunTimestamp);
}

public function sunset(Carbon $onDay = null): Carbon
public function sunset(?Carbon $onDay = null): Carbon
{
$onDay = $onDay ?? Carbon::now();

Expand Down

0 comments on commit 6827981

Please sign in to comment.