Open dmitrach opened 3 years ago
Through phpdoc seems unable to achieve.
You can create a ide helper file, such as .idehelper.deprecated.php
// Save to `.idehelper.deprecated.php`
/**
* ide-helper for deprecated
*/
class MyClass
{
/**
* Deprecated property.
*
* @deprecated v1.19
*/
public int $property;
/**
* Deprecated method
*
* @deprecated v1.19
*/
function method()
{
}
}
Or append at the end of the class file.
class MyClass
{
// ....
}
if( false ){
/**
* ide-helper for deprecated
*/
class MyClass
{
/**
* Deprecated property.
*
* @deprecated v1.19
*/
public int $property;
/**
* Deprecated method
*
* @deprecated v1.19
*/
function method()
{
}
}
}
@tianyiw2013 Thanks. The first way works for me.
But both ways are disallowed to commit. In the first case I can ignore the helper. But I haven't tools to auto generate it like as _ide_helper.php
. Do you know anything? It is a small problem.
More important problem is go to the definition. Now I find all references and both classes. I've added *ide*helper*.php
to the config of the extension but it doesn't ignore this class in the result.
"intelephense.references.exclude": [
"**/vendor/**",
"*ide*helper*.php"
]
.idehelper.deprecated.php
also doesn't the result.
Do you know a resolve of this problem?
The best solution is to put deprecations into .phpstorm.meta.php
file, it has special treatment. There will be still duplicated definitions, but the original one will be used first for go to definition
.
You can also include file from outside of workspace using intelephense.environment.includePaths
.
I would like to deprecate properties and methods in class descriptions. Now it works only for real properties and methods.
I personally think that if you have already removed the property or method, it's no longer deprecated but simply not supported at all.
As such, @deprecated
status should be used only for properties and methods that still work but will be broken in the future.
Feature description or problem with existing feature I would like to deprecate properties and methods in class descriptions. Now it works only for real properties and methods.
Describe the solution you'd like I would like to see behavior same as real deprecated properties and methods.
Thank you.