Skip to content

Commit

Permalink
Drop PHP v7.3 support and upgrade CS Fixer to v3 (#278)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored May 11, 2021
1 parent 4f8db38 commit 6b92e54
Show file tree
Hide file tree
Showing 7 changed files with 19 additions and 26 deletions.
4 changes: 2 additions & 2 deletions .github/workflows/test-unit.yml
Original file line number Diff line number Diff line change
Expand Up @@ -63,7 +63,7 @@ jobs:

- name: Check Coding Style (only for CodingStyle)
if: matrix.type == 'CodingStyle'
run: vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --diff-format=udiff --verbose --show-progress=dots
run: vendor/bin/php-cs-fixer fix --dry-run --using-cache=no --diff --verbose

- name: Run Static Analysis (only for StaticAnalysis)
if: matrix.type == 'StaticAnalysis'
Expand All @@ -79,7 +79,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['7.3', '7.4', 'latest']
php: ['7.4', 'latest']
type: ['Phpunit']
include:
- php: 'latest'
Expand Down
18 changes: 9 additions & 9 deletions .php_cs.dist → .php-cs-fixer.dist.php
100755 → 100644
Original file line number Diff line number Diff line change
Expand Up @@ -8,13 +8,13 @@
'vendor',
]);

return PhpCsFixer\Config::create()
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setRules([
'@PhpCsFixer' => true,
'@PhpCsFixer:risky' =>true,
'@PHP71Migration:risky' => true,
'@PHP73Migration' => true,
'@PhpCsFixer:risky' => true,
'@PHP74Migration:risky' => true,
'@PHP74Migration' => true,

// required by PSR-12
'concat_space' => [
Expand All @@ -33,9 +33,6 @@
],
'native_constant_invocation' => true,
'native_function_invocation' => false,
'non_printable_character' => [
'use_escape_sequences_in_strings' => true,
],
'void_return' => false,
'blank_line_before_statement' => [
'statements' => ['break', 'continue', 'declare', 'return', 'throw', 'exit'],
Expand All @@ -53,13 +50,16 @@
'phpdoc_add_missing_param_annotation' => false,
'return_assignment' => false,
'comment_to_phpdoc' => false,
'list_syntax' => ['syntax' => 'short'],
'general_phpdoc_annotation_remove' => [
'annotations' => ['author', 'copyright', 'throws'],
],
'nullable_type_declaration_for_default_null_value' => [
'use_nullable_type_declaration' => false,
],

// fn => without curly brackets is less readable,
// also prevent bounding of unwanted variables for GC
'use_arrow_functions' => false,
])
->setFinder($finder)
->setCacheFile(__DIR__ . '/.php_cs.cache');
->setCacheFile(sys_get_temp_dir() . '/php-cs-fixer.' . md5(__DIR__) . '.cache');
11 changes: 5 additions & 6 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -31,30 +31,29 @@
}
],
"require": {
"php": ">=7.3.0",
"php": ">=7.4.0",
"ext-json": "*",
"psr/log": "~1.0",
"symfony/polyfill-php74": "^1.17",
"symfony/polyfill-php80": "^1.17",
"symfony/polyfill-php81": "^1.22",
"symfony/yaml": "^3.4 || ^4.4 || ^5.1"
},
"require-dev": {
"atk4/data": "dev-develop",
"ergebnis/composer-normalize": "^2.13",
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^3.0",
"johnkary/phpunit-speedtrap": "^3.2",
"phpstan/phpstan": "^0.12.58",
"phpunit/phpunit": ">=9.1",
"phpunit/phpunit": ">=9.3",
"symfony/contracts": ">=1.1"
},
"require-dev-release": {
"atk4/data": "~3.0.0",
"ergebnis/composer-normalize": "^2.13",
"friendsofphp/php-cs-fixer": "^2.17",
"friendsofphp/php-cs-fixer": "^3.0",
"johnkary/phpunit-speedtrap": "^3.2",
"phpstan/phpstan": "^0.12.58",
"phpunit/phpunit": ">=9.1",
"phpunit/phpunit": ">=9.3",
"symfony/contracts": ">=1.1"
},
"config": {
Expand Down
2 changes: 1 addition & 1 deletion phpunit.xml.dist
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
<listeners>
<listener class="JohnKary\PHPUnit\Listener\SpeedTrapListener" />
</listeners>
<coverage processUncoveredFiles="true">
<coverage>
<include>
<directory suffix=".php">src</directory>
</include>
Expand Down
3 changes: 1 addition & 2 deletions src/Factory.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,8 +6,7 @@

class Factory
{
/** @var Factory */
private static $_instance;
private static ?Factory $_instance = null;

protected function __construct()
{
Expand Down
2 changes: 1 addition & 1 deletion src/StaticAddToTrait.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@
*/
trait StaticAddToTrait
{
// use DiContainerTrait; // uncomment once PHP7.2 support is dropped
use DiContainerTrait;

private static function _addTo_add(object $parent, object $object, array $addArgs, bool $skipAdd = false): void
{
Expand Down
5 changes: 0 additions & 5 deletions tests/StaticAddToTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,13 +6,11 @@

use Atk4\Core\AtkPhpunit;
use Atk4\Core\ContainerTrait;
use Atk4\Core\DiContainerTrait;
use Atk4\Core\StaticAddToTrait;
use Atk4\Core\TrackableTrait;

class StdSat extends \StdClass
{
use DiContainerTrait; // remove once PHP7.2 support is dropped
use StaticAddToTrait;
}

Expand All @@ -27,13 +25,11 @@ class ContainerFactoryMockSat

class TrackableMockSat
{
use DiContainerTrait; // remove once PHP7.2 support is dropped
use StaticAddToTrait;
use TrackableTrait;
}
class DiMockSat
{
use DiContainerTrait;
use StaticAddToTrait;

/** @var string */
Expand All @@ -46,7 +42,6 @@ class DiMockSat

class DiConstructorMockSat
{
use DiContainerTrait;
use StaticAddToTrait;

/** @var string */
Expand Down

0 comments on commit 6b92e54

Please sign in to comment.