Skip to content

Enhancement: Enable binary_operator_spaces fixer #667

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

Merged
merged 2 commits into from
Aug 22, 2022
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
1 change: 1 addition & 0 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -21,6 +21,7 @@
->setRules([
'array_indentation' => true,
'array_syntax' => true,
'binary_operator_spaces' => true,
'class_attributes_separation' => true,
'concat_space' => [
'spacing' => 'one',
Expand Down
4 changes: 2 additions & 2 deletions archive/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,12 @@
include_once __DIR__ . '/../include/prepend.inc';
$i = 0;
do {
$y = date("Y")-$i;
$y = date("Y") - $i;
if (file_exists("./$y.php")) {
mirror_redirect("/archive/$y.php");
break;
}
} while (++$i<3);
} while (++$i < 3);

include_once __DIR__ . '/../include/errors.inc';
error_noservice();
4 changes: 2 additions & 2 deletions build-setup.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,7 +2,7 @@
$_SERVER['BASE_PAGE'] = 'build-setup.php';
include_once __DIR__ . '/include/prepend.inc';

$SIDEBAR_DATA ='
$SIDEBAR_DATA = '
<div class="panel">
<div class="body">
<p>
Expand Down Expand Up @@ -172,6 +172,6 @@
</p>
</div>
<?php
site_footer(['sidebar'=>$SIDEBAR_DATA]);
site_footer(['sidebar' => $SIDEBAR_DATA]);

/* vim: set et ts=4 sw=4 ft=php: : */
2 changes: 1 addition & 1 deletion cached.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@
$abs = realpath($abs);

if (strncmp($abs, $pwd, strlen($pwd)) != 0) {
header("Location: https://www.php.net/" . strtr($_GET["f"],["\r"=>"", "\n"=>""]));
header("Location: https://www.php.net/" . strtr($_GET["f"],["\r" => "", "\n" => ""]));
exit;
}

Expand Down
34 changes: 17 additions & 17 deletions cal.php
Original file line number Diff line number Diff line change
Expand Up @@ -126,7 +126,7 @@

// Beginning and end of this month
$bom = mktime(0, 0, 1, $cm, 1, $cy);
$eom = mktime(0, 0, 1, $cm+1, 0, $cy);
$eom = mktime(0, 0, 1, $cm + 1, 0, $cy);

// Link to previous month (but do not link to too early dates)
$prev_link = (function () use ($cm, $cy) {
Expand All @@ -147,7 +147,7 @@

// Link to next month (but do not link to too early dates)
$next_link = (function () use ($cm, $cy) {
$nm = mktime(0, 0, 1, $cm+1, 1, $cy);
$nm = mktime(0, 0, 1, $cm + 1, 1, $cy);
$year = date('Y', $nm);
if (!valid_year($year)) {
return '&nbsp;';
Expand All @@ -174,7 +174,7 @@

// Print out headers for weekdays
for ($i = 0; $i < 7; $i++) {
echo '<th width="14%">', date("l",mktime(0,0,1,4,$i+1,2001)), "</th>\n";
echo '<th width="14%">', date("l",mktime(0,0,1,4,$i + 1,2001)), "</th>\n";
}
echo "</tr>\n<tr>";

Expand Down Expand Up @@ -225,7 +225,7 @@ function date_for_recur($recur, $day, $bom, $eom)
$eomd = date("w",$eom) + 1;
$days = (($eomd - $day + 7) % 7) + ((abs($recur) - 1) * 7);

return mktime(0, 0, 1, date("m", $bom)+1, -$days, date("Y", $bom));
return mktime(0, 0, 1, date("m", $bom) + 1, -$days, date("Y", $bom));
}

// Display a <div> for each of the events that are on a given day
Expand Down Expand Up @@ -327,8 +327,8 @@ function load_events($from, $whole_month = false)
// Multi-day event
case 2:
if (($event['start'] >= $from_date && $event['start'] <= $to_date)
|| ($event['end'] >= $from_date && $event['end'] <= $to_date)
|| ($event['start'] <= $from_date && $event['end'] >= $to_date)) {
|| ($event['end'] >= $from_date && $event['end'] <= $to_date)
|| ($event['start'] <= $from_date && $event['end'] >= $to_date)) {
$events[] = $event;
}
break;
Expand Down Expand Up @@ -363,17 +363,17 @@ function read_event($fp)

// Return with SQL-resultset like array
return [
'id' => $id,
'type' => $tipo,
'start' => $sdato,
'end' => $edato,
'recur' => $recur,
'id' => $id,
'type' => $tipo,
'start' => $sdato,
'end' => $edato,
'recur' => $recur,
'recur_day' => $recur_day,
'sdesc' => $sdesc,
'url' => $url,
'ldesc' => base64_decode($ldesc, false),
'country' => $country,
'category' => $category,
'sdesc' => $sdesc,
'url' => $url,
'ldesc' => base64_decode($ldesc, false),
'country' => $country,
'category' => $category,
Comment on lines -366 to +376
Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't like such vertical alignments, but others may, so let's wait a while for possible objections.

Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

@cmb69

For the record, it is also possible to configure the spacing per operator: https://github.com/FriendsOfPHP/PHP-CS-Fixer/blob/v3.4.0/doc/rules/operator/binary_operator_spaces.rst.

];
}

Expand All @@ -385,7 +385,7 @@ function valid_year($year)
$current_year = date("Y");

// We only allow this and the next year for displays
if ($year != $current_year && $year != $current_year+1) {
if ($year != $current_year && $year != $current_year + 1) {
return false;
}

Expand Down
6 changes: 3 additions & 3 deletions conferences/index.php
Original file line number Diff line number Diff line change
Expand Up @@ -3,10 +3,10 @@
include_once __DIR__ . '/../include/prepend.inc';
include_once __DIR__ . '/../include/pregen-news.inc';

mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60*60*24*365);
mirror_setcookie("LAST_NEWS", $_SERVER["REQUEST_TIME"], 60 * 60 * 24 * 365);
site_header("PHP Conferences around the world", [
'headtags' => '<link rel="alternate" type="application/atom+xml" title="PHP: Conference announcements" href="' . $MYSITE . 'feed.atom">',
'current' => 'community',
'current' => 'community',
'css' => ['home.css'],
]);

Expand All @@ -28,7 +28,7 @@

foreach ($frontpage as $entry) {
$link = preg_replace('~^(http://php.net/|https://www.php.net/)~', '', $entry["id"]);
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
$id = parse_url($entry["id"], PHP_URL_FRAGMENT);
$date = date_format(date_create($entry["updated"]), 'Y-m-d');
$content .= '<div class="newsentry">';
$content .= '<h3 class="newstitle title"><a href="' . $MYSITE . $link . '" id="' . $id . '">' . $entry["title"] . '</a></h3>';
Expand Down
10 changes: 5 additions & 5 deletions download-docs.php
Original file line number Diff line number Diff line change
Expand Up @@ -7,7 +7,7 @@
exit;
}

$SIDEBAR_DATA='
$SIDEBAR_DATA = '
<div class="panel">
<div class="headline">Online documentation</div>
<div class="body">
Expand Down Expand Up @@ -42,8 +42,8 @@
// Format to look for
$formats = [
"Single HTML file" => "html.gz",
"Many HTML files" => "tar.gz",
"HTML Help file" => "chm",
"Many HTML files" => "tar.gz",
"HTML Help file" => "chm",
"HTML Help file (with user notes)" => "chm",
];
?>
Expand Down Expand Up @@ -114,14 +114,14 @@
$link_to = "/distributions/manual/$filename";

// Try to get size and changed date
$size = @filesize($filepath);
$size = @filesize($filepath);
$changed = @filemtime($filepath);

// Size available, collect information
if ($size !== false) {
$files[$langcode][$formatname] = [
$link_to,
(int) ($size/1024),
(int) ($size / 1024),
date("j M Y", $changed),
$extension
];
Expand Down
2 changes: 1 addition & 1 deletion download-logos.php
Original file line number Diff line number Diff line change
Expand Up @@ -22,7 +22,7 @@ function print_star(): void
function random_bgcolor($min, $max): void
{
echo "style=\"background-color: #" .
sprintf('%02x%02x%02x', rand($min, $max)*51, rand($min, $max)*51, rand($min, $max)*51) .
sprintf('%02x%02x%02x', rand($min, $max) * 51, rand($min, $max) * 51, rand($min, $max) * 51) .
";\"";
}
?>
Expand Down
6 changes: 3 additions & 3 deletions downloads.php
Original file line number Diff line number Diff line change
Expand Up @@ -29,9 +29,9 @@
[
'link' => [
[
"rel" => "alternate",
"type" => "application/atom+xml",
"href" => $MYSITE . "releases/feed.php",
"rel" => "alternate",
"type" => "application/atom+xml",
"href" => $MYSITE . "releases/feed.php",
"title" => "PHP Release feed"
],
],
Expand Down
Loading