src/Commands/RenameCommand.php
private function updateComposer(string $name): RenameCommand
    {
        $this->task(
            'Updating config/app.php "name" property',
            function () use ($name) {
                $neededLine = "'name' => '".Str::ucfirst($this->getCurrentBinaryName())."'";

                if (! Str::contains($contents = $this->getConfig(), $neededLine)) {
                    return false;
                }
                File::put(
                    $this->app->configPath('app.php'),
                    Str::replaceFirst(
                        $neededLine,
                        "'name' => '".Str::ucfirst($name)."'",
                        $contents
                    )
                );
            }
        );

        $this->task(
            'Updating composer "bin"',
            function () use ($name) {
                $neededLine = '"bin": ["'.$this->getCurrentBinaryName().'"]';

                if (! Str::contains($contents = $this->getComposer(), $neededLine)) {
                    return false;
                }

                File::put(
                    $this->app->basePath('composer.json'),
                    Str::replaceFirst(
                        $neededLine,
                        '"bin": ["'.$name.'"]',
                        $contents
                    )
                );
            }
        );

        return $this;
    }
private function updateComposer(string $name): RenameCommand
    {
        $this->task(
            'Updating config/app.php "name" property',
            function () use ($name) {
                $neededLine = "'name' => '".Str::ucfirst($this->getCurrentBinaryName())."'";

                if (! Str::contains($contents = $this->getConfig(), $neededLine)) {
                    return false;
                }
                File::put(
                    $this->app->configPath('app.php'),
                    Str::replaceFirst(
                        $neededLine,
                        "'name' => '".Str::ucfirst($name)."'",
                        $contents
                    )
                );
            }
        );

        $this->task(
            'Updating composer "bin"',
            function () use ($name) {
                $neededLine = '"bin": ["'.$this->getCurrentBinaryName().'"]';

                if (! Str::contains($contents = $this->getComposer(), $neededLine)) {
                    return false;
                }

                File::put(
                    $this->app->basePath('composer.json'),
                    Str::replaceFirst(
                        $neededLine,
                        '"bin": ["'.$name.'"]',
                        $contents
                    )
                );
            }
        );

        return $this;
    }
private function updateComposer ( string $ name ) : RenameCommand { $ this -> task ( 'Updating config/app.php "name" property' , function ( ) use ( $ name ) { $ neededLine = "'name' => '" . Str :: ucfirst ( $ this -> getCurrentBinaryName ( ) ) . "'" ; if ( ! Str :: contains ( $ contents = $ this -> getConfig ( ) , $ neededLine ) ) { return false ; } File :: put ( $ this -> app -> configPath ( 'app.php' ) , Str :: replaceFirst ( $ neededLine , "'name' => '" . Str :: ucfirst ( $ name ) . "'" , $ contents ) ) ; } ) ; $ this -> task ( 'Updating composer "bin"' , function ( ) use ( $ name ) { $ neededLine = '"bin": ["' . $ this -> getCurrentBinaryName ( ) . '"]' ; if ( ! Str :: contains ( $ contents = $ this -> getComposer ( ) , $ neededLine ) ) { return false ; } File :: put ( $ this -> app -> basePath ( 'composer.json' ) , Str :: replaceFirst ( $ neededLine , '"bin": ["' . $ name . '"]' , $ contents ) ) ; } ) ; return $ this ; }
Update composer json with related information.
Update composer json with related information .