Book Image

PhpStorm Cookbook

By : Mukund Chaudhary
Book Image

PhpStorm Cookbook

By: Mukund Chaudhary

Overview of this book

Table of Contents (16 chapters)
PhpStorm Cookbook
Credits
About the Authors
About the Reviewers
www.PacktPub.com
Preface
Index

Moving a variable


Moving a member variable to some other class is simple but quite important from an architectural point of view. A variable usually denotes an attribute from the real world. So, if you planned sugar for PizzaDish, you will definitely and very quickly need to move the sugar from PizzaDish to some other dish, say Cookie. Just like methods, you can only move the static members to some other class.

How to do it...

Select Refactor from the right-click context menu, and then select Move.

If the current member variable to be moved was private in the current class, the Move operation will convert the member to public.

PhpStorm warns you before performing the move, as shown in the following screenshot:

Tip

Wherever you put the sugar, you should always try to use the syntactic sugar because it eases a bit of the documentation load.

PhpStorm said "Your knowledge level has been increased to 200 percent". You must say "Great!"... 200 percent... how? You already knew how to copy or cut and paste...