Skip to content

Commit

Permalink
Fix CS.
Browse files Browse the repository at this point in the history
  • Loading branch information
dereuromark committed Nov 1, 2021
1 parent caabd54 commit 5423991
Show file tree
Hide file tree
Showing 8 changed files with 21 additions and 16 deletions.
9 changes: 4 additions & 5 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -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:
Expand All @@ -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
Expand All @@ -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
Expand All @@ -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:
Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
@@ -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)
Expand Down
10 changes: 5 additions & 5 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -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": {
Expand All @@ -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/"
}
Expand Down
1 change: 0 additions & 1 deletion docs/README.md
Original file line number Diff line number Diff line change
Expand Up @@ -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
```

Expand Down
2 changes: 1 addition & 1 deletion src/Docs/DiffTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -33,7 +33,7 @@ protected function getDiff($before, $after) {
/**
* @param string $content
*
* @return string[]
* @return array<string>
*/
protected function toSimpleArray($content) {
return explode(PHP_EOL, $content);
Expand Down
9 changes: 8 additions & 1 deletion src/Docs/Generator.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,14 @@ class Generator {

use DiffTrait;

/**
* @var int
*/
public const CODE_SUCCESS = 0;

/**
* @var int
*/
public const CODE_ERROR = 1;

/**
Expand All @@ -20,7 +27,7 @@ class Generator {
protected $dryRun = false;

/**
* @param string[] $args
* @param array<string> $args
*/
public function __construct(array $args) {
if (in_array('-d', $args, true)) {
Expand Down
2 changes: 1 addition & 1 deletion src/MediaEmbed.php
Original file line number Diff line number Diff line change
Expand Up @@ -238,7 +238,7 @@ public function embedLocal($file) {
}

/**
* @param string|array $stub
* @param array|string $stub
* @param array $config
*
* @return \MediaEmbed\Object\MediaObject|null
Expand Down
2 changes: 1 addition & 1 deletion src/Object/MediaObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -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;
Expand Down

0 comments on commit 5423991

Please sign in to comment.