Skip to content

Commit

Permalink
Require PHP 8.4+
Browse files Browse the repository at this point in the history
  • Loading branch information
olvlvl committed Nov 29, 2024
1 parent c06d0af commit c017a82
Show file tree
Hide file tree
Showing 15 changed files with 62 additions and 70 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/code-style.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
uses: shivammathur/setup-php@v2
with:
coverage: none
php-version: "8.2"
php-version: "8.4"
ini-values: memory_limit=-1
tools: phpcs, cs2pr
- name: Run PHP Code Sniffer
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/static-analysis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -14,7 +14,7 @@ jobs:
- name: Install PHP
uses: shivammathur/setup-php@v2
with:
php-version: "8.2"
php-version: "8.4"
ini-values: memory_limit=-1
tools: composer:v2
- name: Cache dependencies
Expand Down
3 changes: 1 addition & 2 deletions .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,6 @@ jobs:
strategy:
matrix:
php-version:
- "8.2"
- "8.4"
steps:
- name: Checkout
Expand Down Expand Up @@ -39,7 +38,7 @@ jobs:
run: make test-coveralls

- name: Upload code coverage
if: ${{ matrix.php-version == '8.2' }}
if: ${{ matrix.php-version == '8.4' }}
env:
COVERALLS_REPO_TOKEN: ${{ secrets.GITHUB_TOKEN }}
run: |
Expand Down
26 changes: 25 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,12 +1,36 @@
# CHANGELOG

## v7.0

### New Requirements

PHP 8.4+

### New features

None

### Deprecated Features

None

### Backward Incompatible Changes

None

### Other changes

None



## v0.6 to v6.0

### New Requirements

PHP 8.2+

### Breaking changes
### Backward Incompatible Changes

- `EngineCollection` has been removed in favor of the new concept of engine providers. The new engine
provider `Mutable` has similar features, in the sense that it can be modified to add more engines.
Expand Down
16 changes: 6 additions & 10 deletions Dockerfile
Original file line number Diff line number Diff line change
@@ -1,16 +1,12 @@
ARG PHP_VERSION=8.2
ARG PHP_VERSION=8.4
FROM php:${PHP_VERSION}-cli-bookworm

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

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 xdebug
fi
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 <<-EOF
Expand Down
9 changes: 2 additions & 7 deletions Makefile
Original file line number Diff line number Diff line change
Expand Up @@ -27,12 +27,7 @@ test-coveralls: test-dependencies
@$(PHPUNIT) --coverage-clover build/logs/clover.xml

.PHONY: test-container
test-container: test-container-82

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

.PHONY: test-container-84
test-container-84:
Expand All @@ -41,5 +36,5 @@ test-container-84:

