From c32bd2060562098e1c0cd75dc350efe46b6d3974 Mon Sep 17 00:00:00 2001 From: Daniel Opitz Date: Wed, 6 Sep 2023 20:39:59 +0200 Subject: [PATCH] Update build --- .cs.php | 26 ++++++++++++++++++++++++-- .github/workflows/build.yml | 4 ++-- LICENSE | 2 +- composer.json | 37 +++++++++++++++++++++---------------- phpstan.neon | 4 ++++ 5 files changed, 52 insertions(+), 21 deletions(-) diff --git a/.cs.php b/.cs.php index e4ab7fc..00f3314 100644 --- a/.cs.php +++ b/.cs.php @@ -1,6 +1,8 @@ setUsingCache(false) ->setRiskyAllowed(true) ->setRules( @@ -19,6 +21,12 @@ 'concat_space' => ['spacing' => 'one'], 'compact_nullable_typehint' => true, 'declare_equal_normalize' => ['space' => 'single'], + 'general_phpdoc_annotation_remove' => [ + 'annotations' => [ + 'author', + 'package', + ], + ], 'increment_style' => ['style' => 'post'], 'list_syntax' => ['syntax' => 'short'], 'echo_tag_syntax' => ['format' => 'long'], @@ -32,9 +40,23 @@ 'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'], 'ordered_imports' => [ 'sort_algorithm' => 'alpha', - 'imports_order' => ['class', 'const', 'function'] + 'imports_order' => ['class', 'const', 'function'], ], 'single_line_throw' => false, + 'declare_strict_types' => false, + 'blank_line_between_import_groups' => true, + 'fully_qualified_strict_types' => true, + 'global_namespace_import' => false, + 'no_null_property_initialization' => false, + 'operator_linebreak' => [ + 'only_booleans' => true, + 'position' => 'beginning', + ], + 'global_namespace_import' => [ + 'import_classes' => true, + 'import_constants' => null, + 'import_functions' => null + ] ] ) ->setFinder( diff --git a/.github/workflows/build.yml b/.github/workflows/build.yml index 1c994de..126fcc7 100644 --- a/.github/workflows/build.yml +++ b/.github/workflows/build.yml @@ -8,7 +8,7 @@ jobs: strategy: matrix: operating-system: [ ubuntu-latest ] - php-versions: [ '7.2', '7.3', '7.4', '8.0' ] + php-versions: [ '7.2', '7.3', '7.4', '8.0', '8.1', '8.2' ] name: PHP ${{ matrix.php-versions }} Test on ${{ matrix.operating-system }} steps: @@ -43,6 +43,6 @@ jobs: run: composer update --prefer-dist --no-progress --ignore-platform-req=php - name: Run test suite - run: composer check + run: composer test:all env: PHP_CS_FIXER_IGNORE_ENV: 1 diff --git a/LICENSE b/LICENSE index 0235044..bf7a9a3 100644 --- a/LICENSE +++ b/LICENSE @@ -1,6 +1,6 @@ The MIT License (MIT) -Copyright (c) 2020 odan +Copyright (c) 2023 odan 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 f60fcaf..f260b00 100644 --- a/composer.json +++ b/composer.json @@ -1,7 +1,8 @@ { "name": "selective/config", - "type": "library", "description": "Config component, strictly typed", + "license": "MIT", + "type": "library", "keywords": [ "config", "configuration", @@ -11,7 +12,6 @@ "strict" ], "homepage": "https://github.com/selective-php/config", - "license": "MIT", "require": { "php": "^7.2 || ^8.0", "cakephp/chronos": "^1.2 || ^2.0" @@ -33,24 +33,29 @@ "Selective\\Config\\Test\\": "tests/" } }, + "config": { + "sort-packages": true + }, "scripts": { - "check": [ - "@lint", - "@cs:check", - "@sniffer:check", - "@phpstan", - "@test:coverage" + "cs:check": [ + "@putenv PHP_CS_FIXER_IGNORE_ENV=1", + "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php --ansi" + ], + "cs:fix": [ + "@putenv PHP_CS_FIXER_IGNORE_ENV=1", + "php-cs-fixer fix --config=.cs.php --ansi --verbose" ], - "cs:check": "php-cs-fixer fix --dry-run --format=txt --verbose --diff --config=.cs.php", - "cs:fix": "php-cs-fixer fix --config=.cs.php", - "lint": "phplint ./ --exclude=vendor --no-interaction --no-cache", - "phpstan": "phpstan analyse src tests --level=max -c phpstan.neon --no-progress --ansi", "sniffer:check": "phpcs --standard=phpcs.xml", "sniffer:fix": "phpcbf --standard=phpcs.xml", + "stan": "phpstan analyse -c phpstan.neon --no-progress --ansi", + "start": "php -S localhost:8080 -t public/", "test": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always", - "test:coverage": "phpunit --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" - }, - "config": { - "sort-packages": true + "test:all": [ + "@cs:check", + "@sniffer:check", + "@stan", + "@test" + ], + "test:coverage": "php -d xdebug.mode=coverage -r \"require 'vendor/bin/phpunit';\" -- --configuration phpunit.xml --do-not-cache-result --colors=always --coverage-clover build/logs/clover.xml --coverage-html build/coverage" } } diff --git a/phpstan.neon b/phpstan.neon index b0fb215..9950ed9 100644 --- a/phpstan.neon +++ b/phpstan.neon @@ -1,5 +1,9 @@ parameters: + level: 8 reportUnmatchedIgnoredErrors: false + paths: + - src + - tests ignoreErrors: - '#Cannot cast mixed to int.#' - '#Cannot cast mixed to string.#'