Skip to content

Commit

Permalink
Merge pull request #170 from mimmi20/updates
Browse files Browse the repository at this point in the history
upgrade to PHP 8.3
  • Loading branch information
mimmi20 authored Dec 3, 2024
2 parents 319deec + c2d3492 commit 9da779d
Show file tree
Hide file tree
Showing 25 changed files with 153 additions and 64 deletions.
12 changes: 6 additions & 6 deletions .codeclimate.yml
Original file line number Diff line number Diff line change
@@ -1,21 +1,21 @@
version: "2"
checks:
argument-count:
enabled: true
enabled: false
complex-logic:
enabled: true
enabled: false
file-lines:
enabled: false
method-complexity:
enabled: true
enabled: false
method-count:
enabled: true
enabled: false
method-lines:
enabled: true
enabled: false
nested-control-flow:
enabled: true
return-statements:
enabled: true
enabled: false
similar-code:
enabled: false
identical-code:
Expand Down
10 changes: 5 additions & 5 deletions .github/workflows/continuous-integration.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
validate:
name: "Validate Project"

uses: "mimmi20/ci/.github/workflows/validate.yml@8.1"
uses: "mimmi20/ci/.github/workflows/validate.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -37,7 +37,7 @@ jobs:

needs: "validate"

uses: "mimmi20/ci/.github/workflows/install.yml@8.1"
uses: "mimmi20/ci/.github/workflows/install.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -50,7 +50,7 @@ jobs:

needs: "install"

uses: "mimmi20/ci/.github/workflows/analytics.yml@8.1"
uses: "mimmi20/ci/.github/workflows/analytics.yml@8.3"
with:
extensions: "ctype, curl, dom, iconv, intl, mbstring, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand All @@ -59,7 +59,7 @@ jobs:
skip-phpcs: false
skip-phpstan: false
skip-rector: false
skip-phpmd: false
skip-phpmd: true
skip-eslint: true
skip-stylelint: true
skip-prettier: true
Expand All @@ -70,7 +70,7 @@ jobs:

needs: "analytics"

uses: "mimmi20/ci/.github/workflows/test.yml@8.1"
uses: "mimmi20/ci/.github/workflows/test.yml@8.3"
with:
extensions: "ctype, dom, fileinfo, intl, simplexml, tokenizer, xml, xmlwriter"
ini-values: "opcache.enable=1, opcache.fast_shutdown=0, zend.assertions=1, assert.exception=On, intl.default_locale=de, intl.use_exceptions=1, zend.exception_ignore_args=0"
Expand Down
6 changes: 4 additions & 2 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,10 +11,12 @@

declare(strict_types = 1);

$header = <<<'EOF'
$year = date('Y');

$header = <<<EOF
This file is part of the mimmi20/laminasviewrenderer-revision package.
Copyright (c) 2023-2024, Thomas Mueller <[email protected]>
Copyright (c) 2023-{$year}, Thomas Mueller <[email protected]>
For the full copyright and license information, please view the LICENSE
file that was distributed with this source code.
Expand Down
13 changes: 13 additions & 0 deletions codecov.yml
Original file line number Diff line number Diff line change
Expand Up @@ -3,6 +3,19 @@ codecov:
notify:
wait_for_ci: false

coverage:
status:
project:
default: # default is the status check's name, not default settings
target: 100%
threshold: 1%
if_ci_failed: success #success, failure, error, ignore
informational: true
only_pulls: false
patch:
default:
informational: true

