From 4b6161892000cb2b8392dce92a9cf2cabdf2d20e Mon Sep 17 00:00:00 2001 From: Chih-Hsuan Yen Date: Sat, 2 Jul 2022 22:01:51 +0800 Subject: Update php-qrcode and php-settings-container for PHP 8.1 By running the following command after updating composer.json ``` composer update chillerlan/php-qrcode chillerlan/php-settings-container ``` This change fixes a deprecation warning from Preferences -> Personal data / Authentication -> Authenticator (OTP). ``` Return type of chillerlan\Settings\SettingsContainerAbstract::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice 1. vendor/chillerlan/php-settings-container/src/SettingsContainerAbstract.php(19): ttrss_error_handler(Return type of chillerlan\Settings\SettingsContainerAbstract::jsonSerialize() should either be compatible with JsonSerializable::jsonSerialize(): mixed, or the #[\ReturnTypeWillChange] attribute should be used to temporarily suppress the notice, vendor/chillerlan/php-settings-container/src/SettingsContainerAbstract.php) 2. vendor/composer/ClassLoader.php(571): include(/usr/share/webapps/tt-rss/vendor/chillerlan/php-settings-container/src/SettingsContainerAbstract.php) 3. vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile(/usr/share/webapps/tt-rss/vendor/composer/../chillerlan/php-settings-container/src/SettingsContainerAbstract.php) 4. vendor/chillerlan/php-qrcode/src/QROptions.php(59): loadClass(chillerlan\Settings\SettingsContainerAbstract) 5. vendor/composer/ClassLoader.php(571): include(/usr/share/webapps/tt-rss/vendor/chillerlan/php-qrcode/src/QROptions.php) 6. vendor/composer/ClassLoader.php(428): Composer\Autoload\includeFile(/usr/share/webapps/tt-rss/vendor/composer/../chillerlan/php-qrcode/src/QROptions.php) 7. vendor/chillerlan/php-qrcode/src/QRCode.php(113): loadClass(chillerlan\QRCode\QROptions) 8. classes/pref/prefs.php(958): __construct() 9. classes/pref/prefs.php(469): _get_otp_qrcode_img() 10. classes/pref/prefs.php(541): index_auth_2fa() 11. backend.php(136): index_auth() ``` The issue is fixed in php-settings-container 2.1.1 [1] Here I use the latest php-qrcode version for another PHP 8.1 fix [2]. [1] https://github.com/chillerlan/php-settings-container/commit/68bc5019c8b38956c83906431ef879668366b036#diff-359c7f7a6d32d9935951e1b0742eb116fb654f4a932c8d40328bb5dcab2fa111L162 [2] https://github.com/chillerlan/php-qrcode/issues/97 --- .../php-settings-container/.github/FUNDING.yml | 2 + .../.github/workflows/tests.yml | 107 +++++++++++++++++++++ .../chillerlan/php-settings-container/.gitignore | 6 +- .../php-settings-container/.phan/config.php | 54 +++++++++++ .../php-settings-container/.scrutinizer.yml | 9 ++ .../chillerlan/php-settings-container/.travis.yml | 18 ---- vendor/chillerlan/php-settings-container/README.md | 42 ++++---- .../php-settings-container/composer.json | 18 +++- .../php-settings-container/docs/Readme.md | 13 +++ .../php-settings-container/examples/advanced.php | 15 ++- .../php-settings-container/examples/simple.php | 1 - .../chillerlan/php-settings-container/phpdoc.xml | 20 ++++ vendor/chillerlan/php-settings-container/phpmd.xml | 35 ------- .../chillerlan/php-settings-container/phpunit.xml | 44 +++++---- .../src/SettingsContainerAbstract.php | 45 ++++----- .../src/SettingsContainerInterface.php | 32 +----- .../php-settings-container/tests/ContainerTest.php | 78 ++++++++------- .../php-settings-container/tests/TestContainer.php | 4 +- .../tests/TestOptionsTrait.php | 22 ++--- 19 files changed, 348 insertions(+), 217 deletions(-) create mode 100644 vendor/chillerlan/php-settings-container/.github/FUNDING.yml create mode 100644 vendor/chillerlan/php-settings-container/.github/workflows/tests.yml create mode 100644 vendor/chillerlan/php-settings-container/.phan/config.php delete mode 100644 vendor/chillerlan/php-settings-container/.travis.yml create mode 100644 vendor/chillerlan/php-settings-container/docs/Readme.md create mode 100644 vendor/chillerlan/php-settings-container/phpdoc.xml delete mode 100644 vendor/chillerlan/php-settings-container/phpmd.xml (limited to 'vendor/chillerlan/php-settings-container') diff --git a/vendor/chillerlan/php-settings-container/.github/FUNDING.yml b/vendor/chillerlan/php-settings-container/.github/FUNDING.yml new file mode 100644 index 000000000..16a077f52 --- /dev/null +++ b/vendor/chillerlan/php-settings-container/.github/FUNDING.yml @@ -0,0 +1,2 @@ +ko_fi: codemasher +custom: "https://www.paypal.com/donate?hosted_button_id=WLYUNAT9ZTJZ4" diff --git a/vendor/chillerlan/php-settings-container/.github/workflows/tests.yml b/vendor/chillerlan/php-settings-container/.github/workflows/tests.yml new file mode 100644 index 000000000..e52681849 --- /dev/null +++ b/vendor/chillerlan/php-settings-container/.github/workflows/tests.yml @@ -0,0 +1,107 @@ +# https://help.github.com/en/categories/automating-your-workflow-with-github-actions +# https://github.com/sebastianbergmann/phpunit/blob/master/.github/workflows/ci.yml + +on: + push: + branches: + - main + pull_request: + branches: + - main + + +name: "CI" + +jobs: + + static-code-analysis: + name: "Static Code Analysis" + + runs-on: ubuntu-latest + + env: + PHAN_ALLOW_XDEBUG: 0 + PHAN_DISABLE_XDEBUG_WARN: 1 + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + tools: pecl + coverage: none + extensions: ast, json + + - name: "Update dependencies with composer" + run: composer update --no-interaction --no-ansi --no-progress --no-suggest + + - name: "Run phan" + run: php vendor/bin/phan + + build-docs: + name: "Build and publish Docs" + + runs-on: ubuntu-latest + + steps: + - name: "Checkout sources" + uses: actions/checkout@v2 + + - name: "Install PHP" + uses: shivammathur/setup-php@v2 + with: + php-version: "7.4" + coverage: none + tools: phpDocumentor + extensions: json + + - name: "Build Docs" + run: phpdoc --config=phpdoc.xml + + - name: "Publish Docs to gh-pages" + uses: JamesIves/github-pages-deploy-action@v4.2.5 + with: + branch: gh-pages + folder: docs + clean: true + + tests: + name: "Unit Tests" + + runs-on: ${{ matrix.os }} + + strategy: + fail-fast: false + matrix: + os: + - ubuntu-latest + - windows-latest + php-version: + - "7.4" + - "8.0" + - "8.1" + + steps: + - name: "Checkout" + uses: actions/checkout@v2 + + - name: "Install PHP with extensions" + uses: shivammathur/setup-php@v2 + with: + php-version: ${{ matrix.php-version }} + coverage: pcov + extensions: json + + - name: "Install dependencies with composer" + run: composer update --no-ansi --no-interaction --no-progress --no-suggest + + - name: "Run tests with phpunit" + run: php vendor/phpunit/phpunit/phpunit --configuration=phpunit.xml + + - name: "Send code coverage report to Codecov.io" + uses: codecov/codecov-action@v1 + with: + token: ${{ secrets.CODECOV_TOKEN }} diff --git a/vendor/chillerlan/php-settings-container/.gitignore b/vendor/chillerlan/php-settings-container/.gitignore index e313cba45..142dd453a 100644 --- a/vendor/chillerlan/php-settings-container/.gitignore +++ b/vendor/chillerlan/php-settings-container/.gitignore @@ -1,4 +1,4 @@ -.idea -.vendor +/.build +/.idea +/vendor composer.lock -*.phpunit.result.cache diff --git a/vendor/chillerlan/php-settings-container/.phan/config.php b/vendor/chillerlan/php-settings-container/.phan/config.php new file mode 100644 index 000000000..468bd9983 --- /dev/null +++ b/vendor/chillerlan/php-settings-container/.phan/config.php @@ -0,0 +1,54 @@ + '7.4', + + // A list of directories that should be parsed for class and + // method information. After excluding the directories + // defined in exclude_analysis_directory_list, the remaining + // files will be statically analyzed for errors. + // + // Thus, both first-party and third-party code being used by + // your application should be included in this list. + 'directory_list' => [ + 'examples', + 'src', + 'tests', + 'vendor', + ], + + // A regex used to match every file name that you want to + // exclude from parsing. Actual value will exclude every + // "test", "tests", "Test" and "Tests" folders found in + // "vendor/" directory. + 'exclude_file_regex' => '@^vendor/.*/(tests?|Tests?)/@', + + // A directory list that defines files that will be excluded + // from static analysis, but whose class and method + // information should be included. + // + // Generally, you'll want to include the directories for + // third-party code (such as "vendor/") in this list. + // + // n.b.: If you'd like to parse but not analyze 3rd + // party code, directories containing that code + // should be added to both the `directory_list` + // and `exclude_analysis_directory_list` arrays. + 'exclude_analysis_directory_list' => [ + 'tests', + 'vendor', + ], +]; diff --git a/vendor/chillerlan/php-settings-container/.scrutinizer.yml b/vendor/chillerlan/php-settings-container/.scrutinizer.yml index 7fdd2a4dc..daeb475f4 100644 --- a/vendor/chillerlan/php-settings-container/.scrutinizer.yml +++ b/vendor/chillerlan/php-settings-container/.scrutinizer.yml @@ -1,3 +1,12 @@ +build: + nodes: + analysis: + tests: + override: + - php-scrutinizer-run + environment: + php: 8.0.0 + filter: excluded_paths: - examples/* diff --git a/vendor/chillerlan/php-settings-container/.travis.yml b/vendor/chillerlan/php-settings-container/.travis.yml deleted file mode 100644 index c2ad210ed..000000000 --- a/vendor/chillerlan/php-settings-container/.travis.yml +++ /dev/null @@ -1,18 +0,0 @@ -language: php - -matrix: - include: - - php: 7.2 - - php: 7.3 - - php: 7.4 - - php: 8.0 - - php: nightly - allow_failures: - - php: nightly - - -before_script: travis_retry composer install --no-interaction --prefer-source - -script: vendor/bin/phpunit --configuration phpunit.xml --coverage-clover clover.xml - -after_script: bash <(curl -s https://codecov.io/bash) diff --git a/vendor/chillerlan/php-settings-container/README.md b/vendor/chillerlan/php-settings-container/README.md index f3bb26c5e..b5fd4ad27 100644 --- a/vendor/chillerlan/php-settings-container/README.md +++ b/vendor/chillerlan/php-settings-container/README.md @@ -1,52 +1,46 @@ # chillerlan/php-settings-container -A container class for immutable settings objects. Not a DI container. PHP 7.2+ -- [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerInterface.php) provides immutable properties with magic getter & setter and some fancy +A container class for immutable settings objects. Not a DI container. PHP 7.4+ +- [`SettingsContainerInterface`](https://github.com/chillerlan/php-settings-container/blob/main/src/SettingsContainerInterface.php) provides immutable properties with magic getter & setter and some fancy - decouple configuration logic from your application! +[![PHP Version Support][php-badge]][php] [![version][packagist-badge]][packagist] [![license][license-badge]][license] -[![Travis][travis-badge]][travis] [![Coverage][coverage-badge]][coverage] [![Scrunitizer][scrutinizer-badge]][scrutinizer] [![Packagist downloads][downloads-badge]][downloads] -[![PayPal donate][donate-badge]][donate] +[![Continuous Integration][gh-action-badge]][gh-action] -[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-settings-container.svg?style=flat-square +[php-badge]: https://img.shields.io/packagist/php-v/chillerlan/php-settings-container?logo=php&color=8892BF +[php]: https://www.php.net/supported-versions.php +[packagist-badge]: https://img.shields.io/packagist/v/chillerlan/php-settings-container.svg?logo=packagist [packagist]: https://packagist.org/packages/chillerlan/php-settings-container -[license-badge]: https://img.shields.io/github/license/chillerlan/php-settings-container.svg?style=flat-square -[license]: https://github.com/chillerlan/php-settings-container/blob/master/LICENSE -[travis-badge]: https://img.shields.io/travis/chillerlan/php-settings-container.svg?style=flat-square -[travis]: https://travis-ci.org/chillerlan/php-settings-container -[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-settings-container.svg?style=flat-square +[license-badge]: https://img.shields.io/github/license/chillerlan/php-settings-container.svg +[license]: https://github.com/chillerlan/php-settings-container/blob/main/LICENSE +[coverage-badge]: https://img.shields.io/codecov/c/github/chillerlan/php-settings-container.svg?logo=codecov [coverage]: https://codecov.io/github/chillerlan/php-settings-container -[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-settings-container.svg?style=flat-square +[scrutinizer-badge]: https://img.shields.io/scrutinizer/g/chillerlan/php-settings-container.svg?logo=scrutinizer [scrutinizer]: https://scrutinizer-ci.com/g/chillerlan/php-settings-container -[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-settings-container.svg?style=flat-square +[downloads-badge]: https://img.shields.io/packagist/dt/chillerlan/php-settings-container.svg?logo=packagist [downloads]: https://packagist.org/packages/chillerlan/php-settings-container/stats -[donate-badge]: https://img.shields.io/badge/donate-paypal-ff33aa.svg?style=flat-square -[donate]: https://www.paypal.com/cgi-bin/webscr?cmd=_s-xclick&hosted_button_id=WLYUNAT9ZTJZ4 +[gh-action-badge]: https://github.com/chillerlan/php-settings-container/workflows/CI/badge.svg +[gh-action]: https://github.com/chillerlan/php-settings-container/actions?query=workflow%3A%22CI%22 ## Documentation ### Installation **requires [composer](https://getcomposer.org)** -*composer.json* (note: replace `dev-master` with a version boundary) +*composer.json* (note: replace `dev-main` with a [version constraint](https://getcomposer.org/doc/articles/versions.md#writing-version-constraints), e.g. `^2.1` - see [releases](https://github.com/chillerlan/php-settings-container/releases) for valid versions) ```json { "require": { - "php": "^7.2", - "chillerlan/php-settings-container": "^1.0" + "php": "^7.4", + "chillerlan/php-settings-container": "dev-main" } } ``` -### Manual installation -Download the desired version of the package from [master](https://github.com/chillerlan/php-settings-container/archive/master.zip) or -[release](https://github.com/chillerlan/php-settings-container/releases) and extract the contents to your project folder. After that: -- run `composer install` to install the required dependencies and generate `/vendor/autoload.php`. -- if you use a custom autoloader, point the namespace `chillerlan\Settings` to the folder `src` of the package - Profit! ## Usage @@ -140,7 +134,7 @@ var_dump($container->what); // -> md5 hash of "some value" ### API -#### [`SettingsContainerAbstract`](https://github.com/chillerlan/php-settings-container/blob/master/src/SettingsContainerAbstract.php) +#### [`SettingsContainerAbstract`](https://github.com/chillerlan/php-settings-container/blob/main/src/SettingsContainerAbstract.php) method | return | info -------- | ---- | ----------- diff --git a/vendor/chillerlan/php-settings-container/composer.json b/vendor/chillerlan/php-settings-container/composer.json index 4464e6e8a..1d89b6c41 100644 --- a/vendor/chillerlan/php-settings-container/composer.json +++ b/vendor/chillerlan/php-settings-container/composer.json @@ -1,12 +1,12 @@ { "name": "chillerlan/php-settings-container", - "description": "A container class for immutable settings objects. Not a DI container. PHP 7.2+", + "description": "A container class for immutable settings objects. Not a DI container. PHP 7.4+", "homepage": "https://github.com/chillerlan/php-settings-container", "license": "MIT", "type": "library", "minimum-stability": "stable", "keywords": [ - "php7", "helper", "container", "settings" + "php7", "helper", "container", "settings", "configuration" ], "authors": [ { @@ -20,11 +20,12 @@ "source": "https://github.com/chillerlan/php-settings-container" }, "require": { - "php": "^7.2 || ^8.0", + "php": "^7.4 || ^8.0", "ext-json": "*" }, "require-dev": { - "phpunit/phpunit": "^8.4" + "phan/phan": "^5.3", + "phpunit/phpunit": "^9.5" }, "autoload": { "psr-4": { @@ -36,5 +37,14 @@ "chillerlan\\SettingsTest\\": "tests/", "chillerlan\\SettingsExamples\\": "examples/" } + }, + "scripts": { + "phpunit": "@php vendor/bin/phpunit", + "phan": "@php vendor/bin/phan" + }, + "config": { + "lock": false, + "sort-packages": true, + "platform-check": true } } diff --git a/vendor/chillerlan/php-settings-container/docs/Readme.md b/vendor/chillerlan/php-settings-container/docs/Readme.md new file mode 100644 index 000000000..7749a1e7f --- /dev/null +++ b/vendor/chillerlan/php-settings-container/docs/Readme.md @@ -0,0 +1,13 @@ +# Auto generated API documentation + +The API documentation can be auto generated with [phpDocumentor](https://www.phpdoc.org/). +There is an [online version available](https://chillerlan.github.io/php-settings-container/) via the [gh-pages branch](https://github.com/chillerlan/php-settings-container/tree/gh-pages) that is [automatically deployed](https://github.com/chillerlan/php-settings-container/deployments) on each push to main. + +Locally created docs will appear in this directory. If you'd like to create local docs, please follow these steps: + +- [download phpDocumentor](https://github.com/phpDocumentor/phpDocumentor/releases) v3+ as .phar archive +- run it in the repository root directory: + - on Windows `c:\path\to\php.exe c:\path\to\phpDocumentor.phar --config=phpdoc.xml` + - on Linux just `php /path/to/phpDocumentor.phar --config=phpdoc.xml` +- open [index.html](./index.html) in a browser +- profit! diff --git a/vendor/chillerlan/php-settings-container/examples/advanced.php b/vendor/chillerlan/php-settings-container/examples/advanced.php index 1030b0a29..f11642c83 100644 --- a/vendor/chillerlan/php-settings-container/examples/advanced.php +++ b/vendor/chillerlan/php-settings-container/examples/advanced.php @@ -1,6 +1,5 @@ * @copyright 2018 smiley @@ -15,7 +14,7 @@ require_once __DIR__.'/../vendor/autoload.php'; // from library #1 trait SomeOptions{ - protected $foo; + protected string $foo = ''; // this method will be called in SettingsContainerAbstract::__construct() after the properties have been set protected function SomeOptions(){ @@ -26,7 +25,7 @@ trait SomeOptions{ // from library #2 trait MoreOptions{ - protected $bar = 'whatever'; // provide default values + protected string $bar = 'whatever'; // provide default values } $commonOptions = [ @@ -37,10 +36,16 @@ $commonOptions = [ ]; // now plug the several library options together to a single object -/** @var \chillerlan\Settings\SettingsContainerInterface $container */ -$container = new class ($commonOptions) extends SettingsContainerAbstract{ + +/** + * @property string $foo + * @property string $bar + */ +class MySettings extends SettingsContainerAbstract{ use SomeOptions, MoreOptions; // ... }; +$container = new MySettings($commonOptions); + var_dump($container->foo); // -> WHATEVER (constructor ran strtoupper on the value) var_dump($container->bar); // -> nothing diff --git a/vendor/chillerlan/php-settings-container/examples/simple.php b/vendor/chillerlan/php-settings-container/examples/simple.php index d8d81095b..acdbe4cb3 100644 --- a/vendor/chillerlan/php-settings-container/examples/simple.php +++ b/vendor/chillerlan/php-settings-container/examples/simple.php @@ -1,6 +1,5 @@ * @copyright 2018 smiley diff --git a/vendor/chillerlan/php-settings-container/phpdoc.xml b/vendor/chillerlan/php-settings-container/phpdoc.xml new file mode 100644 index 000000000..d440f1d8a --- /dev/null +++ b/vendor/chillerlan/php-settings-container/phpdoc.xml @@ -0,0 +1,20 @@ + + + + docs + utf8 + + TODO + + + + docs + + + src + tests + + +