Permalink
Browse files

Modified route filter callbacks to require that results be returned r…

…ather than passed by reference
  • Loading branch information...
1 parent 20b5a86 commit ca883a8a191207d738b67dfe2f56f71cfc64610a @elazar elazar committed Jun 23, 2011
Showing with 7 additions and 7 deletions.
  1. +2 −2 README.md
  2. +2 −2 lib/Breeze.php
  3. +1 −1 lib/Breeze/Application.php
  4. +2 −2 test/Breeze/Dispatcher/DispatcherTest.php
View
@@ -167,8 +167,8 @@ In some cases, routes patterns require a global modification, such as prepending
``` php
config('base_dir', '/subdir');
-route(function(&$pattern) {
- $pattern = config('base_dir') . $pattern;
+route(function($pattern) {
+ return config('base_dir') . $pattern;
});
```
View
@@ -125,8 +125,8 @@ function before()
* in the order it was defined.
*
* @code
- * route(function(&$pattern){
- * $pattern = '/subdir' . $pattern;
+ * route(function($pattern){
+ * return '/subdir' . $pattern;
* });
* @endcode
*
@@ -1501,7 +1501,7 @@ public function dispatch($requestMethod = null, $requestUri = null)
foreach ($this->_routes[$this->_requestMethod] as $route) {
$pattern = $route['pattern'];
foreach ($filters as $filter) {
- $filter($pattern);
+ $pattern = $filter($pattern);
}
try {
if ($pattern{0} != '/') {
@@ -255,8 +255,8 @@ public function testSetRequestUriWithParameter()
*/
public function testDispatchWithRouteFilters()
{
- $bar = function(&$pattern) { $pattern .= '/bar'; };
- $baz = function(&$pattern) { $pattern .= '/baz'; };
+ $bar = function($pattern) { return $pattern . '/bar'; };
+ $baz = function($pattern) { return $pattern . '/baz'; };
$this->_mockApplication(array($bar, $baz));
$this->_dispatcher = new Dispatcher($this->_application);
$success = false;

0 comments on commit ca883a8

Please sign in to comment.