-
Notifications
You must be signed in to change notification settings - Fork 6
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #34 from veewee/optional-deps
Improve error handling of optional dependencies
- Loading branch information
Showing
13 changed files
with
113 additions
and
13 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
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
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
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpro\HttpTools\Dependency; | ||
|
||
use GuzzleHttp\Client; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class GuzzleDependency | ||
{ | ||
public static function guard(): void | ||
{ | ||
Assert::classExists( | ||
Client::class, | ||
'Could not find guzzle client. Please run: "composer require guzzlehttp/guzzle" and make sure the version >7.' | ||
); | ||
} | ||
} |
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 | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpro\HttpTools\Dependency; | ||
|
||
use Webmozart\Assert\Assert; | ||
|
||
final class MockClientDependency | ||
{ | ||
public static function guard(): void | ||
{ | ||
Assert::classExists( | ||
\Http\Mock\Client::class, | ||
'Could not find a mock client. Please run: "composer require --dev php-http/mock-client"' | ||
); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpro\HttpTools\Dependency; | ||
|
||
use Symfony\Component\HttpClient\CurlHttpClient; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class SymfonyClientDependency | ||
{ | ||
public static function guard(): void | ||
{ | ||
Assert::classExists( | ||
CurlHttpClient::class, | ||
'Could not find symfony HTTP client. Please run: "composer require symfony/http-client" and make sure the version >5.4' | ||
); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpro\HttpTools\Dependency; | ||
|
||
use Symfony\Component\Mime\MimeTypes; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class SymfonyMimeDependency | ||
{ | ||
public static function guard(): void | ||
{ | ||
Assert::classExists( | ||
MimeTypes::class, | ||
'Could not find symfony HTTP client. Please run: "composer require symfony/mime" and make sure the version >6.0' | ||
); | ||
} | ||
} |
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Phpro\HttpTools\Dependency; | ||
|
||
use Http\Client\Plugin\Vcr\RecordPlugin; | ||
use Webmozart\Assert\Assert; | ||
|
||
final class VcrPluginDependency | ||
{ | ||
public static function guard(): void | ||
{ | ||
Assert::classExists( | ||
RecordPlugin::class, | ||
'Could not find the VCR plugin. Please run: "composer require --dev php-http/vcr-plugin"' | ||
); | ||
} | ||
} |
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
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
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
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
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