Skip to content

Commit 325279b

Browse files
authored
Upgrading php-cs-fixer and adding some php 8 rulesets (#385)
1 parent 3b32af1 commit 325279b

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

73 files changed

+450
-458
lines changed

.github/workflows/build.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
runs-on: ${{ matrix.operating-system }}
1919
steps:
2020
- name: Checkout
21-
uses: actions/checkout@v4.2.2
21+
uses: actions/checkout@v5.0.0
2222
- name: Setup PHP
2323
uses: shivammathur/setup-php@v2
2424
with:

.php-cs-fixer.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -10,10 +10,13 @@
1010

1111
$config = new PhpCsFixer\Config();
1212
return $config
13+
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect())
1314
->setRiskyAllowed(true)
1415
->setRules(array(
1516
'@PSR2' => true,
16-
'@PHP70Migration:risky' => true,
17+
'@PHP7x0Migration:risky' => true,
18+
'@PHP8x0Migration' => true,
19+
'@PHP8x1Migration' => true,
1720
'binary_operator_spaces' => array(
1821
'default' => 'align_single_space_minimal',
1922
'operators' => array('||' => null, '&&' => null)

composer.json

Lines changed: 1 addition & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -29,21 +29,14 @@
2929
"replace": {
3030
"doctrine/doctrine1": "*"
3131
},
32-
"repositories": [
33-
{
34-
"type": "vcs",
35-
"no-api": true,
36-
"url": "https://github.com/diablomedia/phpstorm-stubs"
37-
}
38-
],
3932
"require": {
4033
"php": "~8.1.0 || ~8.2.0 || ~8.3.0 || ~8.4.0",
4134
"ext-pdo": "*",
4235
"symfony/yaml": "^5.0 || ^6.0 || ^7.0"
4336
},
4437
"require-dev": {
4538
"phpunit/php-code-coverage": "^9.1.10",
46-
"friendsofphp/php-cs-fixer": "^3.75.0",
39+
"friendsofphp/php-cs-fixer": "^3.88.0",
4740
"phpstan/phpstan": "2.1.17",
4841
"vimeo/psalm": "6.11.0"
4942
},

lib/Doctrine/Adapter/Oracle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -70,7 +70,7 @@ class Doctrine_Adapter_Oracle implements Doctrine_Adapter_Interface
7070
'username' => null,
7171
'password' => null,
7272
'charset' => null,
73-
'persistent' => false
73+
'persistent' => false,
7474
);
7575

7676
/**

lib/Doctrine/Adapter/Statement/Oracle.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -397,7 +397,7 @@ public function fetchColumn($columnIndex = 0)
397397
return false;
398398
}
399399
$row = $this->fetch(Doctrine_Core::FETCH_NUM);
400-
return isset($row[$columnIndex]) ? $row[$columnIndex] : false;
400+
return $row[$columnIndex] ?? false;
401401
}
402402

403403
/**

lib/Doctrine/AuditLog.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -169,6 +169,6 @@ public function getMaxVersion(Doctrine_Record $record)
169169

170170
$result = $q->execute($values, Doctrine_Core::HYDRATE_ARRAY);
171171

172-
return isset($result[0]['max_version']) ? $result[0]['max_version']:0;
172+
return $result[0]['max_version'] ?? 0;
173173
}
174174
}

lib/Doctrine/Cache/Db.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -176,18 +176,18 @@ public function createTable()
176176
$fields = array(
177177
'id' => array(
178178
'type' => 'string',
179-
'length' => 255
179+
'length' => 255,
180180
),
181181
'data' => array(
182-
'type' => 'blob'
182+
'type' => 'blob',
183183
),
184184
'expire' => array(
185-
'type' => 'timestamp'
186-
)
185+
'type' => 'timestamp',
186+
),
187187
);
188188

189189
$options = array(
190-
'primary' => array('id')
190+
'primary' => array('id'),
191191
);
192192

193193
$this->getConnection()->export->createTable($name, $fields, $options);

lib/Doctrine/Cache/Driver.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -225,7 +225,7 @@ public function deleteAll()
225225
*/
226226
protected function _getKey($id)
227227
{
228-
$prefix = isset($this->_options['prefix']) ? $this->_options['prefix'] : '';
228+
$prefix = $this->_options['prefix'] ?? '';
229229

230230
if (! $prefix || strpos($id, $prefix) === 0) {
231231
return $id;

lib/Doctrine/Cli.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -39,7 +39,7 @@ class Doctrine_Cli
3939
*
4040
* @var string
4141
*/
42-
const TASK_BASE_CLASS = 'Doctrine_Task';
42+
public const TASK_BASE_CLASS = 'Doctrine_Task';
4343

4444
/**
4545
* @var string
@@ -502,7 +502,7 @@ protected function _run(array $args)
502502
{
503503
$this->_scriptName = $args[0];
504504

505-
$requestedTaskName = isset($args[1]) ? $args[1] : null;
505+
$requestedTaskName = $args[1] ?? null;
506506

507507
if (! $requestedTaskName || $requestedTaskName == 'help') {
508508
$this->printTasks(null, $requestedTaskName == 'help' ? true : false);

lib/Doctrine/Collection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -193,7 +193,7 @@ public function __unserialize(array $array): void
193193

194194
$this->_table = $connection->getTable((string) $this->_table);
195195

196-
$keyColumn = isset($array['keyColumn']) ? $array['keyColumn'] : null;
196+
$keyColumn = $array['keyColumn'] ?? null;
197197
if ($keyColumn === null) {
198198
$keyColumn = $this->_table->getBoundQueryPart('indexBy');
199199
}

0 commit comments

Comments
 (0)