LoginSignup
0
0

Do not use HEREDOC or NOWDOC syntax in your plugins

Last updated at Posted at 2023-09-25

See the Pen Heredoc/Nowdoc Converter by John Doe (@04) on CodePen.

ヒアドキュメントを手動で書き換えるのはめんどいので変換ツール作りました。
echo <<<END$hoge = <<<ENDとHeredocとNowdocに対応しています

Do not use HEREDOC or NOWDOC syntax in your plugins

While both are totally valid, and in many ways desirable features of PHP that allow you to output content, it comes with a cost that is too high for most plugins.

The primary issue is that most (if not all) codesniffers won't detect lack of escaping in code when you use HEREDOC or NOWDOC. While there are ways around this they have the end result of dashing all that readability to the rubbish pile and leaving you with a jumbled mess that won't properly be scanned.

We feel the risk here is much higher than the benefits, which is why we don't permit their use.

ダブルクォーテーション使うでもいいと思います

0
0
0

Register as a new user and use Qiita more conveniently

  1. You get articles that match your needs
  2. You can efficiently read back useful information
  3. You can use dark theme
What you can do with signing up
0
0