This commit is contained in:
Fabien Potencier 2011-12-18 14:42:59 +01:00
parent 8d7a6e598d
commit 4316595dbb
60 changed files with 109 additions and 108 deletions

View File

@ -142,7 +142,7 @@ class EntityChoiceList extends ArrayChoiceList
if (is_array($this->choices)) {
$entities = $this->choices;
} else if ($qb = $this->queryBuilder) {
} elseif ($qb = $this->queryBuilder) {
$entities = $qb->getQuery()->execute();
} else {
$entities = $this->em->getRepository($this->class)->findAll();
@ -269,9 +269,9 @@ class EntityChoiceList extends ArrayChoiceList
$entities = $this->getEntities();
return isset($entities[$key]) ? $entities[$key] : null;
} else if ($this->entities) {
} elseif ($this->entities) {
return isset($this->entities[$key]) ? $this->entities[$key] : null;
} else if ($qb = $this->queryBuilder) {
} elseif ($qb = $this->queryBuilder) {
// should we clone the builder?
$alias = $qb->getRootAlias();
$where = $qb->expr()->eq($alias.'.'.current($this->identifier), $key);

View File

@ -38,7 +38,7 @@ class MergeCollectionListener implements EventSubscriberInterface
if (!$collection) {
$collection = $data;
} else if (count($data) === 0) {
} elseif (count($data) === 0) {
$collection->clear();
} else {
// merge $data into $collection

View File

@ -196,7 +196,7 @@ abstract class AbstractDoctrineExtension extends Extension
$args[0] = array_merge(array_values($driverPaths), $args[0]);
}
$mappingDriverDef->setArguments($args);
} else if ($driverType == 'annotation') {
} elseif ($driverType == 'annotation') {
$mappingDriverDef = new Definition('%'.$this->getObjectManagerElementName('metadata.'.$driverType.'.class%'), array(
new Reference($this->getObjectManagerElementName('metadata.annotation_reader')),
array_values($driverPaths)

View File

@ -88,7 +88,7 @@ class CodeHelper extends Helper
if (false !== strpos($method, '::')) {
list($class, $method) = explode('::', $method, 2);
$result = sprintf("%s::%s()", $this->abbrClass($class), $method);
} else if ('Closure' === $method) {
} elseif ('Closure' === $method) {
$result = sprintf("<abbr title=\"%s\">%s</abbr>", $method, $method);
} else {
$result = sprintf("<abbr title=\"%s\">%s</abbr>()", $method, $method);

View File

@ -45,7 +45,7 @@ class TemplateNameParser extends BaseTemplateNameParser
{
if ($name instanceof TemplateReferenceInterface) {
return $name;
} else if (isset($this->cache[$name])) {
} elseif (isset($this->cache[$name])) {
return $this->cache[$name];
}

View File

@ -45,6 +45,7 @@ class SessionController extends ContainerAware
public function logoutAction()
{
$request = $this->container->get('request')->getSession('session')->clear();
return new Response('Session cleared.');
}

View File

@ -241,7 +241,7 @@ class SecurityExtension extends Extension
$matcher = null;
if (isset($firewall['request_matcher'])) {
$matcher = new Reference($firewall['request_matcher']);
} else if (isset($firewall['pattern'])) {
} elseif (isset($firewall['pattern'])) {
$matcher = $this->createRequestMatcher($container, $firewall['pattern']);
}
@ -515,7 +515,7 @@ class SecurityExtension extends Extension
// access denied handler setup
if (isset($config['access_denied_handler'])) {
$listener->replaceArgument(5, new Reference($config['access_denied_handler']));
} else if (isset($config['access_denied_url'])) {
} elseif (isset($config['access_denied_url'])) {
$listener->replaceArgument(4, $config['access_denied_url']);
}

View File

@ -112,7 +112,7 @@ abstract class SecurityExtensionTest extends \PHPUnit_Framework_TestCase
if (1 === $i) {
$this->assertEquals(array('ROLE_USER'), $roles);
$this->assertEquals('https', $channel);
} else if (2 === $i) {
} elseif (2 === $i) {
$this->assertEquals(array('IS_AUTHENTICATED_ANONYMOUSLY'), $roles);
$this->assertNull($channel);
}

View File

@ -197,7 +197,7 @@ class PrototypedArrayNode extends ArrayNode
$ex->setPath($this->getPath());
throw $ex;
} else if (isset($v[$this->keyAttribute])) {
} elseif (isset($v[$this->keyAttribute])) {
$k = $v[$this->keyAttribute];
// remove the key attribute when required

View File

@ -45,7 +45,7 @@ class InputArgument
{
if (null === $mode) {
$mode = self::OPTIONAL;
} else if (is_string($mode) || $mode > 7) {
} elseif (is_string($mode) || $mode > 7) {
throw new \InvalidArgumentException(sprintf('Argument mode "%s" is not valid.', $mode));
}
@ -102,7 +102,7 @@ class InputArgument
if ($this->isArray()) {
if (null === $default) {
$default = array();
} else if (!is_array($default)) {
} elseif (!is_array($default)) {
throw new \LogicException('A default value for an array argument must be an array.');
}
}

View File

@ -263,7 +263,7 @@ class InputDefinition
{
if (isset($this->options[$option->getName()])) {
throw new \LogicException(sprintf('An option named "%s" already exist.', $option->getName()));
} else if (isset($this->shortcuts[$option->getShortcut()])) {
} elseif (isset($this->shortcuts[$option->getShortcut()])) {
throw new \LogicException(sprintf('An option with shortcut "%s" already exist.', $option->getShortcut()));
}

View File

@ -62,7 +62,7 @@ class InputOption
if (null === $mode) {
$mode = self::VALUE_NONE;
} else if (!is_int($mode) || $mode > 15) {
} elseif (!is_int($mode) || $mode > 15) {
throw new \InvalidArgumentException(sprintf('Option mode "%s" is not valid.', $mode));
}

View File

@ -92,7 +92,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
foreach ($arguments as $argument) {
if (is_array($argument)) {
$this->processArguments($argument);
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
$this->graph->connect(
$this->currentId,
$this->currentDefinition,
@ -100,7 +100,7 @@ class AnalyzeServiceReferencesPass implements RepeatablePassInterface
$this->getDefinition((string) $argument),
$argument
);
} else if ($argument instanceof Definition) {
} elseif ($argument instanceof Definition) {
$this->processArguments($argument->getArguments());
$this->processArguments($argument->getMethodCalls());
$this->processArguments($argument->getProperties());

View File

@ -50,9 +50,9 @@ class CheckExceptionOnInvalidReferenceBehaviorPass implements CompilerPassInterf
foreach ($arguments as $argument) {
if (is_array($argument)) {
$this->processReferences($argument);
} else if ($argument instanceof Definition) {
} elseif ($argument instanceof Definition) {
$this->processDefinition($argument);
} else if ($argument instanceof Reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $argument->getInvalidBehavior()) {
} elseif ($argument instanceof Reference && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE === $argument->getInvalidBehavior()) {
$destId = (string) $argument;
if (!$this->container->has($destId)) {

View File

@ -70,7 +70,7 @@ class CheckReferenceValidityPass implements CompilerPassInterface
if (ContainerInterface::SCOPE_CONTAINER === $scope) {
$this->currentScopeChildren = array_keys($scopes);
$this->currentScopeAncestors = array();
} else if (ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope) {
$this->currentScopeChildren = $children[$scope];
$this->currentScopeAncestors = $ancestors[$scope];
}

View File

@ -76,7 +76,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
foreach ($arguments as $k => $argument) {
if (is_array($argument)) {
$arguments[$k] = $this->inlineArguments($container, $argument);
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
if (!$container->hasDefinition($id = (string) $argument)) {
continue;
}
@ -90,7 +90,7 @@ class InlineServiceDefinitionsPass implements RepeatablePassInterface
$arguments[$k] = clone $definition;
}
}
} else if ($argument instanceof Definition) {
} elseif ($argument instanceof Definition) {
$argument->setArguments($this->inlineArguments($container, $argument->getArguments()));
$argument->setMethodCalls($this->inlineArguments($container, $argument->getMethodCalls()));
$argument->setProperties($this->inlineArguments($container, $argument->getProperties()));

View File

@ -72,7 +72,7 @@ class RemoveUnusedDefinitionsPass implements RepeatablePassInterface
$definition->setPublic(true);
$container->removeDefinition($id);
$compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'replaces alias '.reset($referencingAliases)));
} else if (0 === count($referencingAliases) && false === $isReferenced) {
} elseif (0 === count($referencingAliases) && false === $isReferenced) {
$container->removeDefinition($id);
$compiler->addLogMessage($formatter->formatRemoveService($this, $id, 'unused'));
$hasChanged = true;

View File

@ -103,7 +103,7 @@ class ReplaceAliasByActualDefinitionPass implements CompilerPassInterface
foreach ($arguments as $k => $argument) {
if (is_array($argument)) {
$arguments[$k] = $this->updateArgumentReferences($argument, $currentId, $newId);
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
if ($currentId === (string) $argument) {
$arguments[$k] = new Reference($newId, $argument->getInvalidBehavior());
$this->compiler->addLogMessage($this->formatter->formatUpdateReference($this, $this->sourceId, $currentId, $newId));

View File

@ -76,7 +76,7 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
foreach ($arguments as $k => $argument) {
if (is_array($argument)) {
$arguments[$k] = $this->processArguments($argument, $inMethodCall);
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
$id = (string) $argument;
$invalidBehavior = $argument->getInvalidBehavior();
@ -85,9 +85,9 @@ class ResolveInvalidReferencesPass implements CompilerPassInterface
// resolve invalid behavior
if ($exists && ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $invalidBehavior) {
$arguments[$k] = new Reference($id);
} else if (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
} elseif (!$exists && ContainerInterface::NULL_ON_INVALID_REFERENCE === $invalidBehavior) {
$arguments[$k] = null;
} else if (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
} elseif (!$exists && ContainerInterface::IGNORE_ON_INVALID_REFERENCE === $invalidBehavior) {
if ($inMethodCall) {
throw new \RuntimeException('Method shouldn\'t be called.');
}

View File

@ -492,7 +492,7 @@ class ContainerBuilder extends Container implements TaggedContainerInterface
if (is_string($id)) {
$id = new Alias($id);
} else if (!$id instanceof Alias) {
} elseif (!$id instanceof Alias) {
throw new \InvalidArgumentException('$id must be a string, or an Alias object.');
}

View File

@ -302,7 +302,7 @@ class PhpDumper extends Dumper
$instantiation = '';
if (ContainerInterface::SCOPE_CONTAINER === $definition->getScope()) {
$instantiation = "\$this->services['$id'] = ".($simple ? '' : '$instance');
} else if (ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
} elseif (ContainerInterface::SCOPE_PROTOTYPE !== $scope = $definition->getScope()) {
$instantiation = "\$this->services['$id'] = \$this->scopedServices['$scope']['$id'] = ".($simple ? '' : '$instance');
} elseif (!$simple) {
$instantiation = '$instance';
@ -875,7 +875,7 @@ EOF;
foreach ($arguments as $argument) {
if (is_array($argument)) {
$this->getServiceCallsFromArguments($argument, $calls, $behavior);
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
$id = (string) $argument;
if (!isset($calls[$id])) {
@ -883,7 +883,7 @@ EOF;
}
if (!isset($behavior[$id])) {
$behavior[$id] = $argument->getInvalidBehavior();
} else if (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $behavior[$id]) {
} elseif (ContainerInterface::EXCEPTION_ON_INVALID_REFERENCE !== $behavior[$id]) {
$behavior[$id] = $argument->getInvalidBehavior();
}
@ -929,7 +929,7 @@ EOF;
foreach ($arguments as $argument) {
if (is_array($argument)) {
$definitions = array_merge($definitions, $this->getDefinitionsFromArguments($argument));
} else if ($argument instanceof Definition) {
} elseif ($argument instanceof Definition) {
$definitions = array_merge(
$definitions,
$this->getInlinedDefinitions($argument),
@ -956,7 +956,7 @@ EOF;
if ($this->hasReference($id, $argument)) {
return true;
}
} else if ($argument instanceof Reference) {
} elseif ($argument instanceof Reference) {
if ($id === (string) $argument) {
return true;
}

View File

@ -241,16 +241,16 @@ class XmlDumper extends Dumper
if (is_array($value)) {
$element->setAttribute('type', 'collection');
$this->convertParameters($value, $type, $element, 'key');
} else if (is_object($value) && $value instanceof Reference) {
} elseif (is_object($value) && $value instanceof Reference) {
$element->setAttribute('type', 'service');
$element->setAttribute('id', (string) $value);
$behaviour = $value->getInvalidBehavior();
if ($behaviour == ContainerInterface::NULL_ON_INVALID_REFERENCE) {
$element->setAttribute('on-invalid', 'null');
} else if ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
} elseif ($behaviour == ContainerInterface::IGNORE_ON_INVALID_REFERENCE) {
$element->setAttribute('on-invalid', 'ignore');
}
} else if (is_object($value) && $value instanceof Definition) {
} elseif (is_object($value) && $value instanceof Definition) {
$element->setAttribute('type', 'service');
$this->addService($value, null, $element);
} else {

View File

@ -131,7 +131,7 @@ class YamlFileLoader extends FileLoader
$this->container->setAlias($id, substr($service, 1));
return;
} else if (isset($service['alias'])) {
} elseif (isset($service['alias'])) {
$public = !array_key_exists('public', $service) || (Boolean) $service['public'];
$this->container->setAlias($id, new Alias($service['alias'], $public));
@ -285,7 +285,7 @@ class YamlFileLoader extends FileLoader
{
if (is_array($value)) {
$value = array_map(array($this, 'resolveServices'), $value);
} else if (is_string($value) && 0 === strpos($value, '@')) {
} elseif (is_string($value) && 0 === strpos($value, '@')) {
if (0 === strpos($value, '@?')) {
$value = substr($value, 2);
$invalidBehavior = ContainerInterface::IGNORE_ON_INVALID_REFERENCE;

View File

@ -47,7 +47,7 @@ class TimezoneChoiceList implements ChoiceListInterface
if (count($parts) > 2) {
$region = $parts[0];
$name = $parts[1].' - '.$parts[2];
} else if (count($parts) > 1) {
} elseif (count($parts) > 1) {
$region = $parts[0];
$name = $parts[1];
} else {

View File

@ -107,11 +107,11 @@ class DateTimeType extends AbstractType
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], $format)
));
} else if ($options['input'] === 'timestamp') {
} elseif ($options['input'] === 'timestamp') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone'])
));
} else if ($options['input'] === 'array') {
} elseif ($options['input'] === 'array') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], $parts)
));

View File

@ -112,11 +112,11 @@ class DateType extends AbstractType
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], 'Y-m-d')
));
} else if ($options['input'] === 'timestamp') {
} elseif ($options['input'] === 'timestamp') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone'])
));
} else if ($options['input'] === 'array') {
} elseif ($options['input'] === 'array') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], array('year', 'month', 'day'))
));

View File

@ -104,7 +104,7 @@ class MoneyType extends AbstractType
if (!empty($matches[1])) {
self::$patterns[\Locale::getDefault()] = $matches[1].' {{ widget }}';
} else if (!empty($matches[2])) {
} elseif (!empty($matches[2])) {
self::$patterns[\Locale::getDefault()] = '{{ widget }} '.$matches[2];
} else {
self::$patterns[\Locale::getDefault()] = '{{ widget }}';

View File

@ -90,11 +90,11 @@ class TimeType extends AbstractType
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToStringTransformer($options['data_timezone'], $options['data_timezone'], $format)
));
} else if ($options['input'] === 'timestamp') {
} elseif ($options['input'] === 'timestamp') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToTimestampTransformer($options['data_timezone'], $options['data_timezone'])
));
} else if ($options['input'] === 'array') {
} elseif ($options['input'] === 'array') {
$builder->appendNormTransformer(new ReversedTransformer(
new DateTimeToArrayTransformer($options['data_timezone'], $options['data_timezone'], $parts)
));

View File

@ -192,7 +192,7 @@ class PropertyPath implements \IteratorAggregate
$value = $this->readProperty($objectOrArray, $i);
// arrays need to be treated separately (due to PHP bug?)
// http://bugs.php.net/bug.php?id=52133
} else if (is_array($objectOrArray)){
} elseif (is_array($objectOrArray)){
$property = $this->elements[$i];
if (!array_key_exists($property, $objectOrArray)) {
$objectOrArray[$property] = $i + 1 < $this->length ? array() : null;
@ -242,7 +242,7 @@ class PropertyPath implements \IteratorAggregate
$nestedObject = $this->readProperty($objectOrArray, $i);
// arrays need to be treated separately (due to PHP bug?)
// http://bugs.php.net/bug.php?id=52133
} else if (is_array($objectOrArray)) {
} elseif (is_array($objectOrArray)) {
$property = $this->elements[$i];
if (!array_key_exists($property, $objectOrArray)) {
$objectOrArray[$property] = array();
@ -294,22 +294,22 @@ class PropertyPath implements \IteratorAggregate
}
return $object->$getter();
} else if ($reflClass->hasMethod($isser)) {
} elseif ($reflClass->hasMethod($isser)) {
if (!$reflClass->getMethod($isser)->isPublic()) {
throw new PropertyAccessDeniedException(sprintf('Method "%s()" is not public in class "%s"', $isser, $reflClass->getName()));
}
return $object->$isser();
} else if ($reflClass->hasMethod('__get')) {
} elseif ($reflClass->hasMethod('__get')) {
// needed to support magic method __get
return $object->$property;
} else if ($reflClass->hasProperty($property)) {
} elseif ($reflClass->hasProperty($property)) {
if (!$reflClass->getProperty($property)->isPublic()) {
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()" or "%s()"?', $property, $reflClass->getName(), $getter, $isser));
}
return $object->$property;
} else if (property_exists($object, $property)) {
} elseif (property_exists($object, $property)) {
// needed to support \stdClass instances
return $object->$property;
} else {
@ -335,7 +335,7 @@ class PropertyPath implements \IteratorAggregate
}
$objectOrArray[$property] = $value;
} else if (is_object($objectOrArray)) {
} elseif (is_object($objectOrArray)) {
$reflClass = new \ReflectionClass($objectOrArray);
$setter = 'set'.$this->camelize($property);
@ -345,16 +345,16 @@ class PropertyPath implements \IteratorAggregate
}
$objectOrArray->$setter($value);
} else if ($reflClass->hasMethod('__set')) {
} elseif ($reflClass->hasMethod('__set')) {
// needed to support magic method __set
$objectOrArray->$property = $value;
} else if ($reflClass->hasProperty($property)) {
} elseif ($reflClass->hasProperty($property)) {
if (!$reflClass->getProperty($property)->isPublic()) {
throw new PropertyAccessDeniedException(sprintf('Property "%s" is not public in class "%s". Maybe you should create the method "%s()"?', $property, $reflClass->getName(), $setter));
}
$objectOrArray->$property = $value;
} else if (property_exists($objectOrArray, $property)) {
} elseif (property_exists($objectOrArray, $property)) {
// needed to support \stdClass instances
$objectOrArray->$property = $value;
} else {

View File

@ -113,7 +113,7 @@ class ParameterBag
}
$currentKey = '';
} else if (']' === $char) {
} elseif (']' === $char) {
if (null === $currentKey) {
throw new \InvalidArgumentException(sprintf('Malformed path. Unexpected "]" at position %d.', $i));
}

View File

@ -206,9 +206,9 @@ class Filesystem
if (is_link($file)) {
$this->symlink($file, $target);
} else if (is_dir($file)) {
} elseif (is_dir($file)) {
$this->mkdir($target);
} else if (is_file($file) || ($copyOnWindows && is_link($file))) {
} elseif (is_file($file) || ($copyOnWindows && is_link($file))) {
$this->copy($file, $target, isset($options['override']) ? $options['override'] : false);
} else {
throw new \RuntimeException(sprintf('Unable to guess "%s" file type.', $file));

View File

@ -33,7 +33,7 @@ class Hour2400Transformer extends HourTransformer
{
if ('AM' == $marker) {
$hour = 0;
} else if ('PM' == $marker) {
} elseif ('PM' == $marker) {
$hour = 12;
}

View File

@ -36,7 +36,7 @@ class Hour2401Transformer extends HourTransformer
{
if ((null === $marker && 24 === $hour) || 'AM' == $marker) {
$hour = 0;
} else if ('PM' == $marker) {
} elseif ('PM' == $marker) {
$hour = 12;
}

View File

@ -497,7 +497,7 @@ QUERY;
$acl = $acls[$aclId];
// has the ACL been hydrated during any previous cycle, or was possibly loaded
// from cache?
} else if (isset($loadedAcls[$classType][$objectIdentifier])) {
} elseif (isset($loadedAcls[$classType][$objectIdentifier])) {
$acl = $loadedAcls[$classType][$objectIdentifier];
// keep reference in local array (saves us some hash calculations)

View File

@ -512,7 +512,7 @@ QUERY;
if ($sid instanceof UserSecurityIdentity) {
$identifier = $sid->getClass().'-'.$sid->getUsername();
$username = true;
} else if ($sid instanceof RoleSecurityIdentity) {
} elseif ($sid instanceof RoleSecurityIdentity) {
$identifier = $sid->getRole();
$username = false;
} else {
@ -580,7 +580,7 @@ QUERY;
if ($sid instanceof UserSecurityIdentity) {
$identifier = $sid->getClass().'-'.$sid->getUsername();
$username = true;
} else if ($sid instanceof RoleSecurityIdentity) {
} elseif ($sid instanceof RoleSecurityIdentity) {
$identifier = $sid->getRole();
$username = false;
} else {

View File

@ -37,7 +37,7 @@ abstract class AuditLogger implements AuditLoggerInterface
if ($granted && $ace->isAuditSuccess()) {
$this->doLog($granted, $ace);
} else if (!$granted && $ace->isAuditFailure()) {
} elseif (!$granted && $ace->isAuditFailure()) {
$this->doLog($granted, $ace);
}
}

View File

@ -61,7 +61,7 @@ final class ObjectIdentity implements ObjectIdentityInterface
try {
if ($domainObject instanceof DomainObjectInterface) {
return new self($domainObject->getObjectIdentifier(), get_class($domainObject));
} else if (method_exists($domainObject, 'getId')) {
} elseif (method_exists($domainObject, 'getId')) {
return new self($domainObject->getId(), get_class($domainObject));
}
} catch (\InvalidArgumentException $invalid) {

View File

@ -197,9 +197,9 @@ class PermissionGrantingStrategy implements PermissionGrantingStrategyInterface
$strategy = $ace->getStrategy();
if (self::ALL === $strategy) {
return $requiredMask === ($ace->getMask() & $requiredMask);
} else if (self::ANY === $strategy) {
} elseif (self::ANY === $strategy) {
return 0 !== ($ace->getMask() & $requiredMask);
} else if (self::EQUAL === $strategy) {
} elseif (self::EQUAL === $strategy) {
return $requiredMask === $ace->getMask();
}

View File

@ -69,10 +69,10 @@ class SecurityIdentityRetrievalStrategy implements SecurityIdentityRetrievalStra
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_FULLY);
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED);
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY);
} else if ($this->authenticationTrustResolver->isRememberMe($token)) {
} elseif ($this->authenticationTrustResolver->isRememberMe($token)) {
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_REMEMBERED);
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY);
} else if ($this->authenticationTrustResolver->isAnonymous($token)) {
} elseif ($this->authenticationTrustResolver->isAnonymous($token)) {
$sids[] = new RoleSecurityIdentity(AuthenticatedVoter::IS_AUTHENTICATED_ANONYMOUSLY);
}

