Permalink
Browse files

Fixed short open tag bug in PHP Formatter

  • Loading branch information...
1 parent cb45b30 commit 72912c199974852ef63539063872b10dad2733f9 @akalongman committed Mar 29, 2016
Showing with 31 additions and 23 deletions.
  1. BIN codeformatter/lib/phpbeautifier/fmt.phar
  2. +13 −7 codeformatter/phpformatter.py
  3. +18 −16 tests/php/test2.php
Binary file not shown.
@@ -8,6 +8,9 @@
import re
import sublime
import subprocess
+import os.path
+from os.path import dirname, realpath
+
class PhpFormatter:
def __init__(self, formatter):
@@ -63,13 +66,20 @@ def format(self, text):
if ("excludes" in self.opts and self.opts["excludes"]):
excludes = self.opts["excludes"]
+ formatter_path = os.path.join(dirname(realpath(sublime.packages_path())), "Packages", "CodeFormatter", "codeformatter", "lib", "phpbeautifier", "fmt.phar")
cmd = []
cmd.append(str(php_path))
+
+ cmd.append("-ddisplay_errors=stderr")
+ cmd.append("-dshort_open_tag=On")
+
if php55_compat:
- cmd.append(sublime.packages_path()+"/CodeFormatter/codeformatter/lib/phpbeautifier/fmt.8.9.0.phar")
+ formatter_path = os.path.join(dirname(realpath(sublime.packages_path())), "Packages", "CodeFormatter", "codeformatter", "lib", "phpbeautifier", "fmt.8.9.0.phar")
else:
- cmd.append(sublime.packages_path()+"/CodeFormatter/codeformatter/lib/phpbeautifier/fmt.phar")
+ formatter_path = os.path.join(dirname(realpath(sublime.packages_path())), "Packages", "CodeFormatter", "codeformatter", "lib", "phpbeautifier", "fmt.phar")
+
+ cmd.append(formatter_path)
if psr1:
cmd.append("--psr1")
@@ -100,16 +110,12 @@ def format(self, text):
if len(excludes) > 0:
cmd.append("--exclude="+','.join(excludes))
- if not php55_compat:
- cmd.append("--dry-run")
-
- cmd.append("--no-backup")
cmd.append("-")
stderr = ""
stdout = ""
- print(cmd)
+ #print(cmd)
try:
if (self.formatter.platform == "windows"):
View
@@ -1,17 +1,19 @@
<?php
namespace App\Http\Controllers\Auth;
-use App\User;
-use Validator;
+
use App\Http\Controllers\Controller;
-use Illuminate\Foundation\Auth\ThrottlesLogins;
+use App\User;
use Illuminate\Foundation\Auth\AuthenticatesAndRegistersUsers;
+use Illuminate\Foundation\Auth\ThrottlesLogins;
+use Validator;
+
/**
* Lorem ipsum.
*
-* @param string $param1
-* @param bool $param2 lorem ipsum
-* @param string $param3 lorem ipsum
-* @return int lorem ipsum
+* @param string $param1
+* @param bool $param2 lorem ipsum
+* @param string $param3 lorem ipsum
+* @return int lorem ipsum
*/
class AuthController extends Controller
{
@@ -26,27 +28,27 @@ public function __construct()
/**
* Lorem ipsum.
*
-* @param string $param1
-* @param bool $param2 lorem ipsum
-* @param string $param3 lorem ipsum
-*
-* @return int lorem ipsum
+* @param string $param1
+* @param bool $param2 lorem ipsum
+* @param string $param3 lorem ipsum
+* @return int lorem ipsum
*/
protected function validator(array $data)
{
return Validator::make($data,
[
-'name' => 'required|max:255',
-'email' => 'required|email|max:255|unique:users',
+'name' => 'required|max:255',
+'email' => 'required|email|max:255|unique:users',
'password' => 'required|confirmed|min:6',
]
);
}
+
protected function create(array $data)
{
return User::create([
-'name' => $data['name'],
-'email' => $data['email'],
+'name' => $data['name'],
+'email' => $data['email'],
'password' => bcrypt($data['password']),
]);
}

0 comments on commit 72912c1

Please sign in to comment.