Page 1
エディタ中立なPHP開発環境の現在
公開版
Modern editor-independent
development
environment for PHP
2018-11-23 Akiba Tokyo, Japan
VimConf 2018 #vimconf
公開日:
by USAMI Kenta@tadsan
に東京都千代田区の富士ソフト アキバプラザで開催された『VimConf 2018』でレギュラートーク(20分)として発表しました。
エディタ中立なPHP開発環境の現在
公開版
2018-11-23 Akiba Tokyo, Japan
VimConf 2018 #vimconf
筆者の英語は残念なので発表済みの日本語資料を先に読むことをおすすめ
aka @tadsan
Who am I...?
Kenta Usami (うさみけんた, @zonuexe)
Language hobbyist, I love Lisp.
Web programmer @pixiv
Founder of Emacs-PHP
https://github.com/emacs-php
My favorite text editors
Maruo Editor (秀丸)
Mery
I usually use Emacs
That's because it's a Lisp machine that is easy for me to hack.
There are reasons for each person to choose an editor.
I am a professional programmer so I would like to raise development efficiency.
First of all...
We hate“Religious War”
宗教戦争
Code of Conduct
Windows vs UNIX
Tab vs Space
Statically typed vs Dynamic typing
...and
Emacs vs vi
No
It was a joke?It violates professionalism.
おk?
Even outside the conference.
Is that okay?
リスペクト
Text editor and Plugin developers and power users respect each other and incorporate the trends of other text editors.
Rainbow Brackets
ElePHPant
<?php
What's PHP?
It is a kind of Web platform.
Small sites, many CMS, large scale SNS are built with PHP.
It is also a general purpose programming language.
手続き?
PHP as a Language
PHP is procedural and it has object-oriented feature.
Weak typing and dynamic type-checking.
PHP is relatively suitable for static analysis in dynamic langs.
知らんけど
“We have things like protected properties.We have abstract methods. We have all this stuff that your computer science teacher told you you should be using.I don't care about this crap at all.”
–Rasmus Lerdorf https://en.wikiquote.org/wiki/Rasmus_Lerdorf
なんでもできる
Abstract class, Trait, Interface,Generator, Iterator, Closure, Dynamic function call, Anonymous class, eval,Type declaration, Associative array(Hash table), Reflection API, Self-documentation, Standard I/O, REPL,Lazy class loading, etc...
ばらばら
PHP coding styles
PHP can be run on cheap hosting servers.
PHP as a HTML template,PHP as a CGI script,PHP as a OOP language...
Various people share PHP.
くぁwせdrftgy
PHP needs IDE?
In the early days of my career,there was no one around me developing with IDE.
However, the scale of our code was huge and it was obvious that tool assistance is necessary.
ふじこlp;@
PHP with text editor
The usual way to code PHP with a text editor is tag jump.
But project has multiple methods with the same name in OOP.
There is no smart input completion.
むりぽ
Refactoring...?
The important thing is sed and a visual check.
Must allow the possibility of a run-time error due to refactoring.
Photoshop
つよい
JetBrains IDE
PhpStorm is an IDE derived from IntelliJ IDEA (Java IDE).
JetBrains' IDE is good at static analysis and refactoring.
The PHP static analysis features of PhpStorm is practical.
解析できるぞ
Static Analysis
Static analysis is required for error detection of code path not executed in test.
PhpStorm can check mistakes with high accuracy if conditions for specifying types are available.
ミスがわかる
スマート
わかりやすい
Coding on PhpStorm
Popup signature
Awesome!
PhpStorm
But, do we have to purchase PhpStorm to write PHP?
No, No.
Since we are developers,we can create FREE implementations other than PhpStorm.
クォリティタカス
PHP QA Projects
Several PHP static analyzer projects are active
Phan PHPStan Phpactor
鬼強い
Phan
https://github.com/phan/phan
Static analyzer
Slow, but it inspects the entire project precisely
It's included LSP Server
鬼速い
PHPStan
https://github.com/phpstan/phpstan
Dynamic and Static hybrid
Very fast and accurate
Specific RPC and LSP
互換性
PHP Standard Recommendation(Draft)
PHPDoc is the de facto standard for writing type definitions in DocComment.They are working on the standard specification of that tag and type definition
鬼速い
Phpactor
http://phpactor.github.io/phpactor/
Phpactor provide code jump,completion, refactoring
This is under development and is now inferior to PhpStorm, but it is promising in the future.
各位仲良く
Editor-independent Movements
スマート
https://microsoft.github.io/language-server-protocol/
A Language Server is meant to provide the language-specific smarts and communicate with development tools over a protocol that enables inter-process communication.
Tab vs Space
EditorConfig
https://editorconfig.org/
Indent and Newline code can be set for each file name and extension.
エディタ横断
# Unix-style newlines with a newline ending every file[*]end_of_line = lf insert_final_newline = true
# Set default charset[*.{js,py}]charset = utf-8
# 4 space indentation[*.py]indent_style = space indent_size = 4
# Tab indentation (no size specified)[Makefile]indent_style = tab
vim
編集中にわかる
Asynchronous Lint Engine https://github.com/w0rp/ale ALE supports PHP syntax checker,PHPStan, Phan, Psalm, PHP CS,PHP-CS-Fixer and LSP
ミスがわかる
型付けされてる
https://camo.qiitausercontent.com/63f80f6472f7de44d28a25cf275c2f80d782d94e/68747470733a2f2f71696974612d696d6167652d73746f7265 2e73332e616d617a6f6e6177732e636f6d2f302f343132312f3 8373535663234332d353532662d663939302d373266332d 3561303835643563643334392e706e67
リファクタ
Phpactor Vim Plugin Provides
Context menu
Code Navigation
Completion (It supports Vim's Omni-completion, Deoplete,NeoVim's NCM and NCM 2)
なにそれ
やばい
veonim is a simple modal IDE built on neovim.https://github.com/veonim/veonim That is integrated with LSP and has a graphical interface like IDE.Veonim realized almost all the functions I wanted as ideal Vim.
やばい
I learned Veonim by @ShougoMatsu two weeks ago.He said that I do not use yet because my plugins does not work.I have not finished studying Veonim yet, but this may be a wonderful IDE
