Skip to content

HTTPS clone URL

Subversion checkout URL

You can clone with HTTPS or Subversion.

Download ZIP

Loading…

Better handling of missing PHP opening tags #5

Merged
merged 3 commits into from

2 participants

@bzikarsky

Show the the requirement of PHP-tags in the textarea and show a better error message in case they get left out

@klaussilveira klaussilveira merged commit ad01273 into from
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Commits on Aug 12, 2012
  1. @bzikarsky
  2. @bzikarsky
  3. @bzikarsky

    Merge pull request #1 from bzikarsky/patch-1

    bzikarsky authored
    Edited "no php detected" error message to include a typical solution 
This page is out of date. Refresh to see the latest.
Showing with 4 additions and 2 deletions.
  1. +1 −1  src/PHPHint/TestCase.php
  2. +3 −1 templates/index.twig
View
2  src/PHPHint/TestCase.php
@@ -9,7 +9,7 @@ class TestCase
public function __construct($code)
{
if (strstr($code, '<?php') === false) {
- throw new \RuntimeException('No PHP code detected!');
+ throw new \RuntimeException('No PHP code detected! Maybe you forgot to include the opening PHP-Tag "<?php"?');
}
$rand = uniqid();
View
4 templates/index.twig
@@ -11,7 +11,9 @@
<p><strong>PHPHint</strong> is a quick and easy tool that analyzes your PHP code and looks for potential errors, lack of <a href="http://paul-m-jones.com/archives/2420">best practices</a> and <a href="http://en.wikipedia.org/wiki/Code_smell">code smell</a>. It also allows you to clean your code <em>automagically</em>.</p>
</div>
- <textarea id="code" name="code">// Your code here</textarea>
+ <textarea id="code" name="code">&lt;?php
+// Your code here
+</textarea>
<div class="toolbar">
<input type="button" id="analyze" value="Analyze" class="btn primary" />
Something went wrong with that request. Please try again.