Skip to content

Commit e6f9764

Browse files
committed
Added backslash to PHP internal functions
1 parent b4801cd commit e6f9764

File tree

4 files changed

+12
-8
lines changed

4 files changed

+12
-8
lines changed

composer.json

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,9 @@
2323
"symfony/psr-http-message-bridge": "~0.2"
2424
},
2525
"require-dev": {
26-
"fabpot/php-cs-fixer": "^1.9",
26+
"symfony/symfony": "2.*",
27+
"fabpot/php-cs-fixer": "~1.9",
28+
"nilportugues/php_backslasher": "~0.2",
2729
"mmoreram/php-formatter": "dev-master"
2830
},
2931
"config": {

src/DependencyInjection/NilPortuguesSymfony2HalJsonExtension.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -36,14 +36,14 @@ public function load(array $configs, ContainerBuilder $container)
3636
*/
3737
private function setMappings(ContainerBuilder $container, $config)
3838
{
39-
if (true === file_exists($config['mappings'])) {
39+
if (true === \file_exists($config['mappings'])) {
4040
$finder = new Finder();
4141
$finder->files()->in($config['mappings']);
4242
$loadedMappings = [];
4343

4444
foreach ($finder as $file) {
4545
/* @var \Symfony\Component\Finder\SplFileInfo $file */
46-
$mapping = file_get_contents($file->getPathname());
46+
$mapping = \file_get_contents($file->getPathname());
4747
$mapping = Yaml::parse($mapping);
4848
$loadedMappings[] = $mapping['mapping'];
4949
}

src/Serializer/HalJsonResponseTrait.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -8,13 +8,14 @@ trait HalJsonResponseTrait
88
{
99
/**
1010
* @param \Psr\Http\Message\ResponseInterface $response
11+
*
1112
* @return \Psr\Http\Message\ResponseInterface
1213
*/
1314
protected function addHeaders(\Psr\Http\Message\ResponseInterface $response)
1415
{
1516
return $response;
1617
}
17-
18+
1819
/**
1920
* @param string $json
2021
*

src/Serializer/HalJsonSerializer.php

Lines changed: 5 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -8,6 +8,7 @@
88
* For the full copyright and license information, please view the LICENSE
99
* file that was distributed with this source code.
1010
*/
11+
1112
namespace NilPortugues\Symfony2\HalJsonBundle\Serializer;
1213

1314
use NilPortugues\Api\HalJson\HalJsonTransformer;
@@ -94,18 +95,18 @@ private function getUrlPattern(Router $router, $routeNameFromMappingFile)
9495
}
9596
} catch (\Exception $e) {
9697
throw new \RuntimeException(
97-
sprintf('Route \'%s\' has not been defined as a Symfony route.', $routeNameFromMappingFile)
98+
\sprintf('Route \'%s\' has not been defined as a Symfony route.', $routeNameFromMappingFile)
9899
);
99100
}
100101

101-
preg_match_all('/{(.*?)}/', $route->getPath(), $matches);
102+
\preg_match_all('/{(.*?)}/', $route->getPath(), $matches);
102103

103104
$pattern = [];
104105
if (!empty($matches)) {
105-
$pattern = array_combine($matches[1], $matches[0]);
106+
$pattern = \array_combine($matches[1], $matches[0]);
106107
}
107108

108-
return urldecode($router->generate($routeNameFromMappingFile, $pattern, true));
109+
return \urldecode($router->generate($routeNameFromMappingFile, $pattern, true));
109110
}
110111

111112
return (string) $routeNameFromMappingFile;

0 commit comments

Comments
 (0)