-
-
Notifications
You must be signed in to change notification settings - Fork 148
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add deprecated
Server
alias for new HttpServer
class to ensure BC
- Loading branch information
Showing
2 changed files
with
33 additions
and
0 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,18 @@ | ||
<?php | ||
|
||
namespace React\Http; | ||
|
||
// Deprecated `Server` is an alias for new `HttpServer` to ensure existing code continues to work as-is. | ||
\class_alias(__NAMESPACE__ . '\\HttpServer', __NAMESPACE__ . '\\Server', true); | ||
|
||
// Aid static analysis and IDE autocompletion about this deprecation, | ||
// but don't actually execute during runtime because `HttpServer` is final. | ||
if (!\class_exists(__NAMESPACE__ . '\\Server', false)) { | ||
/** | ||
* @deprecated 1.5.0 See HttpServer instead | ||
* @see HttpServer | ||
*/ | ||
final class Server extends HttpServer | ||
{ | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,15 @@ | ||
<?php | ||
|
||
namespace React\Tests\Http; | ||
|
||
use React\Http\Server; | ||
|
||
class ServerTest extends TestCase | ||
{ | ||
public function testDeprecatedServerIsInstanceOfNewHttpServer() | ||
{ | ||
$http = new Server(function () { }); | ||
|
||
$this->assertInstanceOf('React\Http\HttpServer', $http); | ||
} | ||
} |