Skip to content

Commit

Permalink
Merge branch '3.4' into 4.3
Browse files Browse the repository at this point in the history
* 3.4: (21 commits)
  [SecurityBundle] fix return type declarations
  [BrowserKit] fix return type declarations
  [PropertyInfo] fix return type declarations
  [Bridge/Doctrine] fix return type declarations
  [Form] fix return type declarations
  [Console] fix return type declarations
  [Intl] fix return type declarations
  [Templating] fix return type declarations
  [DomCrawler] fix return type declarations
  [Validator] fix return type declarations
  [Process] fix return type declarations
  [Workflow] fix return type declarations
  [Cache] fix return type declarations
  [Serializer] fix return type declarations
  [Translation] fix return type declarations
  [DI] fix return type declarations
  [Config] fix return type declarations
  [HttpKernel] Fix return type declarations
  [Security] Fix return type declarations
  [Routing] Fix return type declarations
  ...
  • Loading branch information
nicolas-grekas committed Aug 26, 2019
2 parents aa81e27 + e9886e4 commit 74b2802
Show file tree
Hide file tree
Showing 102 changed files with 422 additions and 353 deletions.
Original file line number Diff line number Diff line change
Expand Up @@ -89,6 +89,6 @@ public function getEntitiesByIds($identifier, array $values)
return $qb->andWhere($where)
->getQuery()
->setParameter($parameter, $values, $parameterType)
->getResult();
->getResult() ?: [];
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -107,6 +107,8 @@ protected function doLeaveNode(Node $node, Environment $env)

/**
* {@inheritdoc}
*
* @return int
*/
public function getPriority()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -97,6 +97,8 @@ protected function doLeaveNode(Node $node, Environment $env)

/**
* {@inheritdoc}
*
* @return int
*/
public function getPriority()
{
Expand Down
4 changes: 1 addition & 3 deletions src/Symfony/Bridge/Twig/Translation/TwigExtractor.php
Original file line number Diff line number Diff line change
Expand Up @@ -106,9 +106,7 @@ protected function canBeExtracted($file)
}

/**
* @param string|array $directory
*
* @return array
* {@inheritdoc}
*/
protected function extractFromDirectory($directory)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -1920,9 +1920,7 @@ private function registerMailerConfiguration(array $config, ContainerBuilder $co
}

/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,16 +24,16 @@ public function testProfilerIsDisabled($insulate)
}

$client->request('GET', '/profiler');
$this->assertFalse($client->getProfile());
$this->assertNull($client->getProfile());

// enable the profiler for the next request
$client->enableProfiler();
$this->assertFalse($client->getProfile());
$this->assertNull($client->getProfile());
$client->request('GET', '/profiler');
$this->assertIsObject($client->getProfile());

$client->request('GET', '/profiler');
$this->assertFalse($client->getProfile());
$this->assertNull($client->getProfile());
}

public function getConfigs()
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -259,7 +259,7 @@ public function getUser()
/**
* Gets the roles of the user.
*
* @return array The roles
* @return array|Data
*/
public function getRoles()
{
Expand All @@ -269,7 +269,7 @@ public function getRoles()
/**
* Gets the inherited roles of the user.
*
* @return array The inherited roles
* @return array|Data
*/
public function getInheritedRoles()
{
Expand Down Expand Up @@ -297,16 +297,25 @@ public function isAuthenticated()
return $this->data['authenticated'];
}

/**
* @return bool
*/
public function isImpersonated()
{
return $this->data['impersonated'];
}

/**
* @return string|null
*/
public function getImpersonatorUser()
{
return $this->data['impersonator_user'];
}

/**
* @return string|null
*/
public function getImpersonationExitPath()
{
return $this->data['impersonation_exit_path'];
Expand All @@ -315,7 +324,7 @@ public function getImpersonationExitPath()
/**
* Get the class name of the security token.
*
* @return string The token
* @return string|Data|null The token
*/
public function getTokenClass()
{
Expand All @@ -325,7 +334,7 @@ public function getTokenClass()
/**
* Get the full security token class as Data object.
*
* @return Data
* @return Data|null
*/
public function getToken()
{
Expand All @@ -335,7 +344,7 @@ public function getToken()
/**
* Get the logout URL.
*
* @return string The logout URL
* @return string|null The logout URL
*/
public function getLogoutUrl()
{
Expand All @@ -345,7 +354,7 @@ public function getLogoutUrl()
/**
* Returns the FQCN of the security voters enabled in the application.
*
* @return string[]
* @return string[]|Data
*/
public function getVoters()
{
Expand All @@ -365,7 +374,7 @@ public function getVoterStrategy()
/**
* Returns the log of the security decisions made by the access decision manager.
*
* @return array
* @return array|Data
*/
public function getAccessDecisionLog()
{
Expand All @@ -375,13 +384,16 @@ public function getAccessDecisionLog()
/**
* Returns the configuration of the current firewall context.
*
* @return array
* @return array|Data
*/
public function getFirewall()
{
return $this->data['firewall'];
}

/**
* @return array|Data
*/
public function getListeners()
{
return $this->data['listeners'];
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -130,9 +130,9 @@ abstract protected function getListenerId();
* @param ContainerBuilder $container
* @param string $id
* @param array $config
* @param string $defaultEntryPointId
* @param string|null $defaultEntryPointId
*
* @return string the entry point id
* @return string|null the entry point id
*/
protected function createEntryPoint($container, $id, $config, $defaultEntryPointId)
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -24,10 +24,10 @@ interface SecurityFactoryInterface
/**
* Configures the container services required to use the authentication listener.
*
* @param string $id The unique id of the firewall
* @param array $config The options array for the listener
* @param string $userProvider The service id of the user provider
* @param string $defaultEntryPoint
* @param string $id The unique id of the firewall
* @param array $config The options array for the listener
* @param string $userProvider The service id of the user provider
* @param string|null $defaultEntryPoint
*
* @return array containing three values:
* - the provider id
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -787,9 +787,7 @@ public function addUserProviderFactory(UserProviderFactoryInterface $factory)
}

/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -207,9 +207,7 @@ private function normalizeBundleName($name)
}

/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -62,9 +62,7 @@ public function load(array $configs, ContainerBuilder $container)
}

/**
* Returns the base path for the XSD files.
*
* @return string The XSD base path
* {@inheritdoc}
*/
public function getXsdValidationBasePath()
{
Expand Down
4 changes: 2 additions & 2 deletions src/Symfony/Component/BrowserKit/Client.php
Original file line number Diff line number Diff line change
Expand Up @@ -153,9 +153,9 @@ public function setServerParameter($key, $value)
* Gets single server parameter for specified key.
*
* @param string $key A key of the parameter to get
* @param string $default A default value when key is undefined
* @param mixed $default A default value when key is undefined
*
* @return string A value of the parameter
* @return mixed A value of the parameter
*/
public function getServerParameter($key, $default = '')
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/BrowserKit/Request.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,7 +107,7 @@ public function getServer()
/**
* Gets the request raw body data.
*
* @return string The request raw body data
* @return string|null The request raw body data
*/
public function getContent()
{
Expand Down
3 changes: 2 additions & 1 deletion src/Symfony/Component/Cache/DoctrineProvider.php
Original file line number Diff line number Diff line change
Expand Up @@ -91,13 +91,14 @@ protected function doDelete($id)
*/
protected function doFlush()
{
$this->pool->clear();
return $this->pool->clear();
}

/**
* {@inheritdoc}
*/
protected function doGetStats()
{
return null;
}
}
Original file line number Diff line number Diff line change
Expand Up @@ -40,6 +40,10 @@ public function testLongKeyVersioning()
->setConstructorArgs([str_repeat('-', 26)])
->getMock();

$cache
->method('doFetch')
->willReturn(['2:']);

$reflectionClass = new \ReflectionClass(AbstractAdapter::class);

$reflectionMethod = $reflectionClass->getMethod('getId');
Expand All @@ -56,7 +60,7 @@ public function testLongKeyVersioning()
$reflectionProperty->setValue($cache, true);

// Versioning enabled
$this->assertEquals('--------------------------:1:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]));
$this->assertEquals('--------------------------:2:------------', $reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)]));
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 12)])));
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 23)])));
$this->assertLessThanOrEqual(50, \strlen($reflectionMethod->invokeArgs($cache, [str_repeat('-', 40)])));
Expand Down
6 changes: 1 addition & 5 deletions src/Symfony/Component/Config/Definition/ArrayNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,17 +38,13 @@ public function setNormalizeKeys($normalizeKeys)
}

/**
* Normalizes keys between the different configuration formats.
* {@inheritdoc}
*
* Namely, you mostly have foo_bar in YAML while you have foo-bar in XML.
* After running this method, all keys are normalized to foo_bar.
*
* If you have a mixed key like foo-bar_moo, it will not be altered.
* The key will also not be altered if the target key already exists.
*
* @param mixed $value
*
* @return array The value with normalized keys
*/
protected function preNormalize($value)
{
Expand Down
23 changes: 21 additions & 2 deletions src/Symfony/Component/Config/Definition/BaseNode.php
Original file line number Diff line number Diff line change
Expand Up @@ -97,21 +97,37 @@ public static function resetPlaceholders(): void
self::$placeholders = [];
}

/**
* @param string $key
*/
public function setAttribute($key, $value)
{
$this->attributes[$key] = $value;
}

/**
* @param string $key
*
* @return mixed
*/
public function getAttribute($key, $default = null)
{
return isset($this->attributes[$key]) ? $this->attributes[$key] : $default;
}

/**
* @param string $key
*
* @return bool
*/
public function hasAttribute($key)
{
return isset($this->attributes[$key]);
}

/**
* @return array
*/
public function getAttributes()
{
return $this->attributes;
Expand All @@ -122,6 +138,9 @@ public function setAttributes(array $attributes)
$this->attributes = $attributes;
}

/**
* @param string $key
*/
public function removeAttribute($key)
{
unset($this->attributes[$key]);
Expand All @@ -140,7 +159,7 @@ public function setInfo($info)
/**
* Returns info message.
*
* @return string The info text
* @return string|null The info text
*/
public function getInfo()
{
Expand All @@ -160,7 +179,7 @@ public function setExample($example)
/**
* Retrieves the example configuration for this node.
*
* @return string|array The example
* @return string|array|null The example
*/
public function getExample()
{
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -78,7 +78,7 @@ public function setKeyAttribute($attribute, $remove = true)
/**
* Retrieves the name of the attribute which value should be used as key.
*
* @return string The name of the attribute
* @return string|null The name of the attribute
*/
public function getKeyAttribute()
{
Expand Down
2 changes: 1 addition & 1 deletion src/Symfony/Component/Config/Util/XmlUtils.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public static function loadFile($file, $schemaOrCallable = null)
* @param \DOMElement $element A \DOMElement instance
* @param bool $checkPrefix Check prefix in an element or an attribute name
*
* @return array A PHP array
* @return mixed
*/
public static function convertDomElementToArray(\DOMElement $element, $checkPrefix = true)
{
Expand Down

0 comments on commit 74b2802

Please sign in to comment.