protected function updateNamespaces(string $currName, string $newName)
    {
        $paths = [Config::get('paths', 'src'), Config::get('paths', 'tests')];

        foreach ($paths as $pathToUpdate) {
            $files = $this->fileSystem->getFiles($pathToUpdate, true);

            foreach ($files as $file) {
                $currContents = $this->fileSystem->read($file);
                // Change the "namespace" statements
                $updatedContents = str_replace(
                    [
                        "namespace $currName;",
                        "namespace $currName\\"
                    ],
                    [
                        "namespace $newName;",
                        "namespace $newName\\"
                    ],
                    $currContents
                );
                // Change the "use" statements
                $updatedContents = str_replace(
                    [
                        "use $currName;",
                        "use $currName\\"
                    ],
                    [
                        "use $newName;",
                        "use $newName\\"
                    ],
                    $updatedContents
                );
                $this->fileSystem->write($file, $updatedContents);
            }
        }
    }
protected function updateNamespaces(string $currName, string $newName)
    {
        $paths = [Config::get('paths', 'src'), Config::get('paths', 'tests')];

        foreach ($paths as $pathToUpdate) {
            $files = $this->fileSystem->getFiles($pathToUpdate, true);

            foreach ($files as $file) {
                $currContents = $this->fileSystem->read($file);
                // Change the "namespace" statements
                $updatedContents = str_replace(
                    [
                        "namespace $currName;",
                        "namespace $currName\\"
                    ],
                    [
                        "namespace $newName;",
                        "namespace $newName\\"
                    ],
                    $currContents
                );
                // Change the "use" statements
                $updatedContents = str_replace(
                    [
                        "use $currName;",
                        "use $currName\\"
                    ],
                    [
                        "use $newName;",
                        "use $newName\\"
                    ],
                    $updatedContents
                );
                $this->fileSystem->write($file, $updatedContents);
            }
        }
    }
protected function updateNamespaces ( string $ currName , string $ newName ) { $ paths = [ Config :: get ( 'paths' , 'src' ) , Config :: get ( 'paths' , 'tests' ) ] ; foreach ( $ paths as $ pathToUpdate ) { $ files = $ this -> fileSystem -> getFiles ( $ pathToUpdate , true ) ; foreach ( $ files as $ file ) { $ currContents = $ this -> fileSystem -> read ( $ file ) ; // Change the "namespace" statements $ updatedContents = str_replace ( [ "namespace $currName;" , "namespace $currName\\" ] , [ "namespace $newName;" , "namespace $newName\\" ] , $ currContents ) ; // Change the "use" statements $ updatedContents = str_replace ( [ "use $currName;" , "use $currName\\" ] , [ "use $newName;" , "use $newName\\" ] , $ updatedContents ) ; $ this -> fileSystem -> write ( $ file , $ updatedContents ) ; } } }
Updates the namespaces

@param string $currName The current application name
@param string $newName The new application name
Updates the namespaces