PHP code example of phpactor / class-mover

1. Go to this page and download the library: Download phpactor/class-mover library. Choose the download type require.

2. Extract the ZIP file and open the index.php.

3. Add this code to the index.php.
    
        
<?php
require_once('vendor/autoload.php');

/* Start to develop here. Best regards https://php-download.com/ */

    

phpactor / class-mover example snippets

bash
$targetClass = 'Acme\Blog\Post';
$replacementClass = 'Acme\Blog\Article';
$sourceCode = file_get_contents('SomeSource.php');

$classMover = new ClassMover();

$source = $classMover->replaceReferences(
    $classMover->findReferences($sourceCode, $targetClass)
    $replacementClass
);

echo (string) $source;