Skip to content

Commit b2fc2e8

Browse files
authored
[6.x] Remove webmozart/assert package (#352)
1 parent ac8b8c9 commit b2fc2e8

File tree

2 files changed

+13
-7
lines changed

2 files changed

+13
-7
lines changed

composer.json

+1-2
Original file line numberDiff line numberDiff line change
@@ -22,8 +22,7 @@
2222
"php": "^8.2",
2323
"illuminate/contracts": "^11.0",
2424
"laravel/prompts": "^0.1.10",
25-
"laravel/socialite": "^5.12",
26-
"webmozart/assert": "^1.11"
25+
"laravel/socialite": "^5.12"
2726
},
2827
"require-dev": {
2928
"laravel/breeze": "^2.0",

src/Data/ProviderData.php

+12-5
Original file line numberDiff line numberDiff line change
@@ -4,7 +4,6 @@
44

55
use JoelButcher\Socialstream\Enums\ProviderEnum;
66
use JoelButcher\Socialstream\Providers;
7-
use Webmozart\Assert\Assert;
87

98
/**
109
* @internal
@@ -16,15 +15,23 @@ private function __construct(
1615
public readonly string $name,
1716
public readonly ?string $buttonLabel = null,
1817
) {
19-
Assert::stringNotEmpty($id);
20-
Assert::stringNotEmpty($name);
18+
if ($id === '') {
19+
throw new \InvalidArgumentException('Expected a different value than \'\'');
20+
}
21+
if ($name === '') {
22+
throw new \InvalidArgumentException('Expected a different value than \'\'');
23+
}
2124
}
2225

2326
public static function from(ProviderEnum|string|array $provider): self
2427
{
2528
if (is_array($provider)) {
26-
Assert::keyExists($provider, 'id');
27-
Assert::keyExists($provider, 'name');
29+
if (! array_key_exists('id', $provider)) {
30+
throw new \InvalidArgumentException('Expected the key \'id\' to exist');
31+
}
32+
if (! array_key_exists('name', $provider)) {
33+
throw new \InvalidArgumentException('Expected the key \'name\' to exist');
34+
}
2835
}
2936

3037
return match (true) {

0 commit comments

Comments
 (0)