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










share|improve this question




























    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










    share|improve this question


























      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










      share|improve this question















      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






      share|improve this question















      share|improve this question













      share|improve this question




      share|improve this question








      edited Nov 7 at 18:53









      LazyOne

      105k20238256




      105k20238256










      asked Nov 7 at 10:01









      YuriiChmil

      1511312




      1511312
























          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
          }





          share|improve this answer























          • that is what I wanted. Thank!
            – YuriiChmil
            Nov 8 at 7:01











          Your Answer






          StackExchange.ifUsing("editor", function () {
          StackExchange.using("externalEditor", function () {
          StackExchange.using("snippets", function () {
          StackExchange.snippets.init();
          });
          });
          }, "code-snippets");

          StackExchange.ready(function() {
          var channelOptions = {
          tags: "".split(" "),
          id: "1"
          };
          initTagRenderer("".split(" "), "".split(" "), channelOptions);

          StackExchange.using("externalEditor", function() {
          // Have to fire editor after snippets, if snippets enabled
          if (StackExchange.settings.snippets.snippetsEnabled) {
          StackExchange.using("snippets", function() {
          createEditor();
          });
          }
          else {
          createEditor();
          }
          });

          function createEditor() {
          StackExchange.prepareEditor({
          heartbeatType: 'answer',
          convertImagesToLinks: true,
          noModals: true,
          showLowRepImageUploadWarning: true,
          reputationToPostImages: 10,
          bindNavPrevention: true,
          postfix: "",
          imageUploader: {
          brandingHtml: "Powered by u003ca class="icon-imgur-white" href="https://imgur.com/"u003eu003c/au003e",
          contentPolicyHtml: "User contributions licensed under u003ca href="https://creativecommons.org/licenses/by-sa/3.0/"u003ecc by-sa 3.0 with attribution requiredu003c/au003e u003ca href="https://stackoverflow.com/legal/content-policy"u003e(content policy)u003c/au003e",
          allowUrls: true
          },
          onDemand: true,
          discardSelector: ".discard-answer"
          ,immediatelyShowMarkdownHelp:true
          });


          }
          });














           

          draft saved


          draft discarded


















          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

























          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
          }





          share|improve this answer























          • that is what I wanted. Thank!
            – YuriiChmil
            Nov 8 at 7:01















          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
          }





          share|improve this answer























          • that is what I wanted. Thank!
            – YuriiChmil
            Nov 8 at 7:01













          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
          }





          share|improve this answer














          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
          }






          share|improve this answer














          share|improve this answer



          share|improve this answer








          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


















          • 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


















           

          draft saved


          draft discarded



















































           


          draft saved


          draft discarded














          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





















































          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







          這個網誌中的熱門文章

          Academy of Television Arts & Sciences

          L'Équipe

          1995 France bombings