camelCase parameters in setter in PhpStorm
up vote
0
down vote
favorite
I have under_score named properties in my class like transaction_id or web_order_item_id. And I want to customize the parameter name in my setters when I generate it.
For now it generate this:
/**
* @param int $original_transaction_id .camelCase()
*/
public function setOriginalTransactionId(int $original_transaction_id): void
{
$this->original_transaction_id = $original_transaction_id;
}
But I want this:
/**
* @param int $originalTransactionId .camelCase()
*/
public function setOriginalTransactionId(int $originalTransactionId): void
{
$this->original_transaction_id = $originalTransactionId;
}
I have tried to change this behavior in Settings/Editor/File and Code Templates/Code/Php Setter Method but I couldn`t found ability to do it.
There is a variable in the template:
${NAME}
But it returned value in this form $OriginalTransactionId instead $originalTransactionId
jetbrains intelinde
add a comment |
up vote
0
down vote
favorite
I have under_score named properties in my class like transaction_id or web_order_item_id. And I want to customize the parameter name in my setters when I generate it.
For now it generate this:
/**
* @param int $original_transaction_id .camelCase()
*/
public function setOriginalTransactionId(int $original_transaction_id): void
{
$this->original_transaction_id = $original_transaction_id;
}
But I want this:
/**
* @param int $originalTransactionId .camelCase()
*/
public function setOriginalTransactionId(int $originalTransactionId): void
{
$this->original_transaction_id = $originalTransactionId;
}
I have tried to change this behavior in Settings/Editor/File and Code Templates/Code/Php Setter Method but I couldn`t found ability to do it.
There is a variable in the template:
${NAME}
But it returned value in this form $OriginalTransactionId instead $originalTransactionId
jetbrains intelinde
add a comment |
up vote
0
down vote
favorite
up vote
0
down vote
favorite
I have under_score named properties in my class like transaction_id or web_order_item_id. And I want to customize the parameter name in my setters when I generate it.
For now it generate this:
/**
* @param int $original_transaction_id .camelCase()
*/
public function setOriginalTransactionId(int $original_transaction_id): void
{
$this->original_transaction_id = $original_transaction_id;
}
But I want this:
/**
* @param int $originalTransactionId .camelCase()
*/
public function setOriginalTransactionId(int $originalTransactionId): void
{
$this->original_transaction_id = $originalTransactionId;
}
I have tried to change this behavior in Settings/Editor/File and Code Templates/Code/Php Setter Method but I couldn`t found ability to do it.
There is a variable in the template:
${NAME}
But it returned value in this form $OriginalTransactionId instead $originalTransactionId
jetbrains intelinde
I have under_score named properties in my class like transaction_id or web_order_item_id. And I want to customize the parameter name in my setters when I generate it.
For now it generate this:
/**
* @param int $original_transaction_id .camelCase()
*/
public function setOriginalTransactionId(int $original_transaction_id): void
{
$this->original_transaction_id = $original_transaction_id;
}
But I want this:
/**
* @param int $originalTransactionId .camelCase()
*/
public function setOriginalTransactionId(int $originalTransactionId): void
{
$this->original_transaction_id = $originalTransactionId;
}
I have tried to change this behavior in Settings/Editor/File and Code Templates/Code/Php Setter Method but I couldn`t found ability to do it.
There is a variable in the template:
${NAME}
But it returned value in this form $OriginalTransactionId instead $originalTransactionId
jetbrains intelinde
jetbrains intelinde
edited Nov 7 at 18:53
LazyOne
105k20238256
105k20238256
asked Nov 7 at 10:01
YuriiChmil
1511312
1511312
add a comment |
add a comment |
1 Answer
1
active
oldest
votes
up vote
2
down vote
accepted
You can try using Apache Velocity StringUtils here, like
#set($Setter_param = ${StringUtils.removeAndHump(${PARAM_NAME})})
#set($Setter_param = $Setter_param.substring(0,1).toLowerCase() + $Setter_param.substring(1))
/**
* @param ${TYPE_HINT} $${Setter_param}
*/
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${Setter_param})#if (${VOID_RETURN_TYPE}):void #end
{
#if (${STATIC} == "static")
self::$${FIELD_NAME} = $${Setter_param};
#else
$this->${FIELD_NAME} = $${Setter_param};
#end
}
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
add a comment |
1 Answer
1
active
oldest
votes
1 Answer
1
active
oldest
votes
active
oldest
votes
active
oldest
votes
up vote
2
down vote
accepted
You can try using Apache Velocity StringUtils here, like
#set($Setter_param = ${StringUtils.removeAndHump(${PARAM_NAME})})
#set($Setter_param = $Setter_param.substring(0,1).toLowerCase() + $Setter_param.substring(1))
/**
* @param ${TYPE_HINT} $${Setter_param}
*/
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${Setter_param})#if (${VOID_RETURN_TYPE}):void #end
{
#if (${STATIC} == "static")
self::$${FIELD_NAME} = $${Setter_param};
#else
$this->${FIELD_NAME} = $${Setter_param};
#end
}
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
add a comment |
up vote
2
down vote
accepted
You can try using Apache Velocity StringUtils here, like
#set($Setter_param = ${StringUtils.removeAndHump(${PARAM_NAME})})
#set($Setter_param = $Setter_param.substring(0,1).toLowerCase() + $Setter_param.substring(1))
/**
* @param ${TYPE_HINT} $${Setter_param}
*/
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${Setter_param})#if (${VOID_RETURN_TYPE}):void #end
{
#if (${STATIC} == "static")
self::$${FIELD_NAME} = $${Setter_param};
#else
$this->${FIELD_NAME} = $${Setter_param};
#end
}
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
add a comment |
up vote
2
down vote
accepted
up vote
2
down vote
accepted
You can try using Apache Velocity StringUtils here, like
#set($Setter_param = ${StringUtils.removeAndHump(${PARAM_NAME})})
#set($Setter_param = $Setter_param.substring(0,1).toLowerCase() + $Setter_param.substring(1))
/**
* @param ${TYPE_HINT} $${Setter_param}
*/
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${Setter_param})#if (${VOID_RETURN_TYPE}):void #end
{
#if (${STATIC} == "static")
self::$${FIELD_NAME} = $${Setter_param};
#else
$this->${FIELD_NAME} = $${Setter_param};
#end
}
You can try using Apache Velocity StringUtils here, like
#set($Setter_param = ${StringUtils.removeAndHump(${PARAM_NAME})})
#set($Setter_param = $Setter_param.substring(0,1).toLowerCase() + $Setter_param.substring(1))
/**
* @param ${TYPE_HINT} $${Setter_param}
*/
public ${STATIC} function set${NAME}(#if (${SCALAR_TYPE_HINT})${SCALAR_TYPE_HINT} #end$${Setter_param})#if (${VOID_RETURN_TYPE}):void #end
{
#if (${STATIC} == "static")
self::$${FIELD_NAME} = $${Setter_param};
#else
$this->${FIELD_NAME} = $${Setter_param};
#end
}
edited Nov 7 at 13:31
answered Nov 7 at 13:22
lena
49.1k36976
49.1k36976
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
add a comment |
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
that is what I wanted. Thank!
– YuriiChmil
Nov 8 at 7:01
add a comment |
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
StackExchange.ready(
function () {
StackExchange.openid.initPostLogin('.new-post-login', 'https%3a%2f%2fstackoverflow.com%2fquestions%2f53187183%2fcamelcase-parameters-in-setter-in-phpstorm%23new-answer', 'question_page');
}
);
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Sign up or log in
StackExchange.ready(function () {
StackExchange.helpers.onClickDraftSave('#login-link');
});
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Sign up using Google
Sign up using Facebook
Sign up using Email and Password
Post as a guest
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown
Required, but never shown