Skip to content

Commit

Permalink
apply cs
Browse files Browse the repository at this point in the history
  • Loading branch information
TomasVotruba committed Feb 18, 2024
1 parent f41f6f6 commit d6deaff
Show file tree
Hide file tree
Showing 23 changed files with 32 additions and 50 deletions.
23 changes: 2 additions & 21 deletions ecs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,27 +2,8 @@

declare(strict_types=1);

use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withPaths([
__DIR__ . '/src',
__DIR__ . '/tests',
])

// add a single rule
->withRules([
NoUnusedImportsFixer::class,
])

// add sets - group of rules
// ->withPreparedSets(
// arrays: true,
// namespaces: true,
// spaces: true,
// docblocks: true,
// comments: true,
// )

;
->withPaths([__DIR__ . '/src', __DIR__ . '/tests'])
->withPreparedSets(psr12: true);
14 changes: 7 additions & 7 deletions src/CakePHP/PortedInflector.php
Original file line number Diff line number Diff line change
Expand Up @@ -229,13 +229,13 @@ public static function pluralize($word)

if (!isset(static::$_plural['cacheUninflected']) || !isset(static::$_plural['cacheIrregular'])) {
static::$_plural['cacheUninflected'] = '(?:' . implode(
'|',
static::$_plural['merged']['uninflected']
) . ')';
'|',
static::$_plural['merged']['uninflected']
) . ')';
static::$_plural['cacheIrregular'] = '(?:' . implode(
'|',
array_keys(static::$_plural['merged']['irregular'])
) . ')';
'|',
array_keys(static::$_plural['merged']['irregular'])
) . ')';
}

if (preg_match('/(.*?(?:\\b|_))(' . static::$_plural['cacheIrregular'] . ')$/i', $word, $regs)) {
Expand Down Expand Up @@ -272,6 +272,6 @@ public static function pluralize($word)
private static function underscore($camelCasedWord)
{
$underscoredWord = preg_replace('/(?<=\\w)([A-Z])/', '_\\1', (string) $camelCasedWord);
return mb_strtolower($underscoredWord);
return mb_strtolower($underscoredWord);
}
}
2 changes: 1 addition & 1 deletion src/ClassMethodExtension/ModelMethodExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -70,7 +70,7 @@ static function (
return $methodReflection->getName() === $methodName;
}
);
if (! $methodReflections) {
if (!$methodReflections) {
throw new Exception('Method not found');
}
return reset($methodReflections);
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -80,7 +80,7 @@ private function getDefinedComponentsAsList(ClassReflection $classReflection): a
$definedComponents = [];

foreach (array_merge([$classReflection], $classReflection->getParents()) as $class) {
if (! $class->hasProperty('components')) {
if (!$class->hasProperty('components')) {
continue;
}

Expand All @@ -89,7 +89,7 @@ private function getDefinedComponentsAsList(ClassReflection $classReflection): a
->getDefaultValueExpression();

if (!$defaultValue instanceof Array_) {
continue;
continue;
}

foreach ($defaultValue->items as $item) {
Expand Down
1 change: 0 additions & 1 deletion src/ClassPropertyExtension/ShellClassPropertyExtension.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,6 @@

namespace PHPStanCakePHP2\ClassPropertyExtension;


/**
* Adds {@link Model}s as properties to {@link Shell}s.
*
Expand Down
4 changes: 2 additions & 2 deletions src/ModelBehaviorMethodExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,7 +69,7 @@ private function filterBehaviorMethods(
ExtendedMethodReflection $methodReflection
): bool {
return $methodReflection->isPublic()
&& ! $methodReflection->isStatic()
&& !$methodReflection->isStatic()
&& array_filter(
$methodReflection->getVariants(),
[$this, 'filterBehaviorMethodVariants']
Expand All @@ -87,7 +87,7 @@ private function filterBehaviorMethodVariants(
/** @var ParameterReflection|null $firstParameter */
$firstParameter = array_shift($parameters);

if (! $firstParameter) {
if (!$firstParameter) {
return false;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Reflection/ClassReflectionFinder.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ private function getClassNamesFromPaths(
$classPaths = [];
foreach ($paths as $path) {
$filePaths = glob($path);
if (! is_array($filePaths)) {
if (!is_array($filePaths)) {
throw new Exception(sprintf('glob(%s) caused an error', $path));
}
$classPaths = array_merge($classPaths, $filePaths);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
@@ -1,6 +1,6 @@
<?php

declare(strict_types = 1);
declare(strict_types=1);

use function PHPStan\Testing\assertType;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -22,8 +22,8 @@ public function test(string $assertType, string $file, ...$args): void
public static function dataFileAsserts(): \Iterator
{
yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_shell_model.php');
// yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_shell_task.php');
// yield from self::gatherAssertTypes(__DIR__ . '/Fixture/invalid_shell_property.php');
// yield from self::gatherAssertTypes(__DIR__ . '/Fixture/existing_shell_task.php');
// yield from self::gatherAssertTypes(__DIR__ . '/Fixture/invalid_shell_property.php');
}

/**
Expand Down
1 change: 1 addition & 0 deletions tests/Source/Model/Behavior/BasicBehavior.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace PHPStanCakePHP2\Tests\Source\Model\Behavior;

use Model;
use ModelBehavior;

Expand Down
1 change: 1 addition & 0 deletions tests/Source/Model/SameAsModel.php
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

namespace PHPStanCakePHP2\Tests\Source\Model;

use Model;

class SameAsModel extends Model
Expand Down

0 comments on commit d6deaff

Please sign in to comment.