Author: Mike Schinkel (mikeschinkel)
Committer: GitHub (web-flow)
Pusher: kelunik
Date: 2021-07-21T21:20:10+02:00

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

Add returns to end of functions (#422)

PhpStorm flags functions that don't have returns at the end so this PR 
rearranges code so that the returns are always at the end, or in one case adds 
one that was missing.

Changed paths:
  M  include/layout.inc


Diff:

diff --git a/include/layout.inc b/include/layout.inc
index fa61262e7..f66187b70 100644
--- a/include/layout.inc
+++ b/include/layout.inc
@@ -43,7 +43,8 @@ function highlight_php($code, $return = FALSE)
     ) . '</div>';
 
     if ($return) { return $highlighted; }
-    else { echo $highlighted; }
+    echo $highlighted;
+    return null;
 }
 
 // Same as highlight_php() but does not require '<?php' in $code
@@ -54,8 +55,8 @@ function highlight_php_trimmed($code, $return = false)
     $highlighted_code = preg_replace("/\&lt;\?php(\<br \/\>)+/", '', 
$highlighted_code, 1);
 
     if ($return) { return $highlighted_code; }
-
     echo $highlighted_code;
+    return null;
 }
 
 // Stats pages still need this
@@ -549,6 +550,7 @@ function get_news_changes()
         $title = $NEWS_ENTRIES[0]["title"];
         return "<a href='{$link}'>{$title}</a>";
     }
+    return false;
 }
 
 function news_toc($sections = null) {

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

Reply via email to