Skip to content

Enhancement: Enable not_operator_with_successor_space fixer #853

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

Closed
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -36,6 +36,7 @@
'new_with_parentheses' => true,
'no_extra_blank_lines' => true,
'no_trailing_whitespace' => true,
'not_operator_with_successor_space' => true,
'ordered_class_elements' => true,
'random_api_migration' => true,
'single_space_around_construct' => [
Expand Down
2 changes: 1 addition & 1 deletion cached.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$_SERVER['BASE_PAGE'] = 'cached.php';
include_once 'include/prepend.inc';

if (!isset($_GET["f"])) {
if (! isset($_GET["f"])) {
header("Location: https://www.php.net/");
exit;
}
Expand Down
20 changes: 10 additions & 10 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@
// If the year is not valid, set it to the current year
// This excludes all the "too old", or "too far in the future"
// calendar displays (so search engines can handle this page too)
if ($cy != 0 && !valid_year($cy)) {
if ($cy != 0 && ! valid_year($cy)) {
$cy = date("Y");
}

Expand Down Expand Up @@ -80,7 +80,7 @@
}

// Check if month and year is valid
if ($cm && $cy && !checkdate($cm,1,$cy)) {
if ($cm && $cy && ! checkdate($cm,1,$cy)) {
$errors[] = "The specified year and month (" . htmlentities("$cy, $cm", ENT_QUOTES | ENT_IGNORE, 'UTF-8') . ") are not valid.";
unset($cm, $cy);
}
Expand All @@ -92,7 +92,7 @@
// Start of the month date
$date = mktime(0, 0, 1, $cm, 1, $cy);

if (!$begun) {
if (! $begun) {
site_header("Events: " . date("F Y", $date), $site_header_config);
?>
<div class="tip">
Expand Down Expand Up @@ -132,7 +132,7 @@
$prev_link = (function () use ($cm, $cy) {
$lm = mktime(0, 0, 1, $cm, 0, $cy);
$year = date('Y', $lm);
if (!valid_year($year)) {
if (! valid_year($year)) {
return '&nbsp;';
}

Expand All @@ -149,7 +149,7 @@
$next_link = (function () use ($cm, $cy) {
$nm = mktime(0, 0, 1, $cm + 1, 1, $cy);
$year = date('Y', $nm);
if (!valid_year($year)) {
if (! valid_year($year)) {
return '&nbsp;';
}

Expand Down Expand Up @@ -257,10 +257,10 @@ function load_event($id)
{
// Open events CSV file, return on error
$fp = @fopen("backend/events.csv",'r');
if (!$fp) { return false; }
if (! $fp) { return false; }

// Read as we can, event by event
while (!feof($fp)) {
while (! feof($fp)) {

$event = read_event($fp);

Expand Down Expand Up @@ -292,10 +292,10 @@ function load_events($from, $whole_month = false)

// Try to open the events file for reading, return if unable to
$fp = @fopen("backend/events.csv",'r');
if (!$fp) { return false; }
if (! $fp) { return false; }

// For all events, read in the event and check it if fits our scope
while (!feof($fp)) {
while (! feof($fp)) {

// Read the event data into $event, or continue with next
// line, if there was an error with this line
Expand All @@ -305,7 +305,7 @@ function load_events($from, $whole_month = false)

// Keep event's seen list up to date
// (for repeating events with the same ID)
if (!isset($seen[$event['id']])) { $seen[$event['id']] = 1; }
if (! isset($seen[$event['id']])) { $seen[$event['id']] = 1; }
else { continue; }

// Check if event is in our scope, depending on type
Expand Down
2 changes: 1 addition & 1 deletion docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,7 +29,7 @@
// List all manual languages viewable online
$lastlang = end($ACTIVE_ONLINE_LANGUAGES);
foreach ($ACTIVE_ONLINE_LANGUAGES as $langcode => $langname) {
if (!file_exists($_SERVER["DOCUMENT_ROOT"] . "/manual/{$langcode}/index.php")) {
if (! file_exists($_SERVER["DOCUMENT_ROOT"] . "/manual/{$langcode}/index.php")) {
continue;
}

Expand Down
10 changes: 5 additions & 5 deletions download-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$_SERVER['BASE_PAGE'] = 'download-docs.php';
include_once __DIR__ . '/include/prepend.inc';

if (!empty($_GET['active_langs'])) {
if (! empty($_GET['active_langs'])) {
echo serialize($ACTIVE_ONLINE_LANGUAGES);
exit;
}
Expand Down Expand Up @@ -161,7 +161,7 @@

// Print out the name of the formats
foreach ($formats as $formatname => $extension) {
if (!isset($found_formats[$formatname])) { continue; }
if (! isset($found_formats[$formatname])) { continue; }
echo " <th valign=\"bottom\">$formatname</th>\n";
}

Expand All @@ -185,18 +185,18 @@
foreach ($formats as $formatname => $extension) {

// Skip if no file found
if (!isset($found_formats[$formatname])) { continue; }
if (! isset($found_formats[$formatname])) { continue; }

echo "<td align=\"center\"$cellclass>";
if (!isset($lang_files[$formatname])) {
if (! isset($lang_files[$formatname])) {
echo "&nbsp;";
} else {

$fileinfo = $lang_files[$formatname];
echo "<a href=\"$fileinfo[0]\"";

// Only print out tooltip, if explicit information is not printed
if (!isset($_GET['sizes']) && !$preflang) {
if (! isset($_GET['sizes']) && ! $preflang) {
echo " title=\" Size: $fileinfo[1]Kb -- Date: $fileinfo[2]\"";
}

Expand Down
6 changes: 3 additions & 3 deletions error.php
Original file line number Diff line number Diff line change
Expand Up @@ -77,7 +77,7 @@
// default language manual accessibility on mirror sites through /manual/filename)
// @todo do we rely on this? how about removing it...
if (preg_match("!^manual/([^/]*)$!", $URI, $array)) {
if (!isset($INACTIVE_ONLINE_LANGUAGES[$array[1]])) {
if (! isset($INACTIVE_ONLINE_LANGUAGES[$array[1]])) {
mirror_redirect("/manual/$LANG/$array[1]");
}
} elseif (preg_match("!^manual/html/([^/]+)$!", $URI, $array)) {
Expand Down Expand Up @@ -146,7 +146,7 @@
$mr = "https://www.php.net/";

// Check if that mirror really exists if not, bail out
if (!isset($MIRRORS[$mr])) {
if (! isset($MIRRORS[$mr])) {
error_nomirror($mr);
exit;
}
Expand Down Expand Up @@ -179,7 +179,7 @@
// Redirect if the entered URI was a PHP page name (except some pages,
// which we display in the mirror's language or the explicitly specified
// language [see below])
if (!in_array($URI, ['mirror-info', 'error', 'mod'], true) &&
if (! in_array($URI, ['mirror-info', 'error', 'mod'], true) &&
file_exists($_SERVER['DOCUMENT_ROOT'] . "/$URI.php")) {
mirror_redirect("/$URI.php");
}
Expand Down
12 changes: 6 additions & 6 deletions git-php.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,7 +5,7 @@
include_once __DIR__ . '/include/posttohost.inc';

// Force the account requests to php.net
if (!is_primary_site()) {
if (! is_primary_site()) {
header('Location: https://www.php.net/' . $_SERVER['BASE_PAGE']);
exit;
}
Expand Down Expand Up @@ -41,14 +41,14 @@
<?php

// We have a form submitted, and the user have read all the comments
if (count($_POST) && (!isset($_POST['purpose']) || !is_array($_POST['purpose']) || !count($_POST['purpose']))) {
if (count($_POST) && (! isset($_POST['purpose']) || ! is_array($_POST['purpose']) || ! count($_POST['purpose']))) {
// No error found yet
$error = "";

// Check for errors
if (empty($_POST['id'])) {
$error .= "You must supply a desired Git user id. <br>";
} elseif (!preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) {
} elseif (! preg_match('!^[a-z]\w+$!', $_POST['id']) || strlen($_POST['id']) > 16) {
$error .= "Your user id must be from 1-16 characters long, start with " .
"a letter and contain nothing but a-z, 0-9, and _ <br>";
}
Expand All @@ -61,21 +61,21 @@
if (empty($_POST['password'])) {
$error .= "You must supply a desired password. <br>";
}
if (empty($_POST['email']) || !is_emailable_address($_POST['email'])) {
if (empty($_POST['email']) || ! is_emailable_address($_POST['email'])) {
$error .= "You must supply a proper email address. <br>";
}
if (empty($_POST['yesno']) || $_POST['yesno'] != 'yes') {
$error .= "You did not fill the form out correctly. <br>";
}
if (empty($_POST['group']) || $_POST['group'] === 'none' || !isset($groups[$_POST['group']])) {
if (empty($_POST['group']) || $_POST['group'] === 'none' || ! isset($groups[$_POST['group']])) {
$error .= "You did not fill out where to send the request. <br>";
}
if (empty($_POST['guidelines'])) {
$error .= "You did not agree to follow the contribution guidelines. <br>";
}

// Post the request if there is no error
if (!$error) {
if (! $error) {
$error = posttohost(
"https://main.php.net/entry/svn-account.php",
[
Expand Down
4 changes: 2 additions & 2 deletions images/elephpants.php
Original file line number Diff line number Diff line change
Expand Up @@ -50,7 +50,7 @@
$photos = json_decode($json, true);

// if no photo data, respond with an error.
if (!$photos || !is_array($photos)) {
if (! $photos || ! is_array($photos)) {
header('HTTP/1.1 500', true, 500);
print json_encode([
'error' => "No elephpant metadata available."
Expand All @@ -70,7 +70,7 @@
}

// skip photo if file doesn't exist.
if (!is_readable($path . '/' . $photo['filename'])) {
if (! is_readable($path . '/' . $photo['filename'])) {
continue;
}

Expand Down
4 changes: 2 additions & 2 deletions images/logo.php
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
$last = strtotime($_SERVER['HTTP_IF_MODIFIED_SINCE']);

// Use the same logo for a day
if (strtotime('+1 day', $last) > $now && !$refresh) {
if (strtotime('+1 day', $last) > $now && ! $refresh) {
header('HTTP/1.1 304 Not Modified');
exit;
}
Expand Down Expand Up @@ -53,7 +53,7 @@ function get_accepted_encodings() {

function serve_compressed_if_available($logo): void {
$encodings = get_accepted_encodings();
if (!empty($encodings)) {
if (! empty($encodings)) {
foreach ($encodings as $encoding) {
if ($encoding === 'gzip') {
$encoded_file = "$logo.gz";
Expand Down
4 changes: 2 additions & 2 deletions images/supported-versions.php
Original file line number Diff line number Diff line change
Expand Up @@ -39,7 +39,7 @@ function max_date() {

function date_horiz_coord(DateTime $date) {
$diff = $date->diff(min_date());
if (!$diff->invert) {
if (! $diff->invert) {
return $GLOBALS['margin_left'];
}
return $GLOBALS['margin_left'] + ($diff->days / (365.24 / $GLOBALS['year_width']));
Expand All @@ -51,7 +51,7 @@ function date_horiz_coord(DateTime $date) {
$branches[$branch]['top'] = $header_height + ($branch_height * $i++);
}

if (!isset($non_standalone)) {
if (! isset($non_standalone)) {
header('Content-Type: image/svg+xml');
echo '<?xml version="1.0"?>';
}
Expand Down
16 changes: 8 additions & 8 deletions include/branches.inc
Original file line number Diff line number Diff line change
Expand Up @@ -101,7 +101,7 @@ function get_all_branches() {
foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
if (! isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = $release;
$branches[$major][$branch]['version'] = $version;
}
Expand All @@ -112,7 +112,7 @@ function get_all_branches() {
foreach ($GLOBALS['RELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
if (! isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = $release;
$branches[$major][$branch]['version'] = $version;
}
Expand Down Expand Up @@ -149,7 +149,7 @@ function get_active_branches($include_recent_eols = true) {
}
}
}
if (!empty($branches[$major])) {
if (! empty($branches[$major])) {
ksort($branches[$major]);
}
}
Expand All @@ -170,7 +170,7 @@ function get_eol_branches($always_include = null) {
foreach ($GLOBALS['OLDRELEASES'] as $major => $releases) {
foreach ($releases as $version => $release) {
if ($branch = version_number_to_branch($version)) {
if (!isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
if (! isset($branches[$major][$branch]) || version_compare($version, $branches[$major][$branch]['version'], 'gt')) {
$branches[$major][$branch] = [
'date' => strtotime($release['date']),
'link' => "/releases#$version",
Expand Down Expand Up @@ -233,7 +233,7 @@ function get_eol_branches($always_include = null) {
* version metadata from $RELEASES for a single release. */
function get_initial_release($branch) {
$branch = version_number_to_branch($branch);
if (!$branch) {
if (! $branch) {
return null;
}
$major = substr($branch, 0, strpos($branch, '.'));
Expand All @@ -257,7 +257,7 @@ function get_initial_release($branch) {

function get_final_release($branch) {
$branch = version_number_to_branch($branch);
if (!$branch) {
if (! $branch) {
return null;
}
$major = substr($branch, 0, strpos($branch, '.'));
Expand Down Expand Up @@ -389,13 +389,13 @@ function get_current_release_for_branch(int $major, ?int $minor): ?string {
}

foreach (($RELEASES[$major] ?? []) as $version => $_) {
if (!strncmp($prefix, $version, strlen($prefix))) {
if (! strncmp($prefix, $version, strlen($prefix))) {
return $version;
}
}

foreach (($OLDRELEASES[$major] ?? []) as $version => $_) {
if (!strncmp($prefix, $version, strlen($prefix))) {
if (! strncmp($prefix, $version, strlen($prefix))) {
return $version;
}
}
Expand Down
2 changes: 1 addition & 1 deletion include/do-download.inc
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@ function get_actual_download_file($file)
function download_file($mirror, $file): void
{
// Redirect to the particular file
if (!headers_sent()) {
if (! headers_sent()) {
status_header(302);
header('Location: ' . $mirror . 'distributions/' . $file);
} else {
Expand Down
4 changes: 2 additions & 2 deletions include/errors.inc
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ function status_header(int $status): bool
302 => 'Found',
404 => 'Not Found',
];
if (!isset($text[$status])) {
if (! isset($text[$status])) {
return false;
}

Expand Down Expand Up @@ -585,7 +585,7 @@ function get_legacy_manual_urls(string $uri): array
return $matches[1] ;
}, $uri);

if (!isset($pages_ids[$page_id])) {
if (! isset($pages_ids[$page_id])) {
return [];
}

Expand Down
Loading