Skip to content

Instantly share code, notes, and snippets.

@dgpro
Last active February 16, 2018 12:52
Show Gist options
  • Star 0 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save dgpro/328a10c099184683de606c1ebbbb3d5a to your computer and use it in GitHub Desktop.
Save dgpro/328a10c099184683de606c1ebbbb3d5a to your computer and use it in GitHub Desktop.
Convert PHPDoc Class Variables Properties into One Line

Convert PHPDoc Class Variables Properties into One Line

Regular expression:

pattern: (/\*\*)\n\s*\*\s*(\@var.*)\n\s*(\*/)

replacement: $1 $2 $3

It will convert this:

/**
    * @var string
/ *

into one liner:

/** @var string */
How to use

In your IDE (like PHPStorm) select lines you want to convert, press Crl+R (Find and Replace), in the dialog select Regex and In Selection, enter pattern into search box and replacement into replace box and click Replace all

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment