Sfoglia il codice sorgente

renamed Request::fromGlobals() to Request::createFromGlobals() (for consistency with the existing create() method)

Fabien Potencier 14 anni fa
parent
commit
98c1056fbf

+ 10 - 10
src/Symfony/Component/HttpFoundation/Request.php

@@ -70,16 +70,6 @@ class Request
 
     static protected $formats;
 
-    /**
-     * Creates a new request with values from PHP's super globals.
-     *
-     * @return Request A new request
-     */
-    static public function fromGlobals()
-    {
-        return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
-    }
-
     /**
      * Constructor.
      *
@@ -129,6 +119,16 @@ class Request
         $this->format = null;
     }
 
+    /**
+     * Creates a new request with values from PHP's super globals.
+     *
+     * @return Request A new request
+     */
+    static public function createfromGlobals()
+    {
+        return new static($_GET, $_POST, array(), $_COOKIE, $_FILES, $_SERVER);
+    }
+
     /**
      * Creates a Request based on a given URI and configuration.
      *

+ 2 - 2
tests/Symfony/Tests/Component/HttpFoundation/RequestTest.php

@@ -428,7 +428,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
         );
     }
 
-    public function testFromGlobals()
+    public function testCreateFromGlobals()
     {
         $_GET['foo1']    = 'bar1';
         $_POST['foo2']   = 'bar2';
@@ -436,7 +436,7 @@ class RequestTest extends \PHPUnit_Framework_TestCase
         $_FILES['foo4']  = array('bar4');
         $_SERVER['foo5'] = 'bar5';
 
-        $request = Request::fromGlobals();
+        $request = Request::createFromGlobals();
         $this->assertEquals('bar1', $request->query->get('foo1'), '::fromGlobals() uses values from $_GET');
         $this->assertEquals('bar2', $request->request->get('foo2'), '::fromGlobals() uses values from $_POST');
         $this->assertEquals('bar3', $request->cookies->get('foo3'), '::fromGlobals() uses values from $_COOKIE');