This org-mode babel extension enables you to execute phpstan code blocks.
You need to install phpstan to use this extension.
yet
Add ob-phpstan.el to your load-path and require.
(add-to-list 'load-path "/path/to/ob-phpstan.el")
(require 'ob-phpstan)
add phpstan-mode:
(define-derived-mode phpstan-mode php-mode "phpstan")
add org-src-lang-modes:
(eval-after-load "org" '(add-to-list 'org-src-lang-modes '("phpstan" . phpstan)))
#+begin_src phpstan :level 0
class HelloWorld
{
public function sayHello(DateTimeImutable $date): void
{
echo 'Hello, ' . $date->format('j. n. Y');
}
}
#+end_src
#+RESULTS:
#+begin_example
------ ----------------------------------------------------------------------------------
Line /var/folders/z5/sk1q5qj96xg4g87vkcp4hq9h0000gn/T/babel-TGYZJB/phpstan-ulqeYI.php
------ ----------------------------------------------------------------------------------
4 Parameter $date of method HelloWorld::sayHello() has invalid type
DateTimeImutable.
------ ----------------------------------------------------------------------------------
[ERROR] Found 1 error
#+end_example