.PHONY: lint
lint:
@XDEBUG_MODE=off phpcs -s
@#XDEBUG_MODE=off phpcs -s
@XDEBUG_MODE=off vendor/bin/phpstan
3 changes: 1 addition & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,8 +26,7 @@
"minimum-stability": "dev",
"prefer-stable": true,
"require": {
"php": ">=8.2",
"icanboogie/accessor": "^6.0",
"php": ">=8.4",
"psr/container": "^2.0"
},
"require-dev": {
Expand Down
13 changes: 1 addition & 12 deletions docker-compose.yaml
Original file line number Diff line number Diff line change
@@ -1,21 +1,10 @@
---
services:
app82:
build:
context: .
args:
PHP_VERSION: "8.2"
environment:
PHP_IDE_CONFIG: 'serverName=icanboogie-render'
volumes:
- .:/app:delegated
- ~/.composer:/root/.composer:delegated
working_dir: /app
app84:
build:
context: .
args:
PHP_VERSION: "8.4.0RC4"
PHP_VERSION: "8.4"
environment:
PHP_IDE_CONFIG: 'serverName=icanboogie-render'
volumes:
Expand Down
2 changes: 1 addition & 1 deletion lib/Engine.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@ interface Engine
/**
* The pathname of the template being rendered.
*/
public const VAR_TEMPLATE_PATHNAME = '__TEMPLATE_PATHNAME__';
public const string VAR_TEMPLATE_PATHNAME = '__TEMPLATE_PATHNAME__';

/**
* Renders a template.
Expand Down
2 changes: 1 addition & 1 deletion lib/ExtensionResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@

final class ExtensionResolver
{
public const EXTENSION_DOT = '.';
public const string EXTENSION_DOT = '.';

public static function resolve(string $pathname): ?string
{
Expand Down
2 changes: 1 addition & 1 deletion lib/PHPEngine.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,7 +21,7 @@
*/
final class PHPEngine implements Engine
{
private const FORBIDDEN_VAR_THIS = 'this';
private const string FORBIDDEN_VAR_THIS = 'this';

/**
* @throws Throwable
Expand Down
10 changes: 5 additions & 5 deletions lib/RenderOptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,16 +2,16 @@

namespace ICanBoogie\Render;

final class RenderOptions
final readonly class RenderOptions
{
/**
* @param array<string, mixed> $locals
*/
public function __construct(
public readonly ?string $template = null,
public readonly ?string $partial = null,
public readonly ?string $layout = null,
public readonly array $locals = [],
public ?string $template = null,
public ?string $partial = null,
public ?string $layout = null,
public array $locals = [],
) {
}
}
2 changes: 1 addition & 1 deletion lib/Renderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
class Renderer
{
public const VARIABLE_CONTENT = 'content';
public const string VARIABLE_CONTENT = 'content';

/**
* @var string[]
Expand Down
39 changes: 15 additions & 24 deletions lib/TemplateName.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,6 @@

namespace ICanBoogie\Render;

use ICanBoogie\Accessor\AccessorTrait;
use ICanBoogie\ActiveRecord\Query;

use function basename;
Expand All @@ -13,24 +12,13 @@

/**
* Representation of a template name.
*
* @property-read string $as_template Name as template name.
* @property-read string $as_partial Name as partial name.
* @property-read string $as_layout Name as layout name.
*/
final class TemplateName
{
/**
* @uses get_as_template
* @uses get_as_partial
* @uses get_as_layout
*/
use AccessorTrait;

public const TEMPLATE_PREFIX_VIEW = '';
public const TEMPLATE_PREFIX_LAYOUT = '@';
public const TEMPLATE_PREFIX_PARTIAL = '_';
public const TEMPLATE_NAMESPACE_SEPARATOR = '/';
public const string TEMPLATE_PREFIX_VIEW = '';
public const string TEMPLATE_PREFIX_LAYOUT = '@';
public const string TEMPLATE_PREFIX_PARTIAL = '_';
public const string TEMPLATE_NAMESPACE_SEPARATOR = '/';

/**
* @var array<string, self>
Expand Down Expand Up @@ -82,25 +70,28 @@ public static function normalize(string $name): string
return $basename;
}

private function get_as_template(): string
/**
* Template name.
*/
public string $as_template

Check failure on line 76 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

There must not be more than one property declared per statement
{
return $this->name;
get => $this->name;

Check failure on line 78 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

Visibility must be declared on property "$this"
}

/**
* Returns the name as partial name.
* Partial template name.
*/
private function get_as_partial(): string
public string $as_partial

Check failure on line 84 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

There must not be more than one property declared per statement
{
return $this->with_prefix(self::TEMPLATE_PREFIX_PARTIAL);
get => $this->with_prefix(self::TEMPLATE_PREFIX_PARTIAL);

Check failure on line 86 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

Visibility must be declared on property "$this"
}

/**
* Returns the name as layout name.
* Layout template name.
*/
protected function get_as_layout(): string
public string $as_layout

Check failure on line 92 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

There must not be more than one property declared per statement
{
return $this->with_prefix(self::TEMPLATE_PREFIX_LAYOUT);
get => $this->with_prefix(self::TEMPLATE_PREFIX_LAYOUT);

Check failure on line 94 in lib/TemplateName.php

View workflow job for this annotation

GitHub Actions / phpcs

Visibility must be declared on property "$this"
}

/**
Expand Down
1 change: 0 additions & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,6 @@ parameters:
- lib
- tests
ignoreErrors:
- '#.+get_.+is unused.#'
- message: "/::provide_.+ in iterable type array/"
path: tests/
excludePaths:
Expand Down

0 comments on commit c017a82

Please sign in to comment.