Movatterモバイル変換


[0]ホーム

URL:


Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Sign up
Appearance settings

Commitb87d41d

Browse files
committed
Make dispatched events really final
1 parentbfdf79e commitb87d41d

25 files changed

+50
-142
lines changed

‎src/Symfony/Component/Console/Event/ConsoleCommandEvent.php‎

Lines changed: 4 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -15,10 +15,8 @@
1515
* Allows to do things before the command is executed, like skipping the command or changing the input.
1616
*
1717
* @author Fabien Potencier <fabien@symfony.com>
18-
*
19-
* @final since Symfony 4.4
2018
*/
21-
class ConsoleCommandEventextends ConsoleEvent
19+
finalclass ConsoleCommandEventextends ConsoleEvent
2220
{
2321
/**
2422
* The return code for skipped commands, this will also be passed into the terminate event.
@@ -32,30 +30,24 @@ class ConsoleCommandEvent extends ConsoleEvent
3230

3331
/**
3432
* Disables the command, so it won't be run.
35-
*
36-
* @return bool
3733
*/
38-
publicfunctiondisableCommand()
34+
publicfunctiondisableCommand():bool
3935
{
4036
return$this->commandShouldRun =false;
4137
}
4238

4339
/**
4440
* Enables the command.
45-
*
46-
* @return bool
4741
*/
48-
publicfunctionenableCommand()
42+
publicfunctionenableCommand():bool
4943
{
5044
return$this->commandShouldRun =true;
5145
}
5246

5347
/**
5448
* Returns true if the command is runnable, false otherwise.
55-
*
56-
* @return bool
5749
*/
58-
publicfunctioncommandShouldRun()
50+
publicfunctioncommandShouldRun():bool
5951
{
6052
return$this->commandShouldRun;
6153
}

‎src/Symfony/Component/Console/Event/ConsoleTerminateEvent.php‎

Lines changed: 4 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -19,10 +19,8 @@
1919
* Allows to manipulate the exit code of a command after its execution.
2020
*
2121
* @author Francesco Levorato <git@flevour.net>
22-
*
23-
* @final since Symfony 4.4
2422
*/
25-
class ConsoleTerminateEventextends ConsoleEvent
23+
finalclass ConsoleTerminateEventextends ConsoleEvent
2624
{
2725
private$exitCode;
2826

@@ -35,20 +33,16 @@ public function __construct(Command $command, InputInterface $input, OutputInter
3533

3634
/**
3735
* Sets the exit code.
38-
*
39-
* @param int $exitCode The command exit code
4036
*/
41-
publicfunctionsetExitCode($exitCode)
37+
publicfunctionsetExitCode(int$exitCode):void
4238
{
43-
$this->exitCode =(int)$exitCode;
39+
$this->exitCode =$exitCode;
4440
}
4541

4642
/**
4743
* Gets the exit code.
48-
*
49-
* @return int The command exit code
5044
*/
51-
publicfunctiongetExitCode()
45+
publicfunctiongetExitCode():int
5246
{
5347
return$this->exitCode;
5448
}

‎src/Symfony/Component/Form/Event/PostSetDataEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -17,9 +17,7 @@
1717
* This event is dispatched at the end of the Form::setData() method.
1818
*
1919
* This event is mostly here for reading data after having pre-populated the form.
20-
*
21-
* @final since Symfony 4.4
2220
*/
23-
class PostSetDataEventextends FormEvent
21+
finalclass PostSetDataEventextends FormEvent
2422
{
2523
}

‎src/Symfony/Component/Form/Event/PostSubmitEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
* once the model and view data have been denormalized.
1919
*
2020
* It can be used to fetch data after denormalization.
21-
*
22-
* @final since Symfony 4.4
2321
*/
24-
class PostSubmitEventextends FormEvent
22+
finalclass PostSubmitEventextends FormEvent
2523
{
2624
}

‎src/Symfony/Component/Form/Event/PreSetDataEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
* It can be used to:
2020
* - Modify the data given during pre-population;
2121
* - Modify a form depending on the pre-populated data (adding or removing fields dynamically).
22-
*
23-
* @final since Symfony 4.4
2422
*/
25-
class PreSetDataEventextends FormEvent
23+
finalclass PreSetDataEventextends FormEvent
2624
{
2725
}

‎src/Symfony/Component/Form/Event/PreSubmitEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -19,9 +19,7 @@
1919
* It can be used to:
2020
* - Change data from the request, before submitting the data to the form.
2121
* - Add or remove form fields, before submitting the data to the form.
22-
*
23-
* @final since Symfony 4.4
2422
*/
25-
class PreSubmitEventextends FormEvent
23+
finalclass PreSubmitEventextends FormEvent
2624
{
2725
}

‎src/Symfony/Component/Form/Event/SubmitEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -18,9 +18,7 @@
1818
* transforms back the normalized data to the model and view data.
1919
*
2020
* It can be used to change data from the normalized representation of the data.
21-
*
22-
* @final since Symfony 4.4
2321
*/
24-
class SubmitEventextends FormEvent
22+
finalclass SubmitEventextends FormEvent
2523
{
2624
}

‎src/Symfony/Component/HttpKernel/Event/ControllerEvent.php‎

Lines changed: 3 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -24,10 +24,8 @@
2424
* Controllers should be callables.
2525
*
2626
* @author Bernhard Schussek <bschussek@gmail.com>
27-
*
28-
* @final since Symfony 4.4
2927
*/
30-
class ControllerEventextends KernelEvent
28+
finalclass ControllerEventextends KernelEvent
3129
{
3230
private$controller;
3331

@@ -40,15 +38,13 @@ public function __construct(HttpKernelInterface $kernel, callable $controller, R
4038

4139
/**
4240
* Returns the current controller.
43-
*
44-
* @return callable
4541
*/
46-
publicfunctiongetController()
42+
publicfunctiongetController():callable
4743
{
4844
return$this->controller;
4945
}
5046

51-
publicfunctionsetController(callable$controller)
47+
publicfunctionsetController(callable$controller):void
5248
{
5349
$this->controller =$controller;
5450
}

‎src/Symfony/Component/HttpKernel/Event/ExceptionEvent.php‎

Lines changed: 5 additions & 13 deletions
Original file line numberDiff line numberDiff line change
@@ -26,10 +26,8 @@
2626
* event.
2727
*
2828
* @author Bernhard Schussek <bschussek@gmail.com>
29-
*
30-
* @final since Symfony 4.4
3129
*/
32-
class ExceptionEventextends RequestEvent
30+
finalclass ExceptionEventextends RequestEvent
3331
{
3432
/**
3533
* The exception object.
@@ -52,10 +50,8 @@ public function __construct(HttpKernelInterface $kernel, Request $request, int $
5250

5351
/**
5452
* Returns the thrown exception.
55-
*
56-
* @return \Exception The thrown exception
5753
*/
58-
publicfunctiongetException()
54+
publicfunctiongetException():\Exception
5955
{
6056
return$this->exception;
6157
}
@@ -64,28 +60,24 @@ public function getException()
6460
* Replaces the thrown exception.
6561
*
6662
* This exception will be thrown if no response is set in the event.
67-
*
68-
* @param \Exception $exception The thrown exception
6963
*/
70-
publicfunctionsetException(\Exception$exception)
64+
publicfunctionsetException(\Exception$exception):void
7165
{
7266
$this->exception =$exception;
7367
}
7468

7569
/**
7670
* Mark the event as allowing a custom response code.
7771
*/
78-
publicfunctionallowCustomResponseCode()
72+
publicfunctionallowCustomResponseCode():void
7973
{
8074
$this->allowCustomResponseCode =true;
8175
}
8276

8377
/**
8478
* Returns true if the event allows a custom response code.
85-
*
86-
* @return bool
8779
*/
88-
publicfunctionisAllowingCustomResponseCode()
80+
publicfunctionisAllowingCustomResponseCode():bool
8981
{
9082
return$this->allowCustomResponseCode;
9183
}

‎src/Symfony/Component/HttpKernel/Event/FinishRequestEvent.php‎

Lines changed: 1 addition & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -15,9 +15,7 @@
1515
* Triggered whenever a request is fully processed.
1616
*
1717
* @author Benjamin Eberlei <kontakt@beberlei.de>
18-
*
19-
* @final since Symfony 4.4
2018
*/
21-
class FinishRequestEventextends KernelEvent
19+
finalclass FinishRequestEventextends KernelEvent
2220
{
2321
}

0 commit comments

Comments
 (0)

[8]ページ先頭

©2009-2025 Movatter.jp