Skip to content

Commit

Permalink
Remove PHP 7.4 and PHP 8.0 support
Browse files Browse the repository at this point in the history
  • Loading branch information
loevgaard committed May 14, 2024
1 parent 87a93b4 commit 95c0584
Show file tree
Hide file tree
Showing 21 changed files with 107 additions and 217 deletions.
30 changes: 0 additions & 30 deletions .editorconfig
Original file line number Diff line number Diff line change
@@ -1,42 +1,12 @@
root = true

[*]
# Change these settings to your own preference
indent_style = space
indent_size = 4

# We recommend you to keep these unchanged
end_of_line = lf
charset = utf-8
trim_trailing_whitespace = true
insert_final_newline = true


[*.json]
indent_style = space
indent_size = 2

[*.md]
indent_style = space
indent_size = 4
trim_trailing_whitespace = false

[*.neon]
indent_style = tab
indent_size = 4

[*.php]
indent_style = space
indent_size = 4

[composer.json]
indent_style = space
indent_size = 4

[phpstan.neon]
indent_style = tab
indent_size = 4

[phpunit.xml{,.dist}]
indent_style = space
indent_size = 4
57 changes: 28 additions & 29 deletions .github/workflows/build.yaml
Original file line number Diff line number Diff line change
Expand Up @@ -15,14 +15,14 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.1"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -32,7 +32,7 @@ jobs:
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand All @@ -45,6 +45,9 @@ jobs:
- name: "Check style"
run: "composer check-style"

- name: "Rector"
run: "vendor/bin/rector process --dry-run"

dependency-analysis:
name: "Dependency Analysis"

Expand All @@ -53,17 +56,17 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -74,15 +77,15 @@ jobs:
tools: "composer-require-checker, composer-unused"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run maglnet/composer-require-checker"
run: "composer-require-checker check"

- name: "Run composer-unused/composer-unused"
run: "composer-unused || true" # TODO Remove when https://github.com/shivammathur/setup-php/issues/703 is fixed
run: "composer-unused"

static-code-analysis:
name: "Static Code Analysis"
Expand All @@ -92,17 +95,17 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -112,7 +115,7 @@ jobs:
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand All @@ -127,18 +130,17 @@ jobs:
strategy:
matrix:
php-version:
- "7.4"
- "8.0"
- "8.1"
- "8.2"
- "8.3"

dependencies:
- "lowest"
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -148,12 +150,12 @@ jobs:
coverage: "none"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Run phpunit"
run: "vendor/bin/phpunit --no-coverage"
run: "vendor/bin/phpunit"

code-coverage:
name: "Code Coverage"
Expand All @@ -163,14 +165,14 @@ jobs:
strategy:
matrix:
php-version:
- "8.2"
- "8.3"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -179,21 +181,18 @@ jobs:
extensions: "${{ env.PHP_EXTENSIONS }}"
php-version: "${{ matrix.php-version }}"

- name: "Set up problem matchers for phpunit/phpunit"
run: "echo \"::add-matcher::${{ runner.tool_cache }}/phpunit.json\""

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

- name: "Collect code coverage with pcov and phpunit/phpunit"
run: "vendor/bin/phpunit --coverage-clover=.build/logs/clover.xml"

- name: "Send code coverage report to Codecov.io"
env:
CODECOV_TOKEN: "${{ secrets.CODECOV_TOKEN }}"
run: "bash <(curl -s https://codecov.io/bash)"
uses: "codecov/codecov-action@v4"
with:
token: "${{ secrets.CODECOV_TOKEN }}"

mutation-tests:
name: "Mutation tests"
Expand All @@ -203,14 +202,14 @@ jobs:
strategy:
matrix:
php-version:
- "8.2"
- "8.3"

dependencies:
- "highest"

steps:
- name: "Checkout"
uses: "actions/checkout@v3"
uses: "actions/checkout@v4"

- name: "Setup PHP, with composer and extensions"
uses: "shivammathur/setup-php@v2"
Expand All @@ -220,7 +219,7 @@ jobs:
php-version: "${{ matrix.php-version }}"

