Skip to content

Commit

Permalink
CS: always clarify operator precedence when mixing boolean operators
Browse files Browse the repository at this point in the history
  • Loading branch information
jrfnl committed Jun 3, 2024
1 parent 31ba95a commit 5d54c39
Show file tree
Hide file tree
Showing 2 changed files with 7 additions and 7 deletions.
12 changes: 6 additions & 6 deletions src/IdnaEncoder.php
Original file line number Diff line number Diff line change
Expand Up @@ -223,18 +223,18 @@ protected static function utf8_to_codepoints($input) {
}

if (// Non-shortest form sequences are invalid
$length > 1 && $character <= 0x7F
|| $length > 2 && $character <= 0x7FF
|| $length > 3 && $character <= 0xFFFF
($length > 1 && $character <= 0x7F)
|| ($length > 2 && $character <= 0x7FF)
|| ($length > 3 && $character <= 0xFFFF)
// Outside of range of ucschar codepoints
// Noncharacters
|| ($character & 0xFFFE) === 0xFFFE
|| $character >= 0xFDD0 && $character <= 0xFDEF
|| ($character >= 0xFDD0 && $character <= 0xFDEF)
|| (
// Everything else not in ucschar
$character > 0xD7FF && $character < 0xF900
($character > 0xD7FF && $character < 0xF900)
|| $character < 0x20
|| $character > 0x7E && $character < 0xA0
|| ($character > 0x7E && $character < 0xA0)
|| $character > 0xEFFFD
)
) {
Expand Down
2 changes: 1 addition & 1 deletion src/Ipv6.php
Original file line number Diff line number Diff line change
Expand Up @@ -163,7 +163,7 @@ public static function check_ipv6($ip) {
list($ipv6, $ipv4) = self::split_v6_v4($ip);
$ipv6 = explode(':', $ipv6);
$ipv4 = explode('.', $ipv4);
if (count($ipv6) === 8 && count($ipv4) === 1 || count($ipv6) === 6 && count($ipv4) === 4) {
if ((count($ipv6) === 8 && count($ipv4) === 1) || (count($ipv6) === 6 && count($ipv4) === 4)) {
foreach ($ipv6 as $ipv6_part) {
// The section can't be empty
if ($ipv6_part === '') {
Expand Down

0 comments on commit 5d54c39

Please sign in to comment.