Skip to content

Commit 7bc5ef8

Browse files
authored
Merge pull request #2 from emacs-php/feaute/concat-php-tag
Adds PHP tag only when code does not start with `<`
2 parents ab4fddf + 658593c commit 7bc5ef8

File tree

1 file changed

+3
-1
lines changed

1 file changed

+3
-1
lines changed

ob-phpstan.el

Lines changed: 3 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -49,7 +49,9 @@
4949
(defun org-babel-execute:phpstan (body params)
5050
"Org mode fish evaluate function"
5151
(let ((tmp-file (org-babel-temp-file "phpstan-" ".php"))
52-
(body (concat "<?php\n" body))
52+
(body (if (string-prefix-p "<" body)
53+
body
54+
(concat "<?php " body)))
5355
(level (or (cdr (assoc :level params)) org-babel-phpstan-level)))
5456
(with-temp-file tmp-file (insert (org-babel-expand-body:generic body params)))
5557
(org-babel-eval (format "%s analyze %s --level %s --no-progress"

0 commit comments

Comments
 (0)