- name: "Install composer dependencies"
uses: "ramsey/composer-install@v2"
uses: "ramsey/composer-install@v3"
with:
dependency-versions: "${{ matrix.dependencies }}"

Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
/vendor/
/composer.lock
/.phpunit.result.cache
/build/
/.build/
2 changes: 1 addition & 1 deletion LICENSE
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
MIT License

Copyright (c) 2022 Setono
Copyright (c) 2024 Setono

Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
Expand Down
6 changes: 3 additions & 3 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,7 @@
}
],
"require": {
"php": ">=7.4",
"php": ">=8.1",
"ext-hash": "*",
"psr/event-dispatcher": "^1.0",
"psr/log": "^1.1 || ^2.0 || ^3.0",
Expand All @@ -20,7 +20,7 @@
"infection/infection": "^0.26",
"phpunit/phpunit": "^9.6",
"psalm/plugin-phpunit": "^0.18",
"setono/code-quality-pack": "^2.4"
"setono/code-quality-pack": "^2.7"
},
"prefer-stable": true,
"autoload": {
Expand All @@ -35,8 +35,8 @@
},
"config": {
"allow-plugins": {
"ergebnis/composer-normalize": true,
"dealerdirect/phpcodesniffer-composer-installer": false,
"ergebnis/composer-normalize": true,
"infection/extension-installer": true
},
"sort-packages": true
Expand Down
7 changes: 3 additions & 4 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,11 @@

declare(strict_types=1);

use Symfony\Component\DependencyInjection\Loader\Configurator\ContainerConfigurator;
use Symplify\EasyCodingStandard\ValueObject\Option;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ContainerConfigurator $config): void {
return static function (ECSConfig $config): void {
$config->import('vendor/sylius-labs/coding-standard/ecs.php');
$config->parameters()->set(Option::PATHS, [
$config->paths([
'src', 'tests'
]);
};
9 changes: 0 additions & 9 deletions psalm-baseline.xml

This file was deleted.

5 changes: 4 additions & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -3,9 +3,12 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
findUnusedBaselineEntry="false"
findUnusedCode="false"
findUnusedPsalmSuppress="true"
findUnusedVariablesAndParams="false"
errorLevel="1"
phpVersion="8.1"
errorBaseline="psalm-baseline.xml"
>
<projectFiles>
<directory name="src"/>
Expand Down
21 changes: 21 additions & 0 deletions rector.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use Rector\Caching\ValueObject\Storage\FileCacheStorage;
use Rector\Config\RectorConfig;
use Rector\Set\ValueObject\LevelSetList;

return static function (RectorConfig $rectorConfig): void {
$rectorConfig->cacheClass(FileCacheStorage::class);
$rectorConfig->cacheDirectory('./.build/rector');

$rectorConfig->paths([
__DIR__ . '/src',
__DIR__ . '/tests',
]);

$rectorConfig->sets([
LevelSetList::UP_TO_PHP_81
]);
};
5 changes: 1 addition & 4 deletions src/Event/PreTagAddedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,7 @@
*/
final class PreTagAddedEvent
{
public TagInterface $tag;

public function __construct(TagInterface $tag)
public function __construct(public readonly TagInterface $tag)
{
$this->tag = $tag;
}
}
14 changes: 4 additions & 10 deletions src/Event/TagAddedEvent.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,15 +12,9 @@
*/
final class TagAddedEvent
{
/** @readonly */
public RenderedTag $tag;

/** @readonly */
public TagBagInterface $tagBag;

public function __construct(RenderedTag $tag, TagBagInterface $tagBag)
{
$this->tag = $tag;
$this->tagBag = $tagBag;
public function __construct(
public readonly RenderedTag $tag,
public readonly TagBagInterface $tagBag,
) {
}
}
2 changes: 1 addition & 1 deletion src/Exception/UnsupportedTagException.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,6 @@ final class UnsupportedTagException extends InvalidArgumentException
{
public function __construct(TagInterface $tag)
{
parent::__construct(sprintf('The tag %s is not supported', get_class($tag)));
parent::__construct(sprintf('The tag %s is not supported', $tag::class));
}
}
Loading

0 comments on commit 95c0584

Please sign in to comment.