From 5423991c8b387e879d86e914fbe6c32f5a2cece9 Mon Sep 17 00:00:00 2001 From: mscherer Date: Mon, 1 Nov 2021 22:42:46 +0100 Subject: [PATCH] Fix CS. --- .github/workflows/ci.yml | 9 ++++----- README.md | 2 +- composer.json | 10 +++++----- docs/README.md | 1 - src/Docs/DiffTrait.php | 2 +- src/Docs/Generator.php | 9 ++++++++- src/MediaEmbed.php | 2 +- src/Object/MediaObject.php | 2 +- 8 files changed, 21 insertions(+), 16 deletions(-) diff --git a/.github/workflows/ci.yml b/.github/workflows/ci.yml index f5de5e6..5dfbfb4 100644 --- a/.github/workflows/ci.yml +++ b/.github/workflows/ci.yml @@ -11,10 +11,10 @@ jobs: strategy: fail-fast: false matrix: - php-version: ['7.2', '8.1'] + php-version: ['7.3', '8.1'] prefer-lowest: [''] include: - - php-version: '7.2' + - php-version: '7.3' prefer-lowest: 'prefer-lowest' steps: @@ -41,7 +41,6 @@ jobs: - name: Composer install --no-progress --prefer-dist --optimize-autoloader run: | composer --version - composer require --dev phpunit/phpunit:"^8.5|^9.5" if ${{ matrix.prefer-lowest == 'prefer-lowest' }} then composer update --prefer-lowest --prefer-stable @@ -51,7 +50,7 @@ jobs: if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then composer require --dev dereuromark/composer-prefer-lowest:dev-master; fi - name: Run PHPUnit run: | - if [[ ${{ matrix.php-version }} == '7.2' ]] + if [[ ${{ matrix.php-version }} == '7.3' ]] then vendor/bin/phpunit --coverage-clover=coverage.xml else @@ -61,7 +60,7 @@ jobs: run: if ${{ matrix.prefer-lowest == 'prefer-lowest' }}; then vendor/bin/validate-prefer-lowest -m; fi - name: Code Coverage Report - if: success() && matrix.php-version == '7.2' + if: success() && matrix.php-version == '7.3' uses: codecov/codecov-action@v1 validation: diff --git a/README.md b/README.md index 6beda4c..79c5069 100644 --- a/README.md +++ b/README.md @@ -1,6 +1,6 @@ # MediaEmbed [![CI](https://github.com/dereuromark/media-embed/workflows/CI/badge.svg)](https://github.com/dereuromark/media-embed/actions?query=workflow%3ACI+branch%3Amaster) -[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.2-8892BF.svg)](https://php.net/) +[![Minimum PHP Version](https://img.shields.io/badge/php-%3E%3D%207.3-8892BF.svg)](https://php.net/) [![License](https://poser.pugx.org/dereuromark/media-embed/license.svg)](https://packagist.org/packages/dereuromark/media-embed) [![Total Downloads](https://poser.pugx.org/dereuromark/media-embed/d/total.svg)](https://packagist.org/packages/dereuromark/media-embed) [![Coding Standards](https://img.shields.io/badge/cs-PSR--2--R-yellow.svg)](https://github.com/php-fig-rectified/fig-rectified-standards) diff --git a/composer.json b/composer.json index 75606bc..3c9333e 100644 --- a/composer.json +++ b/composer.json @@ -12,11 +12,12 @@ } ], "require": { - "php": ">=7.2", + "php": ">=7.3", "jbroadway/urlify": "^1.0.0" }, "require-dev":{ "sebastian/diff": "@stable", + "phpunit/phpunit": "^9.5", "fig-r/psr2r-sniffer": "dev-master" }, "autoload": { @@ -33,11 +34,10 @@ "bin/generate-docs" ], "scripts": { - "test": "php phpunit.phar", - "test-coverage": "php phpunit.phar --log-junit tmp/coverage/unitreport.xml --coverage-html tmp/coverage --coverage-clover tmp/coverage/coverage.xml", - "test-setup": "[ ! -f phpunit.phar ] && wget https://phar.phpunit.de/phpunit.phar || true", + "test": "phpunit", + "test-coverage": "phpunit --log-junit tmp/coverage/unitreport.xml --coverage-html tmp/coverage --coverage-clover tmp/coverage/coverage.xml", "stan": "phpstan analyse -c tests/phpstan.neon -l 8 src/", - "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^0.12 && mv composer.backup composer.json", + "stan-setup": "cp composer.json composer.backup && composer require --dev phpstan/phpstan:^1.0.0 && mv composer.backup composer.json", "cs-check": "phpcs -s -p --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --extensions=php src/ tests/", "cs-fix": "phpcbf -p --standard=vendor/fig-r/psr2r-sniffer/PSR2R/ruleset.xml --extensions=php src/ tests/" } diff --git a/docs/README.md b/docs/README.md index 20958be..4223b88 100644 --- a/docs/README.md +++ b/docs/README.md @@ -188,7 +188,6 @@ Please provide a simple test URL and test case for any new service. Run tests with ``` -composer test-setup composer test ``` diff --git a/src/Docs/DiffTrait.php b/src/Docs/DiffTrait.php index 67d7720..cb633f7 100644 --- a/src/Docs/DiffTrait.php +++ b/src/Docs/DiffTrait.php @@ -33,7 +33,7 @@ protected function getDiff($before, $after) { /** * @param string $content * - * @return string[] + * @return array */ protected function toSimpleArray($content) { return explode(PHP_EOL, $content); diff --git a/src/Docs/Generator.php b/src/Docs/Generator.php index 79c1da2..673cd0d 100644 --- a/src/Docs/Generator.php +++ b/src/Docs/Generator.php @@ -11,7 +11,14 @@ class Generator { use DiffTrait; + /** + * @var int + */ public const CODE_SUCCESS = 0; + + /** + * @var int + */ public const CODE_ERROR = 1; /** @@ -20,7 +27,7 @@ class Generator { protected $dryRun = false; /** - * @param string[] $args + * @param array $args */ public function __construct(array $args) { if (in_array('-d', $args, true)) { diff --git a/src/MediaEmbed.php b/src/MediaEmbed.php index 9e7d9a8..f3887d6 100644 --- a/src/MediaEmbed.php +++ b/src/MediaEmbed.php @@ -238,7 +238,7 @@ public function embedLocal($file) { } /** - * @param string|array $stub + * @param array|string $stub * @param array $config * * @return \MediaEmbed\Object\MediaObject|null diff --git a/src/Object/MediaObject.php b/src/Object/MediaObject.php index 8e16201..dc7c6bc 100644 --- a/src/Object/MediaObject.php +++ b/src/Object/MediaObject.php @@ -110,7 +110,7 @@ public function stub($property = null, $value = null) { return $this->_stub; } if ($value === null) { - return isset($this->_stub[$property]) ? $this->_stub[$property] : null; + return $this->_stub[$property] ?? null; } if (!empty($property) && !empty($value)) { $this->_stub[$property] = $value;