Skip to content

Commit 8f57734

Browse files
committed
minor #2124 apply fixes from StyleCI (xabbuh)
This PR was merged into the 2.7 branch. Discussion ---------- apply fixes from StyleCI Commits ------- 8965d50 apply fixes from StyleCI
2 parents e3dd5a4 + 8965d50 commit 8f57734

File tree

10 files changed

+83
-45
lines changed

10 files changed

+83
-45
lines changed

DependencyInjection/FOSRestExtension.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -399,7 +399,8 @@ private function loadZoneMatcherListener(array $config, XmlFileLoader $loader, C
399399
$zoneMatcherListener = $container->getDefinition('fos_rest.zone_matcher_listener');
400400

401401
foreach ($config['zone'] as $zone) {
402-
$matcher = $this->createZoneRequestMatcher($container,
402+
$matcher = $this->createZoneRequestMatcher(
403+
$container,
403404
$zone['path'],
404405
$zone['host'],
405406
$zone['methods'],

Negotiation/FormatNegotiator.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,8 @@ public function getBest($header, array $priorities = [])
8585
}
8686

8787
if ($header) {
88-
$mimeTypes = $this->normalizePriorities($request,
88+
$mimeTypes = $this->normalizePriorities(
89+
$request,
8990
empty($priorities) ? $options['priorities'] : $priorities
9091
);
9192

Routing/Loader/Reader/RestActionReader.php

Lines changed: 20 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -340,7 +340,14 @@ public function read(RestRouteCollection $collection, \ReflectionMethod $method,
340340

341341
// add route to collection
342342
$route = new Route(
343-
$path, $defaults, $requirements, $options, $host, $schemes, $methods, $combinedCondition
343+
$path,
344+
$defaults,
345+
$requirements,
346+
$options,
347+
$host,
348+
$schemes,
349+
$methods,
350+
$combinedCondition
344351
);
345352
$this->addRoute($collection, $routeName, $route, $isCollection, $isInflectable, $annotation);
346353
}
@@ -356,7 +363,14 @@ public function read(RestRouteCollection $collection, \ReflectionMethod $method,
356363

357364
// add route to collection
358365
$route = new Route(
359-
$path, $defaults, $requirements, $options, $host, [], $methods, $versionCondition
366+
$path,
367+
$defaults,
368+
$requirements,
369+
$options,
370+
$host,
371+
[],
372+
$methods,
373+
$versionCondition
360374
);
361375
$this->addRoute($collection, $routeName, $route, $isCollection, $isInflectable);
362376
}
@@ -480,7 +494,10 @@ private function getHttpMethodAndResourcesFromMethod(\ReflectionMethod $method,
480494

481495
$httpMethod = strtolower($matches[1]);
482496
$resources = preg_split(
483-
'/([A-Z][^A-Z]*)/', $matches[2], -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
497+
'/([A-Z][^A-Z]*)/',
498+
$matches[2],
499+
-1,
500+
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
484501
);
485502
$isCollection = false;
486503
$isInflectable = true;

Routing/Loader/Reader/RestControllerReader.php

Lines changed: 4 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -85,7 +85,10 @@ public function read(\ReflectionClass $reflectionClass)
8585
$this->actionReader->setPluralize($annotation->pluralize);
8686
} elseif ($reflectionClass->implementsInterface(ClassResourceInterface::class)) {
8787
$resource = preg_split(
88-
'/([A-Z][^A-Z]*)Controller/', $reflectionClass->getShortName(), -1, PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
88+
'/([A-Z][^A-Z]*)Controller/',
89+
$reflectionClass->getShortName(),
90+
-1,
91+
PREG_SPLIT_NO_EMPTY | PREG_SPLIT_DELIM_CAPTURE
8992
);
9093
if (empty($resource)) {
9194
throw new \InvalidArgumentException("Controller '{$reflectionClass->name}' does not identify a resource");

Routing/Loader/RestRouteLoader.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -46,7 +46,8 @@ public function __construct(
4646
ContainerInterface $container,
4747
FileLocatorInterface $locator,
4848
$controllerParser,
49-
RestControllerReader $controllerReader, $defaultFormat = 'html'
49+
RestControllerReader $controllerReader,
50+
$defaultFormat = 'html'
5051
) {
5152
$this->container = $container;
5253
$this->locator = $locator;
@@ -86,8 +87,10 @@ public function supports($resource, $type = null)
8687
{
8788
return is_string($resource)
8889
&& 'rest' === $type
89-
&& !in_array(pathinfo($resource, PATHINFO_EXTENSION), ['xml', 'yml', 'yaml']
90-
);
90+
&& !in_array(
91+
pathinfo($resource, PATHINFO_EXTENSION),
92+
['xml', 'yml', 'yaml']
93+
);
9194
}
9295

9396
/**

Routing/Loader/RestXmlCollectionLoader.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -272,7 +272,8 @@ private function getXmlErrors_($internalErrors)
272272
{
273273
$errors = [];
274274
foreach (libxml_get_errors() as $error) {
275-
$errors[] = sprintf('[%s %s] %s (in %s - line %d, column %d)',
275+
$errors[] = sprintf(
276+
'[%s %s] %s (in %s - line %d, column %d)',
276277
LIBXML_ERR_WARNING === $error->level ? 'WARNING' : 'ERROR',
277278
$error->code,
278279
trim($error->message),

Tests/DependencyInjection/Compiler/FormatListenerRulesPassTest.php

Lines changed: 28 additions & 25 deletions
Original file line numberDiff line numberDiff line change
@@ -41,21 +41,22 @@ public function testRulesAreAddedWhenFormatListenerAndProfilerToolbarAreEnabled(
4141

4242
$container->expects($this->exactly(2))
4343
->method('getParameter')
44-
->will($this->onConsecutiveCalls(
45-
2,
46-
[
44+
->will(
45+
$this->onConsecutiveCalls(
46+
2,
4747
[
48-
'host' => null,
49-
'methods' => null,
50-
'path' => '^/',
51-
'priorities' => ['html', 'json'],
52-
'fallback_format' => 'html',
53-
'attributes' => [],
54-
'prefer_extension' => true,
55-
],
56-
]
57-
)
58-
);
48+
[
49+
'host' => null,
50+
'methods' => null,
51+
'path' => '^/',
52+
'priorities' => ['html', 'json'],
53+
'fallback_format' => 'html',
54+
'attributes' => [],
55+
'prefer_extension' => true,
56+
],
57+
]
58+
)
59+
);
5960

6061
$container->expects($this->exactly(2))
6162
->method('getDefinition')
@@ -88,18 +89,20 @@ public function testNoRulesAreAddedWhenProfilerToolbarAreDisabled()
8889
$container->expects($this->once())
8990
->method('getParameter')
9091
->with('fos_rest.format_listener.rules')
91-
->will($this->returnValue(
92-
[
92+
->will(
93+
$this->returnValue(
9394
[
94-
'host' => null,
95-
'methods' => null,
96-
'path' => '^/',
97-
'priorities' => ['html', 'json'],
98-
'fallback_format' => 'html',
99-
'attributes' => [],
100-
'prefer_extension' => true,
101-
],
102-
])
95+
[
96+
'host' => null,
97+
'methods' => null,
98+
'path' => '^/',
99+
'priorities' => ['html', 'json'],
100+
'fallback_format' => 'html',
101+
'attributes' => [],
102+
'prefer_extension' => true,
103+
],
104+
]
105+
)
103106
);
104107

105108
$container->expects($this->once())

Tests/Functional/ConfigurationTest.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -36,12 +36,12 @@ public function testToolbar()
3636
{
3737
$client = $this->createClient(['test_case' => 'ConfigurationWithTwig']);
3838
$client->request(
39-
'GET',
40-
'/_profiler/empty/search/results?limit=10',
41-
[],
42-
[],
43-
['HTTP_Accept' => 'application/xml']
44-
);
39+
'GET',
40+
'/_profiler/empty/search/results?limit=10',
41+
[],
42+
[],
43+
['HTTP_Accept' => 'application/xml']
44+
);
4545

4646
$this->assertSame(200, $client->getResponse()->getStatusCode());
4747
$this->assertSame('text/html; charset=UTF-8', $client->getResponse()->headers->get('Content-Type'));

Tests/Functional/ParamFetcherTest.php

Lines changed: 11 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,11 +36,20 @@ private function createUploadedFile($path, $originalName, $mimeType = null, $err
3636
if ('error' === $params[3]->getName()) {
3737
// symfony 4 has removed the $size param
3838
return new UploadedFile(
39-
$path, $originalName, $mimeType, $error, $test
39+
$path,
40+
$originalName,
41+
$mimeType,
42+
$error,
43+
$test
4044
);
4145
} else {
4246
return new UploadedFile(
43-
$path, $originalName, $mimeType, filesize($path), $error, $test
47+
$path,
48+
$originalName,
49+
$mimeType,
50+
filesize($path),
51+
$error,
52+
$test
4453
);
4554
}
4655
}

Tests/Functional/VersionTest.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -38,7 +38,7 @@ public function testVersionAnnotation()
3838
[],
3939
[],
4040
['HTTP_Accept' => 'application/json']
41-
);
41+
);
4242
$this->assertEquals('{"version":"test annotation"}', static::$client->getResponse()->getContent());
4343
}
4444

@@ -50,7 +50,7 @@ public function testVersionInPathWithAnnotation()
5050
[],
5151
[],
5252
['HTTP_Accept' => 'application/json']
53-
);
53+
);
5454
$this->assertEquals(
5555
'{"version":"test annotation","version_exclusion":"1.2"}',
5656
static::$client->getResponse()->getContent()

0 commit comments

Comments
 (0)