Supported Versions: PHP 4, PHP 5, PHP 7, PHP 8
Prepend one or more elements to the beginning of an array
<?php array_unshift(array &$array, mixed ...$values): int
<?php }
$sortedPackageMap = $this->sortPackageMap($packageMap);
$sortedPackageMap[] = $rootPackageMap;
array_unshift($packageMap, $rootPackageMap);
$psr0 = $this->parseAutoloadsType($packageMap, 'psr-0', $rootPackage);
$psr4 = $this->parseAutoloadsType($packageMap, 'psr-4', $rootPackage);
<?php $errors = array_map(function ($err) {
return '- ' . $err;
}, $errors);
array_unshift($errors, '# General errors');
}
if ($warnings) {
$warnings = array_map(function ($err) {
<?php $warnings = array_map(function ($err) {
return '- ' . $err;
}, $warnings);
array_unshift($warnings, '# General warnings');
}
<?php }, $publishErrors);
if ($checkPublish) {
array_unshift($publishErrors, '# Publish errors');
$errors = array_merge($errors, $publishErrors);
} else {
array_unshift($publishErrors, '# Publish warnings');
<?php array_unshift($publishErrors, '# Publish errors');
$errors = array_merge($errors, $publishErrors);
} else {
array_unshift($publishErrors, '# Publish warnings');
$extraWarnings = array_merge($extraWarnings, $publishErrors);
}
}
<?php if ($lockErrors) {
if ($checkLock) {
array_unshift($lockErrors, '# Lock file errors');
$errors = array_merge($errors, $lockErrors);
} else {
array_unshift($lockErrors, '# Lock file warnings');
<?php array_unshift($lockErrors, '# Lock file errors');
$errors = array_merge($errors, $lockErrors);
} else {
array_unshift($lockErrors, '# Lock file warnings');
$extraWarnings = array_merge($extraWarnings, $lockErrors);
}
}
<?php private function arrayUnshiftRef(&$array, &$value)
{
$return = array_unshift($array, '');
$array[0] = &$value;
return $return;
<?php }
foreach ($removeMap as $name => $package) {
array_unshift($operations, new Operation\UninstallOperation($package));
}
foreach ($removeAliasMap as $nameVersion => $package) {
$operations[] = new Operation\MarkAliasUninstalledOperation($package);
<?php if ($isDownloadsModifyingPlugin && !count($requires)) {
array_unshift($dlModifyingPluginsNoDeps, $op);
} else {
$dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
<?php $dlModifyingPluginRequires = array_merge($dlModifyingPluginRequires, $requires);
array_unshift($dlModifyingPluginsWithDeps, $op);
}
unset($operations[$idx]);
<?php if ($isPlugin && !count($requires)) {
array_unshift($pluginsNoDeps, $op);
} else {
$pluginRequires = array_merge($pluginRequires, $requires);
<?php $pluginRequires = array_merge($pluginRequires, $requires);
array_unshift($pluginsWithDeps, $op);
}
unset($operations[$idx]);
<?php $removed = array();
while (!is_dir($basePath) && $basePath !== '\\') {
array_unshift($removed, basename($basePath));
$basePath = dirname($basePath);
}
<?php public function addInstaller(InstallerInterface $installer)
{
array_unshift($this->installers, $installer);
$this->cache = array();
}