Skip to content

Commit 227518e

Browse files
authored
Merge pull request #122 from jolicode/update/php-cs-fixer-v3
Make the CI green again (update to PHP-CS-Fixer v3)
2 parents 540e7ff + 09d14d4 commit 227518e

16 files changed

+60
-71
lines changed

.github/workflows/ci.yml

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -18,7 +18,7 @@ jobs:
1818
- name: PHP-CS-Fixer
1919
uses: docker://oskarstark/php-cs-fixer-ga
2020
with:
21-
args: --config=.php_cs --diff --dry-run
21+
args: --config=.php-cs-fixer.php --diff --dry-run
2222

2323
check-spec:
2424
name: Check SDK is in sync with spec
@@ -34,7 +34,7 @@ jobs:
3434
run: CI_TEST=1 vendor/bin/jane-openapi generate --config-file=.jane-openapi.php
3535

3636
- name: Fix CS on ci_generated directory
37-
run: vendor/bin/php-cs-fixer fix --diff --dry-run ci_generated
37+
run: vendor/bin/php-cs-fixer fix --config=.php-cs-fixer.php --diff --dry-run ci_generated
3838

3939
- name: Check ci_generated and generated directories are equal
4040
run: diff ci_generated generated

.gitignore

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -7,8 +7,9 @@ composer.phar
77

88
# CS
99
.php_cs.cache
10-
phpunit.xml
10+
.php-cs-fixer.cache
1111

1212
# tests
13+
phpunit.xml
1314
ci_generated
1415
.phpunit.result.cache

.jane-openapi.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -14,5 +14,5 @@
1414
'strict' => false,
1515
'clean-generated' => true,
1616
'use-fixer' => true,
17-
'fixer-config-file' => __DIR__ . '/.php_cs',
17+
'fixer-config-file' => __DIR__ . '/.php-cs-fixer.php',
1818
];

.php-cs-fixer.php

Lines changed: 30 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,30 @@
1+
<?php
2+
3+
$header = <<<'EOF'
4+
This file is part of JoliCode's Slack PHP API project.
5+
6+
(c) JoliCode <[email protected]>
7+
8+
For the full copyright and license information, please view the LICENSE
9+
file that was distributed with this source code.
10+
EOF;
11+
12+
$finder = PhpCsFixer\Finder::create()
13+
->in(__DIR__)
14+
->exclude('docs')
15+
->exclude('ci_generated')
16+
;
17+
$config = new PhpCsFixer\Config();
18+
19+
return $config->setRules([
20+
'@Symfony' => true,
21+
'@Symfony:risky' => true,
22+
'@PHP71Migration' => true,
23+
'@PHP71Migration:risky' => true,
24+
'header_comment' => array('header' => $header),
25+
'strict_param' => true,
26+
'array_syntax' => ['syntax' => 'short'],
27+
])
28+
->setRiskyAllowed(true)
29+
->setFinder($finder)
30+
;

.php_cs

Lines changed: 0 additions & 42 deletions
This file was deleted.

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -37,7 +37,7 @@
3737
"jane-php/open-api-2": "~6.3.0",
3838
"symfony/http-client": "^4.3.3 || ^5.1",
3939
"nyholm/psr7": "^1.2",
40-
"friendsofphp/php-cs-fixer": "^2.17",
40+
"friendsofphp/php-cs-fixer": "^3.0",
4141
"symfony/phpunit-bridge": "^5.2",
4242
"opis/json-schema": "^1.0",
4343
"symfony/console": "^5.1",

src/Client.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717

1818
class Client extends ApiClient
1919
{
20-
const CURSOR_PAGINATION = [
20+
public const CURSOR_PAGINATION = [
2121
'channelsList' => 'channels',
2222
'conversationsHistory' => 'messages',
2323
'conversationsList' => 'channels',

src/Command/CheckerCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class CheckerCommand extends Command
2323
{
2424
protected static $defaultName = 'checker';
2525

26-
protected function configure()
26+
protected function configure(): void
2727
{
2828
$this
2929
->setDescription('Checks the patched file and displays a summary table.')

src/Command/GeneratePatchCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ class GeneratePatchCommand extends Command
2525
{
2626
protected static $defaultName = 'spec:generate-patch';
2727

28-
protected function configure()
28+
protected function configure(): void
2929
{
3030
$this
3131
->setDescription('Generates the patch by comparing Slack\'s official sorted spec to the currently patched one.')

src/Command/UpdateSpecificationCommand.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -26,7 +26,7 @@ class UpdateSpecificationCommand extends Command
2626
{
2727
protected static $defaultName = 'spec:update';
2828

29-
protected function configure()
29+
protected function configure(): void
3030
{
3131
$this
3232
->setDescription('Downloads a new version of the official Slack OpenAPI file, and applies our patches to it.')

0 commit comments

Comments
 (0)