View File

@ -94,7 +94,7 @@ class MaskBuilder
{
if (is_string($mask) && defined($name = 'static::MASK_'.strtoupper($mask))) {
$mask = constant($name);
} else if (!is_int($mask)) {
} elseif (!is_int($mask)) {
throw new \InvalidArgumentException('$mask must be an integer.');
}
@ -147,7 +147,7 @@ class MaskBuilder
{
if (is_string($mask) && defined($name = 'static::MASK_'.strtoupper($mask))) {
$mask = constant($name);
} else if (!is_int($mask)) {
} elseif (!is_int($mask)) {
throw new \InvalidArgumentException('$mask must be an integer.');
}

View File

@ -64,7 +64,7 @@ class AclVoter implements VoterInterface
}
return $this->allowIfObjectIdentityUnavailable ? self::ACCESS_GRANTED : self::ACCESS_ABSTAIN;
} else if ($object instanceof FieldVote) {
} elseif ($object instanceof FieldVote) {
$field = $object->getField();
$object = $object->getDomainObject();
} else {
@ -73,7 +73,7 @@ class AclVoter implements VoterInterface
if ($object instanceof ObjectIdentityInterface) {
$oid = $object;
} else if (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) {
} elseif (null === $oid = $this->objectIdentityRetrievalStrategy->getObjectIdentity($object)) {
if (null !== $this->logger) {
$this->logger->debug(sprintf('Object identity unavailable. Voting to %s', $this->allowIfObjectIdentityUnavailable? 'grant access' : 'abstain'));
}
@ -96,7 +96,7 @@ class AclVoter implements VoterInterface
}
return self::ACCESS_GRANTED;
} else if (null !== $field && $acl->isFieldGranted($field, $masks, $sids, false)) {
} elseif (null !== $field && $acl->isFieldGranted($field, $masks, $sids, false)) {
if (null !== $this->logger) {
$this->logger->debug('ACL found, permission granted. Voting to grant access');
}

View File

@ -42,7 +42,7 @@ abstract class AbstractToken implements TokenInterface
foreach ($roles as $role) {
if (is_string($role)) {
$role = new Role($role);
} else if (!$role instanceof RoleInterface) {
} elseif (!$role instanceof RoleInterface) {
throw new \InvalidArgumentException(sprintf('$roles must be an array of strings, or RoleInterface instances, but got %s.', gettype($role)));
}
@ -83,13 +83,13 @@ abstract class AbstractToken implements TokenInterface
if (null === $this->user) {
$changed = false;
} else if ($this->user instanceof UserInterface) {
} elseif ($this->user instanceof UserInterface) {
if (!$user instanceof UserInterface) {
$changed = true;
} else {
$changed = !$this->user->equals($user);
}
} else if ($user instanceof UserInterface) {
} elseif ($user instanceof UserInterface) {
$changed = true;
} else {
$changed = (string) $this->user !== (string) $user;

View File

@ -144,7 +144,7 @@ abstract class AbstractAuthenticationListener implements ListenerInterface
$this->sessionStrategy->onAuthentication($request, $returnValue);
$response = $this->onSuccess($event, $request, $returnValue);
} else if ($returnValue instanceof Response) {
} elseif ($returnValue instanceof Response) {
$response = $returnValue;
} else {
throw new \RuntimeException('attemptAuthentication() must either return a Response, an implementation of TokenInterface, or null.');

View File

@ -79,7 +79,7 @@ class GetSetMethodNormalizer extends SerializerAwareNormalizer
$params[] = $data[$paramName];
// don't run set for a parameter passed to the constructor
unset($data[$paramName]);
} else if (!$constructorParameter->isOptional()) {
} elseif (!$constructorParameter->isOptional()) {
throw new RuntimeException(
'Cannot create an instance of '.$class.
' from serialized data because its constructor requires '.

View File

@ -100,7 +100,7 @@ abstract class Constraint
$invalidOptions[] = $option;
}
}
} else if (null !== $options && ! (is_array($options) && count($options) === 0)) {
} elseif (null !== $options && ! (is_array($options) && count($options) === 0)) {
$option = $this->getDefaultOption();
if (null === $option) {

View File

@ -54,7 +54,7 @@ class ChoiceValidator extends ConstraintValidator
if ($constraint->callback) {
if (is_callable(array($this->context->getCurrentClass(), $constraint->callback))) {
$choices = call_user_func(array($this->context->getCurrentClass(), $constraint->callback));
} else if (is_callable($constraint->callback)) {
} elseif (is_callable($constraint->callback)) {
$choices = call_user_func($constraint->callback);
} else {
throw new ConstraintDefinitionException('The Choice constraint expects a valid callback');

View File

@ -81,11 +81,11 @@ class FileValidator extends ConstraintValidator
$size = filesize($path);
$limit = $constraint->maxSize;
$suffix = ' bytes';
} else if (preg_match('/^(\d+)k$/', $constraint->maxSize, $matches)) {
} elseif (preg_match('/^(\d+)k$/', $constraint->maxSize, $matches)) {
$size = round(filesize($path) / 1000, 2);
$limit = $matches[1];
$suffix = ' kB';
} else if (preg_match('/^(\d+)M$/', $constraint->maxSize, $matches)) {
} elseif (preg_match('/^(\d+)M$/', $constraint->maxSize, $matches)) {
$size = round(filesize($path) / 1000000, 2);
$limit = $matches[1];
$suffix = ' MB';

View File

@ -40,7 +40,7 @@ class TypeValidator extends ConstraintValidator
if (function_exists($function) && call_user_func($function, $value)) {
return true;
} else if ($value instanceof $constraint->type) {
} elseif ($value instanceof $constraint->type) {
return true;
}

View File

@ -186,7 +186,7 @@ class ClassMetadata extends ElementMetadata
if ($member instanceof PropertyMetadata && !isset($this->properties[$property])) {
$this->properties[$property] = $member;
} else if ($member instanceof GetterMetadata && !isset($this->getters[$property])) {
} elseif ($member instanceof GetterMetadata && !isset($this->getters[$property])) {
$this->getters[$property] = $member;
}
}

View File

@ -28,7 +28,7 @@ class GetterMetadata extends MemberMetadata
if (method_exists($class, $getMethod)) {
$method = $getMethod;
} else if (method_exists($class, $isMethod)) {
} elseif (method_exists($class, $isMethod)) {
$method = $isMethod;
} else {
throw new ValidatorException(sprintf('Neither method %s nor %s exists in class %s', $getMethod, $isMethod, $class));

View File

@ -58,7 +58,7 @@ abstract class FileLoader implements LoaderInterface
{
if (strpos($name, '\\') !== false && class_exists($name)) {
$className = (string) $name;
} else if (strpos($name, ':') !== false) {
} elseif (strpos($name, ':') !== false) {
list($prefix, $className) = explode(':', $name, 2);
if (!isset($this->namespaces[$prefix])) {

View File

@ -80,14 +80,14 @@ class XmlFileLoader extends FileLoader
if (count($node) > 0) {
if (count($node->value) > 0) {
$options = $this->parseValues($node->value);
} else if (count($node->constraint) > 0) {
} elseif (count($node->constraint) > 0) {
$options = $this->parseConstraints($node->constraint);
} else if (count($node->option) > 0) {
} elseif (count($node->option) > 0) {
$options = $this->parseOptions($node->option);
} else {
$options = array();
}
} else if (strlen((string) $node) > 0) {
} elseif (strlen((string) $node) > 0) {
$options = trim($node);
} else {
$options = null;
@ -114,7 +114,7 @@ class XmlFileLoader extends FileLoader
if (count($node) > 0) {
if (count($node->value) > 0) {
$value = $this->parseValues($node->value);
} else if (count($node->constraint) > 0) {
} elseif (count($node->constraint) > 0) {
$value = $this->parseConstraints($node->constraint);
} else {
$value = array();
@ -148,7 +148,7 @@ class XmlFileLoader extends FileLoader
if (count($node) > 0) {
if (count($node->value) > 0) {
$value = $this->parseValues($node->value);
} else if (count($node->constraint) > 0) {
} elseif (count($node->constraint) > 0) {
$value = $this->parseConstraints($node->constraint);
} else {
$value = array();

View File

@ -110,7 +110,7 @@ class ValidatorFactory implements ValidatorContextInterface
if ($extension === 'xml') {
$xmlMappingFiles[] = $file;
} else if ($extension === 'yaml' || $extension === 'yml') {
} elseif ($extension === 'yaml' || $extension === 'yml') {
$yamlMappingFiles[] = $file;
} else {
throw new MappingException('The only supported mapping file formats are XML and YAML');
@ -135,7 +135,7 @@ class ValidatorFactory implements ValidatorContextInterface
if (count($loaders) > 1) {
$loader = new LoaderChain($loaders);
} else if (count($loaders) === 1) {
} elseif (count($loaders) === 1) {
$loader = $loaders[0];
} else {
throw new MappingException('No mapping loader was found for the given parameters');

View File

@ -171,7 +171,7 @@ class Inline
if (false !== $strpos = strpos($output, ' #')) {
$output = rtrim(substr($output, 0, $strpos));
}
} else if (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
} elseif (preg_match('/^(.+?)('.implode('|', $delimiters).')/', substr($scalar, $i), $match)) {
$output = $match[1];
$i += strlen($output);
} else {

View File

@ -103,7 +103,7 @@ class Parser
$data[] = $this->parseValue($values['value']);
}
}
} else if (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) {
} elseif (preg_match('#^(?P<key>'.Inline::REGEX_QUOTED_STRING.'|[^ \'"\[\{].*?) *\:(\s+(?P<value>.+?))?\s*$#u', $this->currentLine, $values)) {
try {
$key = Inline::parseScalar($values['key']);
} catch (ParseException $e) {
@ -133,7 +133,7 @@ class Parser
$merged = array();
if (!is_array($parsed)) {
throw new ParseException('YAML merge keys used with a scalar value instead of an array.', $this->getRealCurrentLineNb() + 1, $this->currentLine);
} else if (isset($parsed[0])) {
} elseif (isset($parsed[0])) {
// Numeric array, merge individual elements
foreach (array_reverse($parsed) as $parsedItem) {
if (!is_array($parsedItem)) {
@ -148,7 +148,7 @@ class Parser
$isProcessed = $merged;
}
} else if (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
} elseif (isset($values['value']) && preg_match('#^&(?P<ref>[^ ]+) *(?P<value>.*)#u', $values['value'], $matches)) {
$isRef = $matches['ref'];
$values['value'] = $matches['value'];
}
@ -157,7 +157,7 @@ class Parser
// Merge keys
$data = $isProcessed;
// hash
} else if (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
} elseif (!isset($values['value']) || '' == trim($values['value'], ' ') || 0 === strpos(ltrim($values['value'], ' '), '#')) {
// if next line is less indented or equal, then it means that the current value is null
if ($this->isNextLineIndented()) {
$data[$key] = null;
@ -298,9 +298,9 @@ class Parser
if (preg_match('#^(?P<text> *)$#', $this->currentLine, $match)) {
// empty line
$data[] = $match['text'];
} else if ($indent >= $newIndent) {
} elseif ($indent >= $newIndent) {
$data[] = substr($this->currentLine, $newIndent);
} else if (0 == $indent) {
} elseif (0 == $indent) {
$this->moveToPreviousLine();
break;
@ -423,7 +423,7 @@ class Parser
$previousIndent = $matches['indent'];
$text .= str_repeat(' ', $diff = strlen($matches['indent']) - strlen($textIndent)).$matches['text'].($diff ? "\n" : $separator);
} else if (preg_match('#^(?P<text> *)$#', $this->currentLine, $matches)) {
} elseif (preg_match('#^(?P<text> *)$#', $this->currentLine, $matches)) {
$text .= preg_replace('#^ {1,'.strlen($textIndent).'}#', '', $matches['text'])."\n";
} else {
$this->moveToPreviousLine();

View File

@ -165,7 +165,7 @@ class HttpCacheTestCase extends \PHPUnit_Framework_TestCase
{
if (is_link($directory.'/'.$file)) {
unlink($directory.'/'.$file);
} else if (is_dir($directory.'/'.$file)) {
} elseif (is_dir($directory.'/'.$file)) {
self::clearDirectory($directory.'/'.$file);
rmdir($directory.'/'.$file);
} else {

View File

@ -195,7 +195,7 @@ class AclProviderBenchmarkTest extends \PHPUnit_Framework_TestCase
$strategy = rand(0, 2);
if ($strategy === 0) {
$strategy = PermissionGrantingStrategy::ALL;
} else if ($strategy === 1) {
} elseif ($strategy === 1) {
$strategy = PermissionGrantingStrategy::ANY;
} else {
$strategy = PermissionGrantingStrategy::EQUAL;

View File

@ -148,7 +148,7 @@ class SecurityIdentityRetrievalStrategyTest extends \PHPUnit_Framework_TestCase
->expects($this->never())
->method('isRememberMe')
;
} else if ('rememberMe' === $authenticationStatus) {
} elseif ('rememberMe' === $authenticationStatus) {
$trustResolver
->expects($this->once())
->method('isFullFledged')

View File

@ -70,7 +70,7 @@ class AuthenticatedVoterTest extends \PHPUnit_Framework_TestCase
{
if ('fully' === $authenticated) {
return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\TokenInterface');
} else if ('remembered' === $authenticated) {
} elseif ('remembered' === $authenticated) {
return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\RememberMeToken', array('setPersistent'), array(), '', false);
} else {
return $this->getMock('Symfony\Component\Security\Core\Authentication\Token\AnonymousToken', null, array('', ''));

View File

@ -50,7 +50,7 @@ class DumperTest extends \PHPUnit_Framework_TestCase
$test = $this->parser->parse($yaml);
if (isset($test['dump_skip']) && $test['dump_skip']) {
continue;
} else if (isset($test['todo']) && $test['todo']) {
} elseif (isset($test['todo']) && $test['todo']) {
// TODO
} else {
$expected = eval('return '.trim($test['php']).';');