Skip to content

Commit 77cb817

Browse files
SpacePossumnicolas-grekas
authored andcommitted
[CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction
1 parent d73694e commit 77cb817

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
@@ -477,7 +477,7 @@ public function addScope(ScopeInterface $scope)
477477
$this->scopeChildren[$name] = array();
478478

479479
// normalize the child relations
480-
while ($parentScope !== self::SCOPE_CONTAINER) {
480+
while (self::SCOPE_CONTAINER !== $parentScope) {
481481
$this->scopeChildren[$parentScope][] = $name;
482482
$parentScope = $this->scopes[$parentScope];
483483
}

ContainerBuilder.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1038,7 +1038,7 @@ public static function getServiceConditionals($value)
10381038
foreach ($value as $v) {
10391039
$services = array_unique(array_merge($services, self::getServiceConditionals($v)));
10401040
}
1041-
} elseif ($value instanceof Reference && $value->getInvalidBehavior() === ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
1041+
} elseif ($value instanceof Reference && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $value->getInvalidBehavior()) {
10421042
$services[] = (string) $value;
10431043
}
10441044

Definition.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function __construct($class = null, array $arguments = array())
6060
*/
6161
public function setFactory($factory)
6262
{
63-
if (is_string($factory) && strpos($factory, '::') !== false) {
63+
if (is_string($factory) && false !== strpos($factory, '::')) {
6464
$factory = explode('::', $factory, 2);
6565
}
6666

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

@@ -753,7 +753,7 @@ private function addNewInstance($id, Definition $definition, $return, $instantia
753753

754754
$class = $this->dumpValue($callable[0]);
755755
// If the class is a string we can optimize call_user_func away
756-
if (strpos($class, "'") === 0) {
756+
if (0 === strpos($class, "'")) {
757757
return sprintf(" $return{$instantiation}%s::%s(%s);\n", $this->dumpLiteralClass($class), $callable[1], $arguments ? implode(', ', $arguments) : '');
758758
}
759759

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

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), $definition->getFactoryMethod(false), $arguments ? implode(', ', $arguments) : '');
771771
}
772772

Dumper/XmlDumper.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -282,9 +282,9 @@ private function convertParameters(array $parameters, $type, \DOMElement $parent
282282
$element->setAttribute('type', 'service');
283283
$element->setAttribute('id', (string) $value);
284284
$behaviour = $value->getInvalidBehavior();
285-
if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) {
285+
if (ContainerInterface::NULL_ON_INVALID_REFERENCE == $behaviour) {
286286
$element->setAttribute('on-invalid', 'null');
287-
} elseif ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
287+
} elseif (ContainerInterface::IGNORE_ON_INVALID_REFERENCE == $behaviour) {
288288
$element->setAttribute('on-invalid', 'ignore');
289289
}
290290
if (!$value->isStrict()) {

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
@@ -414,7 +414,7 @@ private function getChildren(\DOMNode $node, $name)
414414
{
415415
$children = array();
416416
foreach ($node->childNodes as $child) {
417-
if ($child instanceof \DOMElement && $child->localName === $name && $child->namespaceURI === self::NS) {
417+
if ($child instanceof \DOMElement && $child->localName === $name && self::NS === $child->namespaceURI) {
418418
$children[] = $child;
419419
}
420420
}
@@ -533,7 +533,7 @@ private function validateExtensions(\DOMDocument $dom, $file)
533533
private function loadFromExtensions(\DOMDocument $xml)
534534
{
535535
foreach ($xml->documentElement->childNodes as $node) {
536-
if (!$node instanceof \DOMElement || $node->namespaceURI === self::NS) {
536+
if (!$node instanceof \DOMElement || self::NS === $node->namespaceURI) {
537537
continue;
538538
}
539539

Loader/YamlFileLoader.php

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

193193
if (isset($service['factory'])) {
194194
if (is_string($service['factory'])) {
195-
if (strpos($service['factory'], ':') !== false && strpos($service['factory'], '::') === false) {
195+
if (false !== strpos($service['factory'], ':') && false === strpos($service['factory'], '::')) {
196196
$parts = explode(':', $service['factory']);
197197
$definition->setFactory(array($this->resolveServices('@'.$parts[0]), $parts[1]));
198198
} else {

0 commit comments

Comments
 (0)