Skip to content

Commit

Permalink
Fix SA (#8207)
Browse files Browse the repository at this point in the history
  • Loading branch information
VincentLanglet authored Aug 26, 2024
1 parent 9b91cb5 commit 672a614
Show file tree
Hide file tree
Showing 118 changed files with 430 additions and 430 deletions.
2 changes: 1 addition & 1 deletion src/Action/AppendFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __invoke(Request $request): Response
} elseif (\is_string($objectId) || \is_int($objectId)) {
$subject = $admin->getObject($objectId);
if (null === $subject) {
throw new NotFoundHttpException(sprintf(
throw new NotFoundHttpException(\sprintf(
'Unable to find the object id: %s, class: %s',
$objectId,
$admin->getClass()
Expand Down
2 changes: 1 addition & 1 deletion src/Action/GetShortObjectDescriptionAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -54,7 +54,7 @@ public function __invoke(Request $request): Response
try {
$object = $admin->getObject($objectId);
if (null === $object) {
throw new NotFoundHttpException(sprintf('Could not find subject for id "%s"', $objectId));
throw new NotFoundHttpException(\sprintf('Could not find subject for id "%s"', $objectId));
}
} finally {
// Restore the subclass if present to reduce impact of the parameter removal above.
Expand Down
14 changes: 7 additions & 7 deletions src/Action/RetrieveAutocompleteItemsAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -133,7 +133,7 @@ public function __invoke(Request $request): JsonResponse
$previousFilter = null;
foreach ($property as $prop) {
if (!$datagrid->hasFilter($prop)) {
throw new BadRequestHttpException(sprintf(
throw new BadRequestHttpException(\sprintf(
'To retrieve autocomplete items, you MUST add the filter "%s"'
.' to the %s::configureDatagridFilters() method.',
$prop,
Expand All @@ -143,7 +143,7 @@ public function __invoke(Request $request): JsonResponse

$filter = $datagrid->getFilter($prop);
if (!$filter instanceof ChainableFilterInterface) {
throw new BadRequestHttpException(sprintf(
throw new BadRequestHttpException(\sprintf(
'To retrieve autocomplete items with multiple properties,'
.' the filter "%s" of the admin "%s" MUST implements "%s".',
$filter->getName(),
Expand All @@ -165,7 +165,7 @@ public function __invoke(Request $request): JsonResponse
$datagrid->reorderFilters($property);
} elseif (\is_string($property)) {
if (!$datagrid->hasFilter($property)) {
throw new BadRequestHttpException(sprintf(
throw new BadRequestHttpException(\sprintf(
'To retrieve autocomplete items, you MUST add the filter "%s"'
.' to the %s::configureDatagridFilters() method.',
$property,
Expand Down Expand Up @@ -235,13 +235,13 @@ private function retrieveFilterFieldDescription(
string $field
): FieldDescriptionInterface {
if (!$admin->hasFilterFieldDescription($field)) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field));
throw new \RuntimeException(\sprintf('The field "%s" does not exist.', $field));
}

$fieldDescription = $admin->getFilterFieldDescription($field);

if (null === $fieldDescription->getTargetModel()) {
throw new \RuntimeException(sprintf('No associated entity with field "%s".', $field));
throw new \RuntimeException(\sprintf('No associated entity with field "%s".', $field));
}

return $fieldDescription;
Expand All @@ -259,13 +259,13 @@ private function retrieveFormFieldDescription(
string $field
): FieldDescriptionInterface {
if (!$admin->hasFormFieldDescription($field)) {
throw new \RuntimeException(sprintf('The field "%s" does not exist.', $field));
throw new \RuntimeException(\sprintf('The field "%s" does not exist.', $field));
}

$fieldDescription = $admin->getFormFieldDescription($field);

if (null === $fieldDescription->getTargetModel()) {
throw new \RuntimeException(sprintf('No associated entity with field "%s".', $field));
throw new \RuntimeException(\sprintf('No associated entity with field "%s".', $field));
}

return $fieldDescription;
Expand Down
2 changes: 1 addition & 1 deletion src/Action/RetrieveFormFieldElementAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -48,7 +48,7 @@ public function __invoke(Request $request): Response
} elseif (\is_string($objectId) || \is_int($objectId)) {
$subject = $admin->getObject($objectId);
if (null === $subject) {
throw new NotFoundHttpException(sprintf(
throw new NotFoundHttpException(\sprintf(
'Unable to find the object id: %s, class: %s',
$objectId,
$admin->getClass()
Expand Down
6 changes: 3 additions & 3 deletions src/Action/SetObjectFieldValueAction.php
Original file line number Diff line number Diff line change
Expand Up @@ -42,7 +42,7 @@ public function __construct(
) {
// NEXT_MAJOR: Remove the deprecation and restrict param constructor to RenderElementRuntime.
if (null === $renderElementRuntime) {
@trigger_error(sprintf(
@trigger_error(\sprintf(
'Passing null as argument 5 of "%s()" is deprecated since sonata-project/admin-bundle 4.7'
.' and will throw an error in 5.0. You MUST pass an instance of %s instead.',
__METHOD__,
Expand All @@ -69,7 +69,7 @@ public function __invoke(Request $request): JsonResponse
}

if (Request::METHOD_POST !== $request->getMethod()) {
return new JsonResponse(sprintf(
return new JsonResponse(\sprintf(
'Invalid request method given "%s", %s expected',
$request->getMethod(),
Request::METHOD_POST
Expand Down Expand Up @@ -138,7 +138,7 @@ public function __invoke(Request $request): JsonResponse
}

if (null === $value && FieldDescriptionInterface::TYPE_CHOICE === $fieldDescription->getType()) {
return new JsonResponse(sprintf(
return new JsonResponse(\sprintf(
'Edit failed, object with id "%s" not found in association "%s".',
$objectId,
$field
Expand Down
Loading

0 comments on commit 672a614

Please sign in to comment.