Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: BedrockStreaming/php-cs-fixer-config
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.0.0
Choose a base ref
...
head repository: BedrockStreaming/php-cs-fixer-config
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: master
Choose a head ref
  • 18 commits
  • 11 files changed
  • 10 contributors

Commits on Feb 25, 2022

  1. feat: add code owner

    Benoit382 committed Feb 25, 2022
    Copy the full SHA
    6be1faa View commit details
  2. fix: new line

    Benoit382 committed Feb 25, 2022
    Copy the full SHA
    09ac4bf View commit details
  3. fix: add cs fixer file

    Benoit382 committed Feb 25, 2022
    Copy the full SHA
    7c33acb View commit details

Commits on Mar 14, 2022

  1. feat: add php 8 on ci

    lnahiro authored Mar 14, 2022
    Copy the full SHA
    2dc619a View commit details
  2. Merge pull request #19 from BedrockStreaming/add-code-owne

    Add code owner
    lnahiro authored Mar 14, 2022
    Copy the full SHA
    ab22250 View commit details

Commits on Apr 21, 2022

  1. Copy the full SHA
    e254b0b View commit details

Commits on Apr 25, 2022

  1. Merge pull request #20 from BedrockStreaming/feat/add-declare_strict_…

    …types-rule
    
    add rule 'declare_strict_types' => true
    sztan authored Apr 25, 2022
    Copy the full SHA
    996be53 View commit details

Commits on May 3, 2023

  1. Copy the full SHA
    3f5cbd9 View commit details

Commits on May 25, 2023

  1. Copy the full SHA
    232c71b View commit details
  2. Copy the full SHA
    d63bdcc View commit details
  3. Copy the full SHA
    72708c4 View commit details

Commits on Jun 7, 2023

  1. Copy the full SHA
    ac3771d View commit details

Commits on Jun 8, 2023

  1. Merge pull request #25 from BedrockStreaming/docs/explain-hox-to-exte…

    …d-the-config-on-the-project-side
    yannchabed authored Jun 8, 2023
    Copy the full SHA
    2b70ca2 View commit details

