Author: Andreas Möller (localheinz)
Committer: GitHub (web-flow)
Pusher: kamil-tekiela
Date: 2023-12-06T15:19:57+01:00

Commit: 
https://github.com/php/web-php/commit/a528e6e91b556a7ba348747e338feee04af5484c
Raw diff: 
https://github.com/php/web-php/commit/a528e6e91b556a7ba348747e338feee04af5484c.diff

Enhancement: Enable `no_mixed_echo_print` fixer (#864)

Changed paths:
  M  .php-cs-fixer.php
  M  git-php.php
  M  images/elephpants.php
  M  include/footer.inc
  M  include/header.inc
  M  manual/add-note.php


Diff:

diff --git a/.php-cs-fixer.php b/.php-cs-fixer.php
index 812462b6fa..41f47c9379 100644
--- a/.php-cs-fixer.php
+++ b/.php-cs-fixer.php
@@ -38,6 +38,7 @@
         'line_ending' => true,
         'new_with_parentheses' => true,
         'no_extra_blank_lines' => true,
+        'no_mixed_echo_print' => true,
         'no_trailing_whitespace' => true,
         'ordered_class_elements' => true,
         'random_api_migration' => true,
diff --git a/git-php.php b/git-php.php
index 36982695d6..3654954729 100644
--- a/git-php.php
+++ b/git-php.php
@@ -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
diff --git a/images/elephpants.php b/images/elephpants.php
index 3093973711..ad54ece367 100644
--- a/images/elephpants.php
+++ b/images/elephpants.php
@@ -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;
@@ -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;
@@ -83,4 +83,4 @@
     ];
 }
 
-print json_encode($elephpants);
+echo json_encode($elephpants);
diff --git a/include/footer.inc b/include/footer.inc
index 1f89efa307..6386a9aa24 100644
--- a/include/footer.inc
+++ b/include/footer.inc
@@ -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>";
     }
 
     ?>
@@ -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>";
     }
     ?>
 
diff --git a/include/header.inc b/include/header.inc
index 0ad3050053..26a13846f0 100644
--- a/include/header.inc
+++ b/include/header.inc
@@ -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">
diff --git a/manual/add-note.php b/manual/add-note.php
index e05a191da3..34b3307cff 100644
--- a/manual/add-note.php
+++ b/manual/add-note.php
@@ -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) {

-- 
PHP Webmaster List Mailing List (http://www.php.net/)
To unsubscribe, visit: http://www.php.net/unsub.php

Reply via email to