Skip to content

Commit

Permalink
Requires PHP 8.2+
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Jan 20, 2024
1 parent cb14608 commit f4a1887
Show file tree
Hide file tree
Showing 13 changed files with 81 additions and 67 deletions.
6 changes: 3 additions & 3 deletions .github/workflows/code-style.yml
Expand Up @@ -6,15 +6,15 @@ on:

jobs:
phpcs:
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "8.1"
php-version: "8.3"
ini-values: memory_limit=-1
tools: phpcs, cs2pr
- name: Run PHP Code Sniffer
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/static-analysis.yml
Expand Up @@ -7,18 +7,18 @@ on:
jobs:
phpstan:
name: phpstan
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.1"
php-version: "8.3"
ini-values: memory_limit=-1
tools: composer:v2
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.composer/cache
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/test.yml
Expand Up @@ -7,15 +7,15 @@ on:
jobs:
phpunit:
name: phpunit
runs-on: ubuntu-20.04
runs-on: ubuntu-latest
strategy:
matrix:
php-version:
- "8.1"
- "8.2"
- "8.3"
steps:
- name: Checkout
uses: actions/checkout@v2
uses: actions/checkout@v4
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
Expand All @@ -25,7 +25,7 @@ jobs:
tools: composer:v2
extensions: apcu
- name: Cache dependencies
uses: actions/cache@v2
uses: actions/cache@v4
with:
path: |
~/.composer/cache
Expand All @@ -40,7 +40,7 @@ jobs:
run: make test-coveralls

