SCA: minor code tweaks
This commit is contained in:
parent
7c18377274
commit
cc4529db51
|
@ -96,11 +96,7 @@ class RouterMatchCommandTest extends TestCase
|
||||||
->expects($this->atLeastOnce())
|
->expects($this->atLeastOnce())
|
||||||
->method('has')
|
->method('has')
|
||||||
->will($this->returnCallback(function ($id) {
|
->will($this->returnCallback(function ($id) {
|
||||||
if ('console.command_loader' === $id) {
|
return 'console.command_loader' !== $id;
|
||||||
return false;
|
|
||||||
}
|
|
||||||
|
|
||||||
return true;
|
|
||||||
}))
|
}))
|
||||||
;
|
;
|
||||||
$container
|
$container
|
||||||
|
|
|
@ -13,13 +13,12 @@ namespace Symfony\Component\Cache\Adapter;
|
||||||
|
|
||||||
use Psr\SimpleCache\CacheInterface;
|
use Psr\SimpleCache\CacheInterface;
|
||||||
use Symfony\Component\Cache\PruneableInterface;
|
use Symfony\Component\Cache\PruneableInterface;
|
||||||
use Symfony\Component\Cache\ResettableInterface;
|
|
||||||
use Symfony\Component\Cache\Traits\ProxyTrait;
|
use Symfony\Component\Cache\Traits\ProxyTrait;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @author Nicolas Grekas <p@tchwork.com>
|
* @author Nicolas Grekas <p@tchwork.com>
|
||||||
*/
|
*/
|
||||||
class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface, ResettableInterface
|
class SimpleCacheAdapter extends AbstractAdapter implements PruneableInterface
|
||||||
{
|
{
|
||||||
use ProxyTrait;
|
use ProxyTrait;
|
||||||
|
|
||||||
|
|
|
@ -33,7 +33,6 @@ final class Dotenv
|
||||||
private $lineno;
|
private $lineno;
|
||||||
private $data;
|
private $data;
|
||||||
private $end;
|
private $end;
|
||||||
private $state;
|
|
||||||
private $values;
|
private $values;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
@ -111,27 +110,27 @@ final class Dotenv
|
||||||
$this->lineno = 1;
|
$this->lineno = 1;
|
||||||
$this->cursor = 0;
|
$this->cursor = 0;
|
||||||
$this->end = \strlen($this->data);
|
$this->end = \strlen($this->data);
|
||||||
$this->state = self::STATE_VARNAME;
|
$state = self::STATE_VARNAME;
|
||||||
$this->values = [];
|
$this->values = [];
|
||||||
$name = '';
|
$name = '';
|
||||||
|
|
||||||
$this->skipEmptyLines();
|
$this->skipEmptyLines();
|
||||||
|
|
||||||
while ($this->cursor < $this->end) {
|
while ($this->cursor < $this->end) {
|
||||||
switch ($this->state) {
|
switch ($state) {
|
||||||
case self::STATE_VARNAME:
|
case self::STATE_VARNAME:
|
||||||
$name = $this->lexVarname();
|
$name = $this->lexVarname();
|
||||||
$this->state = self::STATE_VALUE;
|
$state = self::STATE_VALUE;
|
||||||
break;
|
break;
|
||||||
|
|
||||||
case self::STATE_VALUE:
|
case self::STATE_VALUE:
|
||||||
$this->values[$name] = $this->lexValue();
|
$this->values[$name] = $this->lexValue();
|
||||||
$this->state = self::STATE_VARNAME;
|
$state = self::STATE_VARNAME;
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
if (self::STATE_VALUE === $this->state) {
|
if (self::STATE_VALUE === $state) {
|
||||||
$this->values[$name] = '';
|
$this->values[$name] = '';
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|
|
@ -105,7 +105,7 @@ class DebugHandlersListener implements EventSubscriberInterface
|
||||||
if (method_exists($kernel = $event->getKernel(), 'terminateWithException')) {
|
if (method_exists($kernel = $event->getKernel(), 'terminateWithException')) {
|
||||||
$request = $event->getRequest();
|
$request = $event->getRequest();
|
||||||
$hasRun = &$this->hasTerminatedWithException;
|
$hasRun = &$this->hasTerminatedWithException;
|
||||||
$this->exceptionHandler = function (\Exception $e) use ($kernel, $request, &$hasRun) {
|
$this->exceptionHandler = static function (\Exception $e) use ($kernel, $request, &$hasRun) {
|
||||||
if ($hasRun) {
|
if ($hasRun) {
|
||||||
throw $e;
|
throw $e;
|
||||||
}
|
}
|
||||||
|
|
|
@ -215,7 +215,7 @@ class ResponseCacheStrategy implements ResponseCacheStrategyInterface
|
||||||
}
|
}
|
||||||
|
|
||||||
if (false !== $this->ageDirectives[$directive]) {
|
if (false !== $this->ageDirectives[$directive]) {
|
||||||
$value = $value - $age;
|
$value -= $age;
|
||||||
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
|
$this->ageDirectives[$directive] = null !== $this->ageDirectives[$directive] ? min($this->ageDirectives[$directive], $value) : $value;
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
|
@ -47,7 +47,7 @@ class PostAuthenticationGuardToken extends AbstractToken implements GuardTokenIn
|
||||||
|
|
||||||
// this token is meant to be used after authentication success, so it is always authenticated
|
// this token is meant to be used after authentication success, so it is always authenticated
|
||||||
// you could set it as non authenticated later if you need to
|
// you could set it as non authenticated later if you need to
|
||||||
parent::setAuthenticated(true);
|
$this->setAuthenticated(true);
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|
|
@ -16,6 +16,6 @@ namespace Symfony\Component\Workflow\Exception;
|
||||||
*
|
*
|
||||||
* @author Matt Johnson <matj1985@gmail.com>
|
* @author Matt Johnson <matj1985@gmail.com>
|
||||||
*/
|
*/
|
||||||
class InvalidTokenConfigurationException extends LogicException implements ExceptionInterface
|
class InvalidTokenConfigurationException extends LogicException
|
||||||
{
|
{
|
||||||
}
|
}
|
||||||
|
|
Reference in New Issue