Coder Social home page Coder Social logo

vim-php-refactor's Introduction

PHP Refactoring for VIM

Some very simple refactorings for PHP code using VIM:

  • Extract Method
  • Extract Variable
  • Extract Interface
  • Extract Class Property
  • Rename Local Variable
  • Rename Class Variable
  • Implement all abstract functions

Requirements

Mappings

Default key mappings defined:

vmap \em :call ExtractMethod()<CR>
nnoremap \ev :call ExtractVariable()<CR>
nnoremap \ep :call ExtractClassProperty()<CR>
nnoremap \ei :call ExtractInterface()<CR>
nnoremap \rlv :call RenameLocalVariable()<CR>
nnoremap \rcv :call RenameClassVariable()<CR>
nnoremap \iaf :call ImplementAbstractFunctions()<CR>

If you want avoid them being set put the following in your vimrc:

let g:no_php_maps = 1

Documentation

Extract Method

Extracts the current visual selection into a private method. The code will be pasted inline at the current location and has to be moved around.

Extract Variable

Extract the current argument under the cursor into a variable right above the method call.

Extract Interface

Create an interface of all constants, public functions and properties of the current class (the current file actually). The interface is created below the class and can then moved around.

Extract Class Property

Turn a local variable into a class property.

Rename local variable

Renames variable under cursor inside a function/method to a new name.

Rename class variable

Renames variable under cursor inside the whole class. No renaming of getter/setter or checking for breaks in related classes takes place.

Implement all abstract functions

If you copy the body of abstract class or interface into a concrete implementation class, and then execute this refactoring. It will turn all abstract methods into empty body methods throwing a runtime exception.

vim-php-refactor's People

Contributors

beberlei avatar janpieper avatar

Watchers

Ben Gdovicak avatar James Cloos avatar

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    ๐Ÿ–– Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. ๐Ÿ“Š๐Ÿ“ˆ๐ŸŽ‰

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google โค๏ธ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.