comment:
layout: "reach, diff, flags, files"
behavior: default
Expand Down
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -16,7 +16,7 @@
"source": "https://github.com/mimmi20/laminasviewrenderer-revision"
},
"require": {
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0 || ~8.5.0",
"php": "~8.3.0 || ~8.4.0 || ~8.5.0",
"ext-json": "*",
"laminas/laminas-uri": "^2.12.0",
"laminas/laminas-view": "^2.36.0",
Expand All @@ -34,16 +34,16 @@
"laminas/laminas-modulemanager": "^2.17.0",
"laminas/laminas-servicemanager": "^3.22.1",
"mikey179/vfsstream": "^1.6.12",
"mimmi20/coding-standard": "^5.2.45",
"mimmi20/coding-standard": "^6.0.0",
"nikic/php-parser": "^5.3.1",
"phpstan/extension-installer": "^1.4.3",
"phpstan/phpstan": "^1.12.9",
"phpstan/phpstan-deprecation-rules": "^1.2.1",
"phpstan/phpstan-phpunit": "^1.4.0",
"phpunit/phpunit": "^10.5.25",
"phpunit/phpunit": "^11.4.4",
"rector/rector": "^1.2.10",
"rector/type-perfect": "^1.0.0",
"symfony/process": "^6.4.15",
"symfony/process": "^7.2.0",
"symplify/phpstan-rules": "^13.0.1",
"tomasvotruba/cognitive-complexity": "^0.2.3",
"tomasvotruba/type-coverage": "^1.0.0",
Expand Down
36 changes: 0 additions & 36 deletions phpmd.ruleset.xml

This file was deleted.

13 changes: 9 additions & 4 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
parameters:
level: 1

phpVersion: 80300 # PHP 8.3

parallel:
maximumNumberOfProcesses: 1
processTimeout: 200.0
Expand Down Expand Up @@ -99,9 +101,10 @@ parameters:
function: 9

type_coverage:
return: 100
param: 97.1
property: 100
return_type: 100
param_type: 97.2
property_type: 100
constant_type: 100
# also, how many files has declare strict types
declare: 100

Expand All @@ -121,7 +124,9 @@ parameters:
# - '~expects array<string, string>, array<string, string\|null> given~'

stubFiles:
- vendor/mimmi20/coding-standard/stubs/psr/container/ContainerInterface.stub
- stubs/psr/container/ContainerExceptionInterface.stub
- stubs/psr/container/NotFoundExceptionInterface.stub
- stubs/psr/container/ContainerInterface.stub

rules:
# code complexity
Expand Down
4 changes: 3 additions & 1 deletion phpunit.xml
Original file line number Diff line number Diff line change
Expand Up @@ -9,12 +9,14 @@
beStrictAboutCoverageMetadata="false"
beStrictAboutOutputDuringTests="true"
beStrictAboutTestsThatDoNotTestAnything="true"
displayDetailsOnPhpunitDeprecations="true"
displayDetailsOnTestsThatTriggerWarnings="true"
displayDetailsOnTestsThatTriggerNotices="true"
displayDetailsOnTestsThatTriggerErrors="true"
displayDetailsOnTestsThatTriggerDeprecations="true"
displayDetailsOnSkippedTests="true"
displayDetailsOnIncompleteTests="true"
failOnPhpunitDeprecation="true"
failOnEmptyTestSuite="true"
failOnIncomplete="true"
failOnRisky="true"
Expand Down Expand Up @@ -51,7 +53,7 @@
</testsuite>
</testsuites>

<coverage includeUncoveredFiles="true">
<coverage>
<report>
<clover outputFile=".reports/clover.xml"/>
<html outputDirectory=".reports/report/" lowUpperBound="50" highLowerBound="80"/>
Expand Down
2 changes: 1 addition & 1 deletion rector.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@

$rectorConfig->sets([
SetList::DEAD_CODE,
LevelSetList::UP_TO_PHP_81,
LevelSetList::UP_TO_PHP_83,
PHPUnitSetList::PHPUNIT_100,
]);

Expand Down
12 changes: 10 additions & 2 deletions src/Minify.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20\LaminasView\Revision;

use JsonException;
use Override;
use SplFileInfo;

use function array_key_exists;
Expand All @@ -37,12 +38,12 @@ final class Minify implements MinifyInterface
/**
* Standardrevision
*/
public const DEFAULT_REVISION = '1';
public const string DEFAULT_REVISION = '1';

/**
* Postfix
*/
private const REVISION_STRING = '__%s';
private const string REVISION_STRING = '__%s';

/**
* @var array<array<array<string>>>|array<array<string>>
Expand Down Expand Up @@ -88,6 +89,7 @@ public function __construct(
*
* @throws void
*/
#[Override]
public function hasPackage(string $package): bool
{
return array_key_exists($package, $this->groups);
Expand All @@ -102,6 +104,7 @@ public function hasPackage(string $package): bool
*
* @throws void
*/
#[Override]
public function getPackageFiles(string $package): array
{
if (!$this->isValid($package)) {
Expand Down Expand Up @@ -130,6 +133,7 @@ public function getPackageFiles(string $package): array
}

/** @throws void */
#[Override]
public function isEnabled(): bool
{
return $this->enabled;
Expand All @@ -140,6 +144,7 @@ public function isEnabled(): bool
*
* @throws void
*/
#[Override]
public function isItemOkToAddRevision(string $type, string $href): bool
{
if (!$href) {
Expand All @@ -154,6 +159,7 @@ public function isItemOkToAddRevision(string $type, string $href): bool
}

/** @throws void */
#[Override]
public function addRevision(string $resource): string
{
$fileInfo = new SplFileInfo($resource);
Expand All @@ -167,6 +173,7 @@ public function addRevision(string $resource): string
*
* @throws void
*/
#[Override]
public function getRevisionString(): string
{
return sprintf(self::REVISION_STRING, $this->getRevision());
Expand All @@ -177,6 +184,7 @@ public function getRevisionString(): string
*
* @throws void
*/
#[Override]
public function getRevision(): string | null
{
return $this->revision;
Expand Down
2 changes: 2 additions & 0 deletions src/MinifyFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -16,6 +16,7 @@
use JsonException;
use Laminas\ServiceManager\Factory\FactoryInterface;
use Mimmi20\LaminasView\Revision\Config\MinifyConfigInterface;
use Override;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;

Expand All @@ -34,6 +35,7 @@ final class MinifyFactory implements FactoryInterface
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
*/
#[Override]
public function __invoke(ContainerInterface $container, $requestedName, array | null $options = null): Minify
{
$config = $container->get(MinifyConfigInterface::class);
Expand Down
6 changes: 3 additions & 3 deletions src/MinifyInterface.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,16 +18,16 @@
*/
interface MinifyInterface
{
public const FILETYPE_JS = 'js';
public const string FILETYPE_JS = 'js';

public const FILETYPE_CSS = 'css';
public const string FILETYPE_CSS = 'css';

/**
* Standardrevision
*
* @api
*/
public const DEFAULT_REVISION = '1';
public const string DEFAULT_REVISION = '1';

/**
* Test for package of given name is known, might by invalid.
Expand Down
2 changes: 2 additions & 0 deletions src/Module.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20\LaminasView\Revision;

use Laminas\ModuleManager\Feature\ConfigProviderInterface;
use Override;

final class Module implements ConfigProviderInterface
{
Expand All @@ -23,6 +24,7 @@ final class Module implements ConfigProviderInterface
*
* @throws void
*/
#[Override]
public function getConfig(): array
{
$provider = new ConfigProvider();
Expand Down
2 changes: 2 additions & 0 deletions src/View/Helper/BaseUrlFactory.php
Original file line number Diff line number Diff line change
Expand Up @@ -14,6 +14,7 @@
namespace Mimmi20\LaminasView\Revision\View\Helper;

use Laminas\ServiceManager\Factory\FactoryInterface;
use Override;
use Psr\Container\ContainerExceptionInterface;
use Psr\Container\ContainerInterface;
use Psr\Container\NotFoundExceptionInterface;
Expand All @@ -34,6 +35,7 @@ final class BaseUrlFactory implements FactoryInterface
* @phpcsSuppress SlevomatCodingStandard.Functions.UnusedParameter.UnusedParameter
* @phpcsSuppress SlevomatCodingStandard.TypeHints.ParameterTypeHint.MissingNativeTypeHint
*/
#[Override]
public function __invoke(ContainerInterface $container, $requestedName, array | null $options = null): BaseUrl
{
$uri = null;
Expand Down
Loading

0 comments on commit 9da779d

Please sign in to comment.