diff --git a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
index 0888f97ca91d8..626a1313af894 100644
--- a/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
+++ b/src/Symfony/Bridge/Doctrine/ContainerAwareEventManager.php
@@ -56,7 +56,7 @@ public function dispatchEvent($eventName, EventArgs $eventArgs = null)
$initialized = isset($this->initialized[$eventName]);
foreach ($this->listeners[$eventName] as $hash => $listener) {
- if (!$initialized && is_string($listener)) {
+ if (!$initialized && \is_string($listener)) {
$this->listeners[$eventName][$hash] = $listener = $this->container->get($listener);
}
@@ -100,7 +100,7 @@ public function hasListeners($event)
*/
public function addEventListener($events, $listener)
{
- if (is_string($listener)) {
+ if (\is_string($listener)) {
if ($this->initialized) {
throw new \RuntimeException('Adding lazy-loading listeners after construction is not supported.');
}
@@ -126,7 +126,7 @@ public function addEventListener($events, $listener)
*/
public function removeEventListener($events, $listener)
{
- if (is_string($listener)) {
+ if (\is_string($listener)) {
$hash = '_service_'.$listener;
} else {
// Picks the hash code related to that listener
diff --git a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
index a57b9ae6ea151..2580c1b88dc9d 100644
--- a/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
+++ b/src/Symfony/Bridge/Doctrine/DataCollector/DoctrineDataCollector.php
@@ -120,14 +120,14 @@ private function sanitizeQuery($connectionName, $query)
if (null === $query['params']) {
$query['params'] = array();
}
- if (!is_array($query['params'])) {
+ if (!\is_array($query['params'])) {
$query['params'] = array($query['params']);
}
foreach ($query['params'] as $j => $param) {
if (isset($query['types'][$j])) {
// Transform the param according to the type
$type = $query['types'][$j];
- if (is_string($type)) {
+ if (\is_string($type)) {
$type = Type::getType($type);
}
if ($type instanceof Type) {
@@ -158,11 +158,11 @@ private function sanitizeQuery($connectionName, $query)
*/
private function sanitizeParam($var)
{
- if (is_object($var)) {
- return array(sprintf('Object(%s)', get_class($var)), false);
+ if (\is_object($var)) {
+ return array(sprintf('Object(%s)', \get_class($var)), false);
}
- if (is_array($var)) {
+ if (\is_array($var)) {
$a = array();
$original = true;
foreach ($var as $k => $v) {
@@ -174,7 +174,7 @@ private function sanitizeParam($var)
return array($a, $original);
}
- if (is_resource($var)) {
+ if (\is_resource($var)) {
return array(sprintf('Resource(%s)', get_resource_type($var)), false);
}
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
index c0623572ec606..d4ef3b828ba72 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/AbstractDoctrineExtension.php
@@ -162,7 +162,7 @@ protected function getMappingDriverBundleConfigDefaults(array $bundleConfig, \Re
}
if (!$bundleConfig['dir']) {
- if (in_array($bundleConfig['type'], array('annotation', 'staticphp'))) {
+ if (\in_array($bundleConfig['type'], array('annotation', 'staticphp'))) {
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingObjectDefaultName();
} else {
$bundleConfig['dir'] = $bundleDir.'/'.$this->getMappingResourceConfigDirectory();
@@ -249,7 +249,7 @@ protected function assertValidMappingConfiguration(array $mappingConfig, $object
throw new \InvalidArgumentException(sprintf('Specified non-existing directory "%s" as Doctrine mapping source.', $mappingConfig['dir']));
}
- if (!in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
+ if (!\in_array($mappingConfig['type'], array('xml', 'yml', 'annotation', 'php', 'staticphp'))) {
throw new \InvalidArgumentException(sprintf('Can only configure "xml", "yml", "annotation", "php" or '.
'"staticphp" through the DoctrineBundle. Use your own bundle to configure other metadata drivers. '.
'You can register them by adding a new driver to the '.
@@ -278,11 +278,11 @@ protected function detectMetadataDriver($dir, ContainerBuilder $container)
$container->addResource(new FileResource($resource));
$extension = $this->getMappingResourceExtension();
- if (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.xml')) && count($files)) {
+ if (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.xml')) && \count($files)) {
return 'xml';
- } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.yml')) && count($files)) {
+ } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.yml')) && \count($files)) {
return 'yml';
- } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.php')) && count($files)) {
+ } elseif (($files = glob($dir.'/'.$configPath.'/*.'.$extension.'.php')) && \count($files)) {
return 'php';
}
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
index cb4a4816db70a..c4f6d12839ea4 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterEventListenersAndSubscribersPass.php
@@ -156,7 +156,7 @@ private function findAndSortTags($tagName, ContainerBuilder $container)
if ($sortedTags) {
krsort($sortedTags);
- $sortedTags = call_user_func_array('array_merge', $sortedTags);
+ $sortedTags = \call_user_func_array('array_merge', $sortedTags);
}
return $sortedTags;
diff --git a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
index 7f169fe1ae696..2be3c7cc2b7ed 100644
--- a/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
+++ b/src/Symfony/Bridge/Doctrine/DependencyInjection/CompilerPass/RegisterMappingsPass.php
@@ -126,7 +126,7 @@ public function __construct($driver, array $namespaces, array $managerParameters
$this->managerParameters = $managerParameters;
$this->driverPattern = $driverPattern;
$this->enabledParameter = $enabledParameter;
- if (count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
+ if (\count($aliasMap) && (!$configurationPattern || !$registerAliasMethodName)) {
throw new \InvalidArgumentException('configurationPattern and registerAliasMethodName are required to register namespace alias');
}
$this->configurationPattern = $configurationPattern;
@@ -153,7 +153,7 @@ public function process(ContainerBuilder $container)
$chainDriverDef->addMethodCall('addDriver', array($mappingDriverDef, $namespace));
}
- if (!count($this->aliasMap)) {
+ if (!\count($this->aliasMap)) {
return;
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
index 02280c4fe8785..3d697f03238c4 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/DoctrineChoiceLoader.php
@@ -110,7 +110,7 @@ public function loadValuesForChoices(array $choices, $value = null)
// Optimize performance for single-field identifiers. We already
// know that the IDs are used as values
- $optimize = null === $value || is_array($value) && $value[0] === $this->idReader;
+ $optimize = null === $value || \is_array($value) && $value[0] === $this->idReader;
// Attention: This optimization does not check choices for existence
if ($optimize && !$this->choiceList && $this->idReader->isSingleId()) {
@@ -147,7 +147,7 @@ public function loadChoicesForValues(array $values, $value = null)
// Optimize performance in case we have an object loader and
// a single-field identifier
- $optimize = null === $value || is_array($value) && $value[0] === $this->idReader;
+ $optimize = null === $value || \is_array($value) && $value[0] === $this->idReader;
if ($optimize && !$this->choiceList && $this->objectLoader && $this->idReader->isSingleId()) {
$unorderedObjects = $this->objectLoader->getEntitiesByIds($this->idReader->getIdField(), $values);
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
index 72d7a6f10bd4f..a31f9523a42cf 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/EntityChoiceList.php
@@ -117,7 +117,7 @@ public function __construct(ObjectManager $manager, $class, $labelPath = null, E
$this->entityLoader = $entityLoader;
$this->classMetadata = $manager->getClassMetadata($class);
$this->class = $this->classMetadata->getName();
- $this->loaded = is_array($entities) || $entities instanceof \Traversable;
+ $this->loaded = \is_array($entities) || $entities instanceof \Traversable;
$this->preferredEntities = $preferredEntities;
list(
$this->idAsIndex,
@@ -453,13 +453,13 @@ private function getIdentifierInfoForClass(ClassMetadata $classMetadata)
$identifiers = $classMetadata->getIdentifierFieldNames();
- if (1 === count($identifiers)) {
+ if (1 === \count($identifiers)) {
$identifier = $identifiers[0];
if (!$classMetadata->hasAssociation($identifier)) {
$idAsValue = true;
- if (in_array($classMetadata->getTypeOfField($identifier), array('integer', 'smallint', 'bigint'))) {
+ if (\in_array($classMetadata->getTypeOfField($identifier), array('integer', 'smallint', 'bigint'))) {
$idAsIndex = true;
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
index 0161adf3b4c0a..004b00d0554f2 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/IdReader.php
@@ -61,8 +61,8 @@ public function __construct(ObjectManager $om, ClassMetadata $classMetadata)
$this->om = $om;
$this->classMetadata = $classMetadata;
- $this->singleId = 1 === count($ids);
- $this->intId = $this->singleId && in_array($idType, array('integer', 'smallint', 'bigint'));
+ $this->singleId = 1 === \count($ids);
+ $this->intId = $this->singleId && \in_array($idType, array('integer', 'smallint', 'bigint'));
$this->idField = current($ids);
// single field association are resolved, since the schema column could be an int
diff --git a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
index 8d73c32d9e04b..e7827929de481 100644
--- a/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
+++ b/src/Symfony/Bridge/Doctrine/Form/ChoiceList/ORMQueryBuilderLoader.php
@@ -98,7 +98,7 @@ public function getEntitiesByIds($identifier, array $values)
// Guess type
$entity = current($qb->getRootEntities());
$metadata = $qb->getEntityManager()->getClassMetadata($entity);
- if (in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
+ if (\in_array($metadata->getTypeOfField($identifier), array('integer', 'bigint', 'smallint'))) {
$parameterType = Connection::PARAM_INT_ARRAY;
// Filter out non-integer values (e.g. ""). If we don't, some
@@ -106,7 +106,7 @@ public function getEntitiesByIds($identifier, array $values)
$values = array_values(array_filter($values, function ($v) {
return (string) $v === (string) (int) $v || ctype_digit($v);
}));
- } elseif (in_array($metadata->getTypeOfField($identifier), array('uuid', 'guid'))) {
+ } elseif (\in_array($metadata->getTypeOfField($identifier), array('uuid', 'guid'))) {
$parameterType = Connection::PARAM_STR_ARRAY;
// Like above, but we just filter out empty strings.
diff --git a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php
index e56674be351c5..4d369504d5130 100644
--- a/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php
+++ b/src/Symfony/Bridge/Doctrine/Form/DataTransformer/CollectionToArrayTransformer.php
@@ -38,7 +38,7 @@ public function transform($collection)
// For cases when the collection getter returns $collection->toArray()
// in order to prevent modifications of the returned collection
- if (is_array($collection)) {
+ if (\is_array($collection)) {
return $collection;
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
index ebdcb02ca77a4..939d6a13e74fb 100644
--- a/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
+++ b/src/Symfony/Bridge/Doctrine/Form/DoctrineOrmTypeGuesser.php
@@ -131,7 +131,7 @@ public function guessMaxLength($class, $property)
return new ValueGuess($mapping['length'], Guess::HIGH_CONFIDENCE);
}
- if (in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
+ if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
}
@@ -144,7 +144,7 @@ public function guessPattern($class, $property)
{
$ret = $this->getMetadata($class);
if ($ret && $ret[0]->hasField($property) && !$ret[0]->hasAssociation($property)) {
- if (in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
+ if (\in_array($ret[0]->getTypeOfField($property), array(Type::DECIMAL, Type::FLOAT))) {
return new ValueGuess(null, Guess::MEDIUM_CONFIDENCE);
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php
index bb4cfa5087c49..8f96f3677c8b9 100644
--- a/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php
+++ b/src/Symfony/Bridge/Doctrine/Form/EventListener/MergeDoctrineCollectionListener.php
@@ -41,7 +41,7 @@ public function onBind(FormEvent $event)
// If all items were removed, call clear which has a higher
// performance on persistent collections
- if ($collection instanceof Collection && 0 === count($data)) {
+ if ($collection instanceof Collection && 0 === \count($data)) {
$collection->clear();
}
}
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
index 17036a591322a..299c494b782c3 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/DoctrineType.php
@@ -260,7 +260,7 @@ public function configureOptions(OptionsResolver $resolver)
// for equal query builders
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
if (is_callable($queryBuilder)) {
- $queryBuilder = call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
+ $queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
}
return $queryBuilder;
diff --git a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
index fef097d3ea60d..4bb3cdab66c8a 100644
--- a/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
+++ b/src/Symfony/Bridge/Doctrine/Form/Type/EntityType.php
@@ -29,7 +29,7 @@ public function configureOptions(OptionsResolver $resolver)
// for equal query builders
$queryBuilderNormalizer = function (Options $options, $queryBuilder) {
if (is_callable($queryBuilder)) {
- $queryBuilder = call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
+ $queryBuilder = \call_user_func($queryBuilder, $options['em']->getRepository($options['class']));
if (!$queryBuilder instanceof QueryBuilder) {
throw new UnexpectedTypeException($queryBuilder, 'Doctrine\ORM\QueryBuilder');
diff --git a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
index acd8cc0fcd510..65a973646e129 100644
--- a/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
+++ b/src/Symfony/Bridge/Doctrine/Logger/DbalLogger.php
@@ -79,12 +79,12 @@ private function normalizeParams(array $params)
{
foreach ($params as $index => $param) {
// normalize recursively
- if (is_array($param)) {
+ if (\is_array($param)) {
$params[$index] = $this->normalizeParams($param);
continue;
}
- if (!is_string($params[$index])) {
+ if (!\is_string($params[$index])) {
continue;
}
@@ -101,7 +101,7 @@ private function normalizeParams(array $params)
continue;
}
} else {
- if (self::MAX_STRING_LENGTH < strlen($params[$index])) {
+ if (self::MAX_STRING_LENGTH < \strlen($params[$index])) {
$params[$index] = substr($params[$index], 0, self::MAX_STRING_LENGTH - 6).' [...]';
continue;
}
diff --git a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
index 058eb7167e961..773823948b5eb 100644
--- a/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
+++ b/src/Symfony/Bridge/Doctrine/Security/User/EntityUserProvider.php
@@ -51,7 +51,7 @@ public function loadUserByUsername($username)
$user = $repository->findOneBy(array($this->property => $username));
} else {
if (!$repository instanceof UserProviderInterface) {
- throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Component\Security\Core\User\UserProviderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, get_class($repository)));
+ throw new \InvalidArgumentException(sprintf('You must either make the "%s" entity Doctrine Repository ("%s") implement "Symfony\Component\Security\Core\User\UserProviderInterface" or set the "property" option in the corresponding entity provider configuration.', $this->classOrAlias, \get_class($repository)));
}
$user = $repository->loadUserByUsername($username);
@@ -71,7 +71,7 @@ public function refreshUser(UserInterface $user)
{
$class = $this->getClass();
if (!$user instanceof $class) {
- throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', get_class($user)));
+ throw new UnsupportedUserException(sprintf('Instances of "%s" are not supported.', \get_class($user)));
}
$repository = $this->getRepository();
diff --git a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
index 860162a77d5d2..c8f35aa31de79 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/DependencyInjection/DoctrineExtensionTest.php
@@ -68,7 +68,7 @@ public function testFixManagersAutoMappingsWithTwoAutomappings()
'SecondBundle' => 'My\SecondBundle',
);
- $reflection = new \ReflectionClass(get_class($this->extension));
+ $reflection = new \ReflectionClass(\get_class($this->extension));
$method = $reflection->getMethod('fixManagersAutoMappings');
$method->setAccessible(true);
@@ -157,7 +157,7 @@ public function testFixManagersAutoMappings(array $originalEm1, array $originalE
'SecondBundle' => 'My\SecondBundle',
);
- $reflection = new \ReflectionClass(get_class($this->extension));
+ $reflection = new \ReflectionClass(\get_class($this->extension));
$method = $reflection->getMethod('fixManagersAutoMappings');
$method->setAccessible(true);
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
index f72d7d09d0f95..a318030841c29 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Form/Type/EntityTypePerformanceTest.php
@@ -72,7 +72,7 @@ protected function setUp()
$ids = range(1, 300);
foreach ($ids as $id) {
- $name = 65 + (int) chr($id % 57);
+ $name = 65 + (int) \chr($id % 57);
$this->em->persist(new SingleIntIdEntity($id, $name));
}
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
index 5a627dc23155b..559ad1cdcb34d 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Logger/DbalLoggerTest.php
@@ -148,7 +148,7 @@ public function testLogUTF8LongString()
;
$testStringArray = array('é', 'á', 'ű', 'ő', 'ú', 'ö', 'ü', 'ó', 'í');
- $testStringCount = count($testStringArray);
+ $testStringCount = \count($testStringArray);
$shortString = '';
$longString = '';
diff --git a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
index ac7dc543a1d8a..7bf1e61b1c001 100644
--- a/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
+++ b/src/Symfony/Bridge/Doctrine/Tests/Security/User/EntityUserProviderTest.php
@@ -146,7 +146,7 @@ public function testSupportProxy()
$provider = new EntityUserProvider($this->getManager($em), 'Symfony\Bridge\Doctrine\Tests\Fixtures\User', 'name');
$user2 = $em->getReference('Symfony\Bridge\Doctrine\Tests\Fixtures\User', array('id1' => 1, 'id2' => 1));
- $this->assertTrue($provider->supportsClass(get_class($user2)));
+ $this->assertTrue($provider->supportsClass(\get_class($user2)));
}
private function getManager($em, $name = null)
diff --git a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
index b0d9534a0e98d..4ad04d6cab2b5 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/Constraints/UniqueEntityValidator.php
@@ -48,17 +48,17 @@ public function validate($entity, Constraint $constraint)
throw new UnexpectedTypeException($constraint, __NAMESPACE__.'\UniqueEntity');
}
- if (!is_array($constraint->fields) && !is_string($constraint->fields)) {
+ if (!\is_array($constraint->fields) && !\is_string($constraint->fields)) {
throw new UnexpectedTypeException($constraint->fields, 'array');
}
- if (null !== $constraint->errorPath && !is_string($constraint->errorPath)) {
+ if (null !== $constraint->errorPath && !\is_string($constraint->errorPath)) {
throw new UnexpectedTypeException($constraint->errorPath, 'string or null');
}
$fields = (array) $constraint->fields;
- if (0 === count($fields)) {
+ if (0 === \count($fields)) {
throw new ConstraintDefinitionException('At least one field has to be specified.');
}
@@ -73,14 +73,14 @@ public function validate($entity, Constraint $constraint)
throw new ConstraintDefinitionException(sprintf('Object manager "%s" does not exist.', $constraint->em));
}
} else {
- $em = $this->registry->getManagerForClass(get_class($entity));
+ $em = $this->registry->getManagerForClass(\get_class($entity));
if (!$em) {
- throw new ConstraintDefinitionException(sprintf('Unable to find the object manager associated with an entity of class "%s".', get_class($entity)));
+ throw new ConstraintDefinitionException(sprintf('Unable to find the object manager associated with an entity of class "%s".', \get_class($entity)));
}
}
- $class = $em->getClassMetadata(get_class($entity));
+ $class = $em->getClassMetadata(\get_class($entity));
/* @var $class \Doctrine\Common\Persistence\Mapping\ClassMetadata */
$criteria = array();
@@ -123,7 +123,7 @@ public function validate($entity, Constraint $constraint)
return;
}
- $repository = $em->getRepository(get_class($entity));
+ $repository = $em->getRepository(\get_class($entity));
$result = $repository->{$constraint->repositoryMethod}($criteria);
if ($result instanceof \IteratorAggregate) {
@@ -136,7 +136,7 @@ public function validate($entity, Constraint $constraint)
*/
if ($result instanceof \Iterator) {
$result->rewind();
- } elseif (is_array($result)) {
+ } elseif (\is_array($result)) {
reset($result);
}
@@ -144,7 +144,7 @@ public function validate($entity, Constraint $constraint)
* which is the same as the entity being validated, the criteria is
* unique.
*/
- if (0 === count($result) || (1 === count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)))) {
+ if (0 === \count($result) || (1 === \count($result) && $entity === ($result instanceof \Iterator ? $result->current() : current($result)))) {
return;
}
diff --git a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php
index 42cafdd129472..010c051581e70 100644
--- a/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php
+++ b/src/Symfony/Bridge/Doctrine/Validator/DoctrineInitializer.php
@@ -30,7 +30,7 @@ public function __construct(ManagerRegistry $registry)
public function initialize($object)
{
- $manager = $this->registry->getManagerForClass(get_class($object));
+ $manager = $this->registry->getManagerForClass(\get_class($object));
if (null !== $manager) {
$manager->initializeObject($object);
}
diff --git a/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php b/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php
index c959a5a94fcb7..a49c19d14303c 100644
--- a/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php
+++ b/src/Symfony/Bridge/Monolog/Handler/DebugHandler.php
@@ -50,7 +50,7 @@ public function countErrors()
$levels = array(Logger::ERROR, Logger::CRITICAL, Logger::ALERT, Logger::EMERGENCY);
foreach ($levels as $level) {
if (isset($this->recordsByLevel[$level])) {
- $cnt += count($this->recordsByLevel[$level]);
+ $cnt += \count($this->recordsByLevel[$level]);
}
}
diff --git a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
index 66b8762cff4e9..524d16633af73 100644
--- a/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
+++ b/src/Symfony/Bridge/PhpUnit/DeprecationErrorHandler.php
@@ -58,13 +58,13 @@ public static function register($mode = false)
$trace = debug_backtrace(true);
$group = 'other';
- $i = count($trace);
+ $i = \count($trace);
while (1 < $i && (!isset($trace[--$i]['class']) || ('ReflectionMethod' === $trace[$i]['class'] || 0 === strpos($trace[$i]['class'], 'PHPUnit_')))) {
// No-op
}
if (isset($trace[$i]['object']) || isset($trace[$i]['class'])) {
- $class = isset($trace[$i]['object']) ? get_class($trace[$i]['object']) : $trace[$i]['class'];
+ $class = isset($trace[$i]['object']) ? \get_class($trace[$i]['object']) : $trace[$i]['class'];
$method = $trace[$i]['function'];
if (0 !== error_reporting()) {
@@ -73,7 +73,7 @@ public static function register($mode = false)
|| 0 === strpos($method, 'provideLegacy')
|| 0 === strpos($method, 'getLegacy')
|| strpos($class, '\Legacy')
- || in_array('legacy', \PHPUnit_Util_Test::getGroups($class, $method), true)
+ || \in_array('legacy', \PHPUnit_Util_Test::getGroups($class, $method), true)
) {
$group = 'legacy';
} else {
@@ -167,6 +167,6 @@ private static function hasColorSupport()
|| 'xterm' === getenv('TERM');
}
- return defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);
+ return \defined('STDOUT') && function_exists('posix_isatty') && @posix_isatty(STDOUT);
}
}
diff --git a/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php b/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php
index 33fc49e1012d9..7d083a6981e25 100644
--- a/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php
+++ b/src/Symfony/Bridge/ProxyManager/LazyProxy/Instantiator/RuntimeInstantiator.php
@@ -51,7 +51,7 @@ public function instantiateProxy(ContainerInterface $container, Definition $defi
return $this->factory->createProxy(
$definition->getClass(),
function (&$wrappedInstance, LazyLoadingInterface $proxy) use ($realInstantiator) {
- $wrappedInstance = call_user_func($realInstantiator);
+ $wrappedInstance = \call_user_func($realInstantiator);
$proxy->setProxyInitializer(null);
diff --git a/src/Symfony/Bridge/Twig/AppVariable.php b/src/Symfony/Bridge/Twig/AppVariable.php
index 88d9835ce2399..b90f64db2cf1a 100644
--- a/src/Symfony/Bridge/Twig/AppVariable.php
+++ b/src/Symfony/Bridge/Twig/AppVariable.php
@@ -103,7 +103,7 @@ public function getUser()
}
$user = $token->getUser();
- if (is_object($user)) {
+ if (\is_object($user)) {
return $user;
}
}
diff --git a/src/Symfony/Bridge/Twig/Command/DebugCommand.php b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
index f86013b0e2476..8a4c7862ad50c 100644
--- a/src/Symfony/Bridge/Twig/Command/DebugCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/DebugCommand.php
@@ -140,16 +140,16 @@ private function getMetadata($type, $entity)
if (null === $cb) {
return;
}
- if (is_array($cb)) {
+ if (\is_array($cb)) {
if (!method_exists($cb[0], $cb[1])) {
return;
}
$refl = new \ReflectionMethod($cb[0], $cb[1]);
- } elseif (is_object($cb) && method_exists($cb, '__invoke')) {
+ } elseif (\is_object($cb) && method_exists($cb, '__invoke')) {
$refl = new \ReflectionMethod($cb, '__invoke');
} elseif (function_exists($cb)) {
$refl = new \ReflectionFunction($cb);
- } elseif (is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
+ } elseif (\is_string($cb) && preg_match('{^(.+)::(.+)$}', $cb, $m) && method_exists($m[1], $m[2])) {
$refl = new \ReflectionMethod($m[1], $m[2]);
} else {
throw new \UnexpectedValueException('Unsupported callback type');
@@ -199,8 +199,8 @@ private function getPrettyMetadata($type, $entity)
}
if ('globals' === $type) {
- if (is_object($meta)) {
- return ' = object('.get_class($meta).')';
+ if (\is_object($meta)) {
+ return ' = object('.\get_class($meta).')';
}
return ' = '.substr(@json_encode($meta), 0, 50);
diff --git a/src/Symfony/Bridge/Twig/Command/LintCommand.php b/src/Symfony/Bridge/Twig/Command/LintCommand.php
index a731242ce5403..69e3fd2d1fa2e 100644
--- a/src/Symfony/Bridge/Twig/Command/LintCommand.php
+++ b/src/Symfony/Bridge/Twig/Command/LintCommand.php
@@ -98,7 +98,7 @@ protected function execute(InputInterface $input, OutputInterface $output)
$filenames = $input->getArgument('filename');
- if (0 === count($filenames)) {
+ if (0 === \count($filenames)) {
if (0 !== ftell(STDIN)) {
throw new \RuntimeException('Please provide a filename or pipe template content to STDIN.');
}
@@ -182,7 +182,7 @@ private function displayTxt(OutputInterface $output, $filesInfo)
}
}
- $output->writeln(sprintf('
', $code);
$lines = array();
- for ($i = max($line - 3, 1), $max = min($line + 3, count($content)); $i <= $max; ++$i) {
+ for ($i = max($line - 3, 1), $max = min($line + 3, \count($content)); $i <= $max; ++$i) {
$lines[] = '
'.self::fixCodeMarkup($content[$i - 1]).'