10000 minor #11481 Unify null comparisons (WouterJ) · symfony/symfony@8b051f9 · GitHub
[go: up one dir, main page]

Skip to content

Commit 8b051f9

Browse files
committed
minor #11481 Unify null comparisons (WouterJ)
This PR was merged into the 2.3 branch. Discussion ---------- Unify null comparisons | Q | A | ------------- | --- | Fixed tickets | - | License | MIT Commits ------- be04c50 Unify null comparisons
2 parents c548bd8 + be04c50 commit 8b051f9

File tree

10 files changed

+20
-20
lines changed

10 files changed

+20
-20
lines changed

src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function __construct(ContainerInterface $container)
4949
public function dispatchEvent($eventName, EventArgs $eventArgs = null)
5050
{
5151
if (isset($this->listeners[$eventName])) {
52-
$eventArgs = $eventArgs === null ? EventArgs::getEmptyInstance() : $eventArgs;
52+
$eventArgs = null === $eventArgs ? EventArgs::getEmptyInstance() : $eventArgs;
5353

5454
$initialized = isset($this->initialized[$eventName]);
5555

src/Symfony/Bundle/FrameworkBundle/DependencyInjection/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -41,7 +41,7 @@ public function getConfigTreeBuilder()
4141
->end()
4242
->arrayNode('trusted_proxies')
4343
->beforeNormalization()
44-
->ifTrue(function ($v) { return !is_array($v) && !is_null($v); })
44+
->ifTrue(function ($v) { return !is_array($v) && null !== $v; })
4545
->then(function ($v) { return is_bool($v) ? array() : preg_split('/\s*,\s*/', $v); })
4646
->end()
4747
->prototype('scalar')

src/Symfony/Bundle/FrameworkBundle/Resources/views/Form/choice_widget_collapsed.html.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,5 +1,5 @@
11
<select
2-
<?php if ($required && $empty_value === null && $empty_value_in_choices === false && $multiple === false):
2+
<?php if ($required && null === $empty_value && $empty_value_in_choices === false && $multiple === false):
33
$required = false;
44
endif; ?>
55
<?php echo $view['form']->block($form, 'widget_attributes', array(

src/Symfony/Bundle/FrameworkBundle/Test/WebTestCase.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -69,14 +69,14 @@ protected static function getPhpUnitXmlDir()
6969
}
7070

7171
$dir = static::getPhpUnitCliConfigArgument();
72-
if ($dir === null &&
72+
if (null === $dir &&
7373
(is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml') ||
7474
is_file(getcwd().DIRECTORY_SEPARATOR.'phpunit.xml.dist'))) {
7575
$dir = getcwd();
7676
}
7777

7878
// Can't continue
79-
if ($dir === null) {
79+
if (null === $dir) {
8080
throw new \RuntimeException('Unable to guess the Kernel directory.');
8181
}
8282

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Collector/time.html.twig

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -370,7 +370,7 @@
370370
this.getThreshold = function() {
371371
var threshold = Sfjs.getPreference(_storagePrefix + 'threshold');
372372
373-
if (threshold === null) {
373+
if (null === threshold) {
374374
return _threshold;
375375
}
376376

src/Symfony/Bundle/WebProfilerBundle/Resources/views/Profiler/layout.html.twig

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -68,20 +68,20 @@
6868
menu = document.getElementById('navigation'), savedState = Sfjs.getPreference('menu/displayState'),
6969
displayState, elem, className;
7070
71-
if (savedState == null) {
71+
if (null === savedState) {
7272
savedState = 'block';
7373
}
7474
75-
displayState = state || (savedState == 'block' ? 'none' : 'block');
75+
displayState = state || ('block' === savedState ? 'none' : 'block');
7676
77-
if (typeof doSave === 'undefined') {
77+
if ('undefined' === typeof doSave) {
7878
doSave = true;
7979
}
8080
8181
document.getElementById('searchBar').style.display = displayState;
8282
document.getElementById('adminBar').style.display = displayState;
8383
84-
if (displayState == 'block') {
84+
if ('block' === displayState) {
8585
Sfjs.removeClass(menu, 'collapsed-menu');
8686
Sfjs.removeClass(menu.parentNode.parentNode, 'collapsed-menu-parents');
8787
@@ -107,7 +107,7 @@
107107
}
108108
109109
window.setTimeout(function() {
110-
if (document.getElementById('menu-profiler') == null) {
110+
if (null === document.getElementById('menu-profiler')) {
111111
return;
112112
}
113113
@@ -119,12 +119,12 @@
119119
}
120120
121121
for ( 10000 elem in menuItems) {
122-
if (typeof(menuItems[elem].children) != 'undefined' &&
122+
if (typeof(menuItems[elem].children) !== 'undefined' &&
123123
menuItems[elem].children.length > 0) {
124124
child = menuItems[elem].children[0]
125125
126-
if (child.getAttribute('title') == '' ||
127-
child.getAttribute('title') == null) {
126+
if ('' === child.getAttribute('title') ||
127+
null === child.getAttribute('title')) {
128128
value = child.text.replace(/^\s+/g, '').split('\n')[0].replace(/\s+$/g, '');
129129
child.setAttribute('title', value);
130130
}

src/Symfony/Component/Config/Tests/Definition/Builder/ExprBuilderTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -182,7 +182,7 @@ protected function finalizeTestBuilder($testBuilder, $config = null)
182182
->end()
183183
->end()
184184
->buildTree()
185-
->finalize($config === null ? array('key'=>'value') : $config)
185+
->finalize(null === $config ? array('key'=>'value') : $config)
186186
;
187187
}
188188

src/Symfony/Component/Finder/Tests/Iterator/MockSplFileInfo.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -50,7 +50,7 @@ public function __construct($param)
5050

5151
public function isFile()
5252
{
53-
if ($this->type === null) {
53+
if (null === $this->type) {
5454
return preg_match('/file/', $this->getFilename());
5555
};
5656

@@ -59,7 +59,7 @@ public function isFile()
5959

6060
public function isDir()
6161
{
62-
if ($this->type === null) {
62+
if (null === $this->type) {
6363
return preg_match('/directory/', $this->getFilename());
6464
}
6565

@@ -68,7 +68,7 @@ public function isDir()
6868

6969
public function isReadable()
7070
{
71-
if ($this->mode === null) {
71+
if (null === $this->mode) {
7272
return preg_match('/r\+/', $this->getFilename());
7373
}
7474

src/Symfony/Component/Form/Tests/Extension/Validator/ViolationMapper/ViolationPathTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -126,7 +126,7 @@ public function provideParents()
126126
public function testGetParent($violationPath, $parentPath)
127127
{
128128
$path = new ViolationPath($violationPath);
129-
$parent = $parentPath === null ? null : new ViolationPath($parentPath);
129+
$parent = null === $parentPath ? null : new ViolationPath($parentPath);
130130

131131
$this->assertEquals($parent, $path->getParent());
132132
}

src/Symfony/Component/Security/Http/RememberMe/AbstractRememberMeServices.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -303,7 +303,7 @@ protected function isRememberMeRequested(Request $request)
303303

304304
$parameter = $request->get($this->options['remember_me_parameter'], null, true);
305305

306-
if ($parameter === null && null !== $this->logger) {
306+
if (null === $parameter && null !== $this->logger) {
307307
$this->logger->debug(sprintf('Did not send remember-me cookie (remember-me parameter "%s" was not sent).', $this->options['remember_me_parameter']));
308308
}
309309

0 commit comments

Comments
 (0)
0