Skip to content

Commit 3751465

Browse files
Merge branch '2.7' into 2.8
* 2.7: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
2 parents 7280527 + 77cb817 commit 3751465

File tree

8 files changed

+12
-12
lines changed

8 files changed

+12
-12
lines changed

Container.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -513,7 +513,7 @@ public function addScope(ScopeInterface $scope)
513513
$this->scopeChildren[$name] = array();
514514

515515
// normalize the child relations
516-
while ($parentScope !== self::SCOPE_CONTAINER) {
516+
while (self::SCOPE_CONTAINER !== $parentScope) {
517517
$this->scopeChildren[$parentScope][] = $name;
518518
$parentScope = $this->scopes[$parentScope];
519519
}

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1084,7 +1084,7 @@ public static function getServiceConditionals($value)
10841084
foreach ($value as $v) {
10851085
$services = array_unique(array_merge($services, self::getServiceConditionals($v)));
10861086
}
1087-
} elseif ($value instanceof Reference && $value->getInvalidBehavior() === ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
1087+
} elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
10881088
$services[] = (string) $value;
10891089
}
10901090

Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -67,7 +67,7 @@ public function __construct($class = null, array $arguments = array())
6767
*/
6868
public function setFactory($factory)
6969
{
70-
if (is_string($factory) && strpos($factory, '::') !== false) {
70+
if (is_string($factory) && false !== strpos($factory, '::')) {
7171
$factory = explode('::', $factory, 2);
7272
}
7373

Dumper/PhpDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -533,7 +533,7 @@ private function addServiceConfigurator(Definition $definition, $variableName =
533533

534534
$class = $this->dumpValue($callable[0]);
535535
// If the class is a string we can optimize call_user_func away
536-
if (strpos($class, "'") === 0) {
536+
if (0 === strpos($class, "'")) {
537537
return sprintf(" %s::%s(\$%s);\n", $this->dumpLiteralClass($class), $callable[1], $variableName);
538538
}
539539

@@ -766,7 +766,7 @@ private function addNewInstance($id, Definition $definition, $return, $instantia
766766

767767
$class = $this->dumpValue($callable[0]);
768768
// If the class is a string we can optimize call_user_func away
769-
if (strpos($class, "'") === 0) {
769+
if (0 === strpos($class, "'")) {
770770
return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : '');
771771
}
772772

@@ -779,7 +779,7 @@ private function addNewInstance($id, Definition $definition, $return, $instantia
779779
$class = $this->dumpValue($definition->getFactoryClass(false));
780780

781781
// If the class is a string we can optimize call_user_func away
782-
if (strpos($class, "'") === 0) {
782+
if (0 === strpos($class, "'")) {
783783
return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $definition->getFactoryMethod(false), $arguments ? implode(', ', $arguments) : '');
784784
}
785785

Dumper/XmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -306,9 +306,9 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent
306306
$element->setAttribute('type', 'service');
307307
$element->setAttribute('id', (string) $value);
308308
$behaviour = $value->getInvalidBehavior();
309-
if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) {
309+
if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behaviour) {
310310
$element->setAttribute('on-invalid', 'null');
311-
} elseif ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
311+
} elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behaviour) {
312312
$element->setAttribute('on-invalid', 'ignore');
313313
}
314314
if (!$value->isStrict(false)) {

Extension/Extension.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -65,7 +65,7 @@ public function getNamespace()
6565
public function getAlias()
6666
{
6767
$className = get_class($this);
68-
if (substr($className, -9) != 'Extension') {
68+
if ('Extension' != substr($className, -9)) {
6969
throw new BadMethodCallException('This extension does not follow the naming convention; you must overwrite the getAlias() method.');
7070
}
7171
$classBaseName = substr(strrchr($className, '\\'), 1, -9);

Loader/XmlFileLoader.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -437,7 +437,7 @@ private function getChildren(\DOMNode $node, $name)
437437
{
438438
$children = array();
439439
foreach ($node->childNodes as $child) {
440-
if ($child instanceof \DOMElement && $child->localName === $name && $child->namespaceURI === self::NS) {
440+
if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
441441
$children[] = $child;
442442
}
443443
}
@@ -556,7 +556,7 @@ private function validateExtensions(\DOMDocument $dom, $file)
556556
private function loadFromExtensions(\DOMDocument $xml)
557557
{
558558
foreach ($xml->documentElement->childNodes as $node) {
559-
if (!$node instanceof \DOMElement || $node->namespaceURI === self::NS) {
559+
if (!$node instanceof \DOMElement || self::NS === $node->namespaceURI) {
560560
continue;
561561
}
562562

Loader/YamlFileLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -203,7 +203,7 @@ private function parseDefinition($id, $service, $file)
203203

204204
if (isset($service['factory'])) {
205205
if (is_string($service['factory'])) {
206-
if (strpos($service['factory'], ':') !== false && strpos($service['factory'], '::') === false) {
206+
if (false !== strpos($service['factory'], ':') && false === strpos($service['factory'], '::')) {
207207
$parts = explode(':', $service['factory']);
208208
$definition->setFactory(array($this->resolveServices('@'.$parts[0]), $parts[1]));
209209
} else {

0 commit comments

Comments
 (0)