Skip to content

Commit

Permalink
Merge f83f191 into b660c08
Browse files Browse the repository at this point in the history
  • Loading branch information
OndraM committed May 21, 2024
2 parents b660c08 + f83f191 commit 24a41cf
Show file tree
Hide file tree
Showing 5 changed files with 30 additions and 2 deletions.
6 changes: 6 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,6 +50,7 @@
use PhpCsFixer\Fixer\Basic\PsrAutoloadingFixer;
use PhpCsFixer\Fixer\Basic\SingleLineEmptyBodyFixer;
use PhpCsFixer\Fixer\Casing\ClassReferenceNameCasingFixer;
use PhpCsFixer\Fixer\Casing\MagicConstantCasingFixer;
use PhpCsFixer\Fixer\Casing\MagicMethodCasingFixer;
use PhpCsFixer\Fixer\Casing\NativeFunctionCasingFixer;
use PhpCsFixer\Fixer\Casing\NativeTypeDeclarationCasingFixer;
Expand Down Expand Up @@ -123,6 +124,7 @@
use PhpCsFixer\Fixer\Phpdoc\PhpdocScalarFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocSingleLineVarSpacingFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocToCommentFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimConsecutiveBlankLineSeparationFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTrimFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocTypesFixer;
use PhpCsFixer\Fixer\Phpdoc\PhpdocVarAnnotationCorrectOrderFixer;
Expand Down Expand Up @@ -258,6 +260,8 @@
PsrAutoloadingFixer::class,
// When referencing an internal class it must be written using the correct casing.
ClassReferenceNameCasingFixer::class,
// Magic constants should be referred to using the correct casing.
MagicConstantCasingFixer::class,
// Magic method definitions and calls must be using the correct casing
MagicMethodCasingFixer::class,
// Function defined by PHP should be called using the correct casing
Expand Down Expand Up @@ -368,6 +372,8 @@
PhpdocScalarFixer::class,
// Single line `@var` PHPDoc should have proper spacing.
PhpdocSingleLineVarSpacingFixer::class,
// Removes extra blank lines after summary and after description in PHPDoc.
PhpdocTrimConsecutiveBlankLineSeparationFixer::class,
// PHPDoc should start and end with content
PhpdocTrimFixer::class,
// Docblocks should only be used on structural elements.
Expand Down
8 changes: 8 additions & 0 deletions tests/Integration/Fixtures/Basic.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,6 +15,12 @@ class Basic extends AbstractBasic implements InterfaceFromThisNamespace // Fully

protected int $myProperty = 666; // OrderedClassElementsFixer

// MagicMethodCasingFixer, OrderedClassElementsFixer
public function __toString(): string
{
return '';
}

public function isEqual($a, ?string $b): ?bool // VisibilityRequiredFixer, CompactNullableTypeDeclarationFixer
{
// TrimArraySpacesFixer
Expand Down Expand Up @@ -44,6 +50,8 @@ class Basic extends AbstractBasic implements InterfaceFromThisNamespace // Fully

public function fooBar(mixed $foo): mixed // FunctionDeclarationFixer
{
// MagicConstantCasingFixer
$magicConstant = __DIR__;
$value = 5;
// FunctionDeclarationFixer
$function = function ($foo) use ($value) {
Expand Down
8 changes: 8 additions & 0 deletions tests/Integration/Fixtures/Basic.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,8 @@ class Basic extends \Some\Other\Namespace\AbstractBasic implements \Lmc\CodingSt

public function fooBar ( mixed $foo ): mixed // FunctionDeclarationFixer
{
// MagicConstantCasingFixer
$magicConstant = __dir__;
$value = 5;
// FunctionDeclarationFixer
$function = function($foo)use($value) {
Expand Down Expand Up @@ -158,4 +160,10 @@ but should be heredoc instead';
// NullableTypeDeclarationForDefaultNullValueFixer
string $anotherNullableValue = null,
): void {}

// MagicMethodCasingFixer, OrderedClassElementsFixer
public function __ToString(): string
{
return '';
}
}
4 changes: 3 additions & 1 deletion tests/Integration/Fixtures/PhpDoc.correct.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,9 @@ class PhpDoc

/**
* Very well documented method.
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer and possibly other Phpdoc rules.
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer
* and possibly other Phpdoc rules.
*
* @param int|float $second Second parameter does have a comment, unlike the first one.
* @param string|null $third Third parameter is optional and has a default value.
* @return mixed There is also information about return type.
Expand Down
6 changes: 5 additions & 1 deletion tests/Integration/Fixtures/PhpDoc.wrong.php.inc
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,11 @@ class PhpDoc

/**
* Very well documented method.
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer and possibly other Phpdoc rules.
* It tests PhpdocAlignFixer, NoSuperfluousPhpdocTagsFixer, PhpdocTrimConsecutiveBlankLineSeparationFixer
* and possibly other Phpdoc rules.
*
*
*
* @param string $first
* @throws \Exception
* @param int|float $second Second parameter does have a comment, unlike the first one.
Expand Down

0 comments on commit 24a41cf

Please sign in to comment.