Skip to content

Instantly share code, notes, and snippets.

@bkuhl
Last active February 20, 2016 16:08
Show Gist options
  • Star 3 You must be signed in to star a gist
  • Fork 0 You must be signed in to fork a gist
  • Save bkuhl/11e6dd09d625edb8652e to your computer and use it in GitHub Desktop.
Save bkuhl/11e6dd09d625edb8652e to your computer and use it in GitHub Desktop.
Find/replace full classpaths to use php ::class constants

Purpose: Replaces all ::mock and ::make instances with PHP class constants.

This is useful when upgrading Laravel 4 projects to Laravel 5.

Note: This find/replace assumes all mock/make instances utilize full classpaths (e.g. App::make('My\Project\Namespace\MyClass'))

Text to find:

\:\:(mock|make)\('(.+?)'\)

Text to replace:

::$1(\\\\$2::class)
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment