8000 minor #10186 Made some HHVM-related fixes (fabpot) · symfony/symfony@bea1537 · GitHub
[go: up one dir, main page]

Skip to content

Commit bea1537

Browse files
committed
minor #10186 Made some HHVM-related fixes (fabpot)
This PR was merged into the 2.5-dev branch. Discussion ---------- Made some HHVM-related fixes | Q | A | ------------- | --- | Bug fix? | no | New feature? | no | BC breaks? | no | Deprecations? | no | Tests pass? | yes | Fixed tickets | n/a | License | MIT | Doc PR | n/a Commits ------- 1240758 [Routing] fixed CS e223395 [Debug] fixed case differences between PHP and HHVM (classes are case-insensitive anyway in PHP) 23acc24 [Debug] made order of suggestions predictable in error messages
2 parents 4c9e307 + 1240758 commit bea1537

File tree

6 files changed

+12
-8
lines changed

6 files changed

+12
-8
lines changed

src/Symfony/Component/Debug/FatalErrorHandler/UndefinedFunctionFatalErrorHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -80,6 +80,7 @@ public function handleError(array $error, FatalErrorException $exception)
8080
}
8181

8282
if ($candidates) {
83+
sort($candidates);
8384
$message .= ' Did you mean to call: '.implode(', ', array_map(function ($val) {
8485
return '"'.$val.'"';
8586
}, $candidates)).'?';

src/Symfony/Component/Debug/FatalErrorHandler/UndefinedMethodFatalErrorHandler.php

Lines changed: 1 addition & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -45,6 +45,7 @@ public function handleError(array $error, FatalErrorException $exception)
4545
}
4646

4747
if ($candidates) {
48+
sort($candidates);
4849
$message .= sprintf(' Did you mean to call: "%s"?', implode('", "', $candidates));
4950
}
5051

src/Symfony/Component/Debug/Tests/ErrorHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -254,7 +254,8 @@ public function testFatalErrorHandlers($error, $class, $translatedMessage)
254254
$m->invoke($handler, $exceptionHandler, $error);
255255

256256
$this->assertInstanceof($class, $exceptionHandler->e);
257-
$this->assertSame($translatedMessage, $exceptionHandler->e->getMessage());
257+
// class names are case insensitive and PHP/HHVM do not return the same
258+
$this->assertSame(strtolower($translatedMessage), strtolower($exceptionHandler->e->getMessage()));
258259
$this->assertSame($error['type'], $exceptionHandler->e->getSeverity());
259260
$this->assertSame($error['file'], $exceptionHandler->e->getFile());
260261
$this->assertSame($error['line'], $exceptionHandler->e->getLine());

src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedFunctionFatalErrorHandlerTest.php

Lines changed: 2 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,8 @@ public function testUndefinedFunction($error, $translatedMessage)
2525
$exception = $handler->handleError($error, new FatalErrorException('', 0, $error['type'], $error['file'], $error['line']));
2626

2727
$this->assertInstanceof('Symfony\Component\Debug\Exception\UndefinedFunctionException', $exception);
28-
$this->assertSame($translatedMessage, $exception->getMessage());
28+
// class names are case insensitive and PHP/HHVM do not return the same
29+
$this->assertSame(strtolower($translatedMessage), strtolower($exception->getMessage()));
2930
$this->assertSame($error['type'], $exception->getSeverity());
3031
$this->assertSame($error['file'], $exception->getFile());
3132
$this->assertSame($error['line'], $exception->getLine());

src/Symfony/Component/Debug/Tests/FatalErrorHandler/UndefinedMethodFatalErrorHandlerTest.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -59,7 +59,7 @@ public function provideUndefinedMethodData()
5959
'file' => 'foo.php',
6060
'message' => 'Call to undefined method SplObjectStorage::offsetFet()',
6161
),
62-
'Attempted to call method "offsetFet" on class "SplObjectStorage" in foo.php line 12. Did you mean to call: "offsetSet", "offsetUnset", "offsetGet"?',
62+
'Attempted to call method "offsetFet" on class "SplObjectStorage" in foo.php line 12. Did you mean to call: "offsetGet", "offsetSet", "offsetUnset"?',
6363
),
6464
);
6565
}

src/Symfony/Component/Routing/Tests/Generator/Dumper/PhpGeneratorDumperTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -60,7 +60,7 @@ public function testDumpWithRoutes()
6060
$this->routeCollection->add('Test2', new Route('/testing2'));
6161

6262
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump());
63-
include ($this->testTmpFilepath);
63+
include $this->testTmpFilepath;
6464

6565
$projectUrlGenerator = new \ProjectUrlGenerator(new RequestContext('/app.php'));
6666

@@ -81,7 +81,7 @@ public function testDumpWithRoutes()
8181
public function testDumpWithoutRoutes()
8282
{
8383
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'WithoutRoutesUrlGenerator')));
84-
include ($this->testTmpFilepath);
84+
include $this->testTmpFilepath;
8585

8686
$projectUrlGenerator = new \WithoutRoutesUrlGenerator(new RequestContext('/app.php'));
8787

@@ -96,7 +96,7 @@ public function testGenerateNonExistingRoute()
9696
$this->routeCollection->add('Test', new Route('/test'));
9797

9898
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'NonExistingRoutesUrlGenerator')));
99-
include ($this->testTmpFilepath);
99+
include $this->testTmpFilepath;
100100

101101
$projectUrlGenerator = new \NonExistingRoutesUrlGenerator(new RequestContext());
102102
$url = $projectUrlGenerator->generate('NonExisting', array());
@@ -107,7 +107,7 @@ public function testDumpForRouteWithDefaults()
107107
$this->routeCollection->add('Test', new Route('/testing/{foo}', array('foo' => 'bar')));
108108

109109
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'DefaultRoutesUrlGenerator')));
110-
include ($this->testTmpFilepath);
110+
include $this->testTmpFilepath;
111111

112112
$projectUrlGenerator = new \DefaultRoutesUrlGenerator(new RequestContext());
113113
$url = $projectUrlGenerator->generate('Test', array());
@@ -121,7 +121,7 @@ public function testDumpWithSchemeRequirement()
121121
$this->routeCollection->add('Test2', new Route('/testing_bc', array(), array('_scheme' => 'https'))); // BC
122122

123123
file_put_contents($this->testTmpFilepath, $this->generatorDumper->dump(array('class' => 'SchemeUrlGenerator')));
124-
include ($this->testTmpFilepath);
124+
include $this->testTmpFilepath;
125125

126126
$projectUrlGenerator = new \SchemeUrlGenerator(new RequestContext('/app.php'));
127127

0 commit comments

Comments
 (0)
0