You are here

protected function RectorProcessor::findVendorPath in Upgrade Rector 8

Finds vendor location.

Return value

string|null Vendor directory path if found, null otherwise.

1 call to RectorProcessor::findVendorPath()
RectorProcessor::runRector in src/RectorProcessor.php
Run rector on a given extension.

File

src/RectorProcessor.php, line 66

Class

RectorProcessor
Runs rector and processes rector results.

Namespace

Drupal\upgrade_rector

Code

protected function findVendorPath() {

  // Seamless Windows compatibility for the eventually generated rector.yml.
  $root = str_replace('\\', '/', DRUPAL_ROOT);

  // The vendor directory may be found inside the webroot (unlikely).
  if (file_exists($root . '/vendor/bin/rector')) {
    return $root . '/vendor';
  }
  elseif (file_exists(dirname($root) . '/vendor/bin/rector')) {
    return dirname($root) . '/vendor';
  }
  return NULL;
}