Significant improvements specifically to php_cs_fixer

This commit is contained in:
Greyscale 2024-01-05 18:16:21 +01:00
parent 307976917f
commit 629fb64df3
No known key found for this signature in database
GPG key ID: 74BAFF55434DA4B2
2 changed files with 75 additions and 80 deletions

View file

@ -2,21 +2,39 @@
$finder = PhpCsFixer\Finder::create();
$finder->in(__DIR__);
return (new PhpCsFixer\Config)
return (new PhpCsFixer\Config())
->setRiskyAllowed(true)
->setHideProgress(false)
->setRules([
'@PSR2' => true,
'strict_param' => true,
'array_syntax' => ['syntax' => 'short'],
'@PhpCsFixer' => true,
'@PHP73Migration' => true,
'no_php4_constructor' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_superfluous_phpdoc_tags' => false,
'void_return' => true,
'yoda_style' => false,
// '@PhpCsFixer:risky' => true,
'@PHP82Migration' => true,
'@PHP80Migration:risky' => true,
'@PSR12' => true,
'@PSR12:risky' => true,
'@PHPUnit100Migration:risky' => true,
'binary_operator_spaces' => [
'default' => 'align_single_space_minimal',
'operators' => [
'=' => 'align_single_space',
'=>' => 'align_single_space',
],
],
'types_spaces' => [
'space' => 'single',
'space_multiple_catch' => 'single',
],
// Annoyance-fixers:
'concat_space' => ['spacing' => 'one'], // This one is a matter of taste.
'no_superfluous_phpdoc_tags' => [
'allow_mixed' => false,
'allow_unused_params' => false,
'remove_inheritdoc' => true,
],
'yoda_style' => false, // Disabled as its annoying. Comes with @PhpCsFixer
'native_function_invocation' => false, // Disabled as adding count($i) -> \count($i) is annoying, but supposedly more performant
])
->setFinder($finder)
;

View file

@ -62,9 +62,6 @@ class BouncerTarget
];
}
/**
* @return null|string
*/
public function getUsername(): ?string
{
return $this->username;
@ -72,8 +69,6 @@ class BouncerTarget
/**
* @param string
*
* @return BouncerTarget
*/
public function setUsername(string $username): BouncerTarget
{
@ -82,19 +77,11 @@ class BouncerTarget
return $this;
}
/**
* @return null|string
*/
public function getPassword(): ?string
{
return $this->password;
}
/**
* @param string $password
*
* @return BouncerTarget
*/
public function setPassword(string $password): BouncerTarget
{
$this->password = $password;
@ -416,19 +403,11 @@ class Bouncer
}
}
/**
* @return int
*/
public function getMaximumNginxConfigCreationNotices(): int
{
return $this->maximumNginxConfigCreationNotices;
}
/**
* @param int $maximumNginxConfigCreationNotices
*
* @return Bouncer
*/
public function setMaximumNginxConfigCreationNotices(int $maximumNginxConfigCreationNotices): Bouncer
{
$this->maximumNginxConfigCreationNotices = $maximumNginxConfigCreationNotices;
@ -700,7 +679,7 @@ class Bouncer
$containers = $this->dockerGetContainers();
foreach ($containers as $container) {
$inspect = $this->dockerGetContainer($container['Id']);
$name = ltrim($inspect['Name'],"/");
$name = ltrim($inspect['Name'], '/');
$newContainerState[$name] = [
'name' => $name,
'created' => $inspect['Created'],
@ -904,8 +883,6 @@ class Bouncer
}
/**
* @param BouncerTarget[] $target
*
* @return $this
*/
private function generateNginxConfigs(array $targets): self