Skip to content

Commit 15a7e8e

Browse files
author
Matthew Smeets
committed
[WebProfilerBundle] Use scalar type-hints where possible
1 parent d305581 commit 15a7e8e

File tree

6 files changed

+15
-15
lines changed

6 files changed

+15
-15
lines changed

src/Symfony/Bundle/WebProfilerBundle/Controller/ExceptionController.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(Profiler $profiler = null, Environment $twig, bool $
4949
*
5050
* @throws NotFoundHttpException
5151
*/
52-
public function showAction($token)
52+
public function showAction(string $token)
5353
{
5454
if (null === $this->profiler) {
5555
throw new NotFoundHttpException('The profiler must be enabled.');
@@ -89,7 +89,7 @@ public function showAction($token)
8989
*
9090
* @throws NotFoundHttpException
9191
*/
92-
public function cssAction($token)
92+
public function cssAction(string $token)
9393
{
9494
if (null === $this->profiler) {
9595
throw new NotFoundHttpException('The profiler must be enabled.');
@@ -115,7 +115,7 @@ protected function getTemplate()
115115
}
116116

117117
// to be removed when the minimum required version of Twig is >= 2.0
118-
protected function templateExists($template)
118+
protected function templateExists(string $template)
119119
{
120120
$loader = $this->twig->getLoader();
121121
if ($loader instanceof ExistsLoaderInterface) {

src/Symfony/Bundle/WebProfilerBundle/Controller/ProfilerController.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function homeAction()
6969
*
7070
* @throws NotFoundHttpException
7171
*/
72-
public function panelAction(Request $request, $token)
72+
public function panelAction(Request $request, string $token)
7373
{
7474
$this->denyAccessIfProfilerDisabled();
7575

@@ -115,7 +115,7 @@ public function panelAction(Request $request, $token)
115115
*
116116
* @throws NotFoundHttpException
117117
*/
118-
public function toolbarAction(Request $request, $token)
118+
public function toolbarAction(Request $request, string $token)
119119
{
120120
if (null === $this->profiler) {
121121
throw new NotFoundHttpException('The profiler must be enabled.');
@@ -156,9 +156,9 @@ public function toolbarAction(Request $request, $token)
156156
/**
157157
* Renders the profiler search bar.
158158
*
159-
* @return Response A Response instance
159+
* @param Request $request
160160
*
161-
* @throws NotFoundHttpException
161+
* @return Response A Response instance
162162
*/
163163
public function searchBarAction(Request $request)
164164
{
@@ -217,7 +217,7 @@ public function searchBarAction(Request $request)
217217
*
218218
* @throws NotFoundHttpException
219219
*/
220-
public function searchResultsAction(Request $request, $token)
220+
public function searchResultsAction(Request $request, string $token)
221221
{
222222
$this->denyAccessIfProfilerDisabled();
223223

src/Symfony/Bundle/WebProfilerBundle/Controller/RouterController.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -51,7 +51,7 @@ public function __construct(Profiler $profiler = null, Environment $twig, UrlMat
5151
*
5252
* @throws NotFoundHttpException
5353
*/
54-
public function panelAction($token)
54+
public function panelAction(string $token)
5555
{
5656
if (null === $this->profiler) {
5757
throw new NotFoundHttpException('The profiler must be enabled.');

src/Symfony/Bundle/WebProfilerBundle/Csp/ContentSecurityPolicyHandler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -190,7 +190,7 @@ private function generateCspHeader(array $directives)
190190
*
191191
* @return array The directive set
192192
*/
193-
private function parseDirectives($header)
193+
private function parseDirectives(string $header)
194194
{
195195
$directives = [];
196196

@@ -214,7 +214,7 @@ private function parseDirectives($header)
214214
*
215215
* @return bool
216216
*/
217-
private function authorizesInline(array $directivesSet, $type)
217+
private function authorizesInline(array $directivesSet, string $type)
218218
{
219219
if (isset($directivesSet[$type])) {
220220
$directives = $directivesSet[$type];

src/Symfony/Bundle/WebProfilerBundle/Profiler/TemplateManager.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(Profiler $profiler, Environment $twig, array $templa
4949
*
5050
* @throws NotFoundHttpException
5151
*/
52-
public function getName(Profile $profile, $panel)
52+
public function getName(Profile $profile, string $panel)
5353
{
5454
$templates = $this->getNames($profile);
5555

@@ -97,7 +97,7 @@ public function getNames(Profile $profile)
9797
}
9898

9999
// to be removed when the minimum required version of Twig is >= 2.0
100-
protected function templateExists($template)
100+
protected function templateExists(string $template)
101101
{
102102
$loader = $this->twig->getLoader();
103103
if ($loader instanceof ExistsLoaderInterface) {

src/Symfony/Bundle/WebProfilerBundle/Twig/WebProfilerExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,7 +69,7 @@ public function getFunctions()
6969
];
7070
}
7171

72-
public function dumpData(Environment $env, Data $data, $maxDepth = 0)
72+
public function dumpData(Environment $env, Data $data, int $maxDepth = 0)
7373
{
7474
$this->dumper->setCharset($env->getCharset());
7575
$this->dumper->dump($data, null, [
@@ -83,7 +83,7 @@ public function dumpData(Environment $env, Data $data, $maxDepth = 0)
8383
return str_replace("\n</pre", '</pre', rtrim($dump));
8484
}
8585

86-
public function dumpLog(Environment $env, $message, Data $context = null)
86+
public function dumpLog(Environment $env, string $message, Data $context = null)
8787
{
8888
$message = twig_escape_filter($env, $message);
8989
$message = preg_replace('/&quot;(.*?)&quot;/', '&quot;<b>$1</b>&quot;', $message);

0 commit comments

Comments
 (0)