unify short ternary operator

This commit is contained in:
Tobias Schultze 2013-11-14 15:22:38 +01:00
parent 2a9daff8d9
commit 2888594dbd
5 changed files with 6 additions and 6 deletions

View File

@ -41,7 +41,7 @@ class Router extends BaseRouter implements WarmableInterface
$this->container = $container;
$this->resource = $resource;
$this->context = null === $context ? new RequestContext() : $context;
$this->context = $context ?: new RequestContext();
$this->setOptions($options);
}

View File

@ -46,7 +46,7 @@ abstract class Output implements OutputInterface
public function __construct($verbosity = self::VERBOSITY_NORMAL, $decorated = false, OutputFormatterInterface $formatter = null)
{
$this->verbosity = null === $verbosity ? self::VERBOSITY_NORMAL : $verbosity;
$this->formatter = null === $formatter ? new OutputFormatter() : $formatter;
$this->formatter = $formatter ?: new OutputFormatter();
$this->formatter->setDecorated($decorated);
}

View File

@ -11,7 +11,7 @@
namespace Symfony\Component\HttpFoundation\Tests;
use \Symfony\Component\HttpFoundation\RedirectResponse;
use Symfony\Component\HttpFoundation\RedirectResponse;
class RedirectResponseTest extends \PHPUnit_Framework_TestCase
{

View File

@ -82,7 +82,7 @@ class Router implements RouterInterface
$this->loader = $loader;
$this->resource = $resource;
$this->logger = $logger;
$this->context = null === $context ? new RequestContext() : $context;
$this->context = $context ?: new RequestContext();
$this->setOptions($options);
}

View File

@ -32,8 +32,8 @@ class JsonEncoder implements EncoderInterface, DecoderInterface
public function __construct(JsonEncode $encodingImpl = null, JsonDecode $decodingImpl = null)
{
$this->encodingImpl = null === $encodingImpl ? new JsonEncode() : $encodingImpl;
$this->decodingImpl = null === $decodingImpl ? new JsonDecode(true) : $decodingImpl;
$this->encodingImpl = $encodingImpl ?: new JsonEncode();
$this->decodingImpl = $decodingImpl ?: new JsonDecode(true);
}
/**