<?php

namespace Http\Factory\Diactoros;

use Psr\Http\Factory\ServerRequestFactoryInterface;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory as Factory;

class ServerRequestFactory implements ServerRequestFactoryInterface
{
    public function createServerRequest($method, $uri)
    {
        return new ServerRequest([], [], $uri, $method);
    }

    public function createServerRequestFromGlobals()
    {
        return Factory::fromGlobals();
    }
}

<?php

namespace Http\Factory\Diactoros;

use Psr\Http\Factory\ServerRequestFactoryInterface;
use Zend\Diactoros\ServerRequest;
use Zend\Diactoros\ServerRequestFactory as Factory;

class ServerRequestFactory implements ServerRequestFactoryInterface
{
    public function createServerRequest($method, $uri)
    {
        if (is_string($uri)) {
            return new ServerRequest([], [], $uri, $method);
        }

        return (new ServerRequest([], [], null, $method))
            ->withUri($uri);
    }

    public function createServerRequestFromGlobals()
    {
        return Factory::fromGlobals();
    }
}

--- 
+++ 
@@ -10,12 +10,7 @@
 {
     public function createServerRequest($method, $uri)
     {
-        if (is_string($uri)) {
-            return new ServerRequest([], [], $uri, $method);
-        }
-
-        return (new ServerRequest([], [], null, $method))
-            ->withUri($uri);
+        return new ServerRequest([], [], $uri, $method);
     }
 
     public function createServerRequestFromGlobals()
Remove extra logic if $uri is UriInterface
