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 b33f5a0
Show file tree
Hide file tree
Showing 13 changed files with 52 additions and 114 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
54 changes: 25 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 @@ -53,17 +53,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 +74,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 +92,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 +112,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 +127,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 +147,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 +162,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 +178,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 +199,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 +216,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 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
2 changes: 1 addition & 1 deletion src/Renderer/ElementRenderer.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ public function render(TagInterface $tag): string
$tag->getElement(),
$this->renderAttributes($tag),
$tag->getContent(),
$tag->getElement()
$tag->getElement(),
);
}

Expand Down
1 change: 0 additions & 1 deletion src/Tag/ElementTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,6 @@
class ElementTag extends Tag implements AttributesAwareInterface, ContentAwareInterface
{
use AttributesAwareTrait;

use ContentAwareTrait;

protected string $element;
Expand Down
32 changes: 6 additions & 26 deletions src/Tag/RenderedTag.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,33 +14,13 @@
*/
final class RenderedTag
{
/** @readonly */
public string $value;

/** @readonly */
public string $section;

/** @readonly */
public int $priority;

/** @readonly */
public bool $unique;

/** @readonly */
public string $fingerprint;

private function __construct(
string $value,
string $section,
int $priority,
bool $unique,
string $fingerprint
public readonly string $value,
public readonly string $section,
public readonly int $priority,
public readonly bool $unique,
public readonly string $fingerprint,
) {
$this->value = $value;
$this->section = $section;
$this->priority = $priority;
$this->unique = $unique;
$this->fingerprint = $fingerprint;
}

public static function createFromTag(TagInterface $tag, string $value, string $fingerprint): self
Expand All @@ -50,7 +30,7 @@ public static function createFromTag(TagInterface $tag, string $value, string $f
$tag->getSection(),
$tag->getPriority(),
$tag->isUnique(),
$fingerprint
$fingerprint,
);
}

Expand Down
2 changes: 0 additions & 2 deletions src/TagBag.php
Original file line number Diff line number Diff line change
Expand Up @@ -261,7 +261,6 @@ private function unserialize(string $data): array

$serializationException = new SerializationException(sprintf('Could not unserialize data: %s.', $data));
$prevUnserializeHandler = ini_set('unserialize_callback_func', self::class . '::handleUnserializeCallback');
/** @psalm-suppress MixedArgumentTypeCoercion */
$prevErrorHandler = set_error_handler(static function ($type, $msg, $file, $line, $context = []) use (&$prevErrorHandler, $serializationException) {

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.1, lowest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.1, lowest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.1, highest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.1, highest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.2, lowest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.2, lowest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.2, highest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.2, highest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.3, lowest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.3, lowest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.3, highest)

MixedArgument

src/TagBag.php:264:47: MixedArgument: Argument 1 of set_error_handler cannot be mixed, expecting callable(int, string, string=, int=, array<array-key, mixed>=):bool|null (see https://psalm.dev/030)

Check failure on line 264 in src/TagBag.php

View workflow job for this annotation

GitHub Actions / Static Code Analysis (8.3, highest)

UndefinedVariable

src/TagBag.php:264:112: UndefinedVariable: Cannot find referenced variable $prevErrorHandler (see https://psalm.dev/024)
if (__FILE__ === $file) {
throw $serializationException;
Expand All @@ -285,7 +284,6 @@ private function unserialize(string $data): array
/** @psalm-suppress RedundantConditionGivenDocblockType */
Assert::isArray($tags);

/** @psalm-suppress DocblockTypeContradiction */
Assert::allIsInstanceOf($tags, RenderedTag::class);
}
} catch (InvalidArgumentException $e) {
Expand Down
Loading

0 comments on commit b33f5a0

Please sign in to comment.