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

Enhancement: Enable no_mixed_echo_print fixer #864

Merged
merged 2 commits into from
Dec 6, 2023
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 @@ -38,6 +38,7 @@
'line_ending' => true,
'new_with_parentheses' => true,
'no_extra_blank_lines' => true,
'no_mixed_echo_print' => true,
Copy link
Contributor Author

Choose a reason for hiding this comment

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

Note that this fixer can be configured with the use option to prefer echo or print.

Using the default option (echo) applies fewer changes across the code base.

'no_trailing_whitespace' => true,
'ordered_class_elements' => true,
'random_api_migration' => true,
Expand Down
2 changes: 1 addition & 1 deletion git-php.php
Original file line number Diff line number Diff line change
Expand Up @@ -159,7 +159,7 @@

else {
if (count($_POST)) {
print <<<EOT
echo <<<EOT
<div class="warning">
<p>
We could not have said it more clearly. Read everything on
Expand Down
6 changes: 3 additions & 3 deletions images/elephpants.php
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@
$count = min((int) $_REQUEST['count'], 50);
} else {
header('HTTP/1.1 400', true, 400);
print json_encode([
echo json_encode([
'error' => "Specify how many elephpants to serve via 'count'."
]);
exit;
Expand All @@ -52,7 +52,7 @@
// if no photo data, respond with an error.
if (!$photos || !is_array($photos)) {
header('HTTP/1.1 500', true, 500);
print json_encode([
echo json_encode([
'error' => "No elephpant metadata available."
]);
exit;
Expand Down Expand Up @@ -83,4 +83,4 @@
];
}

print json_encode($elephpants);
echo json_encode($elephpants);
8 changes: 4 additions & 4 deletions include/footer.inc
Original file line number Diff line number Diff line change
@@ -1,9 +1,9 @@
</section><!-- layout-content -->
<?php
if (!empty($config['spanning-content'])) {
print "<div class='spanning-content'>";
print $config['spanning-content'];
print "</div>";
echo "<div class='spanning-content'>";
echo $config['spanning-content'];
echo "</div>";
}

?>
Expand Down Expand Up @@ -80,7 +80,7 @@
// if elephpants enabled, insert placeholder nodes
// to be populated with images via javascript.
if (isset($config['elephpants']) && $config['elephpants']) {
print "<div class='elephpants'><div class=images></div></div>";
echo "<div class='elephpants'><div class=images></div></div>";
}
?>

Expand Down
2 changes: 1 addition & 1 deletion include/header.inc
Original file line number Diff line number Diff line change
Expand Up @@ -92,7 +92,7 @@ if (!isset($config["languages"])) {
<?php if (isset($config['meta_tags'])) { echo $config['meta_tags']; } ?>

</head>
<body class="<?php print $curr; ?> <?php echo $classes; ?>">
<body class="<?php echo $curr; ?> <?php echo $classes; ?>">

<nav id="head-nav" class="navbar navbar-fixed-top">
<div class="navbar-inner clearfix">
Expand Down
4 changes: 2 additions & 2 deletions manual/add-note.php
Original file line number Diff line number Diff line change
Expand Up @@ -107,11 +107,11 @@
// If there is any non-header result, then it is an error
if ($result) {
if (strpos($result, '[TOO MANY NOTES]') !== false) {
print "<p class=\"formerror\">As a security precaution, we only allow a certain number of notes to be submitted per minute. At this time, this number has been exceeded. Please re-submit your note in about a minute.</p>";
echo "<p class=\"formerror\">As a security precaution, we only allow a certain number of notes to be submitted per minute. At this time, this number has been exceeded. Please re-submit your note in about a minute.</p>";
} elseif (($pos = strpos($result, '[SPAMMER]')) !== false) {
$ip = trim(substr($result, $pos + 9));
$spam_url = $ip_spam_lookup_url . $ip;
print '<p class="formerror">Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at <a href="' . $spam_url . '">' . $spam_url . '</a>.</p>';
echo '<p class="formerror">Your IP is listed in one of the spammers lists we use, which aren\'t controlled by us. More information is available at <a href="' . $spam_url . '">' . $spam_url . '</a>.</p>';
} elseif (strpos($result, '[SPAM WORD]') !== false) {
echo '<p class="formerror">Your note contains a prohibited (usually SPAM) word. Please remove it and try again.</p>';
} elseif (strpos($result, '[CLOSED]') !== false) {
Expand Down