- name: Upload code coverage
if: ${{ matrix.php-version == '8.1' }}
if: ${{ matrix.php-version == '8.3' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
48 changes: 28 additions & 20 deletions Dockerfile
@@ -1,30 +1,38 @@
ARG PHP_VERSION
FROM php:${PHP_VERSION}-cli-buster
FROM php:${PHP_VERSION}-cli-bookworm

RUN apt-get update && \
apt-get install -y autoconf pkg-config && \
pecl channel-update pecl.php.net && \
pecl install xdebug && \
RUN <<-EOF
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
EOF

RUN echo '\
xdebug.client_host=host.docker.internal\n\
xdebug.mode=develop\n\
xdebug.start_with_request=yes\n\
' >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
RUN <<-EOF
cat <<-SHELL >> /usr/local/etc/php/conf.d/docker-php-ext-xdebug.ini
xdebug.client_host=host.docker.internal
xdebug.mode=develop
xdebug.start_with_request=yes
SHELL

RUN echo '\
display_errors=On\n\
error_reporting=E_ALL\n\
date.timezone=UTC\n\
' >> /usr/local/etc/php/conf.d/php.ini
cat <<-SHELL >> /usr/local/etc/php/conf.d/php.ini
display_errors=On
error_reporting=E_ALL
date.timezone=UTC
SHELL
EOF

ENV COMPOSER_ALLOW_SUPERUSER 1

RUN apt-get update && \
apt-get install unzip && \
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet && \
mv composer.phar /usr/local/bin/composer && \
echo 'export PATH="$HOME/.composer/vendor/bin:$PATH"\n' >> /root/.bashrc
RUN <<-EOF
apt-get update
apt-get install unzip
curl -s https://raw.githubusercontent.com/composer/getcomposer.org/76a7060ccb93902cd7576b67264ad91c8a2700e2/web/installer | php -- --quiet
mv composer.phar /usr/local/bin/composer
cat <<-SHELL >> /root/.bashrc
export PATH="$HOME/.composer/vendor/bin:$PATH"
SHELL
EOF

RUN composer global require squizlabs/php_codesniffer
2 changes: 1 addition & 1 deletion LICENSE
@@ -1,7 +1,7 @@
The ICanBoogie framework is free software.
It is released under the terms of the following BSD License.

Copyright (c) 2007-2023 by Olivier Laviale
Copyright (c) 2007-present by Olivier Laviale
All rights reserved.

Redistribution and use in source and binary forms, with or without modification,
Expand Down
4 changes: 4 additions & 0 deletions MIGRATION.md
Expand Up @@ -2,6 +2,10 @@

## v5.x to v6.0

### New Requirements

- PHP 8.2+

### New features

- Added `AppConfigBuilder`.
Expand Down
12 changes: 6 additions & 6 deletions Makefile
Expand Up @@ -37,18 +37,18 @@ test-cleanup:
@rm -rf tests/lib/sandbox/*

.PHONY: test-container
test-container: test-container-81

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

.PHONY: test-container-82
test-container-82:
@-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 -v

.PHONY: lint
lint:
@XDEBUG_MODE=off phpcs -s
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Expand Up @@ -26,7 +26,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.1",
"php": ">=8.2",
"ext-json": "*",
"icanboogie/bind-event": "^6.0",
"icanboogie/bind-http": "^6.0",
Expand All @@ -42,7 +42,7 @@
"require-dev": {
"composer/composer": "^2.0",
"phpstan/phpstan": "^1.10",
"phpunit/phpunit": "^10.0"
"phpunit/phpunit": "^10.5"
},
"suggest": {
"icanboogie/bind-activerecord": "ActiveRecord Object-relational mapping.",
Expand Down
8 changes: 4 additions & 4 deletions docker-compose.yaml
@@ -1,22 +1,22 @@
---
version: "3.2"
services:
app81:
app82:
build:
context: .
args:
PHP_VERSION: "8.1"
PHP_VERSION: "8.2"
environment:
PHP_IDE_CONFIG: 'serverName=icanboogie'
volumes:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app
app82:
app83:
build:
context: .
args:
PHP_VERSION: "8.2"
PHP_VERSION: "8.3"
environment:
PHP_IDE_CONFIG: 'serverName=icanboogie'
volumes:
Expand Down
2 changes: 2 additions & 0 deletions lib/AppAccessor.php
Expand Up @@ -15,6 +15,8 @@
* Accessor for the `$app` property.
*
* @property-read Application $app
*
* @deprecated Use dependency injection instead
*/
trait AppAccessor
{
Expand Down
28 changes: 14 additions & 14 deletions lib/AppConfig.php
Expand Up @@ -15,7 +15,7 @@

use const DIRECTORY_SEPARATOR;

final class AppConfig
final readonly class AppConfig
{
public const DEFAULT_DIRECTORY_FOR_VAR = 'var';
public const DEFAULT_DIRECTORY_FOR_CACHE = 'cache';
Expand All @@ -38,42 +38,42 @@ public static function __set_state(array $an_array): self
* @var non-empty-string
*/

public readonly string $var;
public string $var;

/**
* This directory used to store cache data.
*
* @var non-empty-string
*/
public readonly string $var_cache;
public string $var_cache;

/**
* This directory used to store cache config data.
*
* @var non-empty-string
*/
public readonly string $var_cache_configs;
public string $var_cache_configs;

/**
* This directory used to store files.
*
* @var non-empty-string
*/
public readonly string $var_files;
public string $var_files;

/**
* The directory used to store state information.
*
* @var non-empty-string
*/
public readonly string $var_lib;
public string $var_lib;

/**
* This directory used to store temporary files.
*
* @var non-empty-string
*/
public readonly string $var_tmp;
public string $var_tmp;

/**
* @param bool $cache_catalogs
Expand Down Expand Up @@ -152,19 +152,19 @@ public static function __set_state(array $an_array): self
* Session parameters.
*/
public function __construct(
public readonly bool $cache_catalogs = false,
public readonly bool $cache_configs = false,
public readonly mixed $storage_for_config = null,
public readonly mixed $storage_for_vars = null,
public readonly mixed $error_handler = null,
public readonly mixed $exception_handler = null,
public bool $cache_catalogs = false,
public bool $cache_configs = false,
public mixed $storage_for_config = null,
public mixed $storage_for_vars = null,
public mixed $error_handler = null,
public mixed $exception_handler = null,
?string $var = null,
?string $var_cache = null,
?string $var_cache_configs = null,
?string $var_files = null,
?string $var_lib = null,
?string $var_tmp = null,
public readonly array $session = [],
public array $session = [],
) {
$this->var = $var = $this->ensure_trailing_separator(
$var ?? self::DEFAULT_DIRECTORY_FOR_VAR
Expand Down
4 changes: 2 additions & 2 deletions lib/Debug/Config.php
Expand Up @@ -11,7 +11,7 @@

namespace ICanBoogie\Debug;

final class Config
final readonly class Config
{
/**
* @param array<string, mixed> $an_array
Expand All @@ -22,7 +22,7 @@ public static function __set_state(array $an_array): self
}

public function __construct(
public readonly string $mode = 'dev',
public string $mode = 'dev',
) {
}
}
12 changes: 6 additions & 6 deletions phpunit.xml
@@ -1,14 +1,14 @@
<?xml version="1.0" encoding="UTF-8"?>
<?xml version="1.0"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.3/phpunit.xsd"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
executionOrder="depends,defects"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
beStrictAboutCoverageMetadata="true"
beStrictAboutOutputDuringTests="true"
bootstrap="tests/bootstrap.php"
cacheDirectory=".phpunit.cache"
colors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
executionOrder="depends,defects"
>
<coverage/>
<testsuites>
<testsuite name="icanboogie/icanboogie">
<directory>tests</directory>
Expand Down

0 comments on commit f4a1887

Please sign in to comment.