Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

CS: always clarify operator precedence when mixing boolean operators #870

Merged
merged 1 commit into from
Jun 3, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
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
Loading