Fix yoda style

This commit is contained in:
2024-06-12 14:47:21 +02:00
parent 06fb90881e
commit 2aca0fc5a6
9 changed files with 17 additions and 12 deletions
+6 -1
View File
@@ -7,6 +7,11 @@ $finder = (new PhpCsFixer\Finder())
return (new PhpCsFixer\Config())
->setRules([
'@Symfony' => true,
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline']
'method_argument_space' => ['on_multiline' => 'ensure_fully_multiline'],
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false
]
])
->setFinder($finder);
+1 -1
View File
@@ -116,7 +116,7 @@ class Accounting
{
// ensure ownership does not change
if (
null !== $this->ownerClass
$this->ownerClass !== null
&& $this->ownerClass !== $ownerClass
) {
throw new \Exception('Are you trying to commit fraud? Cannot change ownership of an Accounting.');
+2 -2
View File
@@ -50,11 +50,11 @@ class SystemVariable
return "int:$value";
}
if (\is_bool($value) && true === $value) {
if (\is_bool($value) && $value === true) {
return 'bool:true';
}
if (\is_bool($value) && false === $value) {
if (\is_bool($value) && $value === false) {
return 'bool:false';
}
+1 -1
View File
@@ -193,7 +193,7 @@ class User implements UserInterface, UserOwnedInterface, PasswordAuthenticatedUs
public function hasRoles(array $roles): bool
{
return 0 < count(array_intersect($this->getRoles(), $roles));
return count(array_intersect($this->getRoles(), $roles)) > 0;
}
/**
@@ -12,7 +12,7 @@ trait ArrayPumpTrait
*/
public function hasAllKeys(array $data, array $keys): bool
{
if (0 === count(\array_diff($keys, \array_keys($data)))) {
if (count(\array_diff($keys, \array_keys($data))) === 0) {
return true;
}
@@ -63,7 +63,7 @@ trait ProgressivePumpTrait
{
if (
\array_key_exists('progress', $this->config)
&& false === $this->config['progress']
&& $this->config['progress'] === false
) {
return false;
}
+3 -3
View File
@@ -43,7 +43,7 @@ class Stream implements StreamInterface
throw new \RuntimeException('Length parameter cannot be negative');
}
if (0 === $size) {
if ($size === 0) {
return '';
}
@@ -53,7 +53,7 @@ class Stream implements StreamInterface
throw new \RuntimeException(self::MESSAGE_ERROR_UNABLE_TO_READ, 0, $e);
}
if (false === $string) {
if ($string === false) {
throw new \RuntimeException(self::MESSAGE_ERROR_UNABLE_TO_READ);
}
@@ -66,7 +66,7 @@ class Stream implements StreamInterface
throw new \RuntimeException(self::MESSAGE_ERROR_DETACHED);
}
return ftell($this->stream);
return \ftell($this->stream);
}
public function size(): int
+1 -1
View File
@@ -48,6 +48,6 @@ class LegacyPasswordHasher implements PasswordHasherInterface
private function isOldBcrypt(string $str): bool
{
return 0 === strpos($str, '$1$');
return strpos($str, '$1$') === 0;
}
}
+1 -1
View File
@@ -18,7 +18,7 @@ class GatewayNameValidator extends ChoiceValidator
{
/* @var App\Validator\GatewayName $constraint */
if (null === $value || '' === $value) {
if ($value === null || $value === '') {
return;
}