Remove suppression operator from RegexRoute

This commit is contained in:
PJ Dietz 2015-05-15 19:11:43 -04:00
parent 74369f5b0b
commit 15602d8e97
2 changed files with 8 additions and 1 deletions

View File

@ -20,7 +20,7 @@ class RegexRoute extends Route
public function matchesRequestTarget($requestTarget)
{
$this->captures = [];
$matched = @preg_match($this->getTarget(), $requestTarget, $captures);
$matched = preg_match($this->getTarget(), $requestTarget, $captures);
if ($matched) {
$this->captures = $captures;
return true;

View File

@ -106,7 +106,14 @@ class RegexRouteTest extends \PHPUnit_Framework_TestCase
public function testThrowsExceptionOnInvalidPattern($pattern)
{
$route = new RegexRoute($pattern, $this->methodMap->reveal());
\PHPUnit_Framework_Error_Warning::$enabled = false;
\PHPUnit_Framework_Error_Notice::$enabled = false;
$level = error_reporting();
error_reporting($level & ~E_WARNING);
$route->matchesRequestTarget("/");
error_reporting($level);
\PHPUnit_Framework_Error_Warning::$enabled = true;
\PHPUnit_Framework_Error_Notice::$enabled = true;
}
public function invalidRouteProvider()