Skip to content

Commit 3444c1e

Browse files
committed
minor symfony#48434 [TwigBridge] Fix casing of getCurrentRoute/getCurrentRouteParameters methods (Kocal)
This PR was merged into the 6.2 branch. Discussion ---------- [TwigBridge] Fix casing of getCurrentRoute/getCurrentRouteParameters methods | Q | A | ------------- | --- | Branch? | 6.2 | Bug fix? | yes | New feature? | no <!-- please update src/**/CHANGELOG.md files --> | Deprecations? | no <!-- please update UPGRADE-*.md and src/**/CHANGELOG.md files --> | Tickets | Fix #... <!-- prefix each issue number with "Fix #", no need to create an issue if none exists, explain below instead --> | License | MIT | Doc PR | - Following of symfony#47535, those two methods were named like this in order to get `app.current_route` and `app.current_route_parameters`, however PHPStorm autocomplete for `app.current_Route` and `app.current_Route_Parameters`. I'm not sure if this is a PHPStorm-only issue or not. **Before:** ![image](https://user-images.githubusercontent.com/2103975/205177835-fe5c64d7-2581-44be-8f3f-39f7cd4dcf9e.png) **After:** <img width="604" alt="image" src="https://user-images.githubusercontent.com/2103975/205177787-b3e55d95-4a0f-40ea-8b65-a0b3ddc447f0.png"> Commits ------- 67588b3 [TwigBridge] Fix casing of currentRoute/currentRouteParameters methods
2 parents 38e2707 + 67588b3 commit 3444c1e

File tree

2 files changed

+7
-7
lines changed

2 files changed

+7
-7
lines changed

src/Symfony/Bridge/Twig/AppVariable.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -159,7 +159,7 @@ public function getFlashes(string|array $types = null): array
159159
return $result;
160160
}
161161

162-
public function getCurrent_Route(): ?string
162+
public function getCurrent_route(): ?string
163163
{
164164
if (!isset($this->requestStack)) {
165165
throw new \RuntimeException('The "app.current_route" variable is not available.');
@@ -171,7 +171,7 @@ public function getCurrent_Route(): ?string
171171
/**
172172
* @return array<string, mixed>
173173
*/
174-
public function getCurrent_Route_Parameters(): array
174+
public function getCurrent_route_parameters(): array
175175
{
176176
if (!isset($this->requestStack)) {
177177
throw new \RuntimeException('The "app.current_route_parameters" variable is not available.');

src/Symfony/Bridge/Twig/Tests/AppVariableTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -232,34 +232,34 @@ public function testGetCurrentRoute()
232232
{
233233
$this->setRequestStack(new Request(attributes: ['_route' => 'some_route']));
234234

235-
$this->assertSame('some_route', $this->appVariable->getCurrent_Route());
235+
$this->assertSame('some_route', $this->appVariable->getCurrent_route());
236236
}
237237

238238
public function testGetCurrentRouteWithRequestStackNotSet()
239239
{
240240
$this->expectException(\RuntimeException::class);
241-
$this->appVariable->getCurrent_Route();
241+
$this->appVariable->getCurrent_route();
242242
}
243243

244244
public function testGetCurrentRouteParameters()
245245
{
246246
$routeParams = ['some_param' => true];
247247
$this->setRequestStack(new Request(attributes: ['_route_params' => $routeParams]));
248248

249-
$this->assertSame($routeParams, $this->appVariable->getCurrent_Route_Parameters());
249+
$this->assertSame($routeParams, $this->appVariable->getCurrent_route_parameters());
250250
}
251251

252252
public function testGetCurrentRouteParametersWithoutAttribute()
253253
{
254254
$this->setRequestStack(new Request());
255255

256-
$this->assertSame([], $this->appVariable->getCurrent_Route_Parameters());
256+
$this->assertSame([], $this->appVariable->getCurrent_route_parameters());
257257
}
258258

259259
public function testGetCurrentRouteParametersWithRequestStackNotSet()
260260
{
261261
$this->expectException(\RuntimeException::class);
262-
$this->appVariable->getCurrent_Route_Parameters();
262+
$this->appVariable->getCurrent_route_parameters();
263263
}
264264

265265
protected function setRequestStack($request)

0 commit comments

Comments
 (0)