Skip to content

Commit e2f2b23

Browse files
committed
Fully qualify the SODIUM_* constants
Similarly this allows OPcache to inline the constants.
1 parent 7199e4c commit e2f2b23

1 file changed

Lines changed: 6 additions & 6 deletions

File tree

src/Base64.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -55,8 +55,8 @@ public static function encode(
5555
): string {
5656
if (\extension_loaded('sodium')) {
5757
$variant = match(static::class) {
58-
Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL,
59-
Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE,
58+
Base64::class => \SODIUM_BASE64_VARIANT_ORIGINAL,
59+
Base64UrlSafe::class => \SODIUM_BASE64_VARIANT_URLSAFE,
6060
default => 0,
6161
};
6262
if ($variant > 0) {
@@ -87,8 +87,8 @@ public static function encodeUnpadded(
8787
): string {
8888
if (\extension_loaded('sodium')) {
8989
$variant = match(static::class) {
90-
Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING,
91-
Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING,
90+
Base64::class => \SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING,
91+
Base64UrlSafe::class => \SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING,
9292
default => 0,
9393
};
9494
if ($variant > 0) {
@@ -201,8 +201,8 @@ public static function decode(
201201
}
202202
if (\extension_loaded('sodium')) {
203203
$variant = match(static::class) {
204-
Base64::class => SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING,
205-
Base64UrlSafe::class => SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING,
204+
Base64::class => \SODIUM_BASE64_VARIANT_ORIGINAL_NO_PADDING,
205+
Base64UrlSafe::class => \SODIUM_BASE64_VARIANT_URLSAFE_NO_PADDING,
206206
default => 0,
207207
};
208208
if ($variant > 0) {

0 commit comments

Comments
 (0)