Skip to content
This repository was archived by the owner on May 11, 2021. It is now read-only.

Commit

Permalink
Drop PHP v7.3 support and upgrade CS Fixer to v3 (#303)
Browse files Browse the repository at this point in the history
  • Loading branch information
mvorisek authored May 11, 2021
1 parent e0c1f41 commit 1cf6c9a
Show file tree
Hide file tree
Showing 5 changed files with 28 additions and 24 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
19 changes: 10 additions & 9 deletions .php_cs.dist → .php-cs-fixer.dist.php
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 @@ -31,10 +31,8 @@
'equal' => false,
'identical' => false,
],
'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 @@ -52,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');
8 changes: 4 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -27,24 +27,24 @@
}
],
"require": {
"php": ">=7.3.0",
"php": ">=7.4.0",
"ext-pdo": "*",
"atk4/core": "dev-develop",
"doctrine/dbal": "^2.10 || ^3.0"
},
"require-release": {
"php": ">=7.3.0",
"php": ">=7.4.0",
"ext-pdo": "*",
"atk4/core": "~3.0.0",
"doctrine/dbal": "^2.10 || ^3.0"
},
"require-dev": {
"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/phpcov": "*",
"phpunit/phpunit": ">=9.1"
"phpunit/phpunit": ">=9.3"
},
"suggest": {
"jdorn/sql-formatter": "*"
Expand Down
17 changes: 10 additions & 7 deletions src/Connection.php
Original file line number Diff line number Diff line change
Expand Up @@ -341,11 +341,12 @@ public function getAddExtendedPropertySQL(
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level0Name)
. ', N' . $this->quoteStringLiteral((string) $level1Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level1Name)
. ($level2Type !== null || $level2Name !== null
. (
$level2Type !== null || $level2Name !== null
? ', N' . $this->quoteStringLiteral((string) $level2Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level2Name)
: ''
);
);
}

public function getDropExtendedPropertySQL(
Expand All @@ -363,11 +364,12 @@ public function getDropExtendedPropertySQL(
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level0Name)
. ', N' . $this->quoteStringLiteral((string) $level1Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level1Name)
. ($level2Type !== null || $level2Name !== null
. (
$level2Type !== null || $level2Name !== null
? ', N' . $this->quoteStringLiteral((string) $level2Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level2Name)
: ''
);
);
}

public function getUpdateExtendedPropertySQL(
Expand All @@ -386,11 +388,12 @@ public function getUpdateExtendedPropertySQL(
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level0Name)
. ', N' . $this->quoteStringLiteral((string) $level1Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level1Name)
. ($level2Type !== null || $level2Name !== null
. (
$level2Type !== null || $level2Name !== null
? ', N' . $this->quoteStringLiteral((string) $level2Type)
. ', ' . $this->quoteSingleIdentifierAsStringLiteral((string) $level2Name)
: ''
);
);
}

protected function getCommentOnTableSQL(string $tableName, ?string $comment): string
Expand Down Expand Up @@ -422,7 +425,7 @@ protected function getCommentOnTableSQL(string $tableName, ?string $comment): st
$dbalConnection->platform = new class() extends OraclePlatform {
private function forwardTypeDeclarationSQL(string $targetMethodName, array $column): string
{
$backtrace = debug_backtrace(DEBUG_BACKTRACE_PROVIDE_OBJECT | DEBUG_BACKTRACE_IGNORE_ARGS);
$backtrace = debug_backtrace(\DEBUG_BACKTRACE_PROVIDE_OBJECT | \DEBUG_BACKTRACE_IGNORE_ARGS);
foreach ($backtrace as $frame) {
if ($this === ($frame['object'] ?? null)
&& $targetMethodName === ($frame['function'] ?? null)) {
Expand Down
4 changes: 2 additions & 2 deletions src/Expression.php
Original file line number Diff line number Diff line change
Expand Up @@ -112,7 +112,7 @@ public function __construct($properties = [], $arguments = null)
*/
public function __toString()
{
'trigger_error'('Method is deprecated. Use $this->getOne() instead', E_USER_DEPRECATED);
'trigger_error'('Method is deprecated. Use $this->getOne() instead', \E_USER_DEPRECATED);

return $this->getOne();
}
Expand Down Expand Up @@ -613,7 +613,7 @@ private function getCastValue($v): ?string
*/
public function get(): array
{
'trigger_error'('Method is deprecated. Use getRows instead', E_USER_DEPRECATED);
'trigger_error'('Method is deprecated. Use getRows instead', \E_USER_DEPRECATED);

return $this->getRows();
}
Expand Down

0 comments on commit 1cf6c9a

Please sign in to comment.