From 18067e121a1f9dff14a9698b332c9ae99896e9c4 Mon Sep 17 00:00:00 2001 From: Adrian Suter Date: Wed, 18 Jan 2023 08:17:00 +0100 Subject: [PATCH 1/2] Drop support for php 7. --- LICENSE | 2 +- composer.json | 10 +++++----- phpunit.xml.dist | 2 +- src/CacheBusters/DictionaryCacheBuster.php | 2 +- src/CacheBusters/FileNameCacheBuster.php | 4 ++-- src/CacheBusters/QueryParamCacheBuster.php | 8 ++++---- src/CacheBustingTokenParser.php | 10 +++++----- src/CacheBustingTwigExtension.php | 6 +++--- src/Dictionaries/ArrayDictionary.php | 3 +-- 9 files changed, 23 insertions(+), 24 deletions(-) diff --git a/LICENSE b/LICENSE index 646ac6b..dd74d57 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ MIT License -Copyright (c) 2019 Adrian Suter +Copyright (c) 2023 Adrian Suter Permission is hereby granted, free of charge, to any person obtaining a copy of this software and associated documentation files (the "Software"), to deal diff --git a/composer.json b/composer.json index b5402b0..126c7d3 100644 --- a/composer.json +++ b/composer.json @@ -16,14 +16,14 @@ } ], "require": { - "php": "^7.3 || ^8", - "twig/twig": ">=2.11 || ^3" + "php": "^8", + "twig/twig": "^3.5" }, "require-dev": { - "phpunit/phpunit": "^9.3", + "phpunit/phpunit": "^9.5", "phpspec/prophecy-phpunit": "^2.0", - "phpstan/phpstan": "^0.12.80 || ^1.0.0", - "squizlabs/php_codesniffer": "^3.5" + "phpstan/phpstan": "^1.9", + "squizlabs/php_codesniffer": "^3.7" }, "autoload": { "psr-4": { diff --git a/phpunit.xml.dist b/phpunit.xml.dist index efdeea2..00a99bf 100644 --- a/phpunit.xml.dist +++ b/phpunit.xml.dist @@ -1,6 +1,6 @@ endPointDirectory.'/'.$path; + $filePath = $this->endPointDirectory . '/' . $path; $bustPath = $path; $hash = $this->hashGenerator->generate($filePath); if ($hash !== null) { - $bustPath .= '?h='.urlencode($hash); + $bustPath .= '?h=' . urlencode($hash); } return $bustPath; diff --git a/src/CacheBustingTokenParser.php b/src/CacheBustingTokenParser.php index 494326b..b3aebc4 100644 --- a/src/CacheBustingTokenParser.php +++ b/src/CacheBustingTokenParser.php @@ -15,17 +15,17 @@ class CacheBustingTokenParser extends AbstractTokenParser /** * @var CacheBusterInterface */ - private $cacheBuster; + protected CacheBusterInterface $cacheBuster; /** * @var string */ - private $basePath; + protected string $basePath; /** * @var string */ - private $twigTag; + protected string $twigTag; /** * @param CacheBusterInterface $cacheBuster @@ -64,12 +64,12 @@ private function buildPath(string $path): string if ($this->basePath === '') { $basePath = ''; } elseif ($this->basePath[0] !== '/') { - $basePath = '/'.$this->basePath; + $basePath = '/' . $this->basePath; } else { $basePath = $this->basePath; } - return $basePath.'/'.$this->cacheBuster->bust($path); + return $basePath . '/' . $this->cacheBuster->bust($path); } /** diff --git a/src/CacheBustingTwigExtension.php b/src/CacheBustingTwigExtension.php index dcee9d0..696418e 100644 --- a/src/CacheBustingTwigExtension.php +++ b/src/CacheBustingTwigExtension.php @@ -13,7 +13,7 @@ class CacheBustingTwigExtension extends AbstractExtension /** * @var CacheBustingTokenParser */ - private $tokenParser; + protected CacheBustingTokenParser $tokenParser; /** * Create a Cache Busting Twig Extension. @@ -43,9 +43,9 @@ public function __construct(CacheBustingTokenParser $tokenParser) } /** - * @return array|TokenParserInterface[] + * @return TokenParserInterface[] */ - public function getTokenParsers() + public function getTokenParsers(): array { return [ $this->tokenParser, diff --git a/src/Dictionaries/ArrayDictionary.php b/src/Dictionaries/ArrayDictionary.php index e5ab631..dc52e60 100644 --- a/src/Dictionaries/ArrayDictionary.php +++ b/src/Dictionaries/ArrayDictionary.php @@ -11,7 +11,7 @@ class ArrayDictionary implements DictionaryInterface /** * @var array */ - private $data; + protected array $data; /** * @param array $data @@ -21,7 +21,6 @@ public function __construct(array $data = []) $this->data = $data; } - /** * @inheritDoc */ From 60fda04df26e871ad832c8eb0020dfe2261a40de Mon Sep 17 00:00:00 2001 From: Adrian Suter Date: Wed, 18 Jan 2023 08:19:14 +0100 Subject: [PATCH 2/2] Drop support for php 7. --- .github/workflows/tests.yml | 2 +- 1 file changed, 1 insertion(+), 1 deletion(-) diff --git a/.github/workflows/tests.yml b/.github/workflows/tests.yml index de6fce5..dd11624 100644 --- a/.github/workflows/tests.yml +++ b/.github/workflows/tests.yml @@ -10,7 +10,7 @@ jobs: strategy: fail-fast: false matrix: - php: [7.3, 7.4, 8.0, 8.1, 8.2] + php: [8.0, 8.1, 8.2] experimental: [false] include: - php: 8.1