mirror of
https://gitlab.com/Chill-Projet/chill-bundles.git
synced 2025-08-23 16:13:50 +00:00
apply more cs rules for php-cs
This commit is contained in:
@@ -168,7 +168,6 @@ PHP */
|
||||
}
|
||||
|
||||
/**
|
||||
* @param Node\Stmt\ClassMethod $buildFormMethod
|
||||
* @return array{"build_form_method": Node\Stmt\ClassMethod, "empty_to_replace": array<string, mixed>}
|
||||
*/
|
||||
private function filterBuildFormMethod(Node\Stmt\ClassMethod $buildFormMethod, Node\Stmt\Class_ $node): array
|
||||
@@ -194,7 +193,7 @@ PHP */
|
||||
|
||||
$buildFormMethod->stmts = $newStmts;
|
||||
|
||||
return ['build_form_method' => $buildFormMethod, "empty_to_replace" => $emptyDataToReplace];
|
||||
return ['build_form_method' => $buildFormMethod, 'empty_to_replace' => $emptyDataToReplace];
|
||||
}
|
||||
|
||||
private function handleMethodCallBuilderAdd(Node\Expr\MethodCall $methodCall, string $builderName, Node\Stmt\Class_ $node): array|false
|
||||
@@ -227,14 +226,14 @@ PHP */
|
||||
}
|
||||
}
|
||||
|
||||
if ($methodCall->name instanceof Node\Identifier && $methodCall->name->name !== 'add') {
|
||||
if ($methodCall->name instanceof Node\Identifier && 'add' !== $methodCall->name->name) {
|
||||
return ['stmt' => $methodCall, 'emptyDataToReplace' => $emptyDataToReplace];
|
||||
}
|
||||
|
||||
if (
|
||||
// the method call must be "add"
|
||||
$methodCall->name instanceof Node\Identifier
|
||||
&& $methodCall->name->name === 'add'
|
||||
&& 'add' === $methodCall->name->name
|
||||
// it must have a first argument, a string
|
||||
// TODO what happens if a value, or a const ?
|
||||
&& ($methodCall->args[0] ?? null) instanceof Node\Arg
|
||||
@@ -247,7 +246,7 @@ PHP */
|
||||
$emptyDataIndex = null;
|
||||
foreach ($methodCall->args[2]->value->items as $arrayItemIndex => $item) {
|
||||
/* @phpstan-ignore-next-line */
|
||||
if ($item->key->value === 'data' or $item->key->value === 'empty_data') {
|
||||
if ('data' === $item->key->value or 'empty_data' === $item->key->value) {
|
||||
$k = $methodCall->args[0]->value->value;
|
||||
$emptyDataToReplace[$k] = $item->value;
|
||||
$emptyDataIndex = $arrayItemIndex;
|
||||
@@ -259,7 +258,7 @@ PHP */
|
||||
array_filter(
|
||||
$methodCall->args[2]->value->items,
|
||||
/* @phpstan-ignore-next-line */
|
||||
fn (Node\Expr\ArrayItem $item) => $item->key->value !== 'data'
|
||||
fn (Node\Expr\ArrayItem $item) => 'data' !== $item->key->value
|
||||
)
|
||||
);
|
||||
}
|
||||
|
Reference in New Issue
Block a user