diff --git a/lib/action/sfAction.class.php b/lib/action/sfAction.class.php
index cabab27f0..28d020e81 100644
--- a/lib/action/sfAction.class.php
+++ b/lib/action/sfAction.class.php
@@ -290,7 +290,7 @@ public function getPartial($templateName, $vars = null)
{
$this->getContext()->getConfiguration()->loadHelpers('Partial');
- $vars = null !== $vars ? $vars : $this->varHolder->getAll();
+ $vars ??= $this->varHolder->getAll();
return get_partial($templateName, $vars);
}
@@ -333,7 +333,7 @@ public function getComponent($moduleName, $componentName, $vars = null)
{
$this->getContext()->getConfiguration()->loadHelpers('Partial');
- $vars = null !== $vars ? $vars : $this->varHolder->getAll();
+ $vars ??= $this->varHolder->getAll();
return get_component($moduleName, $componentName, $vars);
}
@@ -388,15 +388,7 @@ public function getSecurityValue($name, $default = null)
{
$actionName = strtolower($this->getActionName());
- if (isset($this->security[$actionName][$name])) {
- return $this->security[$actionName][$name];
- }
-
- if (isset($this->security['all'][$name])) {
- return $this->security['all'][$name];
- }
-
- return $default;
+ return $this->security[$actionName][$name] ?? $this->security['all'][$name] ?? $default;
}
/**
@@ -430,7 +422,7 @@ public function getCredential()
public function setTemplate($name, $module = null)
{
if (sfConfig::get('sf_logging_enabled')) {
- $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change template to "%s/%s"', null === $module ? 'CURRENT' : $module, $name)]));
+ $this->dispatcher->notify(new sfEvent($this, 'application.log', [sprintf('Change template to "%s/%s"', $module ?? 'CURRENT', $name)]));
}
if (null !== $module) {
@@ -516,6 +508,6 @@ public function getRoute()
*/
protected function get404Message($message = null)
{
- return null === $message ? sprintf('This request has been forwarded to a 404 error page by the action "%s/%s".', $this->getModuleName(), $this->getActionName()) : $message;
+ return $message ?? sprintf('This request has been forwarded to a 404 error page by the action "%s/%s".', $this->getModuleName(), $this->getActionName());
}
}
diff --git a/lib/action/sfActionStack.class.php b/lib/action/sfActionStack.class.php
index 09242f6ef..9952a6694 100644
--- a/lib/action/sfActionStack.class.php
+++ b/lib/action/sfActionStack.class.php
@@ -49,13 +49,7 @@ public function addEntry($moduleName, $actionName, $actionInstance)
*/
public function getEntry($index)
{
- $retval = null;
-
- if ($index > -1 && $index < count($this->stack)) {
- $retval = $this->stack[$index];
- }
-
- return $retval;
+ return $this->stack[$index] ?? null;
}
/**
@@ -75,13 +69,7 @@ public function popEntry()
*/
public function getFirstEntry()
{
- $retval = null;
-
- if (isset($this->stack[0])) {
- $retval = $this->stack[0];
- }
-
- return $retval;
+ return $this->stack[0] ?? null;
}
/**
@@ -91,14 +79,7 @@ public function getFirstEntry()
*/
public function getLastEntry()
{
- $count = count($this->stack);
- $retval = null;
-
- if (isset($this->stack[0])) {
- $retval = $this->stack[$count - 1];
- }
-
- return $retval;
+ return $this->stack[count($this->stack) - 1] ?? null;
}
/**
diff --git a/lib/autoload/sfAutoload.class.php b/lib/autoload/sfAutoload.class.php
index de53e724c..1985b1b7d 100644
--- a/lib/autoload/sfAutoload.class.php
+++ b/lib/autoload/sfAutoload.class.php
@@ -90,7 +90,7 @@ public function getClassPath($class)
{
$class = strtolower($class);
- return isset($this->classes[$class]) ? $this->classes[$class] : null;
+ return $this->classes[$class] ?? null;
}
/**
diff --git a/lib/autoload/sfSimpleAutoload.class.php b/lib/autoload/sfSimpleAutoload.class.php
index 85674e7a0..fad08b7b9 100755
--- a/lib/autoload/sfSimpleAutoload.class.php
+++ b/lib/autoload/sfSimpleAutoload.class.php
@@ -279,7 +279,7 @@ public function getClassPath($class)
{
$class = strtolower($class);
- return isset($this->classes[$class]) ? $this->classes[$class] : null;
+ return $this->classes[$class] ?? null;
}
/**
diff --git a/lib/cache/sfCache.class.php b/lib/cache/sfCache.class.php
index 60b9a2858..aca6746d4 100644
--- a/lib/cache/sfCache.class.php
+++ b/lib/cache/sfCache.class.php
@@ -166,7 +166,7 @@ public function getMany($keys)
*/
public function getLifetime($lifetime)
{
- return null === $lifetime ? $this->getOption('lifetime') : $lifetime;
+ return $lifetime ?? $this->getOption('lifetime');
}
/**
@@ -191,7 +191,7 @@ public function getBackend()
*/
public function getOption($name, $default = null)
{
- return isset($this->options[$name]) ? $this->options[$name] : $default;
+ return $this->options[$name] ?? $default;
}
/**
diff --git a/lib/cache/sfMemcacheCache.class.php b/lib/cache/sfMemcacheCache.class.php
index 0caae1753..057b4d8c5 100644
--- a/lib/cache/sfMemcacheCache.class.php
+++ b/lib/cache/sfMemcacheCache.class.php
@@ -50,8 +50,8 @@ public function initialize($options = [])
if ($this->getOption('servers')) {
foreach ($this->getOption('servers') as $server) {
- $port = isset($server['port']) ? $server['port'] : 11211;
- if (!$this->memcache->addServer($server['host'], $port, isset($server['persistent']) ? $server['persistent'] : true)) {
+ $port = $server['port'] ?? 11211;
+ if (!$this->memcache->addServer($server['host'], $port, $server['persistent'] ?? true)) {
throw new sfInitializationException(sprintf('Unable to connect to the memcache server (%s:%s).', $server['host'], $port));
}
}
@@ -106,7 +106,7 @@ public function has($key)
*/
public function set($key, $data, $lifetime = null)
{
- $lifetime = null === $lifetime ? $this->getOption('lifetime') : $lifetime;
+ $lifetime ??= $this->getOption('lifetime');
// save metadata
$this->setMetadata($key, $lifetime);
diff --git a/lib/cache/sfSQLiteCache.class.php b/lib/cache/sfSQLiteCache.class.php
index 30484ad2d..788be5e53 100644
--- a/lib/cache/sfSQLiteCache.class.php
+++ b/lib/cache/sfSQLiteCache.class.php
@@ -70,7 +70,7 @@ public function get($key, $default = null)
$data = $this->dbh->singleQuery(sprintf("SELECT data FROM cache WHERE key = '%s' AND timeout > %d", sqlite_escape_string($key), time()));
}
- return null === $data ? $default : $data;
+ return $data ?? $default;
}
/**
@@ -153,7 +153,7 @@ public function getTimeout($key)
if ($this->isSqLite3()) {
$rs = $this->dbh->querySingle(sprintf("SELECT timeout FROM cache WHERE key = '%s' AND timeout > %d", $this->dbh->escapeString($key), time()));
- return null === $rs ? 0 : $rs;
+ return $rs ?? 0;
}
$rs = $this->dbh->query(sprintf("SELECT timeout FROM cache WHERE key = '%s' AND timeout > %d", sqlite_escape_string($key), time()));
@@ -169,7 +169,7 @@ public function getLastModified($key)
if ($this->isSqLite3()) {
$rs = $this->dbh->querySingle(sprintf("SELECT last_modified FROM cache WHERE key = '%s' AND timeout > %d", $this->dbh->escapeString($key), time()));
- return null === $rs ? 0 : $rs;
+ return $rs ?? 0;
}
$rs = $this->dbh->query(sprintf("SELECT last_modified FROM cache WHERE key = '%s' AND timeout > %d", sqlite_escape_string($key), time()));
diff --git a/lib/command/sfCommandApplication.class.php b/lib/command/sfCommandApplication.class.php
index 15bad631d..b57ea28a6 100644
--- a/lib/command/sfCommandApplication.class.php
+++ b/lib/command/sfCommandApplication.class.php
@@ -63,7 +63,7 @@ abstract class sfCommandApplication
public function __construct(sfEventDispatcher $dispatcher, ?sfFormatter $formatter = null, $options = [])
{
$this->dispatcher = $dispatcher;
- $this->formatter = null === $formatter ? $this->guessBestFormatter(STDOUT) : $formatter;
+ $this->formatter = $formatter ?? $this->guessBestFormatter(STDOUT);
$this->options = $options;
$this->fixCgi();
@@ -100,7 +100,7 @@ abstract public function configure();
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
@@ -396,11 +396,11 @@ public function renderException($e)
]);
for ($i = 0, $count = count($trace); $i < $count; ++$i) {
- $class = isset($trace[$i]['class']) ? $trace[$i]['class'] : '';
- $type = isset($trace[$i]['type']) ? $trace[$i]['type'] : '';
+ $class = $trace[$i]['class'] ?? '';
+ $type = $trace[$i]['type'] ?? '';
$function = $trace[$i]['function'];
- $file = isset($trace[$i]['file']) ? $trace[$i]['file'] : 'n/a';
- $line = isset($trace[$i]['line']) ? $trace[$i]['line'] : 'n/a';
+ $file = $trace[$i]['file'] ?? 'n/a';
+ $line = $trace[$i]['line'] ?? 'n/a';
fwrite(STDERR, sprintf(" %s%s%s at %s:%s\n", $class, $type, $function, $this->formatter->format($file, 'INFO', STDERR), $this->formatter->format($line, 'INFO', STDERR)));
}
diff --git a/lib/command/sfCommandLogger.class.php b/lib/command/sfCommandLogger.class.php
index 77673b5c1..ae3178853 100644
--- a/lib/command/sfCommandLogger.class.php
+++ b/lib/command/sfCommandLogger.class.php
@@ -33,7 +33,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
*/
public function listenToLogEvent(sfEvent $event)
{
- $priority = isset($event['priority']) ? $event['priority'] : self::INFO;
+ $priority = $event['priority'] ?? self::INFO;
$prefix = '';
if ('application.log' == $event->getName()) {
diff --git a/lib/config/sfAutoloadConfigHandler.class.php b/lib/config/sfAutoloadConfigHandler.class.php
index 2b7cb7a5c..20b5257e4 100755
--- a/lib/config/sfAutoloadConfigHandler.class.php
+++ b/lib/config/sfAutoloadConfigHandler.class.php
@@ -134,7 +134,7 @@ protected function parse(array $configFiles)
}
} else {
// directory mapping
- $ext = isset($entry['ext']) ? $entry['ext'] : '.php';
+ $ext = $entry['ext'] ?? '.php';
$path = $entry['path'];
// we automatically add our php classes
@@ -142,7 +142,7 @@ protected function parse(array $configFiles)
$finder = sfFinder::type('file')->name('*'.$ext)->follow_link();
// recursive mapping?
- $recursive = isset($entry['recursive']) ? $entry['recursive'] : false;
+ $recursive = $entry['recursive'] ?? false;
if (!$recursive) {
$finder->maxdepth(0);
}
@@ -154,7 +154,7 @@ protected function parse(array $configFiles)
if ($matches = glob($path)) {
foreach ($finder->in($matches) as $file) {
- $mapping = array_merge($mapping, $this->parseFile($path, $file, isset($entry['prefix']) ? $entry['prefix'] : ''));
+ $mapping = array_merge($mapping, $this->parseFile($path, $file, $entry['prefix'] ?? ''));
}
}
}
diff --git a/lib/config/sfConfig.class.php b/lib/config/sfConfig.class.php
index 2ad673ea7..9040d89ee 100644
--- a/lib/config/sfConfig.class.php
+++ b/lib/config/sfConfig.class.php
@@ -27,7 +27,7 @@ class sfConfig
*/
public static function get($name, $default = null)
{
- return isset(self::$config[$name]) ? self::$config[$name] : $default;
+ return self::$config[$name] ?? $default;
}
/**
diff --git a/lib/config/sfFactoryConfigHandler.class.php b/lib/config/sfFactoryConfigHandler.class.php
index 95e067f7b..548095b00 100644
--- a/lib/config/sfFactoryConfigHandler.class.php
+++ b/lib/config/sfFactoryConfigHandler.class.php
@@ -97,7 +97,7 @@ public function execute($configFiles)
$defaultParameters = [];
$defaultParameters[] = sprintf("'auto_shutdown' => false, 'session_id' => \$this->getRequest()->getParameter('%s'),", $parameters['session_name']);
if (is_subclass_of($class, 'sfDatabaseSessionStorage')) {
- $defaultParameters[] = sprintf("'database' => \$this->getDatabaseManager()->getDatabase('%s'),", isset($parameters['database']) ? $parameters['database'] : 'default');
+ $defaultParameters[] = sprintf("'database' => \$this->getDatabaseManager()->getDatabase('%s'),", $parameters['database'] ?? 'default');
unset($parameters['database']);
}
diff --git a/lib/config/sfFilterConfigHandler.class.php b/lib/config/sfFilterConfigHandler.class.php
index d9d221e27..8461b4668 100644
--- a/lib/config/sfFilterConfigHandler.class.php
+++ b/lib/config/sfFilterConfigHandler.class.php
@@ -68,7 +68,7 @@ public function execute($configFiles)
unset($keys['param']['condition']);
}
- $type = isset($keys['param']['type']) ? $keys['param']['type'] : null;
+ $type = $keys['param']['type'] ?? null;
unset($keys['param']['type']);
if ($condition) {
diff --git a/lib/config/sfGeneratorConfigHandler.class.php b/lib/config/sfGeneratorConfigHandler.class.php
index 32279c9c1..3b5f28397 100644
--- a/lib/config/sfGeneratorConfigHandler.class.php
+++ b/lib/config/sfGeneratorConfigHandler.class.php
@@ -35,18 +35,18 @@ public function execute($configFiles)
}
if (!isset($config['generator'])) {
- throw new sfParseException(sprintf('Configuration file "%s" must specify a generator section.', isset($configFiles[1]) ? $configFiles[1] : $configFiles[0]));
+ throw new sfParseException(sprintf('Configuration file "%s" must specify a generator section.', $configFiles[1] ?? $configFiles[0]));
}
$config = $config['generator'];
if (!isset($config['class'])) {
- throw new sfParseException(sprintf('Configuration file "%s" must specify a generator class section under the generator section.', isset($configFiles[1]) ? $configFiles[1] : $configFiles[0]));
+ throw new sfParseException(sprintf('Configuration file "%s" must specify a generator class section under the generator section.', $configFiles[1] ?? $configFiles[0]));
}
foreach (['fields', 'list', 'edit'] as $section) {
if (isset($config[$section])) {
- throw new sfParseException(sprintf('Configuration file "%s" can specify a "%s" section but only under the param section.', isset($configFiles[1]) ? $configFiles[1] : $configFiles[0], $section));
+ throw new sfParseException(sprintf('Configuration file "%s" can specify a "%s" section but only under the param section.', $configFiles[1] ?? $configFiles[0], $section));
}
}
@@ -54,7 +54,7 @@ public function execute($configFiles)
$generatorManager = new sfGeneratorManager(sfContext::getInstance()->getConfiguration());
// generator parameters
- $generatorParam = (isset($config['param']) ? $config['param'] : []);
+ $generatorParam = ($config['param'] ?? []);
// hack to find the module name (look for the last /modules/ in path)
preg_match('#.*/modules/([^/]+)/#', str_replace('\\', '/', $configFiles[0]), $match);
diff --git a/lib/config/sfPluginConfiguration.class.php b/lib/config/sfPluginConfiguration.class.php
index aa80e077d..5d1ba422c 100644
--- a/lib/config/sfPluginConfiguration.class.php
+++ b/lib/config/sfPluginConfiguration.class.php
@@ -32,7 +32,7 @@ public function __construct(sfProjectConfiguration $configuration, $rootDir = nu
$this->configuration = $configuration;
$this->dispatcher = $configuration->getEventDispatcher();
$this->rootDir = null === $rootDir ? $this->guessRootDir() : realpath($rootDir);
- $this->name = null === $name ? $this->guessName() : $name;
+ $this->name = $name ?? $this->guessName();
$this->setup();
$this->configure();
diff --git a/lib/config/sfProjectConfiguration.class.php b/lib/config/sfProjectConfiguration.class.php
index 68f006e20..17aea4eff 100644
--- a/lib/config/sfProjectConfiguration.class.php
+++ b/lib/config/sfProjectConfiguration.class.php
@@ -56,7 +56,7 @@ public function __construct($rootDir = null, ?sfEventDispatcher $dispatcher = nu
$this->rootDir = null === $rootDir ? static::guessRootDir() : realpath($rootDir);
$this->symfonyLibDir = realpath(__DIR__.'/..');
- $this->dispatcher = null === $dispatcher ? new sfEventDispatcher() : $dispatcher;
+ $this->dispatcher = $dispatcher ?? new sfEventDispatcher();
ini_set('magic_quotes_runtime', 'off');
diff --git a/lib/config/sfRoutingConfigHandler.class.php b/lib/config/sfRoutingConfigHandler.class.php
index f917bd4ab..91541962e 100644
--- a/lib/config/sfRoutingConfigHandler.class.php
+++ b/lib/config/sfRoutingConfigHandler.class.php
@@ -91,17 +91,17 @@ protected function parse($configFiles)
(isset($params['type']) && 'collection' == $params['type'])
|| (isset($params['class']) && false !== strpos($params['class'], 'Collection'))
) {
- $options = isset($params['options']) ? $params['options'] : [];
+ $options = $params['options'] ?? [];
$options['name'] = $name;
- $options['requirements'] = isset($params['requirements']) ? $params['requirements'] : [];
+ $options['requirements'] = $params['requirements'] ?? [];
- $routes[$name] = [isset($params['class']) ? $params['class'] : 'sfRouteCollection', [$options]];
+ $routes[$name] = [$params['class'] ?? 'sfRouteCollection', [$options]];
} else {
- $routes[$name] = [isset($params['class']) ? $params['class'] : 'sfRoute', [
+ $routes[$name] = [$params['class'] ?? 'sfRoute', [
$params['url'] ?: '/',
- isset($params['params']) ? $params['params'] : (isset($params['param']) ? $params['param'] : []),
- isset($params['requirements']) ? $params['requirements'] : [],
- isset($params['options']) ? $params['options'] : [],
+ $params['params'] ?? $params['param'] ?? [],
+ $params['requirements'] ?? [],
+ $params['options'] ?? [],
]];
}
}
diff --git a/lib/config/sfYamlConfigHandler.class.php b/lib/config/sfYamlConfigHandler.class.php
index d1ea1e798..018435c46 100644
--- a/lib/config/sfYamlConfigHandler.class.php
+++ b/lib/config/sfYamlConfigHandler.class.php
@@ -69,7 +69,7 @@ public static function parseYaml($configFile)
throw new sfParseException(sprintf('Configuration file "%s" could not be parsed', $configFile));
}
- return null === $config ? [] : $config;
+ return $config ?? [];
}
public static function flattenConfiguration($config)
diff --git a/lib/debug/sfWebDebug.class.php b/lib/debug/sfWebDebug.class.php
index 3e1d2258b..0a83f0614 100644
--- a/lib/debug/sfWebDebug.class.php
+++ b/lib/debug/sfWebDebug.class.php
@@ -134,7 +134,7 @@ public function removePanel($name)
*/
public function getOption($name, $default = null)
{
- return isset($this->options[$name]) ? $this->options[$name] : $default;
+ return $this->options[$name] ?? $default;
}
/**
@@ -178,7 +178,7 @@ public function injectToolbar($content)
*/
public function asHtml()
{
- $current = isset($this->options['request_parameters']['sfWebDebugPanel']) ? $this->options['request_parameters']['sfWebDebugPanel'] : null;
+ $current = $this->options['request_parameters']['sfWebDebugPanel'] ?? null;
$titles = [];
$panels = [];
diff --git a/lib/debug/sfWebDebugPanel.class.php b/lib/debug/sfWebDebugPanel.class.php
index 487feac49..c1399e843 100644
--- a/lib/debug/sfWebDebugPanel.class.php
+++ b/lib/debug/sfWebDebugPanel.class.php
@@ -112,8 +112,8 @@ public function getToggleableDebugStack($debugStack)
$html = $this->getToggler($element, 'Toggle debug stack');
$html .= '
';
foreach ($debugStack as $j => $trace) {
- $file = isset($trace['file']) ? $trace['file'] : null;
- $line = isset($trace['line']) ? $trace['line'] : null;
+ $file = $trace['file'] ?? null;
+ $line = $trace['line'] ?? null;
$isProjectFile = $file && 0 === strpos($file, sfConfig::get('sf_root_dir')) && !preg_match('/(cache|plugins|vendor)/', $file);
@@ -122,8 +122,8 @@ public function getToggleableDebugStack($debugStack)
if (isset($trace['function'])) {
$html .= sprintf(
'in
%s%s%s() ',
- isset($trace['class']) ? $trace['class'] : '',
- isset($trace['type']) ? $trace['type'] : '',
+ $trace['class'] ?? '',
+ $trace['type'] ?? '',
$trace['function']
);
}
@@ -166,7 +166,7 @@ public function formatFileLink($file, $line = null, $text = null)
'
%s',
htmlspecialchars(strtr($linkFormat, ['%f' => $file, '%l' => $line]), ENT_QUOTES, sfConfig::get('sf_charset')),
htmlspecialchars($shortFile, ENT_QUOTES, sfConfig::get('sf_charset')),
- null === $text ? $shortFile : $text
+ $text ?? $shortFile
);
}
if (null === $text) {
diff --git a/lib/escaper/sfOutputEscaperArrayDecorator.class.php b/lib/escaper/sfOutputEscaperArrayDecorator.class.php
index 149ea2fa8..a6aa6b595 100644
--- a/lib/escaper/sfOutputEscaperArrayDecorator.class.php
+++ b/lib/escaper/sfOutputEscaperArrayDecorator.class.php
@@ -120,7 +120,7 @@ public function offsetExists($offset)
#[\ReturnTypeWillChange]
public function offsetGet($offset)
{
- $value = isset($this->value[$offset]) ? $this->value[$offset] : null;
+ $value = $this->value[$offset] ?? null;
return sfOutputEscaper::escape($this->escapingMethod, $value);
}
diff --git a/lib/exception/data/error.html.php b/lib/exception/data/error.html.php
index a8c3acb9c..207e9fd14 100644
--- a/lib/exception/data/error.html.php
+++ b/lib/exception/data/error.html.php
@@ -1,6 +1,6 @@
-
+
diff --git a/lib/exception/data/unavailable.php b/lib/exception/data/unavailable.php
index 13b33e378..c4839f996 100644
--- a/lib/exception/data/unavailable.php
+++ b/lib/exception/data/unavailable.php
@@ -1,6 +1,6 @@
-
+
diff --git a/lib/exception/sfError404Exception.class.php b/lib/exception/sfError404Exception.class.php
index 51528373e..ce0fe8d7b 100644
--- a/lib/exception/sfError404Exception.class.php
+++ b/lib/exception/sfError404Exception.class.php
@@ -20,7 +20,7 @@ class sfError404Exception extends sfException
*/
public function printStackTrace()
{
- $exception = null === $this->wrappedException ? $this : $this->wrappedException;
+ $exception = $this->wrappedException ?? $this;
if (sfConfig::get('sf_debug')) {
$response = sfContext::getInstance()->getResponse();
diff --git a/lib/exception/sfException.class.php b/lib/exception/sfException.class.php
index 19fd9d950..853f3fd22 100644
--- a/lib/exception/sfException.class.php
+++ b/lib/exception/sfException.class.php
@@ -216,7 +216,7 @@ protected static function outputStackTrace($exception)
$format = 'txt';
}
- $message = null === $exception->getMessage() ? 'n/a' : $exception->getMessage();
+ $message = $exception->getMessage() ?? 'n/a';
$name = get_class($exception);
$traces = self::getTraces($exception, $format);
@@ -280,17 +280,17 @@ protected static function getTraces($exception, $format = 'txt')
}
for ($i = 0, $count = count($traceData); $i < $count; ++$i) {
- $line = isset($traceData[$i]['line']) ? $traceData[$i]['line'] : null;
- $file = isset($traceData[$i]['file']) ? $traceData[$i]['file'] : null;
- $args = isset($traceData[$i]['args']) ? $traceData[$i]['args'] : [];
+ $line = $traceData[$i]['line'] ?? null;
+ $file = $traceData[$i]['file'] ?? null;
+ $args = $traceData[$i]['args'] ?? [];
$traces[] = sprintf(
$lineFormat,
- isset($traceData[$i]['class']) ? $traceData[$i]['class'] : '',
- isset($traceData[$i]['type']) ? $traceData[$i]['type'] : '',
+ $traceData[$i]['class'] ?? '',
+ $traceData[$i]['type'] ?? '',
$traceData[$i]['function'],
self::formatArgs($args, false, $format),
self::formatFile($file, $line, $format, null === $file ? 'n/a' : sfDebug::shortenFilePath($file)),
- null === $line ? 'n/a' : $line,
+ $line ?? 'n/a',
'trace_'.$i,
'trace_'.$i,
0 == $i ? 'block' : 'none',
diff --git a/lib/filter/sfExecutionFilter.class.php b/lib/filter/sfExecutionFilter.class.php
index 53a5af33e..20d3b74b6 100644
--- a/lib/filter/sfExecutionFilter.class.php
+++ b/lib/filter/sfExecutionFilter.class.php
@@ -85,7 +85,7 @@ protected function executeAction($actionInstance)
$viewName = $actionInstance->execute($this->context->getRequest());
$actionInstance->postExecute();
- return null === $viewName ? sfView::SUCCESS : $viewName;
+ return $viewName ?? sfView::SUCCESS;
}
/**
diff --git a/lib/form/sfForm.class.php b/lib/form/sfForm.class.php
index e3a9cc0a3..95df17505 100644
--- a/lib/form/sfForm.class.php
+++ b/lib/form/sfForm.class.php
@@ -262,8 +262,8 @@ public function bindEmbeddedForms(?array $taintedValues = null, ?array $taintedF
// bind
$form->bind(
- isset($taintedValues[$name]) ? $taintedValues[$name] : [],
- isset($taintedFiles[$name]) ? $taintedFiles[$name] : []
+ $taintedValues[$name] ?? [],
+ $taintedFiles[$name] ?? []
);
// set values for current form
@@ -439,7 +439,7 @@ public function embedForm($name, sfForm $form, $decorator = null)
$this->setDefault($name, $form->getDefaults());
- $decorator = null === $decorator ? $widgetSchema->getFormFormatter()->getDecoratorFormat() : $decorator;
+ $decorator ??= $widgetSchema->getFormFormatter()->getDecoratorFormat();
$this->widgetSchema[$name] = new sfWidgetFormSchemaDecorator($widgetSchema, $decorator);
$this->validatorSchema[$name] = new sfValidatorPass();
@@ -763,7 +763,7 @@ public function setOption($name, $value)
*/
public function getOption($name, $default = null)
{
- return isset($this->options[$name]) ? $this->options[$name] : $default;
+ return $this->options[$name] ?? $default;
}
/**
@@ -792,7 +792,7 @@ public function setDefault($name, $default)
*/
public function getDefault($name)
{
- return isset($this->defaults[$name]) ? $this->defaults[$name] : null;
+ return $this->defaults[$name] ?? null;
}
/**
@@ -818,7 +818,7 @@ public function hasDefault($name)
*/
public function setDefaults($defaults)
{
- $this->defaults = null === $defaults ? [] : $defaults;
+ $this->defaults = $defaults ?? [];
if ($this->isCSRFProtected()) {
$this->setDefault(self::$CSRFFieldName, $this->getCSRFToken($this->localCSRFSecret ?: self::$CSRFSecret));
@@ -927,7 +927,7 @@ public static function getCSRFFieldName()
*/
public function enableLocalCSRFProtection($secret = null)
{
- $this->localCSRFSecret = null === $secret ? true : $secret;
+ $this->localCSRFSecret = $secret ?? true;
}
/**
@@ -1037,7 +1037,7 @@ public function offsetGet($name)
}
if ($this->isBound) {
- $value = isset($this->taintedValues[$name]) ? $this->taintedValues[$name] : null;
+ $value = $this->taintedValues[$name] ?? null;
} elseif (isset($this->defaults[$name])) {
$value = $this->defaults[$name];
} else {
diff --git a/lib/form/sfFormField.class.php b/lib/form/sfFormField.class.php
index 0d04cd478..7af99ed82 100644
--- a/lib/form/sfFormField.class.php
+++ b/lib/form/sfFormField.class.php
@@ -144,7 +144,7 @@ public function renderRow($attributes = [], $label = null, $help = null)
$error = $this->error instanceof sfValidatorErrorSchema ? $this->error->getGlobalErrors() : $this->error;
- $help = null === $help ? $this->parent->getWidget()->getHelp($this->name) : $help;
+ $help ??= $this->parent->getWidget()->getHelp($this->name);
return strtr($this->parent->getWidget()->getFormFormatter()->formatRow($this->renderLabel($label), $field, $error, $help), ['%hidden_fields%' => '']);
}
diff --git a/lib/form/sfFormFieldSchema.class.php b/lib/form/sfFormFieldSchema.class.php
index e0a93fb48..099e0c8d6 100644
--- a/lib/form/sfFormFieldSchema.class.php
+++ b/lib/form/sfFormFieldSchema.class.php
@@ -103,7 +103,7 @@ public function offsetGet($name)
throw new InvalidArgumentException(sprintf('Widget "%s" does not exist.', $name));
}
- $error = isset($this->error[$name]) ? $this->error[$name] : null;
+ $error = $this->error[$name] ?? null;
if ($widget instanceof sfWidgetFormSchema) {
$class = 'sfFormFieldSchema';
@@ -117,7 +117,7 @@ public function offsetGet($name)
$class = 'sfFormField';
}
- $this->fields[$name] = new $class($widget, $this, $name, isset($this->value[$name]) ? $this->value[$name] : null, $error);
+ $this->fields[$name] = new $class($widget, $this, $name, $this->value[$name] ?? null, $error);
}
return $this->fields[$name];
diff --git a/lib/generator/sfModelGenerator.class.php b/lib/generator/sfModelGenerator.class.php
index ab6b139ee..bf8bf3692 100644
--- a/lib/generator/sfModelGenerator.class.php
+++ b/lib/generator/sfModelGenerator.class.php
@@ -43,7 +43,7 @@ public function generate($params = [])
$this->setGeneratedModuleName('auto'.ucfirst($this->params['moduleName']));
// theme exists?
- $theme = isset($this->params['theme']) ? $this->params['theme'] : 'default';
+ $theme = $this->params['theme'] ?? 'default';
$this->setTheme($theme);
$themeDir = $this->generatorManager->getConfiguration()->getGeneratorTemplate($this->getGeneratorClass(), $theme, '');
if (!is_dir($themeDir)) {
@@ -73,7 +73,7 @@ public function generate($params = [])
*/
public function getActionsBaseClass()
{
- return isset($this->params['actions_base_class']) ? $this->params['actions_base_class'] : 'sfActions';
+ return $this->params['actions_base_class'] ?? 'sfActions';
}
/**
@@ -105,7 +105,7 @@ public function getPrimaryKeys($firstOne = false)
*/
public function getSingularName()
{
- return isset($this->params['singular']) ? $this->params['singular'] : sfInflector::underscore($this->getModelClass());
+ return $this->params['singular'] ?? sfInflector::underscore($this->getModelClass());
}
/**
@@ -115,7 +115,7 @@ public function getSingularName()
*/
public function getPluralName()
{
- return isset($this->params['plural']) ? $this->params['plural'] : $this->getSingularName().'_list';
+ return $this->params['plural'] ?? $this->getSingularName().'_list';
}
/**
@@ -125,7 +125,7 @@ public function getPluralName()
*/
public function getI18nCatalogue()
{
- return isset($this->params['i18n_catalogue']) ? $this->params['i18n_catalogue'] : 'messages';
+ return $this->params['i18n_catalogue'] ?? 'messages';
}
/**
@@ -199,7 +199,7 @@ abstract public function getManyToManyTables();
*/
public function getLinkToAction($actionName, $params, $pk_link = false)
{
- $action = isset($params['action']) ? $params['action'] : 'List'.sfInflector::camelize($actionName);
+ $action = $params['action'] ?? 'List'.sfInflector::camelize($actionName);
$url_params = $pk_link ? '?'.$this->getPrimaryKeyUrlParams() : '\'';
@@ -370,7 +370,7 @@ protected function validateParameters($params)
throw new sfInitializationException(sprintf('Unable to generate a module for non-existent model "%s".', $params['model_class']));
}
- $this->config = isset($params['config']) ? $params['config'] : [];
+ $this->config = $params['config'] ?? [];
unset($params['config']);
$this->params = $params;
diff --git a/lib/generator/sfModelGeneratorConfiguration.class.php b/lib/generator/sfModelGeneratorConfiguration.class.php
index 069c4ba47..33db4fe23 100644
--- a/lib/generator/sfModelGeneratorConfiguration.class.php
+++ b/lib/generator/sfModelGeneratorConfiguration.class.php
@@ -149,8 +149,8 @@ public function getFormFilterFields(sfForm $form)
list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
if (!isset($this->configuration['filter']['fields'][$name])) {
$this->configuration['filter']['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(
- isset($config['default'][$name]) ? $config['default'][$name] : [],
- isset($config['filter'][$name]) ? $config['filter'][$name] : [],
+ $config['default'][$name] ?? [],
+ $config['filter'][$name] ?? [],
['is_real' => false, 'type' => 'Text', 'flag' => $flag]
));
}
@@ -166,8 +166,8 @@ public function getFormFilterFields(sfForm $form)
foreach ($form->getWidgetSchema()->getPositions() as $name) {
$fields[$name] = new sfModelGeneratorConfigurationField($name, array_merge(
['type' => 'Text'],
- isset($config['default'][$name]) ? $config['default'][$name] : [],
- isset($config['filter'][$name]) ? $config['filter'][$name] : [],
+ $config['default'][$name] ?? [],
+ $config['filter'][$name] ?? [],
['is_real' => false]
));
}
@@ -214,9 +214,9 @@ public function getFormFields(sfForm $form, $context)
list($name, $flag) = sfModelGeneratorConfigurationField::splitFieldWithFlag($name);
if (!isset($this->configuration[$context]['fields'][$name])) {
$this->configuration[$context]['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(
- isset($config['default'][$name]) ? $config['default'][$name] : [],
- isset($config['form'][$name]) ? $config['form'][$name] : [],
- isset($config[$context][$name]) ? $config[$context][$name] : [],
+ $config['default'][$name] ?? [],
+ $config['form'][$name] ?? [],
+ $config[$context][$name] ?? [],
['is_real' => false, 'type' => 'Text', 'flag' => $flag]
));
}
@@ -234,9 +234,9 @@ public function getFormFields(sfForm $form, $context)
foreach ($form->getWidgetSchema()->getPositions() as $name) {
$fields[$name] = new sfModelGeneratorConfigurationField($name, array_merge(
['type' => 'Text'],
- isset($config['default'][$name]) ? $config['default'][$name] : [],
- isset($config['form'][$name]) ? $config['form'][$name] : [],
- isset($config[$context][$name]) ? $config[$context][$name] : [],
+ $config['default'][$name] ?? [],
+ $config['form'][$name] ?? [],
+ $config[$context][$name] ?? [],
['is_real' => false]
));
}
@@ -280,7 +280,7 @@ public function getCredentials($action)
$action = substr($action, 1);
}
- return isset($this->configuration['credentials'][$action]) ? $this->configuration['credentials'][$action] : [];
+ return $this->configuration['credentials'][$action] ?? [];
}
public function getPager($model)
@@ -364,12 +364,12 @@ protected function compile()
];
foreach (array_keys($config['default']) as $field) {
- $formConfig = array_merge($config['default'][$field], isset($config['form'][$field]) ? $config['form'][$field] : []);
+ $formConfig = array_merge($config['default'][$field], $config['form'][$field] ?? []);
- $this->configuration['list']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(['label' => sfInflector::humanize(sfInflector::underscore($field))], $config['default'][$field], isset($config['list'][$field]) ? $config['list'][$field] : []));
- $this->configuration['filter']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($config['default'][$field], isset($config['filter'][$field]) ? $config['filter'][$field] : []));
- $this->configuration['new']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, isset($config['new'][$field]) ? $config['new'][$field] : []));
- $this->configuration['edit']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, isset($config['edit'][$field]) ? $config['edit'][$field] : []));
+ $this->configuration['list']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(['label' => sfInflector::humanize(sfInflector::underscore($field))], $config['default'][$field], $config['list'][$field] ?? []));
+ $this->configuration['filter']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($config['default'][$field], $config['filter'][$field] ?? []));
+ $this->configuration['new']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, $config['new'][$field] ?? []));
+ $this->configuration['edit']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge($formConfig, $config['edit'][$field] ?? []));
}
// "virtual" fields for list
@@ -378,8 +378,8 @@ protected function compile()
$this->configuration['list']['fields'][$field] = new sfModelGeneratorConfigurationField($field, array_merge(
['type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($field))],
- isset($config['default'][$field]) ? $config['default'][$field] : [],
- isset($config['list'][$field]) ? $config['list'][$field] : [],
+ $config['default'][$field] ?? [],
+ $config['list'][$field] ?? [],
['flag' => $flag]
));
}
@@ -444,8 +444,8 @@ protected function compile()
$action = substr($action, 1);
}
- $this->configuration['credentials'][$action] = isset($params['credentials']) ? $params['credentials'] : [];
- $this->configuration['credentials']['batch'.ucfirst($action)] = isset($params['credentials']) ? $params['credentials'] : [];
+ $this->configuration['credentials'][$action] = $params['credentials'] ?? [];
+ $this->configuration['credentials']['batch'.ucfirst($action)] = $params['credentials'] ?? [];
}
$this->configuration['credentials']['create'] = $this->configuration['credentials']['new'];
$this->configuration['credentials']['update'] = $this->configuration['credentials']['edit'];
@@ -459,8 +459,8 @@ protected function parseVariables($context, $key)
if (!isset($this->configuration[$context]['fields'][$name])) {
$this->configuration[$context]['fields'][$name] = new sfModelGeneratorConfigurationField($name, array_merge(
['type' => 'Text', 'label' => sfInflector::humanize(sfInflector::underscore($name))],
- isset($config['default'][$name]) ? $config['default'][$name] : [],
- isset($config[$context][$name]) ? $config[$context][$name] : [],
+ $config['default'][$name] ?? [],
+ $config[$context][$name] ?? [],
['flag' => $flag]
));
} else {
diff --git a/lib/generator/sfModelGeneratorConfigurationField.class.php b/lib/generator/sfModelGeneratorConfigurationField.class.php
index 683bba8c7..339d86e68 100644
--- a/lib/generator/sfModelGeneratorConfigurationField.class.php
+++ b/lib/generator/sfModelGeneratorConfigurationField.class.php
@@ -76,7 +76,7 @@ public function getType()
*/
public function isReal()
{
- return isset($this->config['is_real']) ? $this->config['is_real'] : false;
+ return $this->config['is_real'] ?? false;
}
/**
@@ -86,7 +86,7 @@ public function isReal()
*/
public function isPartial()
{
- return isset($this->config['is_partial']) ? $this->config['is_partial'] : false;
+ return $this->config['is_partial'] ?? false;
}
/**
@@ -106,7 +106,7 @@ public function setPartial($boolean)
*/
public function isComponent()
{
- return isset($this->config['is_component']) ? $this->config['is_component'] : false;
+ return $this->config['is_component'] ?? false;
}
/**
@@ -126,7 +126,7 @@ public function setComponent($boolean)
*/
public function isLink()
{
- return isset($this->config['is_link']) ? $this->config['is_link'] : false;
+ return $this->config['is_link'] ?? false;
}
/**
@@ -156,7 +156,7 @@ public function setRenderer($renderer)
*/
public function getRenderer()
{
- return isset($this->config['renderer']) ? $this->config['renderer'] : null;
+ return $this->config['renderer'] ?? null;
}
/**
@@ -176,7 +176,7 @@ public function setRendererArguments(array $arguments)
*/
public function getRendererArguments()
{
- return isset($this->config['renderer_arguments']) ? $this->config['renderer_arguments'] : [];
+ return $this->config['renderer_arguments'] ?? [];
}
public static function splitFieldWithFlag($field)
diff --git a/lib/helper/AssetHelper.php b/lib/helper/AssetHelper.php
index e76ca2d29..885df211b 100644
--- a/lib/helper/AssetHelper.php
+++ b/lib/helper/AssetHelper.php
@@ -43,9 +43,9 @@
function auto_discovery_link_tag($type = 'rss', $url = '', $tag_options = [])
{
return tag('link', [
- 'rel' => isset($tag_options['rel']) ? $tag_options['rel'] : 'alternate',
- 'type' => isset($tag_options['type']) ? $tag_options['type'] : 'application/'.$type.'+xml',
- 'title' => isset($tag_options['title']) ? $tag_options['title'] : ucfirst($type),
+ 'rel' => $tag_options['rel'] ?? 'alternate',
+ 'type' => $tag_options['type'] ?? 'application/'.$type.'+xml',
+ 'title' => $tag_options['title'] ?? ucfirst($type),
'href' => url_for($url, true),
]);
}
diff --git a/lib/helper/I18NHelper.php b/lib/helper/I18NHelper.php
index 991801550..45bc8d892 100644
--- a/lib/helper/I18NHelper.php
+++ b/lib/helper/I18NHelper.php
@@ -67,16 +67,16 @@ function format_number_choice($text, $args = [], $number = null, $catalogue = 'm
function format_country($country_iso, $culture = null)
{
- $c = sfCultureInfo::getInstance(null === $culture ? sfContext::getInstance()->getUser()->getCulture() : $culture);
+ $c = sfCultureInfo::getInstance($culture ?? sfContext::getInstance()->getUser()->getCulture());
$countries = $c->getCountries();
- return isset($countries[$country_iso]) ? $countries[$country_iso] : '';
+ return $countries[$country_iso] ?? '';
}
function format_language($language_iso, $culture = null)
{
- $c = sfCultureInfo::getInstance(null === $culture ? sfContext::getInstance()->getUser()->getCulture() : $culture);
+ $c = sfCultureInfo::getInstance($culture ?? sfContext::getInstance()->getUser()->getCulture());
$languages = $c->getLanguages();
- return isset($languages[$language_iso]) ? $languages[$language_iso] : '';
+ return $languages[$language_iso] ?? '';
}
diff --git a/lib/helper/JavascriptBaseHelper.php b/lib/helper/JavascriptBaseHelper.php
index a2b3057a6..f1f936e20 100644
--- a/lib/helper/JavascriptBaseHelper.php
+++ b/lib/helper/JavascriptBaseHelper.php
@@ -32,7 +32,7 @@ function link_to_function($name, $function, $html_options = [])
{
$html_options = _parse_attributes($html_options);
- $html_options['href'] = isset($html_options['href']) ? $html_options['href'] : '#';
+ $html_options['href'] ??= '#';
if (isset($html_options['confirm'])) {
$confirm = escape_javascript($html_options['confirm']);
unset($html_options['confirm']);
diff --git a/lib/helper/PartialHelper.php b/lib/helper/PartialHelper.php
index b3a892ea3..70b0fa00e 100644
--- a/lib/helper/PartialHelper.php
+++ b/lib/helper/PartialHelper.php
@@ -326,7 +326,7 @@ function get_slot($name, $default = '')
$context->getEventDispatcher()->notify(new sfEvent(null, 'application.log', [sprintf('Get slot "%s"', $name)]));
}
- return isset($slots[$name]) ? $slots[$name] : $default;
+ return $slots[$name] ?? $default;
}
function _call_component($moduleName, $componentName, $vars)
diff --git a/lib/helper/UrlHelper.php b/lib/helper/UrlHelper.php
index 58d5f1cf1..86fd3a537 100644
--- a/lib/helper/UrlHelper.php
+++ b/lib/helper/UrlHelper.php
@@ -472,18 +472,18 @@ function mail_to($email, $name = '', $options = [], $default_value = [])
function _convert_options_to_javascript($html_options, $url = 'this.href')
{
// confirm
- $confirm = isset($html_options['confirm']) ? $html_options['confirm'] : '';
+ $confirm = $html_options['confirm'] ?? '';
unset($html_options['confirm']);
// popup
- $popup = isset($html_options['popup']) ? $html_options['popup'] : '';
+ $popup = $html_options['popup'] ?? '';
unset($html_options['popup']);
// method
- $method = isset($html_options['method']) ? $html_options['method'] : (isset($html_options['post']) && $html_options['post'] ? 'post' : false);
+ $method = $html_options['method'] ?? (isset($html_options['post']) && $html_options['post'] ? 'post' : false);
unset($html_options['post'], $html_options['method']);
- $onclick = isset($html_options['onclick']) ? $html_options['onclick'] : '';
+ $onclick = $html_options['onclick'] ?? '';
if ($popup && $method) {
throw new sfConfigurationException('You can\'t use "popup", "method" and "post" in the same link.');
diff --git a/lib/i18n/sfI18N.class.php b/lib/i18n/sfI18N.class.php
index 944b14485..c21121ced 100644
--- a/lib/i18n/sfI18N.class.php
+++ b/lib/i18n/sfI18N.class.php
@@ -223,7 +223,7 @@ public function getMessageFormat()
*/
public function getCountry($iso, $culture = null)
{
- $c = sfCultureInfo::getInstance(null === $culture ? $this->culture : $culture);
+ $c = sfCultureInfo::getInstance($culture ?? $this->culture);
$countries = $c->getCountries();
return (array_key_exists($iso, $countries)) ? $countries[$iso] : '';
@@ -251,12 +251,12 @@ public function getNativeName($culture)
*/
public function getTimestampForCulture($dateTime, $culture = null)
{
- list($day, $month, $year) = $this->getDateForCulture($dateTime, null === $culture ? $this->culture : $culture);
- list($hour, $minute) = $this->getTimeForCulture($dateTime, null === $culture ? $this->culture : $culture);
+ list($day, $month, $year) = $this->getDateForCulture($dateTime, $culture ?? $this->culture);
+ list($hour, $minute) = $this->getTimeForCulture($dateTime, $culture ?? $this->culture);
// mktime behavior change with php8
- $hour = null !== $hour ? $hour : 0;
- $minute = null !== $minute ? $minute : 0;
+ $hour ??= 0;
+ $minute ??= 0;
return null === $day ? null : mktime($hour, $minute, 0, $month, $day, $year);
}
@@ -275,7 +275,7 @@ public function getDateForCulture($date, $culture = null)
return null;
}
- $dateFormatInfo = @sfDateTimeFormatInfo::getInstance(null === $culture ? $this->culture : $culture);
+ $dateFormatInfo = @sfDateTimeFormatInfo::getInstance($culture ?? $this->culture);
$dateFormat = $dateFormatInfo->getShortDatePattern();
// We construct the regexp based on date format
@@ -319,7 +319,7 @@ public function getTimeForCulture($time, $culture = null)
return 0;
}
- $culture = null === $culture ? $this->culture : $culture;
+ $culture ??= $this->culture;
$timeFormatInfo = @sfDateTimeFormatInfo::getInstance($culture);
$timeFormat = $timeFormatInfo->getShortTimePattern();
diff --git a/lib/log/sfFileLogger.class.php b/lib/log/sfFileLogger.class.php
index efb6f94c3..f7f90b15b 100644
--- a/lib/log/sfFileLogger.class.php
+++ b/lib/log/sfFileLogger.class.php
@@ -57,7 +57,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
}
$dir = dirname($options['file']);
- $dirMode = isset($options['dir_mode']) ? $options['dir_mode'] : 0777;
+ $dirMode = $options['dir_mode'] ?? 0777;
if (!is_dir($dir) && !@mkdir($dir, $dirMode, true) && !is_dir($dir)) {
throw new RuntimeException(sprintf('Logger was not able to create a directory "%s"', $dir));
}
@@ -69,7 +69,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
$this->fp = fopen($options['file'], 'a');
if (!$fileExists) {
- chmod($options['file'], isset($options['file_mode']) ? $options['file_mode'] : 0666);
+ chmod($options['file'], $options['file_mode'] ?? 0666);
}
parent::initialize($dispatcher, $options);
diff --git a/lib/log/sfLogger.class.php b/lib/log/sfLogger.class.php
index c1f1b7e5c..a590098ad 100644
--- a/lib/log/sfLogger.class.php
+++ b/lib/log/sfLogger.class.php
@@ -232,7 +232,7 @@ public function debug($message)
*/
public function listenToLogEvent(sfEvent $event)
{
- $priority = isset($event['priority']) ? $event['priority'] : self::INFO;
+ $priority = $event['priority'] ?? self::INFO;
$subject = $event->getSubject();
$subject = is_object($subject) ? get_class($subject) : (is_string($subject) ? $subject : 'main');
diff --git a/lib/log/sfVarLogger.class.php b/lib/log/sfVarLogger.class.php
index 0f9793432..504a1f797 100644
--- a/lib/log/sfVarLogger.class.php
+++ b/lib/log/sfVarLogger.class.php
@@ -30,7 +30,7 @@ class sfVarLogger extends sfLogger
*/
public function initialize(sfEventDispatcher $dispatcher, $options = [])
{
- $this->xdebugLogging = isset($options['xdebug_logging']) ? $options['xdebug_logging'] : false;
+ $this->xdebugLogging = $options['xdebug_logging'] ?? false;
// disable xdebug when an HTTP debug session exists (crashes Apache, see #2438)
if (isset($_GET['XDEBUG_SESSION_START']) || isset($_COOKIE['XDEBUG_SESSION'])) {
@@ -156,7 +156,7 @@ protected function getDebugBacktrace()
// remove sfLogger and sfEventDispatcher from the top of the trace
foreach ($traces as $i => $trace) {
- $class = isset($trace['class']) ? $trace['class'] : substr($file = basename($trace['file']), 0, strpos($file, '.'));
+ $class = $trace['class'] ?? substr($file = basename($trace['file']), 0, strpos($file, '.'));
if (
!class_exists($class)
diff --git a/lib/log/sfWebDebugLogger.class.php b/lib/log/sfWebDebugLogger.class.php
index d61c97dba..4133bb9e7 100644
--- a/lib/log/sfWebDebugLogger.class.php
+++ b/lib/log/sfWebDebugLogger.class.php
@@ -40,7 +40,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
{
$this->context = sfContext::getInstance();
- $this->webDebugClass = isset($options['web_debug_class']) ? $options['web_debug_class'] : 'sfWebDebug';
+ $this->webDebugClass = $options['web_debug_class'] ?? 'sfWebDebug';
if (sfConfig::get('sf_web_debug')) {
$dispatcher->connect('context.load_factories', [$this, 'listenForLoadFactories']);
diff --git a/lib/mailer/sfMailer.class.php b/lib/mailer/sfMailer.class.php
index d115fd2d4..8c07a55e9 100755
--- a/lib/mailer/sfMailer.class.php
+++ b/lib/mailer/sfMailer.class.php
@@ -94,7 +94,7 @@ public function __construct(sfEventDispatcher $dispatcher, $options)
if (!isset($options['spool_class'])) {
throw new InvalidArgumentException('For the spool mail delivery strategy, you must also define a spool_class option');
}
- $arguments = isset($options['spool_arguments']) ? $options['spool_arguments'] : [];
+ $arguments = $options['spool_arguments'] ?? [];
if ($arguments) {
$r = new ReflectionClass($options['spool_class']);
diff --git a/lib/plugin/sfPearEnvironment.class.php b/lib/plugin/sfPearEnvironment.class.php
index 49b73369c..4c411176d 100644
--- a/lib/plugin/sfPearEnvironment.class.php
+++ b/lib/plugin/sfPearEnvironment.class.php
@@ -112,7 +112,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
diff --git a/lib/plugin/sfPearRest10.class.php b/lib/plugin/sfPearRest10.class.php
index 4d08b5dd6..edd1e2e6b 100644
--- a/lib/plugin/sfPearRest10.class.php
+++ b/lib/plugin/sfPearRest10.class.php
@@ -22,7 +22,7 @@ class sfPearRest10 extends PEAR_REST_10
*/
public function __construct($config, $options = [])
{
- $class = isset($options['base_class']) ? $options['base_class'] : 'sfPearRest';
+ $class = $options['base_class'] ?? 'sfPearRest';
$this->_rest = new $class($config, $options);
}
diff --git a/lib/plugin/sfPearRest11.class.php b/lib/plugin/sfPearRest11.class.php
index a5e1cb072..19367bfc9 100644
--- a/lib/plugin/sfPearRest11.class.php
+++ b/lib/plugin/sfPearRest11.class.php
@@ -22,7 +22,7 @@ class sfPearRest11 extends PEAR_REST_11
*/
public function __construct($config, $options = [])
{
- $class = isset($options['base_class']) ? $options['base_class'] : 'sfPearRest';
+ $class = $options['base_class'] ?? 'sfPearRest';
$this->_rest = new $class($config, $options);
}
diff --git a/lib/plugin/sfPearRestPlugin.class.php b/lib/plugin/sfPearRestPlugin.class.php
index 589bb9322..eee5229a1 100644
--- a/lib/plugin/sfPearRestPlugin.class.php
+++ b/lib/plugin/sfPearRestPlugin.class.php
@@ -202,7 +202,7 @@ protected function getRESTBase($channelName)
*/
protected function getAllowedStates($stability = null)
{
- $stability = null === $stability ? $this->config->get('preferred_state', null, $this->channel) : $stability;
+ $stability ??= $this->config->get('preferred_state', null, $this->channel);
return array_flip($this->betterStates($stability, true));
}
diff --git a/lib/plugin/sfPluginManager.class.php b/lib/plugin/sfPluginManager.class.php
index 4ed4b80fe..e53325625 100644
--- a/lib/plugin/sfPluginManager.class.php
+++ b/lib/plugin/sfPluginManager.class.php
@@ -74,7 +74,7 @@ public function getInstalledPlugins()
$installed = [];
foreach ($this->environment->getRegistry()->packageInfo(null, null, null) as $channel => $packages) {
foreach ($packages as $package) {
- $installed[] = $this->environment->getRegistry()->getPackage(isset($package['package']) ? $package['package'] : $package['name'], $channel);
+ $installed[] = $this->environment->getRegistry()->getPackage($package['package'] ?? $package['name'], $channel);
}
}
@@ -118,7 +118,7 @@ public function uninstallPlugin($plugin, $channel = null)
list($channel, $plugin) = explode('/', $plugin);
}
- $channel = null === $channel ? $this->environment->getConfig()->get('default_channel') : $channel;
+ $channel ??= $this->environment->getConfig()->get('default_channel');
$existing = $this->environment->getRegistry()->packageInfo($plugin, 'version', $channel);
if (null === $existing) {
@@ -258,12 +258,12 @@ public function isPluginCompatible($plugin, $version)
*/
public function getPluginLicense($plugin, $options = [])
{
- $channel = isset($options['channel']) ? $options['channel'] : $this->environment->getConfig()->get('default_channel');
- $stability = isset($options['stability']) ? $options['stability'] : $this->environment->getConfig()->get('preferred_state', null, $channel);
- $version = isset($options['version']) ? $options['version'] : null;
+ $channel = $options['channel'] ?? $this->environment->getConfig()->get('default_channel');
+ $stability = $options['stability'] ?? $this->environment->getConfig()->get('preferred_state', null, $channel);
+ $version = $options['version'] ?? null;
$rest = $this->environment->getRest();
- $rest->setChannel(null === $channel ? $this->environment->getConfig()->get('default_channel') : $channel);
+ $rest->setChannel($channel ?? $this->environment->getConfig()->get('default_channel'));
if (null === $version) {
try {
@@ -288,9 +288,9 @@ public function getPluginLicense($plugin, $options = [])
*/
protected function doInstallPlugin($plugin, $options = [])
{
- $channel = isset($options['channel']) ? $options['channel'] : $this->environment->getConfig()->get('default_channel');
- $stability = isset($options['stability']) ? $options['stability'] : $this->environment->getConfig()->get('preferred_state', null, $channel);
- $version = isset($options['version']) ? $options['version'] : null;
+ $channel = $options['channel'] ?? $this->environment->getConfig()->get('default_channel');
+ $stability = $options['stability'] ?? $this->environment->getConfig()->get('preferred_state', null, $channel);
+ $version = $options['version'] ?? null;
$isPackage = true;
if (0 === strpos($plugin, 'http://') || file_exists($plugin)) {
@@ -352,7 +352,7 @@ protected function doInstallPlugin($plugin, $options = [])
if ($isPackage) {
$this->checkPluginDependencies($plugin, $version, [
- 'install_deps' => isset($options['install_deps']) ? (bool) $options['install_deps'] : false,
+ 'install_deps' => (bool) $options['install_deps'] ?? false,
'stability' => $stability,
]);
}
diff --git a/lib/plugin/sfSymfonyPluginManager.class.php b/lib/plugin/sfSymfonyPluginManager.class.php
index 514ca471a..e474c3c44 100644
--- a/lib/plugin/sfSymfonyPluginManager.class.php
+++ b/lib/plugin/sfSymfonyPluginManager.class.php
@@ -147,7 +147,7 @@ public static function disablePlugin($plugin, $configDir)
*/
public function listenToPluginPostInstall($event)
{
- $this->installWebContent($event['plugin'], isset($event['plugin_dir']) ? $event['plugin_dir'] : $this->environment->getOption('plugin_dir'));
+ $this->installWebContent($event['plugin'], $event['plugin_dir'] ?? $this->environment->getOption('plugin_dir'));
$this->enablePlugin($event['plugin'], $this->environment->getOption('config_dir'));
}
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php
index cd266cb72..35bc3850b 100644
--- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php
+++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/actionsConfiguration.php
@@ -1,41 +1,41 @@
- public function getActionsDefault()
+public function getActionsDefault()
{
- return asPhp(isset($this->config['actions']) ? $this->config['actions'] : array()) ?>;
+ return asPhp($this->config['actions'] ?? array()) ?>;
config['actions']) ?>
}
public function getFormActions()
{
- return asPhp(isset($this->config['form']['actions']) ? $this->config['form']['actions'] : array('_delete' => null, '_list' => null, '_save' => null, '_save_and_add' => null)) ?>;
+ return asPhp($this->config['form']['actions'] ?? array('_delete' => null, '_list' => null, '_save' => null, '_save_and_add' => null)) ?>;
config['form']['actions']) ?>
}
public function getNewActions()
{
- return asPhp(isset($this->config['new']['actions']) ? $this->config['new']['actions'] : array()) ?>;
+ return asPhp($this->config['new']['actions'] ?? array()) ?>;
config['new']['actions']) ?>
}
public function getEditActions()
{
- return asPhp(isset($this->config['edit']['actions']) ? $this->config['edit']['actions'] : array()) ?>;
+ return asPhp($this->config['edit']['actions'] ?? array()) ?>;
config['edit']['actions']) ?>
}
public function getListObjectActions()
{
- return asPhp(isset($this->config['list']['object_actions']) ? $this->config['list']['object_actions'] : array('_edit' => null, '_delete' => null)) ?>;
+ return asPhp($this->config['list']['object_actions'] ?? array('_edit' => null, '_delete' => null)) ?>;
config['list']['object_actions']) ?>
}
public function getListActions()
{
- return asPhp(isset($this->config['list']['actions']) ? $this->config['list']['actions'] : array('_new' => null)) ?>;
+ return asPhp($this->config['list']['actions'] ?? array('_new' => null)) ?>;
config['list']['actions']) ?>
}
public function getListBatchActions()
{
- return asPhp(isset($this->config['list']['batch_actions']) ? $this->config['list']['batch_actions'] : array('_delete' => null)) ?>;
+ return asPhp($this->config['list']['batch_actions'] ?? array('_delete' => null)) ?>;
config['list']['batch_actions']) ?>
}
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php
index f28642d8a..f0121f474 100644
--- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php
+++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/configuration.php
@@ -20,7 +20,7 @@ abstract class BasegetModuleName()) ?>GeneratorConfigu
*/
public function getFormClass()
{
- return 'config['form']['class']) ? $this->config['form']['class'] : $this->getModelClass().'Form' ?>';
+ return 'config['form']['class'] ?? $this->getModelClass().'Form' ?>';
config['form']['class']) ?>
}
@@ -46,13 +46,13 @@ public function getFilterFormClass()
public function getTableMethod()
{
- return 'config['list']['table_method']) ? $this->config['list']['table_method'] : null ?>';
+ return 'config['list']['table_method'] ?? null ?>';
config['list']['table_method']) ?>
}
public function getTableCountMethod()
{
- return 'config['list']['table_count_method']) ? $this->config['list']['table_count_method'] : null ?>';
+ return 'config['list']['table_count_method'] ?? null ?>';
config['list']['table_count_method']) ?>
}
}
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php
index dbd06c661..5571f0b22 100644
--- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php
+++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/fieldsConfiguration.php
@@ -1,54 +1,54 @@
- public function getListParams()
+public function getListParams()
{
- return asPhp(isset($this->config['list']['params']) ? $this->config['list']['params'] : '%%'.implode('%% - %%', isset($this->config['list']['display']) ? $this->config['list']['display'] : $this->getAllFieldNames(false)).'%%') ?>;
+ return asPhp($this->config['list']['params'] ?? '%%'.implode('%% - %%', $this->config['list']['display'] ?? $this->getAllFieldNames(false)).'%%') ?>;
config['list']['params']) ?>
}
public function getListLayout()
{
- return 'config['list']['layout']) ? $this->config['list']['layout'] : 'tabular' ?>';
+ return 'config['list']['layout'] ?? 'tabular' ?>';
config['list']['layout']) ?>
}
public function getListTitle()
{
- return 'escapeString(isset($this->config['list']['title']) ? $this->config['list']['title'] : sfInflector::humanize($this->getModuleName()).' List') ?>';
+ return 'escapeString($this->config['list']['title'] ?? sfInflector::humanize($this->getModuleName()).' List') ?>';
config['list']['title']) ?>
}
public function getEditTitle()
{
- return 'escapeString(isset($this->config['edit']['title']) ? $this->config['edit']['title'] : 'Edit '.sfInflector::humanize($this->getModuleName())) ?>';
+ return 'escapeString($this->config['edit']['title'] ?? 'Edit '.sfInflector::humanize($this->getModuleName())) ?>';
config['edit']['title']) ?>
}
public function getNewTitle()
{
- return 'escapeString(isset($this->config['new']['title']) ? $this->config['new']['title'] : 'New '.sfInflector::humanize($this->getModuleName())) ?>';
+ return 'escapeString($this->config['new']['title'] ?? 'New '.sfInflector::humanize($this->getModuleName())) ?>';
config['new']['title']) ?>
}
public function getFilterDisplay()
{
- return asPhp(isset($this->config['filter']['display']) ? $this->config['filter']['display'] : array()) ?>;
+ return asPhp($this->config['filter']['display'] ?? array()) ?>;
config['filter']['display']) ?>
}
public function getFormDisplay()
{
- return asPhp(isset($this->config['form']['display']) ? $this->config['form']['display'] : array()) ?>;
+ return asPhp($this->config['form']['display'] ?? array()) ?>;
config['form']['display']) ?>
}
public function getEditDisplay()
{
- return asPhp(isset($this->config['edit']['display']) ? $this->config['edit']['display'] : array()) ?>;
+ return asPhp($this->config['edit']['display'] ?? array()) ?>;
config['edit']['display']) ?>
}
public function getNewDisplay()
{
- return asPhp(isset($this->config['new']['display']) ? $this->config['new']['display'] : array()) ?>;
+ return asPhp($this->config['new']['display'] ?? array()) ?>;
config['new']['display']) ?>
}
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php
index 5f84cef6a..5a135361b 100644
--- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php
+++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/paginationConfiguration.php
@@ -1,6 +1,6 @@
- public function getPagerClass()
+public function getPagerClass()
{
- return 'config['list']['pager_class']) ? $this->config['list']['pager_class'] : 'sfDoctrinePager' ?>';
+ return 'config['list']['pager_class'] ?? 'sfDoctrinePager' ?>';
config['list']['pager_class']) ?>
}
diff --git a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php
index c52479324..7a7e22f73 100644
--- a/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php
+++ b/lib/plugins/sfDoctrinePlugin/data/generator/sfDoctrineModule/admin/parts/sortingConfiguration.php
@@ -1,8 +1,8 @@
- public function getDefaultSort()
+public function getDefaultSort()
{
-config['list']['sort']) ? $this->config['list']['sort'] : false)): ?>
+config['list']['sort'] ?? false)): ?>
- return array('', '');
+ return array('', '');
return array(null, null);
diff --git a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php b/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php
index 036fa08d8..a62e7ce9d 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/database/sfDoctrineConnectionProfiler.class.php
@@ -36,7 +36,7 @@ public function __construct(sfEventDispatcher $dispatcher, $options = [])
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
diff --git a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php b/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php
index aa0080f38..ade59502d 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/form/sfFormDoctrine.class.php
@@ -112,7 +112,7 @@ public function embedRelation($relationName, $formClass = null, $formArgs = [],
$relation = $this->getObject()->getTable()->getRelation($relationName);
- $r = new ReflectionClass(null === $formClass ? $relation->getClass().'Form' : $formClass);
+ $r = new ReflectionClass($formClass ?? $relation->getClass().'Form');
if (Doctrine_Relation::ONE == $relation->getType()) {
$this->embedForm($fieldName, $r->newInstanceArgs(array_merge([$this->getObject()->{$relationName}], $formArgs)), $decorator);
@@ -290,7 +290,7 @@ protected function processUploadedFile($field, $filename = null, $values = null)
// the parent form has already changed the value of the field
$oldValues = $this->getObject()->getModified(true, false);
- return isset($oldValues[$field]) ? $oldValues[$field] : $this->object->{$field};
+ return $oldValues[$field] ?? $this->object->{$field};
}
// we need the base directory
diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php
index 809e16d10..2f43efd41 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineColumn.class.php
@@ -121,7 +121,7 @@ public function getPhpName()
*/
public function getDoctrineType()
{
- return isset($this->definition['type']) ? $this->definition['type'] : null;
+ return $this->definition['type'] ?? null;
}
/**
diff --git a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php
index d95d59bda..52c91affa 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/generator/sfDoctrineGenerator.class.php
@@ -128,7 +128,7 @@ public function getDefaultFieldsConfiguration()
'is_partial' => false,
'is_component' => false,
'type' => $this->getType($column),
- ], isset($this->config['fields'][$name]) ? $this->config['fields'][$name] : []);
+ ], $this->config['fields'][$name] ?? []);
}
foreach ($this->getManyToManyTables() as $tables) {
@@ -140,7 +140,7 @@ public function getDefaultFieldsConfiguration()
'is_partial' => false,
'is_component' => false,
'type' => 'Text',
- ], isset($this->config['fields'][$name]) ? $this->config['fields'][$name] : []);
+ ], $this->config['fields'][$name] ?? []);
}
if (isset($this->config['fields'])) {
@@ -178,13 +178,13 @@ public function getFieldsConfiguration($context)
$names = [];
foreach ($this->getColumns() as $name => $column) {
$names[] = $name;
- $fields[$name] = isset($this->config[$context]['fields'][$name]) ? $this->config[$context]['fields'][$name] : [];
+ $fields[$name] = $this->config[$context]['fields'][$name] ?? [];
}
foreach ($this->getManyToManyTables() as $tables) {
$name = sfInflector::underscore($tables['alias']).'_list';
$names[] = $name;
- $fields[$name] = isset($this->config[$context]['fields'][$name]) ? $this->config[$context]['fields'][$name] : [];
+ $fields[$name] = $this->config[$context]['fields'][$name] ?? [];
}
if (isset($this->config[$context]['fields'])) {
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php
index fed0f611f..e24e82e5e 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFiltersTask.class.php
@@ -63,8 +63,8 @@ protected function execute($arguments = [], $options = [])
$properties = parse_ini_file(sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'properties.ini', true);
$constants = [
- 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony',
- 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here',
+ 'PROJECT_NAME' => $properties['symfony']['name'] ?? 'symfony',
+ 'AUTHOR_NAME' => $properties['symfony']['author'] ?? 'Your name here',
];
// customize php and yml files
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php
index 1eae22868..0e0bd362b 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildFormsTask.class.php
@@ -63,8 +63,8 @@ protected function execute($arguments = [], $options = [])
$properties = parse_ini_file(sfConfig::get('sf_config_dir').DIRECTORY_SEPARATOR.'properties.ini', true);
$constants = [
- 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony',
- 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here',
+ 'PROJECT_NAME' => $properties['symfony']['name'] ?? 'symfony',
+ 'AUTHOR_NAME' => $properties['symfony']['author'] ?? 'Your name here',
];
// customize php and yml files
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php
index 60a81779d..4734860ae 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineBuildModelTask.class.php
@@ -100,9 +100,9 @@ protected function execute($arguments = [], $options = [])
$properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true);
$tokens = [
- '##PACKAGE##' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony',
+ '##PACKAGE##' => $properties['symfony']['name'] ?? 'symfony',
'##SUBPACKAGE##' => 'model',
- '##NAME##' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here',
+ '##NAME##' => $properties['symfony']['author'] ?? 'Your name here',
' <##EMAIL##>' => '',
"{\n\n}" => "{\n}\n",
];
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php
index b5b3571b2..12ee7b4dd 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineConfigureDatabaseTask.class.php
@@ -75,7 +75,7 @@ protected function execute($arguments = [], $options = [])
$config[$options['env']][$options['name']] = [
'class' => $options['class'],
- 'param' => array_merge(isset($config[$options['env']][$options['name']]['param']) ? $config[$options['env']][$options['name']]['param'] : [], ['dsn' => $arguments['dsn'], 'username' => $arguments['username'], 'password' => $arguments['password']]),
+ 'param' => array_merge($config[$options['env']][$options['name']]['param'] ?? [], ['dsn' => $arguments['dsn'], 'username' => $arguments['username'], 'password' => $arguments['password']]),
];
file_put_contents($file, sfYaml::dump($config, 4));
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php
index 66d717bfe..65f86fb3c 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineDqlTask.class.php
@@ -153,6 +153,6 @@ protected function execute($arguments = [], $options = [])
*/
protected function renderValue($value)
{
- return null === $value ? 'NULL' : $value;
+ return $value ?? 'NULL';
}
}
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php
index d027b64ef..0af2aabe8 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateAdminTask.class.php
@@ -122,7 +122,7 @@ class: sfDoctrineRouteCollection
EOF
- , $name, $model, $module, isset($options['plural']) ? $options['plural'] : $module, $primaryKey).$content;
+ , $name, $model, $module, $options['plural'] ?? $module, $primaryKey).$content;
$this->logSection('file+', $routing);
diff --git a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php
index 4643f1452..191f89cac 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/task/sfDoctrineGenerateModuleTask.class.php
@@ -82,12 +82,12 @@ protected function execute($arguments = [], $options = [])
$properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true);
$this->constants = [
- 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony',
+ 'PROJECT_NAME' => $properties['symfony']['name'] ?? 'symfony',
'APP_NAME' => $arguments['application'],
'MODULE_NAME' => $arguments['module'],
'UC_MODULE_NAME' => ucfirst($arguments['module']),
'MODEL_CLASS' => $arguments['model'],
- 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here',
+ 'AUTHOR_NAME' => $properties['symfony']['author'] ?? 'Your name here',
];
$method = $options['generate-in-cache'] ? 'executeInit' : 'executeGenerate';
diff --git a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php b/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php
index 9753a23fd..345d811e7 100644
--- a/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php
+++ b/lib/plugins/sfDoctrinePlugin/lib/widget/sfWidgetFormDoctrineChoice.class.php
@@ -40,7 +40,7 @@ public function getChoices()
}
if (null === $this->getOption('table_method')) {
- $query = null === $this->getOption('query') ? Doctrine_Core::getTable($this->getOption('model'))->createQuery() : $this->getOption('query');
+ $query = $this->getOption('query') ?? Doctrine_Core::getTable($this->getOption('model'))->createQuery();
if ($order = $this->getOption('order_by')) {
$query->addOrderBy($order[0].' '.$order[1]);
}
diff --git a/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php b/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php
index 046c1da15..d75ec5c5c 100644
--- a/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php
+++ b/lib/plugins/sfDoctrinePlugin/test/bootstrap/functional.php
@@ -11,11 +11,11 @@
include dirname(__FILE__).'/../../../../../test/bootstrap/unit.php';
if (!isset($root_dir)) {
- $root_dir = realpath(dirname(__FILE__).sprintf('/../%s/fixtures', isset($type) ? $type : 'functional'));
+ $root_dir = realpath(dirname(__FILE__).sprintf('/../%s/fixtures', $type ?? 'functional'));
}
include $root_dir.'/config/ProjectConfiguration.class.php';
-$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
+$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', $debug ?? true);
sfContext::createInstance($configuration);
// remove all cache
diff --git a/lib/request/sfRequest.class.php b/lib/request/sfRequest.class.php
index 96e220900..44978c9d3 100644
--- a/lib/request/sfRequest.class.php
+++ b/lib/request/sfRequest.class.php
@@ -124,7 +124,7 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = [], $att
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
diff --git a/lib/request/sfWebRequest.class.php b/lib/request/sfWebRequest.class.php
index e61a2a3f4..3cc461824 100644
--- a/lib/request/sfWebRequest.class.php
+++ b/lib/request/sfWebRequest.class.php
@@ -182,9 +182,9 @@ public function getUri()
// for IIS with rewrite module (IIFR, ISAPI Rewrite, ...)
if ('HTTP_X_REWRITE_URL' == $this->getOption('path_info_key')) {
- $uri = isset($pathArray['HTTP_X_REWRITE_URL']) ? $pathArray['HTTP_X_REWRITE_URL'] : '';
+ $uri = $pathArray['HTTP_X_REWRITE_URL'] ?? '';
} else {
- $uri = isset($pathArray['REQUEST_URI']) ? $pathArray['REQUEST_URI'] : '';
+ $uri = $pathArray['REQUEST_URI'] ?? '';
}
return $this->isAbsUri() ? $uri : $this->getUriPrefix().$uri;
@@ -251,7 +251,7 @@ public function getPathInfo()
$sf_path_info_key = $this->getOption('path_info_key');
if (!isset($pathArray[$sf_path_info_key]) || !$pathArray[$sf_path_info_key]) {
if (isset($pathArray['REQUEST_URI'])) {
- $qs = isset($pathArray['QUERY_STRING']) ? $pathArray['QUERY_STRING'] : '';
+ $qs = $pathArray['QUERY_STRING'] ?? '';
$script_name = $this->getScriptName();
$uri_prefix = $this->isAbsUri() ? $this->getUriPrefix() : '';
$pathInfo = preg_replace('/^'.preg_quote($uri_prefix, '/').'/', '', $pathArray['REQUEST_URI']);
@@ -346,7 +346,7 @@ public function getReferer()
{
$pathArray = $this->getPathInfoArray();
- return isset($pathArray['HTTP_REFERER']) ? $pathArray['HTTP_REFERER'] : '';
+ return $pathArray['HTTP_REFERER'] ?? '';
}
/**
@@ -364,7 +364,7 @@ public function getHost()
return trim($elements[count($elements) - 1]);
}
- return isset($pathArray['HTTP_HOST']) ? $pathArray['HTTP_HOST'] : '';
+ return $pathArray['HTTP_HOST'] ?? '';
}
/**
@@ -376,7 +376,7 @@ public function getScriptName()
{
$pathArray = $this->getPathInfoArray();
- return isset($pathArray['SCRIPT_NAME']) ? $pathArray['SCRIPT_NAME'] : (isset($pathArray['ORIG_SCRIPT_NAME']) ? $pathArray['ORIG_SCRIPT_NAME'] : '');
+ return $pathArray['SCRIPT_NAME'] ?? $pathArray['ORIG_SCRIPT_NAME'] ?? '';
}
/**
@@ -403,7 +403,7 @@ public function getPreferredCulture(?array $cultures = null)
$preferredCultures = $this->getLanguages();
if (null === $cultures) {
- return isset($preferredCultures[0]) ? $preferredCultures[0] : null;
+ return $preferredCultures[0] ?? null;
}
if (!$preferredCultures) {
@@ -412,7 +412,7 @@ public function getPreferredCulture(?array $cultures = null)
$preferredCultures = array_values(array_intersect($preferredCultures, $cultures));
- return isset($preferredCultures[0]) ? $preferredCultures[0] : $cultures[0];
+ return $preferredCultures[0] ?? $cultures[0];
}
/**
@@ -663,7 +663,7 @@ public function getPathInfoArray()
*/
public function getMimeType($format)
{
- return isset($this->formats[$format]) ? $this->formats[$format][0] : null;
+ return $this->formats[$format][0] ?? null;
}
/**
@@ -738,7 +738,7 @@ public function getFiles($key = null)
$this->fixedFileArray = self::convertFileInformation($_FILES);
}
- return null === $key ? $this->fixedFileArray : (isset($this->fixedFileArray[$key]) ? $this->fixedFileArray[$key] : []);
+ return null === $key ? $this->fixedFileArray : ($this->fixedFileArray[$key] ?? []);
}
/**
@@ -862,7 +862,7 @@ public function getClientIp($proxy = true)
}
if ($this->getOption('trust_proxy') && ($ip = $this->getForwardedFor())) {
- return isset($ip[0]) ? trim($ip[0]) : '';
+ return trim($ip[0] ?? '');
}
}
diff --git a/lib/response/sfWebResponse.class.php b/lib/response/sfWebResponse.class.php
index 69eb05d11..bfee88fe6 100644
--- a/lib/response/sfWebResponse.class.php
+++ b/lib/response/sfWebResponse.class.php
@@ -135,7 +135,7 @@ public function initialize(sfEventDispatcher $dispatcher, $options = [])
$this->options['http_protocol'] = 'HTTP/1.0';
}
- $this->options['content_type'] = $this->fixContentType(isset($this->options['content_type']) ? $this->options['content_type'] : 'text/html');
+ $this->options['content_type'] = $this->fixContentType($this->options['content_type'] ?? 'text/html');
}
/**
@@ -204,7 +204,7 @@ public function setCookie($name, $value, $expire = null, $path = '/', $domain =
public function setStatusCode($code, $name = null)
{
$this->statusCode = $code;
- $this->statusText = null !== $name ? $name : self::$statusTexts[$code];
+ $this->statusText = $name ?? self::$statusTexts[$code];
}
/**
@@ -253,7 +253,7 @@ public function setHttpHeader($name, $value, $replace = true)
}
if (!$replace) {
- $current = isset($this->headers[$name]) ? $this->headers[$name] : '';
+ $current = $this->headers[$name] ?? '';
$value = ($current ? $current.', ' : '').$value;
}
@@ -272,7 +272,7 @@ public function getHttpHeader($name, $default = null)
{
$name = $this->normalizeHeaderName($name);
- return isset($this->headers[$name]) ? $this->headers[$name] : $default;
+ return $this->headers[$name] ?? $default;
}
/**
@@ -356,8 +356,8 @@ public function sendHttpHeaders()
// cookies
foreach ($this->cookies as $cookie) {
- $expire = isset($cookie['expire']) ? $cookie['expire'] : 0;
- $domain = isset($cookie['domain']) ? $cookie['domain'] : '';
+ $expire = $cookie['expire'] ?? 0;
+ $domain = $cookie['domain'] ?? '';
setrawcookie($cookie['name'], $cookie['value'], $expire, $cookie['path'], $domain, $cookie['secure'], $cookie['httpOnly']);
if ($this->options['logging']) {
@@ -450,7 +450,7 @@ public function addCacheControlHttpHeader($name, $value = null)
if ($cacheControl) {
foreach (preg_split('/\s*,\s*/', $cacheControl) as $tmp) {
$tmp = explode('=', $tmp);
- $currentHeaders[$tmp[0]] = isset($tmp[1]) ? $tmp[1] : null;
+ $currentHeaders[$tmp[0]] = $tmp[1] ?? null;
}
}
$currentHeaders[str_replace('_', '-', strtolower($name))] = $value;
@@ -496,7 +496,7 @@ public function addHttpMeta($key, $value, $replace = true)
if ('Content-Type' == $key) {
$value = $this->getContentType();
} elseif (!$replace) {
- $current = isset($this->httpMetas[$key]) ? $this->httpMetas[$key] : '';
+ $current = $this->httpMetas[$key] ?? '';
$value = ($current ? $current.', ' : '').$value;
}
@@ -537,7 +537,7 @@ public function addMeta($key, $value, $replace = true, $escape = true)
$value = htmlspecialchars($value, ENT_QUOTES, $this->options['charset']);
}
- $current = isset($this->metas[$key]) ? $this->metas[$key] : null;
+ $current = $this->metas[$key] ?? null;
if ($replace || !$current) {
$this->metas[$key] = $value;
}
@@ -550,7 +550,7 @@ public function addMeta($key, $value, $replace = true, $escape = true)
*/
public function getTitle()
{
- return isset($this->metas['title']) ? $this->metas['title'] : '';
+ return $this->metas['title'] ?? '';
}
/**
@@ -798,7 +798,7 @@ public function copyProperties(sfWebResponse $response)
// HTTP protocol must be from the current request
// this fix is not nice but that's the only way to fix it and keep BC (see #9254)
- $this->options['http_protocol'] = isset($_SERVER['SERVER_PROTOCOL']) ? $_SERVER['SERVER_PROTOCOL'] : 'HTTP/1.0';
+ $this->options['http_protocol'] = $_SERVER['SERVER_PROTOCOL'] ?? 'HTTP/1.0';
}
/**
diff --git a/lib/routing/sfObjectRoute.class.php b/lib/routing/sfObjectRoute.class.php
index d9a7db983..7f7a01518 100644
--- a/lib/routing/sfObjectRoute.class.php
+++ b/lib/routing/sfObjectRoute.class.php
@@ -199,7 +199,7 @@ protected function convertObjectToArray($object)
protected function doConvertObjectToArray($object)
{
- $method = isset($this->options['convert']) ? $this->options['convert'] : 'toParams';
+ $method = $this->options['convert'] ?? 'toParams';
return $object->{$method}();
}
diff --git a/lib/routing/sfObjectRouteCollection.class.php b/lib/routing/sfObjectRouteCollection.class.php
index 9fb03d009..bb79c6062 100644
--- a/lib/routing/sfObjectRouteCollection.class.php
+++ b/lib/routing/sfObjectRouteCollection.class.php
@@ -34,7 +34,7 @@ public function __construct(array $options)
'actions' => false,
'module' => $this->options['name'],
'prefix_path' => '/'.$this->options['name'],
- 'column' => isset($this->options['column']) ? $this->options['column'] : 'id',
+ 'column' => $this->options['column'] ?? 'id',
'with_show' => true,
'segment_names' => ['edit' => 'edit', 'new' => 'new'],
'model_methods' => [],
diff --git a/lib/routing/sfRouting.class.php b/lib/routing/sfRouting.class.php
index 8b09bedb6..7b0c245e4 100644
--- a/lib/routing/sfRouting.class.php
+++ b/lib/routing/sfRouting.class.php
@@ -68,13 +68,13 @@ public function initialize(sfEventDispatcher $dispatcher, ?sfCache $cache = null
{
$this->dispatcher = $dispatcher;
- $options['debug'] = isset($options['debug']) ? (bool) $options['debug'] : false;
+ $options['debug'] = (bool) $options['debug'] ?? false;
// disable caching when in debug mode
$this->cache = $options['debug'] ? null : $cache;
- $this->setDefaultParameter('module', isset($options['default_module']) ? $options['default_module'] : 'default');
- $this->setDefaultParameter('action', isset($options['default_action']) ? $options['default_action'] : 'index');
+ $this->setDefaultParameter('module', $options['default_module'] ?? 'default');
+ $this->setDefaultParameter('action', $options['default_action'] ?? 'index');
if (!isset($options['logging'])) {
$options['logging'] = false;
@@ -200,7 +200,7 @@ public function getDefaultParameters()
*/
public function getDefaultParameter($key)
{
- return isset($this->defaultParameters[$key]) ? $this->defaultParameters[$key] : null;
+ return $this->defaultParameters[$key] ?? null;
}
/**
diff --git a/lib/storage/sfCacheSessionStorage.class.php b/lib/storage/sfCacheSessionStorage.class.php
index 36584ea6c..58e2b71b8 100644
--- a/lib/storage/sfCacheSessionStorage.class.php
+++ b/lib/storage/sfCacheSessionStorage.class.php
@@ -99,8 +99,8 @@ public function initialize($options = [])
}
if (empty($this->id)) {
- $ip = isset($_SERVER['REMOTE_ADDR']) ? $_SERVER['REMOTE_ADDR'] : 'localhost';
- $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'ua';
+ $ip = $_SERVER['REMOTE_ADDR'] ?? 'localhost';
+ $ua = $_SERVER['HTTP_USER_AGENT'] ?? 'ua';
// generate new id based on random # / ip / user agent / secret
$this->id = md5(mt_rand(0, 999999).$ip.$ua.$this->options['session_cookie_secret']);
@@ -176,13 +176,7 @@ public function write($key, $data)
*/
public function read($key)
{
- $retval = null;
-
- if (isset($this->data[$key])) {
- $retval = &$this->data[$key];
- }
-
- return $retval;
+ return $this->data[$key] ?? null;
}
/**
@@ -225,7 +219,7 @@ public function regenerate($destroy = false)
}
// generate session id
- $ua = isset($_SERVER['HTTP_USER_AGENT']) ? $_SERVER['HTTP_USER_AGENT'] : 'ua';
+ $ua = $_SERVER['HTTP_USER_AGENT'] ?? 'ua';
$this->id = md5(mt_rand(0, 999999).$_SERVER['REMOTE_ADDR'].$ua.$this->options['session_cookie_secret']);
diff --git a/lib/storage/sfSessionStorage.class.php b/lib/storage/sfSessionStorage.class.php
index d5dbe91e0..69f8e54de 100644
--- a/lib/storage/sfSessionStorage.class.php
+++ b/lib/storage/sfSessionStorage.class.php
@@ -55,7 +55,7 @@ public function initialize($options = null)
'session_cookie_path' => $cookieDefaults['path'],
'session_cookie_domain' => $cookieDefaults['domain'],
'session_cookie_secure' => $cookieDefaults['secure'],
- 'session_cookie_httponly' => isset($cookieDefaults['httponly']) ? $cookieDefaults['httponly'] : false,
+ 'session_cookie_httponly' => $cookieDefaults['httponly'] ?? false,
'session_cache_limiter' => null,
'gc_maxlifetime' => 1800,
], $options);
@@ -105,13 +105,7 @@ public function initialize($options = null)
*/
public function read($key)
{
- $retval = null;
-
- if (isset($_SESSION[$key])) {
- $retval = $_SESSION[$key];
- }
-
- return $retval;
+ return $_SESSION[$key] ?? null;
}
/**
diff --git a/lib/storage/sfSessionTestStorage.class.php b/lib/storage/sfSessionTestStorage.class.php
index 64494ee1f..8f4822878 100644
--- a/lib/storage/sfSessionTestStorage.class.php
+++ b/lib/storage/sfSessionTestStorage.class.php
@@ -41,7 +41,7 @@ public function initialize($options = null)
// initialize parent
parent::initialize($options);
- $this->sessionId = null !== $this->options['session_id'] ? $this->options['session_id'] : (array_key_exists('session_id', $_SERVER) ? $_SERVER['session_id'] : null);
+ $this->sessionId = $this->options['session_id'] ?? (array_key_exists('session_id', $_SERVER) ? $_SERVER['session_id'] : null);
if ($this->sessionId) {
// we read session data from temp file
@@ -74,13 +74,7 @@ public function getSessionId()
*/
public function read($key)
{
- $retval = null;
-
- if (isset($this->sessionData[$key])) {
- $retval = $this->sessionData[$key];
- }
-
- return $retval;
+ return $this->sessionData[$key] ?? null;
}
/**
diff --git a/lib/task/generator/sfGenerateModuleTask.class.php b/lib/task/generator/sfGenerateModuleTask.class.php
index ef06577e6..785f5e0df 100644
--- a/lib/task/generator/sfGenerateModuleTask.class.php
+++ b/lib/task/generator/sfGenerateModuleTask.class.php
@@ -79,10 +79,10 @@ protected function execute($arguments = [], $options = [])
$properties = parse_ini_file(sfConfig::get('sf_config_dir').'/properties.ini', true);
$constants = [
- 'PROJECT_NAME' => isset($properties['symfony']['name']) ? $properties['symfony']['name'] : 'symfony',
+ 'PROJECT_NAME' => $properties['symfony']['name'] ?? 'symfony',
'APP_NAME' => $app,
'MODULE_NAME' => $module,
- 'AUTHOR_NAME' => isset($properties['symfony']['author']) ? $properties['symfony']['author'] : 'Your name here',
+ 'AUTHOR_NAME' => $properties['symfony']['author'] ?? 'Your name here',
];
if (is_readable(sfConfig::get('sf_data_dir').'/skeleton/module')) {
diff --git a/lib/task/generator/sfGenerateTaskTask.class.php b/lib/task/generator/sfGenerateTaskTask.class.php
index 36607013b..4b61e634e 100644
--- a/lib/task/generator/sfGenerateTaskTask.class.php
+++ b/lib/task/generator/sfGenerateTaskTask.class.php
@@ -73,7 +73,7 @@ protected function execute($arguments = [], $options = [])
$taskName = $arguments['task_name'];
$taskNameComponents = explode(':', $taskName);
$namespace = isset($taskNameComponents[1]) ? $taskNameComponents[0] : '';
- $name = isset($taskNameComponents[1]) ? $taskNameComponents[1] : $taskNameComponents[0];
+ $name = $taskNameComponents[1] ?? $taskNameComponents[0];
$taskClassName = str_replace('-', '', $namespace ? $namespace.ucfirst($name) : $name).'Task';
// Validate the class name
diff --git a/lib/task/log/sfLogRotateTask.class.php b/lib/task/log/sfLogRotateTask.class.php
index ab6f46fb1..002d9ec09 100644
--- a/lib/task/log/sfLogRotateTask.class.php
+++ b/lib/task/log/sfLogRotateTask.class.php
@@ -38,8 +38,8 @@ public function rotate($app, $env, $period = null, $history = null, $override =
$logdir = sfConfig::get('sf_log_dir');
// set history and period values if not passed to default values
- $period = isset($period) ? $period : self::DEF_PERIOD;
- $history = isset($history) ? $history : self::DEF_HISTORY;
+ $period ??= self::DEF_PERIOD;
+ $history ??= self::DEF_HISTORY;
// get todays date
$today = date('Ymd');
diff --git a/lib/task/sfBaseTask.class.php b/lib/task/sfBaseTask.class.php
index f15f7c2b7..3290a0be7 100644
--- a/lib/task/sfBaseTask.class.php
+++ b/lib/task/sfBaseTask.class.php
@@ -321,7 +321,7 @@ protected function replaceTokens($dirs = [], $tokens = [])
$dirs = [sfConfig::get('sf_config_dir'), sfConfig::get('sf_lib_dir')];
}
- $tokens = array_merge(isset($this->tokens) ? $this->tokens : [], $tokens);
+ $tokens = array_merge($this->tokens ?? [], $tokens);
$this->getFilesystem()->replaceTokens(sfFinder::type('file')->prune('vendor')->in($dirs), '##', '##', $tokens);
}
diff --git a/lib/task/sfTask.class.php b/lib/task/sfTask.class.php
index 616433bf2..43ce66cb2 100644
--- a/lib/task/sfTask.class.php
+++ b/lib/task/sfTask.class.php
@@ -412,7 +412,7 @@ public function ask($question, $style = 'QUESTION', $default = null)
if (false === $style) {
$this->log($question);
} else {
- $this->logBlock($question, null === $style ? 'QUESTION' : $style);
+ $this->logBlock($question, $style ?? 'QUESTION');
}
$ret = trim(fgets(STDIN));
diff --git a/lib/test/sfTestBrowser.class.php b/lib/test/sfTestBrowser.class.php
index b4b18bf1e..ee6727294 100644
--- a/lib/test/sfTestBrowser.class.php
+++ b/lib/test/sfTestBrowser.class.php
@@ -36,7 +36,7 @@ public function __construct($hostname = null, $remote = null, $options = [])
$browser = new sfBrowser($hostname, $remote, $options);
if (null === self::$test) {
- $lime = new lime_test(null, isset($options['output']) ? $options['output'] : null);
+ $lime = new lime_test(null, $options['output'] ?? null);
} else {
$lime = null;
}
diff --git a/lib/test/sfTestFunctionalBase.class.php b/lib/test/sfTestFunctionalBase.class.php
index d9feef311..7c80ee809 100644
--- a/lib/test/sfTestFunctionalBase.class.php
+++ b/lib/test/sfTestFunctionalBase.class.php
@@ -35,7 +35,7 @@ public function __construct(sfBrowserBase $browser, ?lime_test $lime = null, $te
$this->browser = $browser;
if (null === self::$test) {
- self::$test = null !== $lime ? $lime : new lime_test();
+ self::$test = $lime ?? new lime_test();
}
$this->setTesters(array_merge([
@@ -189,7 +189,7 @@ public function get($uri, $parameters = [], $changeStack = true)
public function getAndCheck($module, $action, $url = null, $code = 200)
{
return $this->
- get(null !== $url ? $url : sprintf('/%s/%s', $module, $action))->
+ get($url ?? sprintf('/%s/%s', $module, $action))->
with('request')->begin()->
isParameter('module', $module)->
isParameter('action', $action)->
@@ -465,13 +465,13 @@ public function handleException($exception)
$traces = [];
$lineFormat = ' at %s%s%s() in %s line %s';
for ($i = 0, $count = count($traceData); $i < $count; ++$i) {
- $line = isset($traceData[$i]['line']) ? $traceData[$i]['line'] : 'n/a';
- $file = isset($traceData[$i]['file']) ? $traceData[$i]['file'] : 'n/a';
- $args = isset($traceData[$i]['args']) ? $traceData[$i]['args'] : [];
+ $line = $traceData[$i]['line'] ?? 'n/a';
+ $file = $traceData[$i]['file'] ?? 'n/a';
+ $args = $traceData[$i]['args'] ?? [];
$this->test()->error(sprintf(
$lineFormat,
- isset($traceData[$i]['class']) ? $traceData[$i]['class'] : '',
- isset($traceData[$i]['type']) ? $traceData[$i]['type'] : '',
+ $traceData[$i]['class'] ?? '',
+ $traceData[$i]['type'] ?? '',
$traceData[$i]['function'],
$file,
$line
diff --git a/lib/test/sfTesterResponse.class.php b/lib/test/sfTesterResponse.class.php
index 34f7ffcf1..fe70766a6 100644
--- a/lib/test/sfTesterResponse.class.php
+++ b/lib/test/sfTesterResponse.class.php
@@ -77,14 +77,14 @@ public function checkElement($selector, $value = true, $options = [])
} elseif (is_int($value)) {
$this->tester->is(count($values), $value, sprintf('response selector "%s" matches "%s" times', $selector, $value));
} elseif (preg_match('/^(!)?([^a-zA-Z0-9\\\\]).+?\\2[ims]?$/', $value, $match)) {
- $position = isset($options['position']) ? $options['position'] : 0;
+ $position = $options['position'] ?? 0;
if ('!' == $match[1]) {
$this->tester->unlike(@$values[$position], substr($value, 1), sprintf('response selector "%s" does not match regex "%s"', $selector, substr($value, 1)));
} else {
$this->tester->like(@$values[$position], $value, sprintf('response selector "%s" matches regex "%s"', $selector, $value));
}
} else {
- $position = isset($options['position']) ? $options['position'] : 0;
+ $position = $options['position'] ?? 0;
$this->tester->is(@$values[$position], $value, sprintf('response selector "%s" matches "%s"', $selector, $value));
}
diff --git a/lib/user/sfUser.class.php b/lib/user/sfUser.class.php
index cbfa368a3..e50e3ada0 100644
--- a/lib/user/sfUser.class.php
+++ b/lib/user/sfUser.class.php
@@ -118,7 +118,7 @@ public function initialize(sfEventDispatcher $dispatcher, sfStorage $storage, $o
// - use the culture defined in the user session
// - use the default culture set in settings.yml
$currentCulture = $storage->read(self::CULTURE_NAMESPACE);
- $this->setCulture(null !== $this->options['culture'] ? $this->options['culture'] : (null !== $currentCulture ? $currentCulture : $this->options['default_culture']));
+ $this->setCulture($this->options['culture'] ?? $currentCulture ?? $this->options['default_culture']);
// flag current flash to be removed at shutdown
if ($this->options['use_flash'] && $names = $this->attributeHolder->getNames('symfony/user/sfUser/flash')) {
diff --git a/lib/util/sfBrowserBase.class.php b/lib/util/sfBrowserBase.class.php
index 8af8fdc8e..322004584 100755
--- a/lib/util/sfBrowserBase.class.php
+++ b/lib/util/sfBrowserBase.class.php
@@ -55,8 +55,8 @@ public function initialize($hostname = null, $remote = null, $options = [])
unset($_SERVER['argv'], $_SERVER['argc']);
// setup our fake environment
- $this->hostname = null === $hostname ? 'localhost' : $hostname;
- $this->remote = null === $remote ? '127.0.0.1' : $remote;
+ $this->hostname = $hostname ?? 'localhost';
+ $this->remote = $remote ?? '127.0.0.1';
// we set a session id (fake cookie / persistence)
$this->newSession();
@@ -700,7 +700,7 @@ public function doClickCssSelector($selector, $arguments = [], $options = [])
*/
public function doClickElement(DOMElement $item, $arguments = [], $options = [])
{
- $method = strtolower(isset($options['method']) ? $options['method'] : 'get');
+ $method = strtolower($options['method'] ?? 'get');
if ('a' == $item->nodeName) {
if (in_array($method, ['post', 'put', 'delete'])) {
@@ -732,7 +732,7 @@ public function doClickElement(DOMElement $item, $arguments = [], $options = [])
if (!$url || '#' == $url) {
$url = $this->stack[$this->stackPosition]['uri'];
}
- $method = strtolower(isset($options['method']) ? $options['method'] : ($item->getAttribute('method') ?: 'get'));
+ $method = strtolower($options['method'] ?? ($item->getAttribute('method') ?: 'get'));
// merge form default values and arguments
$defaults = [];
diff --git a/lib/util/sfContext.class.php b/lib/util/sfContext.class.php
index 1e6c42830..46f630873 100644
--- a/lib/util/sfContext.class.php
+++ b/lib/util/sfContext.class.php
@@ -265,7 +265,7 @@ public function getActionStack()
*/
public function getController()
{
- return isset($this->factories['controller']) ? $this->factories['controller'] : null;
+ return $this->factories['controller'] ?? null;
}
/**
@@ -336,7 +336,7 @@ public function getDatabaseConnection($name = 'default')
*/
public function getDatabaseManager()
{
- return isset($this->factories['databaseManager']) ? $this->factories['databaseManager'] : null;
+ return $this->factories['databaseManager'] ?? null;
}
/**
@@ -378,7 +378,7 @@ public function getModuleName()
*/
public function getRequest()
{
- return isset($this->factories['request']) ? $this->factories['request'] : null;
+ return $this->factories['request'] ?? null;
}
/**
@@ -388,7 +388,7 @@ public function getRequest()
*/
public function getResponse()
{
- return isset($this->factories['response']) ? $this->factories['response'] : null;
+ return $this->factories['response'] ?? null;
}
/**
@@ -408,7 +408,7 @@ public function setResponse($response)
*/
public function getStorage()
{
- return isset($this->factories['storage']) ? $this->factories['storage'] : null;
+ return $this->factories['storage'] ?? null;
}
/**
@@ -418,7 +418,7 @@ public function getStorage()
*/
public function getViewCacheManager()
{
- return isset($this->factories['viewCacheManager']) ? $this->factories['viewCacheManager'] : null;
+ return $this->factories['viewCacheManager'] ?? null;
}
/**
@@ -444,7 +444,7 @@ public function getI18N()
*/
public function getRouting()
{
- return isset($this->factories['routing']) ? $this->factories['routing'] : null;
+ return $this->factories['routing'] ?? null;
}
/**
@@ -454,7 +454,7 @@ public function getRouting()
*/
public function getUser()
{
- return isset($this->factories['user']) ? $this->factories['user'] : null;
+ return $this->factories['user'] ?? null;
}
/**
diff --git a/lib/util/sfDomCssSelector.class.php b/lib/util/sfDomCssSelector.class.php
index a655a00c4..305a5279b 100644
--- a/lib/util/sfDomCssSelector.class.php
+++ b/lib/util/sfDomCssSelector.class.php
@@ -235,7 +235,7 @@ protected function getElementsForNode($selector, $root_node)
foreach ($matches as $match) {
$attrName = $match[1];
$attrOperator = $match[2];
- $attrValue = '' === $match[4] ? (isset($match[5]) ? $match[5] : '') : $match[4];
+ $attrValue = '' === $match[4] ? ($match[5] ?? '') : $match[4];
switch ($attrOperator) {
case '=': // Equality
diff --git a/lib/util/sfToolkit.class.php b/lib/util/sfToolkit.class.php
index 90ea1767f..520674b57 100644
--- a/lib/util/sfToolkit.class.php
+++ b/lib/util/sfToolkit.class.php
@@ -400,7 +400,7 @@ public static function isUTF8($string)
public static function getArrayValueForPath($values, $name, $default = null)
{
if (false === $offset = strpos($name, '[')) {
- return isset($values[$name]) ? $values[$name] : $default;
+ return $values[$name] ?? $default;
}
if (!isset($values[substr($name, 0, $offset)])) {
diff --git a/lib/validator/sfValidatedFile.class.php b/lib/validator/sfValidatedFile.class.php
index bb65bc4e4..ef3546851 100644
--- a/lib/validator/sfValidatedFile.class.php
+++ b/lib/validator/sfValidatedFile.class.php
@@ -45,7 +45,7 @@ public function __construct($originalName, $type, $tempName, $size, $path = null
*/
public function __toString()
{
- return null === $this->savedName ? '' : $this->savedName;
+ return $this->savedName ?? '';
}
/**
diff --git a/lib/validator/sfValidatorBase.class.php b/lib/validator/sfValidatorBase.class.php
index b7137d473..c57356424 100644
--- a/lib/validator/sfValidatorBase.class.php
+++ b/lib/validator/sfValidatorBase.class.php
@@ -84,7 +84,7 @@ public function __construct($options = [], $messages = [])
*/
public function getMessage($name)
{
- return isset($this->messages[$name]) ? $this->messages[$name] : '';
+ return $this->messages[$name] ?? '';
}
/**
@@ -97,7 +97,7 @@ public function getMessage($name)
*/
public function addMessage($name, $value)
{
- $this->messages[$name] = isset(self::$globalDefaultMessages[$name]) ? self::$globalDefaultMessages[$name] : $value;
+ $this->messages[$name] = self::$globalDefaultMessages[$name] ?? $value;
return $this;
}
@@ -154,7 +154,7 @@ public function setMessages($values)
*/
public function getOption($name)
{
- return isset($this->options[$name]) ? $this->options[$name] : null;
+ return $this->options[$name] ?? null;
}
/**
diff --git a/lib/validator/sfValidatorDate.class.php b/lib/validator/sfValidatorDate.class.php
index e14fb13e5..19502c8c4 100644
--- a/lib/validator/sfValidatorDate.class.php
+++ b/lib/validator/sfValidatorDate.class.php
@@ -189,9 +189,9 @@ protected function convertDateArrayToString($value)
(int) $value['year'],
(int) $value['month'],
(int) $value['day'],
- isset($value['hour']) ? (int) $value['hour'] : 0,
- isset($value['minute']) ? (int) $value['minute'] : 0,
- isset($value['second']) ? (int) $value['second'] : 0
+ (int) $value['hour'] ?? 0,
+ (int) $value['minute'] ?? 0,
+ (int) $value['second'] ?? 0,
);
} else {
$clean = sprintf(
diff --git a/lib/validator/sfValidatorDateRange.class.php b/lib/validator/sfValidatorDateRange.class.php
index acec12ae0..8f19c69e4 100644
--- a/lib/validator/sfValidatorDateRange.class.php
+++ b/lib/validator/sfValidatorDateRange.class.php
@@ -48,8 +48,8 @@ protected function doClean($value)
$fromField = $this->getOption('from_field');
$toField = $this->getOption('to_field');
- $value[$fromField] = $this->getOption('from_date')->clean(isset($value[$fromField]) ? $value[$fromField] : null);
- $value[$toField] = $this->getOption('to_date')->clean(isset($value[$toField]) ? $value[$toField] : null);
+ $value[$fromField] = $this->getOption('from_date')->clean($value[$fromField] ?? null);
+ $value[$toField] = $this->getOption('to_date')->clean($value[$toField] ?? null);
if ($value[$fromField] && $value[$toField]) {
$v = new sfValidatorSchemaCompare($fromField, sfValidatorSchemaCompare::LESS_THAN_EQUAL, $toField, ['throw_global_error' => true], ['invalid' => $this->getMessage('invalid')]);
diff --git a/lib/validator/sfValidatorError.class.php b/lib/validator/sfValidatorError.class.php
index 0c1de01d4..f87f376b5 100644
--- a/lib/validator/sfValidatorError.class.php
+++ b/lib/validator/sfValidatorError.class.php
@@ -74,7 +74,7 @@ public function __unserialize($data)
*/
public function getValue()
{
- return isset($this->arguments['value']) ? $this->arguments['value'] : null;
+ return $this->arguments['value'] ?? null;
}
/**
diff --git a/lib/validator/sfValidatorErrorSchema.class.php b/lib/validator/sfValidatorErrorSchema.class.php
index 62c84586a..86e004e60 100644
--- a/lib/validator/sfValidatorErrorSchema.class.php
+++ b/lib/validator/sfValidatorErrorSchema.class.php
@@ -242,7 +242,7 @@ public function offsetExists($name)
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
- return isset($this->errors[$name]) ? $this->errors[$name] : null;
+ return $this->errors[$name] ?? null;
}
/**
diff --git a/lib/validator/sfValidatorFromDescription.class.php b/lib/validator/sfValidatorFromDescription.class.php
index 3d5c71ae7..308f9932b 100644
--- a/lib/validator/sfValidatorFromDescription.class.php
+++ b/lib/validator/sfValidatorFromDescription.class.php
@@ -86,7 +86,7 @@ protected function tokenize($string)
$i += strlen($match[0]);
$rightField = $match[1];
- $tokens[] = new sfValidatorFDToken('sfValidatorSchemaCompare', [$leftField, $operator, $rightField, $arguments[0], isset($arguments[1]) ? $arguments[1] : []]);
+ $tokens[] = new sfValidatorFDToken('sfValidatorSchemaCompare', [$leftField, $operator, $rightField, $arguments[0], $arguments[1] ?? []]);
} elseif (preg_match('/^(and|or)/i', substr($string, $i), $match)) {
// all, any validador
$i += strlen($match[0]);
@@ -101,7 +101,7 @@ protected function tokenize($string)
$class = 'sfValidator'.$match[2];
$arguments = $this->parseArguments($string, $i);
- $token = new sfValidatorFDToken($class, [$arguments[0], isset($arguments[1]) ? $arguments[1] : []]);
+ $token = new sfValidatorFDToken($class, [$arguments[0], $arguments[1] ?? []]);
if ($match[1]) {
$token = new sfValidatorFDTokenFilter($match[1], $token);
}
diff --git a/lib/validator/sfValidatorSchema.class.php b/lib/validator/sfValidatorSchema.class.php
index d0235ae3a..df56c0f77 100644
--- a/lib/validator/sfValidatorSchema.class.php
+++ b/lib/validator/sfValidatorSchema.class.php
@@ -186,7 +186,7 @@ public function offsetExists($name)
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
- return isset($this->fields[$name]) ? $this->fields[$name] : null;
+ return $this->fields[$name] ?? null;
}
/**
diff --git a/lib/validator/sfValidatorSchemaCompare.class.php b/lib/validator/sfValidatorSchemaCompare.class.php
index cd264174e..64aa3d114 100644
--- a/lib/validator/sfValidatorSchemaCompare.class.php
+++ b/lib/validator/sfValidatorSchemaCompare.class.php
@@ -102,8 +102,8 @@ protected function doClean($values)
throw new InvalidArgumentException('You must pass an array parameter to the clean() method');
}
- $leftValue = isset($values[$this->getOption('left_field')]) ? $values[$this->getOption('left_field')] : null;
- $rightValue = isset($values[$this->getOption('right_field')]) ? $values[$this->getOption('right_field')] : null;
+ $leftValue = $values[$this->getOption('left_field')] ?? null;
+ $rightValue = $values[$this->getOption('right_field')] ?? null;
switch ($this->getOption('operator')) {
case self::GREATER_THAN:
diff --git a/lib/validator/sfValidatorSchemaFilter.class.php b/lib/validator/sfValidatorSchemaFilter.class.php
index 76f253449..25e1cea7c 100644
--- a/lib/validator/sfValidatorSchemaFilter.class.php
+++ b/lib/validator/sfValidatorSchemaFilter.class.php
@@ -54,7 +54,7 @@ protected function doClean($values)
throw new InvalidArgumentException(sprintf('You must pass an array parameter to the clean() method for filter field "%s"', $this->getOption('field')));
}
- $value = isset($values[$this->getOption('field')]) ? $values[$this->getOption('field')] : null;
+ $value = $values[$this->getOption('field')] ?? null;
try {
$values[$this->getOption('field')] = $this->getOption('validator')->clean($value);
diff --git a/lib/validator/sfValidatorTime.class.php b/lib/validator/sfValidatorTime.class.php
index bfc949d69..f2e2507d8 100644
--- a/lib/validator/sfValidatorTime.class.php
+++ b/lib/validator/sfValidatorTime.class.php
@@ -96,9 +96,9 @@ protected function convertTimeArrayToTimestamp($value)
}
$clean = mktime(
- isset($value['hour']) ? (int) $value['hour'] : 0,
- isset($value['minute']) ? (int) $value['minute'] : 0,
- isset($value['second']) ? (int) $value['second'] : 0
+ (int) $value['hour'] ?? 0,
+ (int) $value['minute'] ?? 0,
+ (int) $value['second'] ?? 0,
);
if (false === $clean) {
diff --git a/lib/vendor/lime/lime.php b/lib/vendor/lime/lime.php
index c09016fb2..a6e7a21bd 100644
--- a/lib/vendor/lime/lime.php
+++ b/lib/vendor/lime/lime.php
@@ -608,7 +608,7 @@ class lime_output
public function __construct($force_colors = false, $base_dir = null)
{
$this->colorizer = new lime_colorizer($force_colors);
- $this->base_dir = $base_dir === null ? getcwd() : $base_dir;
+ $this->base_dir = $base_dir ?? getcwd();
}
public function diag()
@@ -1121,7 +1121,7 @@ function lime_shutdown()
public function get_failed_files()
{
- return isset($this->stats['failed_files']) ? $this->stats['failed_files'] : array();
+ return $this->stats['failed_files'] ?? array();
}
}
@@ -1247,7 +1247,7 @@ public function output($files)
{
$file = realpath($file);
$is_covered = isset($this->coverage[$file]);
- $cov = isset($this->coverage[$file]) ? $this->coverage[$file] : array();
+ $cov = $this->coverage[$file] ?? array();
$covered_lines = array();
$missing_lines = array();
diff --git a/lib/view/sfViewCacheManager.class.php b/lib/view/sfViewCacheManager.class.php
index 2ccaa0139..f6af8eb55 100644
--- a/lib/view/sfViewCacheManager.class.php
+++ b/lib/view/sfViewCacheManager.class.php
@@ -145,7 +145,7 @@ public function generateCacheKey($internalUri, $hostName = '', $vary = '', $cont
$cacheKey = $contextualPrefix;
}
list($route_name, $params) = $this->controller->convertUrlStringToParameters($internalUri);
- $cacheKey .= sprintf('/%s/%s/%s', $params['module'], $params['action'], isset($params['sf_cache_key']) ? $params['sf_cache_key'] : '');
+ $cacheKey .= sprintf('/%s/%s/%s', $params['module'], $params['action'], $params['sf_cache_key'] ?? '');
} else {
// Regular action or non-contextual partial
list($route_name, $params) = $this->controller->convertUrlStringToParameters($internalUri);
@@ -201,16 +201,16 @@ public function addCache($moduleName, $actionName, $options = [])
}
}
- $options['lifeTime'] = isset($options['lifeTime']) ? $options['lifeTime'] : 0;
+ $options['lifeTime'] ??= 0;
if (!isset($this->cacheConfig[$moduleName])) {
$this->cacheConfig[$moduleName] = [];
}
$this->cacheConfig[$moduleName][$actionName] = [
- 'withLayout' => isset($options['withLayout']) ? $options['withLayout'] : false,
+ 'withLayout' => $options['withLayout'] ?? false,
'lifeTime' => $options['lifeTime'],
- 'clientLifeTime' => isset($options['clientLifeTime']) ? $options['clientLifeTime'] : $options['lifeTime'],
- 'contextual' => isset($options['contextual']) ? $options['contextual'] : false,
- 'vary' => isset($options['vary']) ? $options['vary'] : [],
+ 'clientLifeTime' => $options['clientLifeTime'] ?? $options['lifeTime'],
+ 'contextual' => $options['contextual'] ?? false,
+ 'vary' => $options['vary'] ?? [],
];
}
diff --git a/lib/view/sfViewParameterHolder.class.php b/lib/view/sfViewParameterHolder.class.php
index 6461c82d6..646636d59 100644
--- a/lib/view/sfViewParameterHolder.class.php
+++ b/lib/view/sfViewParameterHolder.class.php
@@ -75,8 +75,8 @@ public function initialize(sfEventDispatcher $dispatcher, $parameters = [], $opt
$this->add($parameters);
- $this->setEscaping(isset($options['escaping_strategy']) ? $options['escaping_strategy'] : false);
- $this->setEscapingMethod(isset($options['escaping_method']) ? $options['escaping_method'] : 'ESC_SPECIALCHARS');
+ $this->setEscaping($options['escaping_strategy'] ?? false);
+ $this->setEscapingMethod($options['escaping_method'] ?? 'ESC_SPECIALCHARS');
return true;
}
diff --git a/lib/widget/i18n/sfWidgetFormI18nChoiceCountry.class.php b/lib/widget/i18n/sfWidgetFormI18nChoiceCountry.class.php
index ab5d8fe05..a8c6c7a26 100644
--- a/lib/widget/i18n/sfWidgetFormI18nChoiceCountry.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nChoiceCountry.class.php
@@ -39,11 +39,11 @@ protected function configure($options = [], $attributes = [])
$this->addOption('add_empty', false);
// populate choices with all countries
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
- $countries = sfCultureInfo::getInstance($culture)->getCountries(isset($options['countries']) ? $options['countries'] : null);
+ $countries = sfCultureInfo::getInstance($culture)->getCountries($options['countries'] ?? null);
- $addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false;
+ $addEmpty = $options['add_empty'] ?? false;
if (false !== $addEmpty) {
$countries = array_merge(['' => true === $addEmpty ? '' : $addEmpty], $countries);
}
diff --git a/lib/widget/i18n/sfWidgetFormI18nChoiceCurrency.class.php b/lib/widget/i18n/sfWidgetFormI18nChoiceCurrency.class.php
index 1ecd43a28..aaf79faea 100644
--- a/lib/widget/i18n/sfWidgetFormI18nChoiceCurrency.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nChoiceCurrency.class.php
@@ -39,11 +39,11 @@ protected function configure($options = [], $attributes = [])
$this->addOption('add_empty', false);
// populate choices with all currencies
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
- $currencies = sfCultureInfo::getInstance($culture)->getCurrencies(isset($options['currencies']) ? $options['currencies'] : null);
+ $currencies = sfCultureInfo::getInstance($culture)->getCurrencies($options['currencies'] ?? null);
- $addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false;
+ $addEmpty = $options['add_empty'] ?? false;
if (false !== $addEmpty) {
$currencies = array_merge(['' => true === $addEmpty ? '' : $addEmpty], $currencies);
}
diff --git a/lib/widget/i18n/sfWidgetFormI18nChoiceLanguage.class.php b/lib/widget/i18n/sfWidgetFormI18nChoiceLanguage.class.php
index de3d08452..7f9f39fa0 100644
--- a/lib/widget/i18n/sfWidgetFormI18nChoiceLanguage.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nChoiceLanguage.class.php
@@ -39,11 +39,11 @@ protected function configure($options = [], $attributes = [])
$this->addOption('add_empty', false);
// populate choices with all languages
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
- $languages = sfCultureInfo::getInstance($culture)->getLanguages(isset($options['languages']) ? $options['languages'] : null);
+ $languages = sfCultureInfo::getInstance($culture)->getLanguages($options['languages'] ?? null);
- $addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false;
+ $addEmpty = $options['add_empty'] ?? false;
if (false !== $addEmpty) {
$languages = array_merge(['' => true === $addEmpty ? '' : $addEmpty], $languages);
}
diff --git a/lib/widget/i18n/sfWidgetFormI18nChoiceTimezone.class.php b/lib/widget/i18n/sfWidgetFormI18nChoiceTimezone.class.php
index dfa8cb8b7..9169c7807 100644
--- a/lib/widget/i18n/sfWidgetFormI18nChoiceTimezone.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nChoiceTimezone.class.php
@@ -36,11 +36,11 @@ protected function configure($options = [], $attributes = [])
$this->addOption('culture');
$this->addOption('add_empty', false);
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
$timezones = array_keys(sfCultureInfo::getInstance($culture)->getTimeZones());
$timezones = array_combine($timezones, $timezones);
- $addEmpty = isset($options['add_empty']) ? $options['add_empty'] : false;
+ $addEmpty = $options['add_empty'] ?? false;
if (false !== $addEmpty) {
$timezones = array_merge(['' => true === $addEmpty ? '' : $addEmpty], $timezones);
}
diff --git a/lib/widget/i18n/sfWidgetFormI18nDate.class.php b/lib/widget/i18n/sfWidgetFormI18nDate.class.php
index 32d3088b3..2be5bf0c7 100644
--- a/lib/widget/i18n/sfWidgetFormI18nDate.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nDate.class.php
@@ -35,8 +35,8 @@ protected function configure($options = [], $attributes = [])
$this->addRequiredOption('culture');
$this->addOption('month_format');
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
- $monthFormat = isset($options['month_format']) ? $options['month_format'] : 'name';
+ $culture = $options['culture'] ?? 'en';
+ $monthFormat = $options['month_format'] ?? 'name';
// format
$this->setOption('format', $this->getDateFormat($culture));
diff --git a/lib/widget/i18n/sfWidgetFormI18nDateTime.class.php b/lib/widget/i18n/sfWidgetFormI18nDateTime.class.php
index 3ade31303..4a969af1d 100644
--- a/lib/widget/i18n/sfWidgetFormI18nDateTime.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nDateTime.class.php
@@ -33,7 +33,7 @@ protected function configure($options = [], $attributes = [])
$this->addRequiredOption('culture');
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
// format
$this->setOption('format', str_replace(['{0}', '{1}'], ['%time%', '%date%'], sfDateTimeFormatInfo::getInstance($culture)->getDateTimeOrderPattern()));
diff --git a/lib/widget/i18n/sfWidgetFormI18nTime.class.php b/lib/widget/i18n/sfWidgetFormI18nTime.class.php
index ba421907f..19901ae15 100644
--- a/lib/widget/i18n/sfWidgetFormI18nTime.class.php
+++ b/lib/widget/i18n/sfWidgetFormI18nTime.class.php
@@ -33,7 +33,7 @@ protected function configure($options = [], $attributes = [])
$this->addRequiredOption('culture');
- $culture = isset($options['culture']) ? $options['culture'] : 'en';
+ $culture = $options['culture'] ?? 'en';
// format
$this->setOption('format', $this->getTimeFormat($culture, true));
diff --git a/lib/widget/sfWidget.class.php b/lib/widget/sfWidget.class.php
index 5752c0051..0646d4f62 100644
--- a/lib/widget/sfWidget.class.php
+++ b/lib/widget/sfWidget.class.php
@@ -136,7 +136,7 @@ public function setOption($name, $value)
*/
public function getOption($name, $default = null)
{
- return isset($this->options[$name]) ? $this->options[$name] : $default;
+ return $this->options[$name] ?? $default;
}
/**
@@ -209,7 +209,7 @@ public function setAttribute($name, $value)
*/
public function getAttribute($name)
{
- return isset($this->attributes[$name]) ? $this->attributes[$name] : null;
+ return $this->attributes[$name] ?? null;
}
/**
diff --git a/lib/widget/sfWidgetForm.class.php b/lib/widget/sfWidgetForm.class.php
index 1833d9cca..87b12527e 100644
--- a/lib/widget/sfWidgetForm.class.php
+++ b/lib/widget/sfWidgetForm.class.php
@@ -265,7 +265,7 @@ public function getParent()
protected function fixFormId($attributes)
{
if (!isset($attributes['id']) && isset($attributes['name'])) {
- $attributes['id'] = $this->generateId($attributes['name'], isset($attributes['value']) ? $attributes['value'] : null);
+ $attributes['id'] = $this->generateId($attributes['name'], $attributes['value'] ?? null);
}
return $attributes;
diff --git a/lib/widget/sfWidgetFormDateTime.class.php b/lib/widget/sfWidgetFormDateTime.class.php
index 9cca91f9c..908c55b26 100644
--- a/lib/widget/sfWidgetFormDateTime.class.php
+++ b/lib/widget/sfWidgetFormDateTime.class.php
@@ -125,7 +125,7 @@ protected function getOptionsFor($type)
*/
protected function getAttributesFor($type, $attributes)
{
- $defaults = isset($this->attributes[$type]) ? $this->attributes[$type] : [];
+ $defaults = $this->attributes[$type] ?? [];
return isset($attributes[$type]) ? array_merge($defaults, $attributes[$type]) : $defaults;
}
diff --git a/lib/widget/sfWidgetFormSchema.class.php b/lib/widget/sfWidgetFormSchema.class.php
index f51e8cd92..60599403b 100644
--- a/lib/widget/sfWidgetFormSchema.class.php
+++ b/lib/widget/sfWidgetFormSchema.class.php
@@ -213,7 +213,7 @@ public function setFormFormatterName($name)
*/
public function getFormFormatterName()
{
- return null === $this->options['form_formatter'] ? self::$defaultFormatterName : $this->options['form_formatter'];
+ return $this->options['form_formatter'] ?? self::$defaultFormatterName;
}
/**
@@ -525,9 +525,9 @@ public function render($name, $values = [], $attributes = [], $errors = [])
// render each field
foreach ($this->positions as $name) {
$widget = $this[$name];
- $value = isset($values[$name]) ? $values[$name] : null;
- $error = isset($errors[$name]) ? $errors[$name] : [];
- $widgetAttributes = isset($attributes[$name]) ? $attributes[$name] : [];
+ $value = $values[$name] ?? null;
+ $error = $errors[$name] ?? [];
+ $widgetAttributes = $attributes[$name] ?? [];
if ($widget instanceof sfWidgetForm && $widget->isHidden()) {
$hiddenRows[] = $this->renderField($name, $value, $widgetAttributes);
@@ -635,7 +635,7 @@ public function offsetExists($name)
#[\ReturnTypeWillChange]
public function offsetGet($name)
{
- return isset($this->fields[$name]) ? $this->fields[$name] : null;
+ return $this->fields[$name] ?? null;
}
/**
diff --git a/lib/widget/sfWidgetFormSchemaFormatter.class.php b/lib/widget/sfWidgetFormSchemaFormatter.class.php
index 9c7a1e94b..2c40b4456 100644
--- a/lib/widget/sfWidgetFormSchemaFormatter.class.php
+++ b/lib/widget/sfWidgetFormSchemaFormatter.class.php
@@ -42,7 +42,7 @@ public function formatRow($label, $field, $errors = [], $help = '', $hiddenField
'%field%' => $field,
'%error%' => $this->formatErrorsForRow($errors),
'%help%' => $this->formatHelp($help),
- '%hidden_fields%' => null === $hiddenFields ? '%hidden_fields%' : $hiddenFields,
+ '%hidden_fields%' => $hiddenFields ?? '%hidden_fields%',
]);
}
diff --git a/lib/yaml/sfYamlParser.class.php b/lib/yaml/sfYamlParser.class.php
index 84d124047..e7be656ac 100644
--- a/lib/yaml/sfYamlParser.class.php
+++ b/lib/yaml/sfYamlParser.class.php
@@ -352,7 +352,7 @@ protected function parseValue($value)
}
if (preg_match('/^(?P
\||>)(?P\+|\-|\d+|\+\d+|\-\d+|\d+\+|\d+\-)?(?P +#.*)?$/', $value, $matches)) {
- $modifiers = isset($matches['modifiers']) ? $matches['modifiers'] : '';
+ $modifiers = $matches['modifiers'] ?? '';
return $this->parseFoldedScalar($matches['separator'], preg_replace('#\d+#', '', $modifiers), abs((int) $modifiers));
}
diff --git a/test/bootstrap/functional.php b/test/bootstrap/functional.php
index e7fab1c93..643794d77 100644
--- a/test/bootstrap/functional.php
+++ b/test/bootstrap/functional.php
@@ -15,11 +15,11 @@
ini_set('allow_url_fopen', 'on');
if (!isset($root_dir)) {
- $root_dir = realpath(__DIR__.sprintf('/../%s/fixtures', isset($type) ? $type : 'functional'));
+ $root_dir = realpath(__DIR__.sprintf('/../%s/fixtures', $type ?? 'functional'));
}
require_once $root_dir.'/config/ProjectConfiguration.class.php';
-$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', isset($debug) ? $debug : true);
+$configuration = ProjectConfiguration::getApplicationConfiguration($app, 'test', $debug ?? true);
// remove all cache
sf_functional_test_shutdown();
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_anotherCacheablePartial.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_anotherCacheablePartial.php
index 3fb3ec9ea..892759b12 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_anotherCacheablePartial.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_anotherCacheablePartial.php
@@ -1,10 +1,10 @@
-OK
+OK
-OK
+OK
Another Partial
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheableComponent.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheableComponent.php
index b810029bc..72217f054 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheableComponent.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheableComponent.php
@@ -1,6 +1,6 @@
-OK
+OK
Component
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheablePartial.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheablePartial.php
index bbd50133b..3bc59dc6e 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheablePartial.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_cacheablePartial.php
@@ -1,7 +1,7 @@
-OK
+OK
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_component.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_component.php
index ce7e7fc6c..78d214a1e 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_component.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_component.php
@@ -1 +1 @@
-OK
+OK
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheableComponent.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheableComponent.php
index 8b2aa634a..cd03a2c21 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheableComponent.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheableComponent.php
@@ -1 +1 @@
-getTitle(); ?>
+getTitle(); ?>
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheablePartial.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheablePartial.php
index dcc1febf7..6e69a99b5 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheablePartial.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualCacheablePartial.php
@@ -1 +1 @@
-getTitle(); ?>
+getTitle(); ?>
diff --git a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualComponent.php b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualComponent.php
index 4024ae5c1..add88f55f 100644
--- a/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualComponent.php
+++ b/test/functional/fixtures/apps/cache/modules/cache/templates/_contextualComponent.php
@@ -1 +1 @@
-OK
+OK
diff --git a/test/unit/cache/sfFunctionCacheTest.php b/test/unit/cache/sfFunctionCacheTest.php
index d352ec1e6..ca37b83e1 100644
--- a/test/unit/cache/sfFunctionCacheTest.php
+++ b/test/unit/cache/sfFunctionCacheTest.php
@@ -20,7 +20,7 @@ class sfSimpleCache extends sfCache
public function get($key, $default = null)
{
- return isset($this->data[$key]) ? $this->data[$key] : $default;
+ return $this->data[$key] ?? $default;
}
public function set($key, $data, $lifetime = null)
diff --git a/test/unit/util/sfBrowserTest.php b/test/unit/util/sfBrowserTest.php
index e50e8ceec..d690c9cd0 100755
--- a/test/unit/util/sfBrowserTest.php
+++ b/test/unit/util/sfBrowserTest.php
@@ -44,7 +44,7 @@ public function call($uri, $method = 'get', $parameters = [], $changeStack = tru
public function getDefaultServerArray($name)
{
- return isset($this->defaultServerArray[$name]) ? $this->defaultServerArray[$name] : false;
+ return $this->defaultServerArray[$name] ?? false;
}
}
diff --git a/test/unit/view/sfViewCacheManagerTest.php b/test/unit/view/sfViewCacheManagerTest.php
index a4cca20cc..4579acb5b 100644
--- a/test/unit/view/sfViewCacheManagerTest.php
+++ b/test/unit/view/sfViewCacheManagerTest.php
@@ -78,7 +78,7 @@ public function initialize($parameters = [])
public function get($key, $default = null)
{
- return isset(self::$cache[$key]) ? self::$cache[$key] : $default;
+ return self::$cache[$key] ?? $default;
}
public function has($key)