function Plugin::verifySaveSuccess
Verify that the paths which were expected to be saved, have been.
Return value
int Exit code. 0 for success, 1 for failure.
1 call to Plugin::verifySaveSuccess()
- Plugin::saveInstalledPaths in vendor/
dealerdirect/ phpcodesniffer-composer-installer/ src/ Plugin.php - Save all coding standard paths back into PHP_CodeSniffer
File
-
vendor/
dealerdirect/ phpcodesniffer-composer-installer/ src/ Plugin.php, line 322
Class
- Plugin
- PHP_CodeSniffer standard installation manager.
Namespace
PHPCSStandards\Composer\Plugin\Installers\PHPCodeSnifferCode
private function verifySaveSuccess() {
$exitCode = 1;
$expectedPaths = $this->installedPaths;
// Request the currently set installed paths after the save.
$this->loadInstalledPaths();
$registeredPaths = array_intersect($this->installedPaths, $expectedPaths);
$registeredCount = count($registeredPaths);
$expectedCount = count($expectedPaths);
if ($expectedCount === $registeredCount) {
$exitCode = 0;
}
if ($exitCode === 1 && $this->io
->isVerbose()) {
$verificationMessage = sprintf("Paths to external standards found by the plugin: <info>%s</info>\n" . 'Actual paths registered with PHPCS: <info>%s</info>', implode(', ', $expectedPaths), implode(', ', $this->installedPaths));
$this->io
->write($verificationMessage);
}
return $exitCode;
}