Skip to content

Commit 4ec1557

Browse files
committed
Merge branch '5.4' into 6.2
* 5.4: Update event_dispatcher.rst Update upload_file.rst Update upload_file.rst Update upload_file.rst
2 parents 47274f4 + 24dc80c commit 4ec1557

File tree

2 files changed

+7
-6
lines changed

2 files changed

+7
-6
lines changed

controller/upload_file.rst

Lines changed: 6 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -27,12 +27,12 @@ add a PDF brochure for each product. To do so, add a new property called
2727
#[ORM\Column(type: 'string')]
2828
private $brochureFilename;
2929

30-
public function getBrochureFilename()
30+
public function getBrochureFilename(): string
3131
{
3232
return $this->brochureFilename;
3333
}
3434

35-
public function setBrochureFilename($brochureFilename)
35+
public function setBrochureFilename(string $brochureFilename)
3636
{
3737
$this->brochureFilename = $brochureFilename;
3838

@@ -126,13 +126,14 @@ Finally, you need to update the code of the controller that handles the form::
126126
use Symfony\Component\HttpFoundation\File\Exception\FileException;
127127
use Symfony\Component\HttpFoundation\File\UploadedFile;
128128
use Symfony\Component\HttpFoundation\Request;
129+
use Symfony\Component\HttpFoundation\Response;
129130
use Symfony\Component\Routing\Annotation\Route;
130131
use Symfony\Component\String\Slugger\SluggerInterface;
131132

132133
class ProductController extends AbstractController
133134
{
134135
#[Route('/product/new', name: 'app_product_new')]
135-
public function new(Request $request, SluggerInterface $slugger)
136+
public function new(Request $request, SluggerInterface $slugger): Response
136137
{
137138
$product = new Product();
138139
$form = $this->createForm(ProductType::class, $product);
@@ -245,7 +246,7 @@ logic to a separate service::
245246
) {
246247
}
247248

248-
public function upload(UploadedFile $file)
249+
public function upload(UploadedFile $file): string
249250
{
250251
$originalFilename = pathinfo($file->getClientOriginalName(), PATHINFO_FILENAME);
251252
$safeFilename = $this->slugger->slug($originalFilename);
@@ -260,7 +261,7 @@ logic to a separate service::
260261
return $fileName;
261262
}
262263

263-
public function getTargetDirectory()
264+
public function getTargetDirectory(): string
264265
{
265266
return $this->targetDirectory;
266267
}

event_dispatcher.rst

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -255,7 +255,7 @@ listen to the same ``kernel.exception`` event::
255255

256256
class ExceptionSubscriber implements EventSubscriberInterface
257257
{
258-
public static function getSubscribedEvents()
258+
public static function getSubscribedEvents(): array
259259
{
260260
// return the subscribed events, their methods and priorities
261261
return [

0 commit comments

Comments
 (0)