src/Phinx/Console/Command/AbstractCommand.php
protected function locateConfigFile(InputInterface $input)
    {
        $configFile = $input->getOption('configuration');

        $useDefault = false;

        if ($configFile === null || $configFile === false) {
            $useDefault = true;
        }

        $cwd = getcwd();

        // locate the phinx config file (default: phinx.yml)
        // TODO - In future walk the tree in reverse (max 10 levels)
        $locator = new FileLocator([
            $cwd . DIRECTORY_SEPARATOR
        ]);

        if (!$useDefault) {
            // Locate() throws an exception if the file does not exist
            return $locator->locate($configFile, $cwd, $first = true);
        }

        $possibleConfigFiles = ['phinx.php', 'phinx.json', 'phinx.yml'];
        foreach ($possibleConfigFiles as $configFile) {
            try {
                return $locator->locate($configFile, $cwd, $first = true);
            } catch (\InvalidArgumentException $exception) {
                $lastException = $exception;
            }
        }
        throw $lastException;
    }
protected function locateConfigFile(InputInterface $input)
    {
        $configFile = $input->getOption('configuration');

        $useDefault = false;

        if ($configFile === null || $configFile === false) {
            $useDefault = true;
        }

        $cwd = getcwd();

        // locate the phinx config file (default: phinx.yml)
        // TODO - In future walk the tree in reverse (max 10 levels)
        $locator = new FileLocator([
            $cwd . DIRECTORY_SEPARATOR
        ]);

        if (!$useDefault) {
            // Locate() throws an exception if the file does not exist
            return $locator->locate($configFile, $cwd, $first = true);
        }

        $possibleConfigFiles = ['phinx.php', 'phinx.json', 'phinx.yml'];
        foreach ($possibleConfigFiles as $configFile) {
            try {
                return $locator->locate($configFile, $cwd, $first = true);
            } catch (\InvalidArgumentException $exception) {
                $lastException = $exception;
            }
        }
        throw $lastException;
    }
protected function locateConfigFile ( InputInterface $ input ) { $ configFile = $ input -> getOption ( 'configuration' ) ; $ useDefault = false ; if ( $ configFile === null || $ configFile === false ) { $ useDefault = true ; } $ cwd = getcwd ( ) ; // locate the phinx config file (default: phinx.yml) // TODO - In future walk the tree in reverse (max 10 levels) $ locator = new FileLocator ( [ $ cwd . DIRECTORY_SEPARATOR ] ) ; if ( ! $ useDefault ) { // Locate() throws an exception if the file does not exist return $ locator -> locate ( $ configFile , $ cwd , $ first = true ) ; } $ possibleConfigFiles = [ 'phinx.php' , 'phinx.json' , 'phinx.yml' ] ; foreach ( $ possibleConfigFiles as $ configFile ) { try { return $ locator -> locate ( $ configFile , $ cwd , $ first = true ) ; } catch ( \ InvalidArgumentException $ exception ) { $ lastException = $ exception ; } } throw $ lastException ; }
Returns config file path

@param \Symfony\Component\Console\Input\InputInterface $input
@return string
Returns config file path