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: CodelyTV/php-coding_style-codely
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: 1.0.1
Choose a base ref
...
head repository: CodelyTV/php-coding_style-codely
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: main
Choose a head ref
  • 6 commits
  • 7 files changed
  • 1 contributor

Commits on Oct 23, 2023

  1. Unverified

    This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
    Copy the full SHA
    34e9050 View commit details
  2. feat: simplify api

    rgomezcasas committed Oct 23, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    rgomezcasas Rafa Gómez
    Copy the full SHA
    9178d43 View commit details
  3. feat: indent arrays

    rgomezcasas committed Oct 23, 2023

    Verified

    This commit was signed with the committer’s verified signature.
    rgomezcasas Rafa Gómez
    Copy the full SHA
    2e00fde View commit details

Commits on Oct 24, 2023

  1. Verified

    This commit was signed with the committer’s verified signature.
    rgomezcasas Rafa Gómez
    Copy the full SHA
    7e6fde0 View commit details
  2. Verified

    This commit was signed with the committer’s verified signature.
    rgomezcasas Rafa Gómez
    Copy the full SHA
    ffd9d00 View commit details

Commits on Aug 5, 2024

  1. feat: add spaces between union types

    rgomezcasas committed Aug 5, 2024

    Verified

    This commit was signed with the committer’s verified signature.
    rgomezcasas Rafa Gómez
    Copy the full SHA
    41d7e6b View commit details
Showing with 49 additions and 18 deletions.
  1. +5 −2 README.md
  2. +7 −1 composer.json
  3. +2 −2 ecs.php
  4. +0 −10 src/CodelyRules.php
  5. +11 −0 src/CodingStyle.php
  6. +3 −3 src/coding_style.php
  7. +21 −0 src/coding_style_aligned.php
7 changes: 5 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
@@ -29,13 +29,16 @@
```
2. Add it to your `ecs.php` file:
```php
use CodelyTv\CodingStyle\CodelyRules;
use CodelyTv\CodingStyle;
use Symplify\EasyCodingStandard\Config\ECSConfig;
return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__ . '/src',]);
$ecsConfig->sets([CodelyRules::CODING_STYLE]);
$ecsConfig->sets([CodingStyle::DEFAULT]);
// Or this if you prefer to have the code aligned
// $ecsConfig->sets([CodingStyle::ALIGNED]);
};
```
3. Execute it:
8 changes: 7 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
@@ -4,9 +4,15 @@
"type": "library",
"keywords": ["static analysis", "code style"],
"license": "AGPL-3.0-or-later",
"authors": [
{
"name": "Codely",
"homepage": "https://codely.com"
}
],
"autoload": {
"psr-4": {
"CodelyTv\\CodingStyle\\": "src/"
"CodelyTv\\": "src/"
}
},
"require": {
4 changes: 2 additions & 2 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -2,11 +2,11 @@

declare(strict_types=1);

use CodelyTv\CodingStyle\CodelyRules;
use CodelyTv\CodingStyle;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return function (ECSConfig $ecsConfig): void {
$ecsConfig->paths([__DIR__ . '/src',]);

$ecsConfig->sets([CodelyRules::CODING_STYLE]);
$ecsConfig->sets([CodingStyle::DEFAULT]);
};
10 changes: 0 additions & 10 deletions src/CodelyRules.php

This file was deleted.

11 changes: 11 additions & 0 deletions src/CodingStyle.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,11 @@
<?php

declare(strict_types=1);

namespace CodelyTv;

final class CodingStyle
{
public const DEFAULT = __DIR__ . '/coding_style.php';
public const ALIGNED = __DIR__ . '/coding_style_aligned.php';
}
6 changes: 3 additions & 3 deletions src/coding_style.php
Original file line number Diff line number Diff line change
@@ -12,7 +12,6 @@
use PhpCsFixer\Fixer\Casing\NativeFunctionTypeDeclarationCasingFixer;
use PhpCsFixer\Fixer\CastNotation\CastSpacesFixer;
use PhpCsFixer\Fixer\ClassNotation\FinalClassFixer;
use PhpCsFixer\Fixer\ClassNotation\FinalPublicMethodForAbstractClassFixer;
use PhpCsFixer\Fixer\ClassNotation\NoBlankLinesAfterClassOpeningFixer;
use PhpCsFixer\Fixer\ClassNotation\NoNullPropertyInitializationFixer;
use PhpCsFixer\Fixer\ClassNotation\NoUnneededFinalMethodFixer;
@@ -46,6 +45,7 @@
use PhpCsFixer\Fixer\Strict\DeclareStrictTypesFixer;
use PhpCsFixer\Fixer\Strict\StrictComparisonFixer;
use PhpCsFixer\Fixer\StringNotation\SingleQuoteFixer;
use PhpCsFixer\Fixer\Whitespace\ArrayIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\StatementIndentationFixer;
use PhpCsFixer\Fixer\Whitespace\TypeDeclarationSpacesFixer;
use PhpCsFixer\Fixer\Whitespace\TypesSpacesFixer;
@@ -66,14 +66,14 @@
NoLeadingImportSlashFixer::class,
// Arrays
TrimArraySpacesFixer::class,
ArrayIndentationFixer::class,
// Blank lines
BlankLineAfterStrictTypesFixer::class,
NoBlankLinesAfterClassOpeningFixer::class,
// Spacing
SingleLineEmptyBodyFixer::class,
CastSpacesFixer::class,
TypeDeclarationSpacesFixer::class,
TypesSpacesFixer::class,
// Casing
ClassReferenceNameCasingFixer::class,
LowercaseStaticReferenceFixer::class,
@@ -82,7 +82,6 @@
NativeFunctionTypeDeclarationCasingFixer::class,
// Architecture
FinalClassFixer::class,
FinalPublicMethodForAbstractClassFixer::class,
ProtectedToPrivateFixer::class,
VisibilityRequiredFixer::class,
DateTimeImmutableFixer::class,
@@ -115,6 +114,7 @@
StatementIndentationFixer::class,
]);

$ecsConfig->ruleWithConfiguration(TypesSpacesFixer::class, ['space' => 'single', 'space_multiple_catch' => 'single']);
$ecsConfig->ruleWithConfiguration(ArraySyntaxFixer::class, ['syntax' => 'short']);
$ecsConfig->ruleWithConfiguration(LineLengthFixer::class, [LineLengthFixer::LINE_LENGTH => 120]);
$ecsConfig->ruleWithConfiguration(
21 changes: 21 additions & 0 deletions src/coding_style_aligned.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,21 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\Operator\BinaryOperatorSpacesFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return static function (ECSConfig $ecsConfig): void {
$ecsConfig->ruleWithConfiguration(
BinaryOperatorSpacesFixer::class,
[
'operators' =>
[
'=' => 'align',
'=>' => 'align',
],
]
);

$ecsConfig->sets([__DIR__ . '/coding_style.php']);
};