Skip to content

Commit

Permalink
Support PHP 8.4.0RC3
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 2, 2024
1 parent 454dd86 commit 1d510d5
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 15 deletions.
1 change: 1 addition & 0 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,6 +13,7 @@ jobs:
php-version:
- "8.2"
- "8.3"
- "8.4"
steps:
- name: Checkout
uses: actions/checkout@v4
Expand Down
8 changes: 7 additions & 1 deletion Dockerfile
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,17 @@ ARG PHP_VERSION=8.2
FROM php:${PHP_VERSION}-cli-bookworm

RUN <<-EOF
docker-php-ext-enable opcache

PHP_VERSION=$(php -v | grep -oP '(?<=PHP )\d+\.\d+')

if [[ $PHP_VERSION < "8.4" ]]; then
apt-get update
apt-get install -y autoconf pkg-config
pecl channel-update pecl.php.net
pecl install xdebug
docker-php-ext-enable opcache xdebug
docker-php-ext-enable xdebug
fi
EOF

RUN <<-EOF
Expand Down
13 changes: 9 additions & 4 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -31,10 +31,15 @@ test-container: test-container-82

.PHONY: test-container-82
test-container-82:
@docker-compose run --rm app82 bash
@docker-compose down
@-docker-compose run --rm app82 bash
@docker-compose down -v

.PHONY: test-container-83
test-container-83:
@docker-compose run --rm app83 bash
@docker-compose down
@-docker-compose run --rm app83 bash
@docker-compose down -v

.PHONY: test-container-84
test-container-84:
@-docker-compose run --rm app84 bash
@docker-compose down -v
11 changes: 11 additions & 0 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -22,3 +22,14 @@ services:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app
app84:
build:
context: .
args:
PHP_VERSION: "8.4.0RC3"
environment:
PHP_IDE_CONFIG: "serverName=icanboogie-datetime"
volumes:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app
12 changes: 2 additions & 10 deletions lib/DateTime.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,6 @@
namespace ICanBoogie;

use DateTimeZone;
use RuntimeException;

/**
* Representation of a date and time.
Expand Down Expand Up @@ -159,13 +158,6 @@
*/
class DateTime extends \DateTime implements \JsonSerializable
{
/**
* We redefine the constant to make sure that the cookie uses a valid pattern.
*
* @link http://grokbase.com/t/php/php-bugs/111xynxd6m/php-bug-bug-53879-new-datetime-createfromformat-fails-to-parse-cookie-expiration-date
*/
public const COOKIE = 'l, d-M-Y H:i:s T';

/**
* DB (example: 2013-02-03 20:59:03)
*/
Expand Down Expand Up @@ -776,15 +768,15 @@ public function format($format): string
*
* @return mixed
*
* @throws RuntimeException if {@see $localizer} is not defined.
* @throws \RuntimeException if {@see $localizer} is not defined.
*/
public function localize(string $locale = 'en')
{
$localizer = self::$localizer;

if (!$localizer)
{
throw new RuntimeException("Localizer is not defined yet.");
throw new \RuntimeException("Localizer is not defined yet.");
}

return $localizer($this, $locale);
Expand Down

0 comments on commit 1d510d5

Please sign in to comment.