Skip to content

Commit ab9e431

Browse files
committed
Update PHP CS Fixer
1 parent 761adf3 commit ab9e431

File tree

5 files changed

+16
-16
lines changed

5 files changed

+16
-16
lines changed

composer.json

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@
4444
"require-dev": {
4545
"phpunit/phpunit": "^10.5.9",
4646
"phpstan/phpstan": "^1.10.57",
47-
"friendsofphp/php-cs-fixer": "^v3.48.0"
47+
"friendsofphp/php-cs-fixer": "^v3.68.3"
4848
},
4949
"autoload": {
5050
"psr-4": {

src/Encryption.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -267,9 +267,9 @@ private static function getIKM(string $userAuthToken, string $userPublicKey, str
267267
if (empty($userAuthToken)) {
268268
return $sharedSecret;
269269
}
270-
if($contentEncoding === "aesgcm") {
270+
if ($contentEncoding === "aesgcm") {
271271
$info = 'Content-Encoding: auth'.chr(0);
272-
} elseif($contentEncoding === "aes128gcm") {
272+
} elseif ($contentEncoding === "aes128gcm") {
273273
$info = "WebPush: info".chr(0).$userPublicKey.$localPublicKey;
274274
} else {
275275
throw new \ValueError("This content encoding is not supported.");

src/Subscription.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -25,7 +25,7 @@ public function __construct(
2525
private ?string $authToken = null,
2626
private ?string $contentEncoding = null
2727
) {
28-
if($publicKey || $authToken || $contentEncoding) {
28+
if ($publicKey || $authToken || $contentEncoding) {
2929
$supportedContentEncodings = ['aesgcm', 'aes128gcm'];
3030
if ($contentEncoding && !in_array($contentEncoding, $supportedContentEncodings, true)) {
3131
throw new \ErrorException('This content encoding ('.$contentEncoding.') is not supported.');

src/Utils.php

Lines changed: 10 additions & 10 deletions
Original file line numberDiff line numberDiff line change
@@ -75,14 +75,14 @@ public static function checkRequirementExtension(): void
7575
'mbstring' => '[WebPush] mbstring extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.',
7676
'openssl' => '[WebPush] openssl extension is not loaded but is required for sending push notifications with payload or for VAPID authentication. You can fix this in your php.ini.',
7777
];
78-
foreach($requiredExtensions as $extension => $message) {
79-
if(!extension_loaded($extension)) {
78+
foreach ($requiredExtensions as $extension => $message) {
79+
if (!extension_loaded($extension)) {
8080
trigger_error($message, E_USER_WARNING);
8181
}
8282
}
8383

8484
// Check optional extensions.
85-
if(!extension_loaded("bcmath") && !extension_loaded("gmp")) {
85+
if (!extension_loaded("bcmath") && !extension_loaded("gmp")) {
8686
trigger_error("It is highly recommended to install the GMP or BCMath extension to speed up calculations. The fastest available calculator implementation will be automatically selected at runtime.", E_USER_NOTICE);
8787
}
8888
}
@@ -95,11 +95,11 @@ public static function checkRequirementKeyCipherHash(): void
9595
'prime256v1' => '[WebPush] Openssl does not support required curve prime256v1.',
9696
];
9797
$availableCurves = openssl_get_curve_names();
98-
if($availableCurves === false) {
98+
if ($availableCurves === false) {
9999
trigger_error('[WebPush] Openssl does not support curves.', E_USER_WARNING);
100100
} else {
101-
foreach($requiredCurves as $curve => $message) {
102-
if(!in_array($curve, $availableCurves, true)) {
101+
foreach ($requiredCurves as $curve => $message) {
102+
if (!in_array($curve, $availableCurves, true)) {
103103
trigger_error($message, E_USER_WARNING);
104104
}
105105
}
@@ -110,8 +110,8 @@ public static function checkRequirementKeyCipherHash(): void
110110
'aes-128-gcm' => '[WebPush] Openssl does not support required cipher aes-128-gcm.',
111111
];
112112
$availableCiphers = openssl_get_cipher_methods();
113-
foreach($requiredCiphers as $cipher => $message) {
114-
if(!in_array($cipher, $availableCiphers, true)) {
113+
foreach ($requiredCiphers as $cipher => $message) {
114+
if (!in_array($cipher, $availableCiphers, true)) {
115115
trigger_error($message, E_USER_WARNING);
116116
}
117117
}
@@ -121,8 +121,8 @@ public static function checkRequirementKeyCipherHash(): void
121121
'sha256' => '[WebPush] Php does not support required hmac hash sha256.',
122122
];
123123
$availableHash = hash_hmac_algos();
124-
foreach($requiredHash as $hash => $message) {
125-
if(!in_array($hash, $availableHash, true)) {
124+
foreach ($requiredHash as $hash => $message) {
125+
if (!in_array($hash, $availableHash, true)) {
126126
trigger_error($message, E_USER_WARNING);
127127
}
128128
}

src/WebPush.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -341,10 +341,10 @@ public function setAutomaticPadding(bool|int $automaticPadding): WebPush
341341
$automaticPadding = 0;
342342
}
343343

344-
if($automaticPadding > Encryption::MAX_PAYLOAD_LENGTH) {
344+
if ($automaticPadding > Encryption::MAX_PAYLOAD_LENGTH) {
345345
throw new \ValueError('Automatic padding is too large. Max is '.Encryption::MAX_PAYLOAD_LENGTH.'. Recommended max is '.Encryption::MAX_COMPATIBILITY_PAYLOAD_LENGTH.' for compatibility reasons (see README).');
346346
}
347-
if($automaticPadding < 0) {
347+
if ($automaticPadding < 0) {
348348
throw new \ValueError('Padding length should be positive or zero.');
349349
}
350350

0 commit comments

Comments
 (0)