Unify null comparisons
This commit is contained in:
parent
c548bd861a
commit
be04c5000c
@ -49,7 +49,7 @@ class ContainerAwareEventManager extends EventManager
|
||||
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
|
||||
{
|
||||
if (isset($this->listeners[$eventName])) {
|
||||
$eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
|
||||
$eventArgs = null === $eventArgs ? EventArgs::getEmptyInstance() : $eventArgs;
|
||||
|
||||
$initialized = isset($this->initialized[$eventName]);
|
||||
|
||||
|
@ -41,7 +41,7 @@ class Configuration implements ConfigurationInterface
|
||||
->end()
|
||||
->arrayNode('trusted_proxies')
|
||||
->beforeNormalization()
|
||||
->ifTrue(function ($v) { return !is_array($v) && !is_null($v); })
|
||||
->ifTrue(function ($v) { return !is_array($v) && null !== $v; })
|
||||
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
|
||||
->end()
|
||||
->prototype('scalar')
|
||||
|
@ -1,5 +1,5 @@
|
||||
<select
|
||||
<?php if ($required && $empty_value === null && $empty_value_in_choices === false && $multiple === false):
|
||||
<?php if ($required && null === $empty_value && $empty_value_in_choices === false && $multiple === false):
|
||||
$required = false;
|
||||
endif; ?>
|
||||
<?php echo $view['form']->block($form, 'widget_attributes', array(
|
||||
|
@ -69,14 +69,14 @@ abstract class WebTestCase extends \PHPUnit_Framework_TestCase
|
||||
}
|
||||
|
||||
$dir = static::getPhpUnitCliConfigArgument();
|
||||
if ($dir === null &&
|
||||
if (null === $dir &&
|
||||
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
|
||||
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
|
||||
$dir = getcwd();
|
||||
}
|
||||
|
||||
// Can't continue
|
||||
if ($dir === null) {
|
||||
if (null === $dir) {
|
||||
throw new \RuntimeException('Unable to guess the Kernel directory.');
|
||||
}
|
||||
|
||||
|
@ -370,7 +370,7 @@
|
||||
this.getThreshold = function() {
|
||||
var threshold = Sfjs.getPreference(_storagePrefix + 'threshold');
|
||||
|
||||
if (threshold === null) {
|
||||
if (null === threshold) {
|
||||
return _threshold;
|
||||
}
|
||||
|
||||
|
@ -68,20 +68,20 @@
|
||||
menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'),
|
||||
displayState, elem, className;
|
||||
|
||||
if (savedState == null) {
|
||||
if (null === savedState) {
|
||||
savedState = 'block';
|
||||
}
|
||||
|
||||
displayState = state || (savedState == 'block' ? 'none' : 'block');
|
||||
displayState = state || ('block' === savedState ? 'none' : 'block');
|
||||
|
||||
if (typeof doSave === 'undefined') {
|
||||
if ('undefined' === typeof doSave) {
|
||||
doSave = true;
|
||||
}
|
||||
|
||||
document.getElementById('searchBar').style.display = displayState;
|
||||
document.getElementById('adminBar').style.display = displayState;
|
||||
|
||||
if (displayState == 'block') {
|
||||
if ('block' === displayState) {
|
||||
Sfjs.removeClass(menu, 'collapsed-menu');
|
||||
Sfjs.removeClass(menu.parentNode.parentNode, 'collapsed-menu-parents');
|
||||
|
||||
@ -107,7 +107,7 @@
|
||||
}
|
||||
|
||||
window.setTimeout(function() {
|
||||
if (document.getElementById('menu-profiler') == null) {
|
||||
if (null === document.getElementById('menu-profiler')) {
|
||||
return;
|
||||
}
|
||||
|
||||
@ -119,12 +119,12 @@
|
||||
}
|
||||
|
||||
for (elem in menuItems) {
|
||||
if (typeof(menuItems[elem].children) != 'undefined' &&
|
||||
if (typeof(menuItems[elem].children) !== 'undefined' &&
|
||||
menuItems[elem].children.length > 0) {
|
||||
child = menuItems[elem].children[0]
|
||||
|
||||
if (child.getAttribute('title') == '' ||
|
||||
child.getAttribute('title') == null) {
|
||||
if ('' === child.getAttribute('title') ||
|
||||
null === child.getAttribute('title')) {
|
||||
value = child.text.replace(/^\s+/g, '').split('\n')[0].replace(/\s+$/g, '');
|
||||
child.setAttribute('title', value);
|
||||
}
|
||||
|
@ -182,7 +182,7 @@ class ExprBuilderTest extends \PHPUnit_Framework_TestCase
|
||||
->end()
|
||||
->end()
|
||||
->buildTree()
|
||||
->finalize($config === null ? array('key'=>'value') : $config)
|
||||
->finalize(null === $config ? array('key'=>'value') : $config)
|
||||
;
|
||||
}
|
||||
|
||||
|
@ -50,7 +50,7 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
|
||||
public function isFile()
|
||||
{
|
||||
if ($this->type === null) {
|
||||
if (null === $this->type) {
|
||||
return preg_match('/file/', $this->getFilename());
|
||||
};
|
||||
|
||||
@ -59,7 +59,7 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
|
||||
public function isDir()
|
||||
{
|
||||
if ($this->type === null) {
|
||||
if (null === $this->type) {
|
||||
return preg_match('/directory/', $this->getFilename());
|
||||
}
|
||||
|
||||
@ -68,7 +68,7 @@ class MockSplFileInfo extends \SplFileInfo
|
||||
|
||||
public function isReadable()
|
||||
{
|
||||
if ($this->mode === null) {
|
||||
if (null === $this->mode) {
|
||||
return preg_match('/r\+/', $this->getFilename());
|
||||
}
|
||||
|
||||
|
@ -126,7 +126,7 @@ class ViolationPathTest extends \PHPUnit_Framework_TestCase
|
||||
public function testGetParent($violationPath, $parentPath)
|
||||
{
|
||||
$path = new ViolationPath($violationPath);
|
||||
$parent = $parentPath === null ? null : new ViolationPath($parentPath);
|
||||
$parent = null === $parentPath ? null : new ViolationPath($parentPath);
|
||||
|
||||
$this->assertEquals($parent, $path->getParent());
|
||||
}
|
||||
|
@ -303,7 +303,7 @@ abstract class AbstractRememberMeServices implements RememberMeServicesInterface
|
||||
|
||||
$parameter = $request->get($this->options['remember_me_parameter'], null, true);
|
||||
|
||||
if ($parameter === null && null !== $this->logger) {
|
||||
if (null === $parameter && null !== $this->logger) {
|
||||
$this->logger->debug(sprintf('Did not send remember-me cookie (remember-me parameter "%s" was not sent).', $this->options['remember_me_parameter']));
|
||||
}
|
||||
|
||||
|
Reference in New Issue
Block a user