Commits on Jun 12, 2023

  1. fix: remove braces rule (#24)

    Co-authored-by: benjamin.chaises <benjamin.chaises@bedrockstreaming.com>
    Bchaises and benjamin.chaises authored Jun 12, 2023
    Copy the full SHA
    45b941b View commit details

Commits on May 22, 2024

  1. Copy the full SHA
    8ffa630 View commit details

Commits on Aug 21, 2024

  1. feat: improve php-cs rules with PSR-12 and `trailing_comma_in_multili…

    …ne` (#27)
    
    Co-authored-by: Anthony Tenneriello <atenneriello.externe@bedrockstreaming.com>
    antten and Anthony Tenneriello authored Aug 21, 2024
    Copy the full SHA
    a8a4473 View commit details
  2. fix: remove trailing_comma_in_multiline because it's not work with PH…

    …P 7.4 (#28)
    
    * fix: remove trailing_comma_in_multiline because it's not work with PHP 7.4
    
    * execute CI on PR
    antten authored Aug 21, 2024
    Copy the full SHA
    b49461d View commit details

Commits on Aug 22, 2024

  1. Copy the full SHA
    210da75 View commit details
Showing with 86 additions and 177 deletions.
  1. +4 −0 .github/CODEOWNERS
  2. +7 −0 .github/PULL_REQUEST_TEMPLATE.md
  3. +17 −0 .github/workflows/ci.yml
  4. +12 −0 .php-cs-fixer.dist.php
  5. +37 −0 README.md
  6. +2 −2 composer.json
  7. +7 −3 src/BedrockStreaming.php
  8. +0 −43 src/Php71.php
  9. +0 −43 src/Php72.php
  10. +0 −43 src/Php73.php
  11. +0 −43 src/Php74.php
4 changes: 4 additions & 0 deletions .github/CODEOWNERS
Original file line number Diff line number Diff line change
@@ -0,0 +1,4 @@
# Note: order is important; the last matching pattern takes the most precedence

# Global rule
* @BedrockStreaming/monitoring-qa
7 changes: 7 additions & 0 deletions .github/PULL_REQUEST_TEMPLATE.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,7 @@
## Why?
<!-- Explain why you've opened this PR -->


## TODO
- [ ] code is tested
- [ ] documentation is updated (if needed)
17 changes: 17 additions & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -0,0 +1,17 @@
name: Continuous Integration
on: [push, pull_request]

jobs:
linter:
name: Code style
runs-on: ubuntu-20.04
strategy:
matrix:
php-version: [ '8.0', '8.1', '8.2', '8.3' ]
steps:
- uses: actions/checkout@master
- uses: shivammathur/setup-php@v2
with:
php-version: ${{ matrix.php-version }}
- run: composer install --prefer-dist --no-interaction
- run: vendor/bin/php-cs-fixer fix --ansi --dry-run --using-cache=no --verbose
12 changes: 12 additions & 0 deletions .php-cs-fixer.dist.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,12 @@
<?php

$config = new M6Web\CS\Config\BedrockStreaming();
$config
->getFinder()
->in(
[
__DIR__.'/src'
]
);

return $config;
37 changes: 37 additions & 0 deletions README.md
Original file line number Diff line number Diff line change
@@ -33,6 +33,43 @@ $config->setFinder($finder);
return $config;
```

### Custom configuration

You may extend these rules and apply your own extra rules.

Create a configuration file `.php-cs-fixer.dist.php` in the root of your project:

```php
<?php

$finder = PhpCsFixer\Finder::create()
->in([
__DIR__.'/src',
__DIR__.'/tests',
]);

$config = new class() extends PhpCsFixer\Config {
public function __construct()
{
parent::__construct('customized Bedrock Streaming');
$this->setRiskyAllowed(true);
}

public function getRules(): array
{
$rules = (new M6Web\CS\Config\BedrockStreaming())->getRules();

// perform updates on the rules array here

return $rules;
}
};

$config->setFinder($finder);

return $config;
```

### Git

Add `.php-cs-fixer.cache` (this is the cache file created by `php-cs-fixer`) to `.gitignore`:
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -12,8 +12,8 @@
}
],
"require": {
"php": "^7.1.3 || ^8.0",
"friendsofphp/php-cs-fixer": "^3.0"
"php": "^8.0",
"friendsofphp/php-cs-fixer": "^3.57"
},
"autoload": {
"psr-4": {
10 changes: 7 additions & 3 deletions src/BedrockStreaming.php
Original file line number Diff line number Diff line change
@@ -1,5 +1,7 @@
<?php

declare(strict_types=1);

namespace M6Web\CS\Config;

use PhpCsFixer\Config;
@@ -16,20 +18,21 @@ public function __construct()
public function getRules(): array
{
$rules = [
'@PSR12' => true,
'@Symfony' => true,
'array_syntax' => [
'syntax' => 'short',
],
'braces' => [
'allow_single_line_closure' => true,
],
'declare_strict_types' => true,
'global_namespace_import' => [
'import_classes' => false,
'import_constants' => false,
'import_functions' => false,
],
'heredoc_to_nowdoc' => false,
'increment_style' => ['style' => 'post'],
'native_function_invocation' => ['strict' => false],
'no_superfluous_phpdoc_tags' => ['allow_mixed' => true],
'no_unreachable_default_argument_value' => false,
'ordered_imports' => ['sort_algorithm' => 'alpha'],
'phpdoc_line_span' => [
@@ -39,6 +42,7 @@ public function getRules(): array
'phpdoc_summary' => false,
'single_line_throw' => false,
'yoda_style' => false,
'trailing_comma_in_multiline' => ['elements' => ['arguments', 'arrays', 'match', 'parameters']],
];

return $rules;
43 changes: 0 additions & 43 deletions src/Php71.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/Php72.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/Php73.php

This file was deleted.

43 changes: 0 additions & 43 deletions src/Php74.php

This file was deleted.