Skip to content

Commit 257f412

Browse files
Merge branch '3.3' into 3.4
* 3.3: [CS][2.7] yoda_style, no_unneeded_curly_braces, no_unneeded_final_method, semicolon_after_instruction [Filesystem] mirror - fix copying content with same name as source/target. Removed unnecessary getDefinition() call. .php_cs.dist - simplify config [WebProfilerBundle] fixed TemplateManager when using Twig 2 without compat interfaces
2 parents 5bbc256 + dc77aa4 commit 257f412

File tree

3 files changed

+5
-5
lines changed

3 files changed

+5
-5
lines changed

Loader/ObjectRouteLoader.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -45,7 +45,7 @@ abstract protected function getServiceObject($id);
4545
public function load($resource, $type = null)
4646
{
4747
$parts = explode(':', $resource);
48-
if (count($parts) != 2) {
48+
if (2 != count($parts)) {
4949
throw new \InvalidArgumentException(sprintf('Invalid resource "%s" passed to the "service" route loader: use the format "service_name:methodName"', $resource));
5050
}
5151

Matcher/Dumper/PhpMatcherDumper.php

Lines changed: 3 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -241,8 +241,8 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
241241
$supportsTrailingSlash = $supportsRedirections && (!$methods || in_array('HEAD', $methods) || in_array('GET', $methods));
242242
$regex = $compiledRoute->getRegex();
243243

244-
if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#'.(substr($regex, -1) === 'u' ? 'u' : ''), $regex, $m)) {
245-
if ($supportsTrailingSlash && substr($m['url'], -1) === '/') {
244+
if (!count($compiledRoute->getPathVariables()) && false !== preg_match('#^(.)\^(?P<url>.*?)\$\1#'.('u' === substr($regex, -1) ? 'u' : ''), $regex, $m)) {
245+
if ($supportsTrailingSlash && '/' === substr($m['url'], -1)) {
246246
$conditions[] = sprintf('%s === $trimmedPathinfo', var_export(rtrim(str_replace('\\', '', $m['url']), '/'), true));
247247
$hasTrailingSlash = true;
248248
} else {
@@ -282,7 +282,7 @@ private function compileRoute(Route $route, $name, $supportsRedirections, $paren
282282

283283
if ($methods) {
284284
if (1 === count($methods)) {
285-
if ($methods[0] === 'HEAD') {
285+
if ('HEAD' === $methods[0]) {
286286
$code .= <<<EOF
287287
if ('HEAD' !== \$requestMethod) {
288288
\$allow[] = 'HEAD';

Matcher/Dumper/StaticPrefixCollection.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ private function groupWithItem($item, $prefix, $route)
139139
*/
140140
private function accepts($prefix)
141141
{
142-
return '' === $this->prefix || strpos($prefix, $this->prefix) === 0;
142+
return '' === $this->prefix || 0 === strpos($prefix, $this->prefix);
143143
}
144144

145145
/**

0 commit comments

Comments
 (0)