Skip to content

Commit 4f94b17

Browse files
minor symfony#30653 SCA: minor code tweaks (kalessil)
This PR was merged into the 3.4 branch. Discussion ---------- SCA: minor code tweaks | Q | A | ------------- | --- | Branch? | 3.4 | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a - minor code tweaks - drop private properties, which used as local variables Commits ------- cc4529d SCA: minor code tweaks
2 parents 7c18377 + cc4529d commit 4f94b17

File tree

7 files changed

+11
-17
lines changed

7 files changed

+11
-17
lines changed

src/Symfony/Bundle/FrameworkBundle/Tests/Command/RouterMatchCommandTest.php

Lines changed: 1 addition & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -96,11 +96,7 @@ private function getKernel()
9696
->expects($this->atLeastOnce())
9797
->method('has')
9898
->will($this->returnCallback(function ($id) {
99-
if ('console.command_loader' === $id) {
100-
return false;
101-
}
102-
103-
return true;
99+
return 'console.command_loader' !== $id;
104100
}))
105101
;
106102
$container

src/Symfony/Component/Cache/Adapter/SimpleCacheAdapter.php

Lines changed: 1 addition & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -13,13 +13,12 @@
1313

1414
use Psr\SimpleCache\CacheInterface;
1515
use Symfony\Component\Cache\PruneableInterface;
16-
use Symfony\Component\Cache\ResettableInterface;
1716
use Symfony\Component\Cache\Traits\ProxyTrait;
1817

1918
/**
2019
* @author Nicolas Grekas <p@tchwork.com>
2120
*/
22-
class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface, ResettableInterface
21+
class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface
2322
{
2423
use ProxyTrait;
2524

src/Symfony/Component/Dotenv/Dotenv.php

Lines changed: 5 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,6 @@ final class Dotenv
3333
private $lineno;
3434
private $data;
3535
private $end;
36-
private $state;
3736
private $values;
3837

3938
/**
@@ -111,27 +110,27 @@ public function parse($data, $path = '.env')
111110
$this->lineno = 1;
112111
$this->cursor = 0;
113112
$this->end = \strlen($this->data);
114-
$this->state = self::STATE_VARNAME;
113+
$state = self::STATE_VARNAME;
115114
$this->values = [];
116115
$name = '';
117116

118117
$this->skipEmptyLines();
119118

120119
while ($this->cursor < $this->end) {
121-
switch ($this->state) {
120+
switch ($state) {
122121
case self::STATE_VARNAME:
123122
$name = $this->lexVarname();
124-
$this->state = self::STATE_VALUE;
123+
$state = self::STATE_VALUE;
125124
break;
126125

127126
case self::STATE_VALUE:
128127
$this->values[$name] = $this->lexValue();
129-
$this->state = self::STATE_VARNAME;
128+
$state = self::STATE_VARNAME;
130129
break;
131130
}
132131
}
133132

134-
if (self::STATE_VALUE === $this->state) {
133+
if (self::STATE_VALUE === $state) {
135134
$this->values[$name] = '';
136135
}
137136

src/Symfony/Component/HttpKernel/EventListener/DebugHandlersListener.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -105,7 +105,7 @@ public function configure(Event $event = null)
105105
if (method_exists($kernel = $event->getKernel(), 'terminateWithException')) {
106106
$request = $event->getRequest();
107107
$hasRun = &$this->hasTerminatedWithException;
108-
$this->exceptionHandler = function (\Exception $e) use ($kernel, $request, &$hasRun) {
108+
$this->exceptionHandler = static function (\Exception $e) use ($kernel, $request, &$hasRun) {
109109
if ($hasRun) {
110110
throw $e;
111111
}

src/Symfony/Component/HttpKernel/HttpCache/ResponseCacheStrategy.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -215,7 +215,7 @@ private function storeRelativeAgeDirective($directive, $value, $age)
215215
}
216216

217217
if (false !== $this->ageDirectives[$directive]) {
218-
$value = $value - $age;
218+
$value -= $age;
219219
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
220220
}
221221
}

src/Symfony/Component/Security/Guard/Token/PostAuthenticationGuardToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -47,7 +47,7 @@ public function __construct(UserInterface $user, $providerKey, array $roles)
4747

4848
// this token is meant to be used after authentication success, so it is always authenticated
4949
// you could set it as non authenticated later if you need to
50-
parent::setAuthenticated(true);
50+
$this->setAuthenticated(true);
5151
}
5252

5353
/**

src/Symfony/Component/Workflow/Exception/InvalidTokenConfigurationException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -16,6 +16,6 @@
1616
*
1717
* @author Matt Johnson <matj1985@gmail.com>
1818
*/
19-
class InvalidTokenConfigurationException extends LogicException implements ExceptionInterface
19+
class InvalidTokenConfigurationException extends LogicException
2020
{
2121
}

0 commit comments

Comments
 (0)