How to add @deprecated to multiple classes/files
I would like to mark whole directories/namespaces as deprecated.
Because of our saas-applications we have multiple versions which need to stay online, until nobody needs it anymore.
Our namespace/directories are like:
- module\v100
- module\v102
- module\v201
etc.
Inside an 'older' directory all files have to be marked as deprecated. So we put a `@deprecated` tag (with timestamp and info) in the doc-block of the classes, traits, etc.
I have a regexp (from our netbeans time) for replace in directories to do this a bit automated.
([\r\n]\h*\*)(\/[\r\n]+(\h*(abstract|static))?\h*(class|trait|interface))
replace with:
$1 \@deprecated since 20210722 version v3$1$2
But I hope there is a nicer and quicker way.
nb. We are not on php8 yet :-(, so attributes is no option yet.
Thanks in advance!
flexJoly
请先登录再写评论。
I am afraid there is no option to do that automagically. However, you may want to use the SSR (Structural search and replace), for example, to search for classes. Just in case, a little bit more about it:
https://www.jetbrains.com/help/phpstorm/structural-search-and-replace.html
I did look to that, but can't get it to work.
Search:
filter for $doc$:
replace with:
The search goes well.
But replace gives:
:-(
And this is only for a class.... but it should also find interfaces, traits etc.
I read the documentation over and over again. Also tried for replacement:
with script:
Please help, thanks!
Tried to play around with SSR but with no luck either :( (got to try it again later)
Back to the original post, what seems to be a drawback from the Netbeans time regex replacement solution?
thanks for trying!!
The setback is that it is not saved like the SSR.
And I hoped to find a nicer solution or maybe that phpStorm had a feature for this. I think I am not the only one, needing something like this.