Commit 08d04b40 authored by Fabien Potencier's avatar Fabien Potencier

fixed CS

parent 5e032d07
<?php
return PhpCsFixer\Config::create()
->setRules(array(
'@Symfony' => true,
'@Symfony:risky' => true,
'@PHPUnit48Migration:risky' => true,
'php_unit_no_expectation_annotation' => false, // part of `PHPUnitXYMigration:risky` ruleset, to be enabled when PHPUnit 4.x support will be dropped, as we don't want to rewrite exceptions handling twice
'array_syntax' => array('syntax' => 'long'),
'protected_to_private' => false,
))
->setRiskyAllowed(true)
->setFinder(
PhpCsFixer\Finder::create()
->in(__DIR__.'/src/')
->in(__DIR__.'/tests/')
->name('*.php')
)
;
......@@ -34,7 +34,7 @@ class AppArgumentValueResolver implements ArgumentValueResolverInterface
*/
public function supports(Request $request, ArgumentMetadata $argument)
{
return null !== $argument->getType() && ($argument->getType() === Application::class || is_subclass_of($argument->getType(), Application::class));
return null !== $argument->getType() && (Application::class === $argument->getType() || is_subclass_of($argument->getType(), Application::class));
}
/**
......
......@@ -54,7 +54,7 @@ class Application extends Container implements HttpKernelInterface, TerminableIn
*
* Objects and parameters can be passed as argument to the constructor.
*
* @param array $values The parameters or objects.
* @param array $values the parameters or objects
*/
public function __construct(array $values = array())
{
......
......@@ -44,7 +44,7 @@ trait SecurityTrait
*
* @return bool
*
* @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token.
* @throws AuthenticationCredentialsNotFoundException when the token storage has no authentication token
*/
public function isGranted($attributes, $object = null)
{
......
......@@ -43,7 +43,7 @@ class CallbackResolver
*
* @return callable
*
* @throws \InvalidArgumentException In case the method does not exist.
* @throws \InvalidArgumentException in case the method does not exist
*/
public function convertCallback($name)
{
......@@ -69,7 +69,7 @@ class CallbackResolver
*
* @return string|callable A callable value or the string passed in
*
* @throws \InvalidArgumentException In case the method does not exist.
* @throws \InvalidArgumentException in case the method does not exist
*/
public function resolveCallback($name)
{
......
......@@ -211,7 +211,7 @@ class ControllerCollection
private function doFlush($prefix, RouteCollection $routes)
{
if ($prefix !== '') {
if ('' !== $prefix) {
$prefix = '/'.trim(trim($prefix), '/');
}
......
......@@ -52,7 +52,7 @@ class SilexFormExtension implements FormExtensionInterface
public function getTypeExtensions($name)
{
return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : [];
return isset($this->typeExtensions[$name]) ? $this->typeExtensions[$name] : array();
}
public function hasTypeExtensions($name)
......@@ -66,7 +66,7 @@ class SilexFormExtension implements FormExtensionInterface
$this->guesserLoaded = true;
if ($this->guessers) {
$guessers = [];
$guessers = array();
foreach ($this->guessers as $guesser) {
if (!is_object($guesser)) {
$guesser = $this->app[$guesser];
......@@ -82,7 +82,7 @@ class SilexFormExtension implements FormExtensionInterface
private function setTypes(array $types)
{
$this->types = [];
$this->types = array();
foreach ($types as $type) {
if (!is_object($type)) {
if (!isset($this->app[$type])) {
......@@ -97,7 +97,7 @@ class SilexFormExtension implements FormExtensionInterface
private function setTypeExtensions(array $typeExtensions)
{
$this->typeExtensions = [];
$this->typeExtensions = array();
foreach ($typeExtensions as $extension) {
if (!is_object($extension)) {
if (!isset($this->app[$extension])) {
......@@ -111,7 +111,7 @@ class SilexFormExtension implements FormExtensionInterface
private function setGuessers(array $guessers)
{
$this->guessers = [];
$this->guessers = array();
foreach ($guessers as $guesser) {
if (!is_object($guesser) && !isset($this->app[$guesser])) {
throw new InvalidArgumentException(sprintf('Invalid form type guesser. The silex service "%s" does not exist.', $guesser));
......
......@@ -29,7 +29,7 @@ class RedirectableUrlMatcher extends BaseRedirectableUrlMatcher
$url = $this->context->getBaseUrl().$path;
$query = $this->context->getQueryString() ?: '';
if ($query !== '') {
if ('' !== $query) {
$url .= '?'.$query;
}
......
......@@ -613,7 +613,7 @@ class SecurityServiceProvider implements ServiceProviderInterface, EventListener
return $app[$options['entry_point']];
}
$authenticatorIds = $options['authenticators'];
if (count($authenticatorIds) == 1) {
if (1 == count($authenticatorIds)) {
// if there is only one authenticator, use that as the entry point
return $app[reset($authenticatorIds)];
}
......
......@@ -62,7 +62,7 @@ class SwiftmailerServiceProvider implements ServiceProviderInterface, EventListe
'password' => '',
'encryption' => null,
'auth_mode' => null,
'stream_context_options' => [],
'stream_context_options' => array(),
), $app['swiftmailer.options']);
$transport->setHost($options['host']);
......
......@@ -17,7 +17,7 @@ use Symfony\Component\HttpKernel\Controller\ControllerResolverInterface;
/**
* Enables name_of_service:method_name syntax for declaring controllers.
*
* @link http://silex.sensiolabs.org/doc/providers/service_controller.html
* @see http://silex.sensiolabs.org/doc/providers/service_controller.html
*/
class ServiceControllerResolver implements ControllerResolverInterface
{
......
......@@ -154,7 +154,7 @@ class ControllerCollectionTest extends TestCase
$routes = $controllers->flush();
$subRoutes = $subControllers->flush();
$this->assertTrue($routes->count() == 2 && $subRoutes->count() == 0);
$this->assertTrue(2 == $routes->count() && 0 == $subRoutes->count());
}
public function testMountControllersFactory()
......
Markdown is supported
0% or
You are about to add 0 people to the discussion. Proceed with caution.
Finish editing this message first!
Please register or to comment