Skip to content

Commit 2367f4a

Browse files
committed
CS: Unary operators should be placed adjacent to their operands
1 parent 0b1f172 commit 2367f4a

File tree

13 files changed

+42
-42
lines changed

13 files changed

+42
-42
lines changed

src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function buildForm(FormBuilderInterface $builder, array $options)
6060

6161
public function setDefaultOptions(OptionsResolverInterface $resolver)
6262
{
63-
$choiceListCache = & $this->choiceListCache;
63+
$choiceListCache = &$this->choiceListCache;
6464
$registry = $this->registry;
6565
$propertyAccessor = $this->propertyAccessor;
6666
$type = $this;

src/Symfony/Bridge/ProxyManager/Tests/LazyProxy/Fixtures/php/lazy_service.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,7 @@ public function getFooService($lazyLoad = true)
4949
$container = $this;
5050

5151
return $this->services['foo'] = new stdClass_c1d194250ee2e2b7d2eab8b8212368a8(
52-
function (& $wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
52+
function (&$wrappedInstance, \ProxyManager\Proxy\LazyLoadingInterface $proxy) use ($container) {
5353
$wrappedInstance = $container->getFooService(false);
5454

5555
$proxy->setProxyInitializer(null);

src/Symfony/Component/DomCrawler/FormFieldRegistry.php

Lines changed: 8 additions & 8 deletions
Original file line numberDiff line numberDiff line change
@@ -33,16 +33,16 @@ public function add(FormField $field)
3333
{
3434
$segments = $this->getSegments($field->getName());
3535

36-
$target = & $this->fields;
36+
$target = &$this->fields;
3737
while ($segments) {
3838
if (!is_array($target)) {
3939
$target = array();
4040
}
4141
$path = array_shift($segments);
4242
if ('' === $path) {
43-
$target = & $target[];
43+
$target = &$target[];
4444
} else {
45-
$target = & $target[$path];
45+
$target = &$target[$path];
4646
}
4747
}
4848
$target = $field;
@@ -58,13 +58,13 @@ public function add(FormField $field)
5858
public function remove($name)
5959
{
6060
$segments = $this->getSegments($name);
61-
$target = & $this->fields;
61+
$target = &$this->fields;
6262
while (count($segments) > 1) {
6363
$path = array_shift($segments);
6464
if (!array_key_exists($path, $target)) {
6565
return;
6666
}
67-
$target = & $target[$path];
67+
$target = &$target[$path];
6868
}
6969
unset($target[array_shift($segments)]);
7070
}
@@ -82,13 +82,13 @@ public function remove($name)
8282
public function &get($name)
8383
{
8484
$segments = $this->getSegments($name);
85-
$target = & $this->fields;
85+
$target = &$this->fields;
8686
while ($segments) {
8787
$path = array_shift($segments);
8888
if (!array_key_exists($path, $target)) {
8989
throw new \InvalidArgumentException(sprintf('Unreachable field "%s"', $path));
9090
}
91-
$target = & $target[$path];
91+
$target = &$target[$path];
9292
}
9393

9494
return $target;
@@ -123,7 +123,7 @@ public function has($name)
123123
*/
124124
public function set($name, $value)
125125
{
126-
$target = & $this->get($name);
126+
$target = &$this->get($name);
127127
if (!is_array($value) || $target instanceof Field\ChoiceFormField) {
128128
$target->setValue($value);
129129
} else {

src/Symfony/Component/Form/Extension/Core/Type/ChoiceType.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -160,7 +160,7 @@ public function finishView(FormView $view, FormInterface $form, array $options)
160160
*/
161161
public function setDefaultOptions(OptionsResolverInterface $resolver)
162162
{
163-
$choiceListCache = & $this->choiceListCache;
163+
$choiceListCache = &$this->choiceListCache;
164164

165165
$choiceList = function (Options $options) use (&$choiceListCache) {
166166
// Harden against NULL values (like in EntityType and ModelType)

src/Symfony/Component/HttpFoundation/Session/Attribute/NamespacedAttributeBag.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function get($name, $default = null)
7373
*/
7474
public function set($name, $value)
7575
{
76-
$attributes = & $this->resolveAttributePath($name, true);
76+
$attributes = &$this->resolveAttributePath($name, true);
7777
$name = $this->resolveKey($name);
7878
$attributes[$name] = $value;
7979
}
@@ -84,7 +84,7 @@ public function set($name, $value)
8484
public function remove($name)
8585
{
8686
$retval = null;
87-
$attributes = & $this->resolveAttributePath($name);
87+
$attributes = &$this->resolveAttributePath($name);
8888
$name = $this->resolveKey($name);
8989
if (null !== $attributes && array_key_exists($name, $attributes)) {
9090
$retval = $attributes[$name];
@@ -106,7 +106,7 @@ public function remove($name)
106106
*/
107107
protected function &resolveAttributePath($name, $writeContext = false)
108108
{
109-
$array = & $this->attributes;
109+
$array = &$this->attributes;
110110
$name = (strpos($name, $this->namespaceCharacter) === 0) ? substr($name, 1) : $name;
111111

112112
// Check if there is anything to do, else return
@@ -132,7 +132,7 @@ protected function &resolveAttributePath($name, $writeContext = false)
132132
$array[$part] = $writeContext ? array() : null;
133133
}
134134

135-
$array = & $array[$part];
135+
$array = &$array[$part];
136136
}
137137

138138
return $array;

src/Symfony/Component/HttpKernel/Tests/Profiler/AbstractProfilerStorageTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@ abstract class AbstractProfilerStorageTest extends \PHPUnit_Framework_TestCase
1717
{
1818
public function testStore()
1919
{
20-
for ($i = 0; $i < 10; $i ++) {
20+
for ($i = 0; $i < 10; $i++) {
2121
$profile = new Profile('token_'.$i);
2222
$profile->setIp('127.0.0.1');
2323
$profile->setUrl('http://foo.bar');

src/Symfony/Component/PropertyAccess/PropertyAccessor.php

Lines changed: 11 additions & 11 deletions
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public function getValue($objectOrArray, $propertyPath)
4444
$propertyPath = new PropertyPath($propertyPath);
4545
}
4646

47-
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength());
47+
$propertyValues = &$this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength());
4848

4949
return $propertyValues[count($propertyValues) - 1][self::VALUE];
5050
}
@@ -58,7 +58,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
5858
$propertyPath = new PropertyPath($propertyPath);
5959
}
6060

61-
$propertyValues = & $this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
61+
$propertyValues = &$this->readPropertiesUntil($objectOrArray, $propertyPath, $propertyPath->getLength() - 1);
6262
$overwrite = true;
6363

6464
// Add the root object to the list
@@ -68,7 +68,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
6868
));
6969

7070
for ($i = count($propertyValues) - 1; $i >= 0; --$i) {
71-
$objectOrArray = & $propertyValues[$i][self::VALUE];
71+
$objectOrArray = &$propertyValues[$i][self::VALUE];
7272

7373
if ($overwrite) {
7474
$property = $propertyPath->getElement($i);
@@ -82,7 +82,7 @@ public function setValue(&$objectOrArray, $propertyPath, $value)
8282
}
8383
}
8484

85-
$value = & $objectOrArray;
85+
$value = &$objectOrArray;
8686
$overwrite = !$propertyValues[$i][self::IS_REF];
8787
}
8888
}
@@ -122,19 +122,19 @@ private function &readPropertiesUntil(&$objectOrArray, PropertyPathInterface $pr
122122
}
123123

124124
if ($isIndex) {
125-
$propertyValue = & $this->readIndex($objectOrArray, $property);
125+
$propertyValue = &$this->readIndex($objectOrArray, $property);
126126
} else {
127-
$propertyValue = & $this->readProperty($objectOrArray, $property);
127+
$propertyValue = &$this->readProperty($objectOrArray, $property);
128128
}
129129

130-
$objectOrArray = & $propertyValue[self::VALUE];
130+
$objectOrArray = &$propertyValue[self::VALUE];
131131

132132
// the final value of the path must not be validated
133133
if ($i + 1 < $propertyPath->getLength() && !is_object($objectOrArray) && !is_array($objectOrArray)) {
134134
throw new UnexpectedTypeException($objectOrArray, 'object or array');
135135
}
136136

137-
$propertyValues[] = & $propertyValue;
137+
$propertyValues[] = &$propertyValue;
138138
}
139139

140140
return $propertyValues;
@@ -164,7 +164,7 @@ private function &readIndex(&$array, $index)
164164

165165
if (isset($array[$index])) {
166166
if (is_array($array)) {
167-
$result[self::VALUE] = & $array[$index];
167+
$result[self::VALUE] = &$array[$index];
168168
$result[self::IS_REF] = true;
169169
} else {
170170
$result[self::VALUE] = $array[$index];
@@ -216,15 +216,15 @@ private function &readProperty(&$object, $property)
216216
} elseif ($reflClass->hasMethod('__get') && $reflClass->getMethod('__get')->isPublic()) {
217217
$result[self::VALUE] = $object->$property;
218218
} elseif ($classHasProperty && $reflClass->getProperty($property)->isPublic()) {
219-
$result[self::VALUE] = & $object->$property;
219+
$result[self::VALUE] = &$object->$property;
220220
$result[self::IS_REF] = true;
221221
} elseif (!$classHasProperty && property_exists($object, $property)) {
222222
// Needed to support \stdClass instances. We need to explicitly
223223
// exclude $classHasProperty, otherwise if in the previous clause
224224
// a *protected* property was found on the class, property_exists()
225225
// returns true, consequently the following line will result in a
226226
// fatal error.
227-
$result[self::VALUE] = & $object->$property;
227+
$result[self::VALUE] = &$object->$property;
228228
$result[self::IS_REF] = true;
229229
} elseif ($this->magicCall && $reflClass->hasMethod('__call') && $reflClass->getMethod('__call')->isPublic()) {
230230
// we call the getter and hope the __call do the job

src/Symfony/Component/Security/Acl/Dbal/AclProvider.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -507,8 +507,8 @@ private function hydrateObjectIdentities(Statement $stmt, array $oidLookup, arra
507507
$acls = $aces = $emptyArray = array();
508508
$oidCache = $oidLookup;
509509
$result = new \SplObjectStorage();
510-
$loadedAces = & $this->loadedAces;
511-
$loadedAcls = & $this->loadedAcls;
510+
$loadedAces = &$this->loadedAces;
511+
$loadedAcls = &$this->loadedAcls;
512512
$permissionGrantingStrategy = $this->permissionGrantingStrategy;
513513

514514
// we need these to set protected properties on hydrated objects

src/Symfony/Component/Security/Acl/Domain/Acl.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -405,7 +405,7 @@ public function updateObjectFieldAuditing($index, $field, $auditSuccess, $auditF
405405
*/
406406
private function deleteAce($property, $index)
407407
{
408-
$aces = & $this->$property;
408+
$aces = &$this->$property;
409409
if (!isset($aces[$index])) {
410410
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
411411
}
@@ -431,7 +431,7 @@ private function deleteAce($property, $index)
431431
*/
432432
private function deleteFieldAce($property, $index, $field)
433433
{
434-
$aces = & $this->$property;
434+
$aces = &$this->$property;
435435
if (!isset($aces[$field][$index])) {
436436
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
437437
}
@@ -477,7 +477,7 @@ private function insertAce($property, $index, $mask, SecurityIdentityInterface $
477477
}
478478
}
479479

480-
$aces = & $this->$property;
480+
$aces = &$this->$property;
481481
$oldValue = $this->$property;
482482
if (isset($aces[$index])) {
483483
$this->$property = array_merge(
@@ -527,7 +527,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
527527
}
528528
}
529529

530-
$aces = & $this->$property;
530+
$aces = &$this->$property;
531531
if (!isset($aces[$field])) {
532532
$aces[$field] = array();
533533
}
@@ -565,7 +565,7 @@ private function insertFieldAce($property, $index, $field, $mask, SecurityIdenti
565565
*/
566566
private function updateAce($property, $index, $mask, $strategy = null)
567567
{
568-
$aces = & $this->$property;
568+
$aces = &$this->$property;
569569
if (!isset($aces[$index])) {
570570
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
571571
}
@@ -626,7 +626,7 @@ private function updateFieldAce($property, $index, $field, $mask, $strategy = nu
626626
throw new \InvalidArgumentException('$field cannot be empty.');
627627
}
628628

629-
$aces = & $this->$property;
629+
$aces = &$this->$property;
630630
if (!isset($aces[$field][$index])) {
631631
throw new \OutOfBoundsException(sprintf('The index "%d" does not exist.', $index));
632632
}

src/Symfony/Component/Security/Core/Authentication/Token/AbstractToken.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -252,7 +252,7 @@ private function hasUserChanged(UserInterface $user)
252252
}
253253

254254
if ($this->user instanceof EquatableInterface) {
255-
return ! (bool) $this->user->isEqualTo($user);
255+
return !(bool) $this->user->isEqualTo($user);
256256
}
257257

258258
if ($this->user->getPassword() !== $user->getPassword()) {

0 commit comments

Comments
 (0)