Skip to content

Commit 83dac1f

Browse files
committed
Apply code style fixes
1 parent 5aa6dae commit 83dac1f

File tree

12 files changed

+39
-46
lines changed

12 files changed

+39
-46
lines changed

.php-cs-fixer.dist.php

Lines changed: 0 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -12,11 +12,9 @@
1212
*/
1313

1414
use Nexus\CsConfig\Factory;
15-
use Nexus\CsConfig\Fixer\Comment\NoCodeSeparatorCommentFixer;
1615
use Nexus\CsConfig\FixerGenerator;
1716
use Nexus\CsConfig\Ruleset\Nexus82;
1817
use PhpCsFixer\Finder;
19-
use PhpCsFixerCustomFixers\Fixer\MultilinePromotedPropertiesFixer;
2018
use PhpCsFixerCustomFixers\Fixer\NoCommentedOutCodeFixer;
2119
use PhpCsFixerCustomFixers\Fixer\NoUselessCommentFixer;
2220
use PhpCsFixerCustomFixers\Fixer\NoUselessParenthesisFixer;
@@ -55,11 +53,6 @@
5553
'finder' => $finder,
5654
'customFixers' => FixerGenerator::create('tools/vendor/nexusphp/cs-config/src/Fixer', 'Nexus\\CsConfig\\Fixer')->mergeWith(new Fixers()),
5755
'customRules' => [
58-
MultilinePromotedPropertiesFixer::name() => [
59-
'keep_blank_lines' => false,
60-
'minimum_number_of_properties' => 1,
61-
],
62-
NoCodeSeparatorCommentFixer::name() => true,
6356
NoCommentedOutCodeFixer::name() => true,
6457
NoUselessCommentFixer::name() => true,
6558
NoUselessParenthesisFixer::name() => true,

api/src/RendererFilter.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -68,10 +68,10 @@ public function filterNamespacePage(NamespaceIndex $namespace): bool
6868

6969
public function filterClassLikePage(ClassLikeInfo $classLike): bool
7070
{
71-
return $this->isClassRendered($classLike);
71+
return self::isClassRendered($classLike);
7272
}
7373

74-
private function isClassRendered(ClassLikeInfo $classLike): bool
74+
private static function isClassRendered(ClassLikeInfo $classLike): bool
7575
{
7676
$name = $classLike->name->full;
7777

composer.json

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -79,8 +79,8 @@
7979
"post-update-cmd": [
8080
"@composer update --ansi --working-dir=tools"
8181
],
82-
"cs:check": "tools/vendor/bin/php-cs-fixer check --ansi --verbose --diff",
83-
"cs:fix": "tools/vendor/bin/php-cs-fixer fix --ansi --verbose --diff",
82+
"cs:check": "tools/vendor/bin/php-cs-fixer check --ansi --verbose --diff --using-cache=no",
83+
"cs:fix": "tools/vendor/bin/php-cs-fixer fix --ansi --verbose --diff --using-cache=no",
8484
"mutation:check": "tools/vendor/bin/infection --threads=max --ansi",
8585
"mutation:filter": "@mutation:check --git-diff-filter=AM --git-diff-base=origin/1.x",
8686
"phpstan:baseline": "phpstan analyse --ansi --generate-baseline=phpstan-baseline.php",

src/Nexus/PHPStan/Rules/CleanCode/AssignExprInCondRule.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -32,19 +32,19 @@ public function getNodeType(): string
3232
public function processNode(Node $node, Scope $scope): array
3333
{
3434
if ($node instanceof Node\Stmt\If_) {
35-
return $this->processExprCond($node->cond, 'an if');
35+
return self::processExprCond($node->cond, 'an if');
3636
}
3737

3838
if ($node instanceof Node\Stmt\ElseIf_) {
39-
return $this->processExprCond($node->cond, 'an elseif');
39+
return self::processExprCond($node->cond, 'an elseif');
4040
}
4141

4242
if ($node instanceof Node\Stmt\While_) {
43-
return $this->processExprCond($node->cond, 'a while');
43+
return self::processExprCond($node->cond, 'a while');
4444
}
4545

4646
if ($node instanceof Node\Stmt\Do_) {
47-
return $this->processExprCond($node->cond, 'a do-while');
47+
return self::processExprCond($node->cond, 'a do-while');
4848
}
4949

5050
return [];
@@ -53,7 +53,7 @@ public function processNode(Node $node, Scope $scope): array
5353
/**
5454
* @return list<IdentifierRuleError>
5555
*/
56-
private function processExprCond(Node\Expr $cond, string $stmt): array
56+
private static function processExprCond(Node\Expr $cond, string $stmt): array
5757
{
5858
if ($cond instanceof Node\Expr\Assign) {
5959
return [

src/Nexus/PHPStan/Rules/Constants/ClassConstantNamingRule.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -43,7 +43,7 @@ public function processNode(Node $node, Scope $scope): array
4343
foreach ($node->consts as $const) {
4444
$errors = [
4545
...$errors,
46-
...$this->processSingleConstant($scope->getClassReflection(), $const),
46+
...self::processSingleConstant($scope->getClassReflection(), $const),
4747
];
4848
}
4949

@@ -53,10 +53,10 @@ public function processNode(Node $node, Scope $scope): array
5353
/**
5454
* @return list<IdentifierRuleError>
5555
*/
56-
private function processSingleConstant(ClassReflection $classReflection, Node\Const_ $const): array
56+
private static function processSingleConstant(ClassReflection $classReflection, Node\Const_ $const): array
5757
{
5858
$constantName = $const->name->toString();
59-
$prototype = $this->findPrototype($classReflection, $constantName);
59+
$prototype = self::findPrototype($classReflection, $constantName);
6060

6161
if (
6262
null !== $prototype
@@ -81,7 +81,7 @@ private function processSingleConstant(ClassReflection $classReflection, Node\Co
8181
return [];
8282
}
8383

84-
private function findPrototype(ClassReflection $classReflection, string $constantName): ?ClassConstantReflection
84+
private static function findPrototype(ClassReflection $classReflection, string $constantName): ?ClassConstantReflection
8585
{
8686
foreach ($classReflection->getImmediateInterfaces() as $immediateInterface) {
8787
if ($immediateInterface->hasConstant($constantName)) {

src/Nexus/PHPStan/Rules/Properties/PropertyNamingRule.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -35,7 +35,7 @@ public function processNode(Node $node, Scope $scope): array
3535
{
3636
$classReflection = $node->getClassReflection();
3737
$propertyName = $node->getName();
38-
$propertyPrototype = $this->findPrototype($classReflection, $propertyName);
38+
$propertyPrototype = self::findPrototype($classReflection, $propertyName);
3939

4040
if (
4141
null !== $propertyPrototype
@@ -67,7 +67,7 @@ public function processNode(Node $node, Scope $scope): array
6767
return [];
6868
}
6969

70-
private function findPrototype(ClassReflection $classReflection, string $propertyName): ?PhpPropertyReflection
70+
private static function findPrototype(ClassReflection $classReflection, string $propertyName): ?PhpPropertyReflection
7171
{
7272
$parentClass = $classReflection->getParentClass();
7373

src/Nexus/Password/Hash/AbstractArgon2Hash.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct(
5050
public Algorithm $algorithm,
5151
array $options = [],
5252
) {
53-
['memory_cost' => $this->memoryCost, 'time_cost' => $this->timeCost, 'threads' => $this->threads] = $this->validatedOptions(
53+
['memory_cost' => $this->memoryCost, 'time_cost' => $this->timeCost, 'threads' => $this->threads] = self::validatedOptions(
5454
$options,
5555
PASSWORD_ARGON2_DEFAULT_MEMORY_COST,
5656
PASSWORD_ARGON2_DEFAULT_TIME_COST,
@@ -74,7 +74,7 @@ public function hash(#[\SensitiveParameter] string $password, array $options = [
7474
return password_hash(
7575
$password,
7676
$this->algorithm->value,
77-
$this->validatedOptions(
77+
self::validatedOptions(
7878
$options,
7979
$this->memoryCost,
8080
$this->timeCost,
@@ -95,7 +95,7 @@ public function needsRehash(string $hash, array $options = []): bool
9595
return password_needs_rehash(
9696
$hash,
9797
$this->algorithm->value,
98-
$this->validatedOptions(
98+
self::validatedOptions(
9999
$options,
100100
$this->memoryCost,
101101
$this->timeCost,
@@ -128,7 +128,7 @@ public function verify(string $password, string $hash): bool
128128
*
129129
* @throws HashException
130130
*/
131-
private function validatedOptions(array $options, int $memoryCost, int $timeCost, int $threads): array
131+
private static function validatedOptions(array $options, int $memoryCost, int $timeCost, int $threads): array
132132
{
133133
$memoryCost = $options['memory_cost'] ?? $memoryCost;
134134
$timeCost = $options['time_cost'] ?? $timeCost;

src/Nexus/Password/Hash/BcryptHash.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function __construct(
4444
));
4545
}
4646

47-
['cost' => $this->cost] = $this->validatedCost($options, self::DEFAULT_COST);
47+
['cost' => $this->cost] = self::validatedCost($options, self::DEFAULT_COST);
4848
}
4949

5050
/**
@@ -63,7 +63,7 @@ public function hash(#[\SensitiveParameter] string $password, array $options = [
6363
return password_hash(
6464
$password,
6565
$this->algorithm->value,
66-
$this->validatedCost($options, $this->cost),
66+
self::validatedCost($options, $this->cost),
6767
);
6868
}
6969

@@ -75,7 +75,7 @@ public function needsRehash(string $hash, array $options = []): bool
7575
return password_needs_rehash(
7676
$hash,
7777
$this->algorithm->value,
78-
$this->validatedCost($options, $this->cost),
78+
self::validatedCost($options, $this->cost),
7979
);
8080
}
8181

@@ -108,7 +108,7 @@ public function valid(): bool
108108
*
109109
* @throws HashException
110110
*/
111-
private function validatedCost(array $options, int $cost): array
111+
private static function validatedCost(array $options, int $cost): array
112112
{
113113
$cost = $options['cost'] ?? $cost;
114114

src/Nexus/Password/Hash/Pbkdf2Hash.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -68,7 +68,7 @@ public function __construct(
6868

6969
$this->algorithm = $algorithm;
7070

71-
['iterations' => $this->iterations, 'length' => $this->length] = $this->validatedOptions(
71+
['iterations' => $this->iterations, 'length' => $this->length] = self::validatedOptions(
7272
$options,
7373
$this->defaultIterations(),
7474
self::DEFAULT_LENGTH,
@@ -87,7 +87,7 @@ public function hash(#[\SensitiveParameter] string $password, array $options = [
8787
throw new HashException('Invalid password provided.');
8888
}
8989

90-
['iterations' => $iterations, 'length' => $length] = $this->validatedOptions(
90+
['iterations' => $iterations, 'length' => $length] = self::validatedOptions(
9191
$options,
9292
$this->iterations,
9393
$this->length,
@@ -134,7 +134,7 @@ public function verify(string $password, string $hash, string $salt = ''): bool
134134
}
135135

136136
try {
137-
['iterations' => $iterations,'length' => $length] = $this->validatedOptions(
137+
['iterations' => $iterations,'length' => $length] = self::validatedOptions(
138138
[],
139139
(int) $matches[1],
140140
(int) $matches[2],
@@ -209,7 +209,7 @@ private function defaultIterations(): int
209209
*
210210
* @throws HashException
211211
*/
212-
private function validatedOptions(array $options, int $iterations, int $length): array
212+
private static function validatedOptions(array $options, int $iterations, int $length): array
213213
{
214214
$iterations = $options['iterations'] ?? $iterations;
215215
$length = $options['length'] ?? $length;

src/Nexus/Password/Hash/SodiumHash.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -58,7 +58,7 @@ public function __construct(
5858
));
5959
}
6060

61-
['opslimit' => $this->opslimit, 'memlimit' => $this->memlimit] = $this->validatedOptions(
61+
['opslimit' => $this->opslimit, 'memlimit' => $this->memlimit] = self::validatedOptions(
6262
$options,
6363
SODIUM_CRYPTO_PWHASH_OPSLIMIT_MODERATE,
6464
SODIUM_CRYPTO_PWHASH_MEMLIMIT_MODERATE,
@@ -74,7 +74,7 @@ public function hash(#[\SensitiveParameter] string $password, array $options = [
7474
throw new HashException('Invalid password provided.');
7575
}
7676

77-
['opslimit' => $opslimit, 'memlimit' => $memlimit] = $this->validatedOptions(
77+
['opslimit' => $opslimit, 'memlimit' => $memlimit] = self::validatedOptions(
7878
$options,
7979
$this->opslimit,
8080
$this->memlimit,
@@ -88,7 +88,7 @@ public function hash(#[\SensitiveParameter] string $password, array $options = [
8888
*/
8989
public function needsRehash(string $hash, array $options = []): bool
9090
{
91-
['opslimit' => $opslimit, 'memlimit' => $memlimit] = $this->validatedOptions(
91+
['opslimit' => $opslimit, 'memlimit' => $memlimit] = self::validatedOptions(
9292
$options,
9393
$this->opslimit,
9494
$this->memlimit,
@@ -126,7 +126,7 @@ public function valid(): bool
126126
*
127127
* @throws HashException
128128
*/
129-
private function validatedOptions(array $options, int $opslimit, int $memlimit): array
129+
private static function validatedOptions(array $options, int $opslimit, int $memlimit): array
130130
{
131131
$opslimit = $options['opslimit'] ?? $opslimit;
132132
$memlimit = $options['memlimit'] ?? $memlimit;

0 commit comments

Comments
 (0)