Fixed coding style.

This commit is contained in:
Jan Böhmer 2020-03-15 13:56:31 +01:00
parent 24939f2342
commit fd61c8d9e2
129 changed files with 962 additions and 1091 deletions

View file

@ -87,8 +87,8 @@ class PartController extends AbstractController
* @Route("/{id}/info/{timestamp}", name="part_info")
* @Route("/{id}", requirements={"id"="\d+"})
*
* @param Part $part
* @return Response
*
* @throws \Exception
*/
public function show(Part $part, Request $request, TimeTravel $timeTravel, HistoryHelper $historyHelper,
@ -97,7 +97,7 @@ class PartController extends AbstractController
$this->denyAccessUnlessGranted('read', $part);
$timeTravel_timestamp = null;
if ($timestamp !== null) {
if (null !== $timestamp) {
$this->denyAccessUnlessGranted('@tools.timetravel');
$this->denyAccessUnlessGranted('show_history', $part);
//If the timestamp only contains numbers interpret it as unix timestamp
@ -110,10 +110,10 @@ class PartController extends AbstractController
$timeTravel->revertEntityToTimestamp($part, $timeTravel_timestamp);
}
if ($this->isGranted('show_history', $part) ) {
if ($this->isGranted('show_history', $part)) {
$table = $dataTable->createFromType(LogDataTable::class, [
'filter_elements' => $historyHelper->getAssociatedElements($part),
'mode' => 'element_history'
'mode' => 'element_history',
], ['pageLength' => 10])
->handleRequest($request);
@ -132,7 +132,7 @@ class PartController extends AbstractController
'attachment_helper' => $this->attachmentManager,
'pricedetail_helper' => $this->pricedetailHelper,
'pictures' => $this->partPreviewGenerator->getPreviewAttachments($part),
'timeTravel' => $timeTravel_timestamp
'timeTravel' => $timeTravel_timestamp,
]
);
}
@ -140,11 +140,6 @@ class PartController extends AbstractController
/**
* @Route("/{id}/edit", name="part_edit")
*
* @param Part $part
* @param Request $request
* @param EntityManagerInterface $em
* @param TranslatorInterface $translator
* @param AttachmentSubmitHandler $attachmentSubmitHandler
* @return Response
*/
public function edit(Part $part, Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
@ -197,8 +192,6 @@ class PartController extends AbstractController
/**
* @Route("/{id}/delete", name="part_delete", methods={"DELETE"})
*
* @param Request $request
* @param Part $part
* @return RedirectResponse
*/
public function delete(Request $request, Part $part): RedirectResponse
@ -226,17 +219,12 @@ class PartController extends AbstractController
* @Route("/new", name="part_new")
* @Route("/{id}/clone", name="part_clone")
*
* @param Request $request
* @param EntityManagerInterface $em
* @param TranslatorInterface $translator
* @param AttachmentManager $attachmentHelper
* @param AttachmentSubmitHandler $attachmentSubmitHandler
* @return Response
*/
public function new(Request $request, EntityManagerInterface $em, TranslatorInterface $translator,
AttachmentManager $attachmentHelper, AttachmentSubmitHandler $attachmentSubmitHandler, ?Part $part = null): Response
{
if($part === null) {
if (null === $part) {
$new_part = new Part();
} else {
$new_part = clone $part;
@ -247,7 +235,7 @@ class PartController extends AbstractController
$cid = $request->get('cid', 1);
$category = $em->find(Category::class, $cid);
if (null !== $category && $new_part->getCategory() === null) {
if (null !== $category && null === $new_part->getCategory()) {
$new_part->setCategory($category);
}