Skip to content

Commit 3157ad6

Browse files
authored
Merge pull request #474 from cakephp/fix-php94
Allow float timestamp for createFromTimestamp() to match php
2 parents b0321ab + 9972225 commit 3157ad6

3 files changed

Lines changed: 7 additions & 10 deletions

File tree

.github/workflows/ci.yml

Lines changed: 4 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,8 @@ jobs:
1717
strategy:
1818
fail-fast: false
1919
matrix:
20-
php-version: ['7.4', '8.0', '8.1', '8.2']
20+
php-version: ['8.4']
2121
prefer-lowest: ['']
22-
include:
23-
- php-version: '7.2'
24-
prefer-lowest: 'prefer-lowest'
2522

2623
steps:
2724
- uses: actions/checkout@v4
@@ -56,19 +53,19 @@ jobs:
5653
fi
5754
5855
- name: Setup problem matchers for PHPUnit
59-
if: matrix.php-version == '7.4'
56+
if: matrix.php-version == '8.4'
6057
run: echo "::add-matcher::${{ runner.tool_cache }}/phpunit.json"
6158

6259
- name: Run PHPUnit
6360
run: |
64-
if [[ ${{ matrix.php-version }} == '7.4' ]]; then
61+
if [[ ${{ matrix.php-version }} == '8.4' ]]; then
6562
export CODECOVERAGE=1 && vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
6663
else
6764
vendor/bin/phpunit
6865
fi
6966
7067
- name: Submit code coverage
71-
if: matrix.php-version == '7.4'
68+
if: matrix.php-version == '8.4'
7269
uses: codecov/codecov-action@v3
7370

7471
cs-stan:

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@
2525
"source": "https://github.com/cakephp/chronos"
2626
},
2727
"require": {
28-
"php": ">=7.2"
28+
"php": ">=8.0"
2929
},
3030
"require-dev": {
3131
"phpunit/phpunit": "^8.0 || ^9.0",

src/Traits/FactoryTrait.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -332,11 +332,11 @@ public static function createFromArray(array $values): ChronosInterface
332332
/**
333333
* Create a ChronosInterface instance from a timestamp
334334
*
335-
* @param int $timestamp The timestamp to create an instance from.
335+
* @param float|int $timestamp The timestamp to create an instance from.
336336
* @param \DateTimeZone|string|null $tz The DateTimeZone object or timezone name the new instance should use.
337337
* @return static
338338
*/
339-
public static function createFromTimestamp(int $timestamp, $tz = null): ChronosInterface
339+
public static function createFromTimestamp(float|int $timestamp, $tz = null): ChronosInterface
340340
{
341341
$instance = static::now($tz)->setTimestamp($timestamp);
342342
if (get_class($instance) === ChronosDate::class) {

0 commit comments

Comments
 (0)