Remove BC event and constraint classes

main
Jordi Boggiano 6 years ago
parent f11c357325
commit 5a56bb6971

@ -321,44 +321,6 @@ class EventDispatcher
$expected = $typehint->getName();
// BC support
if (!$event instanceof $expected && $expected === 'Composer\Script\CommandEvent') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\CommandEvent(
$event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getArguments()
);
}
if (!$event instanceof $expected && $expected === 'Composer\Script\PackageEvent') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\PackageEvent(
$event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getPolicy(),
$event->getRepositorySet(),
$event->getInstalledRepo(),
$event->getRequest(),
$event->getOperations(),
$event->getOperation()
);
}
if (!$event instanceof $expected && $expected === 'Composer\Script\Event') {
trigger_error('The callback '.$this->serializeCallback($target).' declared at '.$reflected->getDeclaringFunction()->getFileName().' accepts a '.$expected.' but '.$event->getName().' events use a '.get_class($event).' instance. Please adjust your type hint accordingly, see https://getcomposer.org/doc/articles/scripts.md#event-classes', E_USER_DEPRECATED);
$event = new \Composer\Script\Event(
$event->getName(),
$event->getComposer(),
$event->getIO(),
$event->isDevMode(),
$event->getArguments(),
$event->getFlags()
);
}
return $event;
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package\LinkConstraint;
use Composer\Semver\Constraint\EmptyConstraint as SemverEmptyConstraint;
trigger_error('The ' . __NAMESPACE__ . '\EmptyConstraint class is deprecated, use Composer\Semver\Constraint\EmptyConstraint instead.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Semver\Constraint\EmptyConstraint instead
*/
class EmptyConstraint extends SemverEmptyConstraint implements LinkConstraintInterface
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package\LinkConstraint;
use Composer\Semver\Constraint\ConstraintInterface;
trigger_error('The ' . __NAMESPACE__ . '\LinkConstraintInterface interface is deprecated, use Composer\Semver\Constraint\ConstraintInterface instead.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Semver\Constraint\ConstraintInterface instead
*/
interface LinkConstraintInterface extends ConstraintInterface
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package\LinkConstraint;
use Composer\Semver\Constraint\MultiConstraint as SemverMultiConstraint;
trigger_error('The ' . __NAMESPACE__ . '\MultiConstraint class is deprecated, use Composer\Semver\Constraint\MultiConstraint instead.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Semver\Constraint\MultiConstraint instead
*/
class MultiConstraint extends SemverMultiConstraint implements LinkConstraintInterface
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package\LinkConstraint;
use Composer\Semver\Constraint\AbstractConstraint;
trigger_error('The ' . __NAMESPACE__ . '\SpecificConstraint abstract class is deprecated, there is no replacement for it.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Semver\Constraint\AbstractConstraint instead
*/
abstract class SpecificConstraint extends AbstractConstraint implements LinkConstraintInterface
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Package\LinkConstraint;
use Composer\Semver\Constraint\Constraint;
trigger_error('The ' . __NAMESPACE__ . '\VersionConstraint class is deprecated, use Composer\Semver\Constraint\Constraint instead.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Semver\Constraint\Constraint instead
*/
class VersionConstraint extends Constraint implements LinkConstraintInterface
{
}

@ -1,22 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Script;
/**
* The Command Event.
*
* @deprecated use Composer\Script\Event instead
*/
class CommandEvent extends Event
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Script;
use Composer\Installer\PackageEvent as BasePackageEvent;
/**
* The Package Event.
*
* @deprecated Use Composer\Installer\PackageEvent instead
*/
class PackageEvent extends BasePackageEvent
{
}

@ -1,24 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer\Util;
use Composer\Spdx\SpdxLicenses;
trigger_error('The ' . __NAMESPACE__ . '\SpdxLicense class is deprecated, use Composer\Spdx\SpdxLicenses instead.', E_USER_DEPRECATED);
/**
* @deprecated use Composer\Spdx\SpdxLicenses instead
*/
class SpdxLicense extends SpdxLicenses
{
}

@ -1,31 +0,0 @@
<?php
/*
* This file is part of Composer.
*
* (c) Nils Adermann <naderman@naderman.de>
* Jordi Boggiano <j.boggiano@seld.be>
*
* For the full copyright and license information, please view the LICENSE
* file that was distributed with this source code.
*/
namespace Composer;
use Symfony\Component\Console\Output\OutputInterface;
trigger_error('The ' . __NAMESPACE__ . '\XdebugHandler class is deprecated, use Composer\XdebugHandler\XdebugHandler instead,', E_USER_DEPRECATED);
/**
* @deprecated use Composer\XdebugHandler\XdebugHandler instead
*/
class XdebugHandler extends XdebugHandler\XdebugHandler
{
const ENV_ALLOW = 'COMPOSER_ALLOW_XDEBUG';
const ENV_VERSION = 'COMPOSER_XDEBUG_VERSION';
public function __construct(OutputInterface $output)
{
parent::__construct('composer', '--ansi');
}
}

@ -20,7 +20,7 @@ use Composer\Composer;
use Composer\TestCase;
use Composer\IO\BufferIO;
use Composer\Script\ScriptEvents;
use Composer\Script\CommandEvent;
use Composer\Script\Event as ScriptEvent;
use Composer\Util\ProcessExecutor;
use Symfony\Component\Console\Output\OutputInterface;
@ -51,29 +51,6 @@ class EventDispatcherTest extends TestCase
$dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false);
}
/**
* @expectedException PHPUnit_Framework_Error_Deprecated
*/
public function testDispatcherCanConvertScriptEventToCommandEventForListener()
{
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$dispatcher = $this->getDispatcherStubForListenersTest(array(
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsCommandEvent',
), $io);
$this->assertEquals(1, $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false));
}
public function testDispatcherDoesNotAttemptConversionForListenerWithoutTypehint()
{
$io = $this->getMockBuilder('Composer\IO\IOInterface')->getMock();
$dispatcher = $this->getDispatcherStubForListenersTest(array(
'Composer\Test\EventDispatcher\EventDispatcherTest::expectsVariableEvent',
), $io);
$this->assertEquals(1, $dispatcher->dispatchScript(ScriptEvents::POST_INSTALL_CMD, false));
}
/**
* @dataProvider getValidCommands
* @param string $command
@ -265,7 +242,7 @@ class EventDispatcherTest extends TestCase
return array();
}));
$dispatcher->dispatch('root', new CommandEvent('root', $composer, $io));
$dispatcher->dispatch('root', new ScriptEvent('root', $composer, $io));
$expected = '> root: @group'.PHP_EOL.
'> group: echo -n foo'.PHP_EOL.
'> group: @subgroup'.PHP_EOL.
@ -305,7 +282,7 @@ class EventDispatcherTest extends TestCase
return array();
}));
$dispatcher->dispatch('root', new CommandEvent('root', $composer, $io));
$dispatcher->dispatch('root', new ScriptEvent('root', $composer, $io));
}
private function getDispatcherStubForListenersTest($listeners, $io)
@ -424,16 +401,6 @@ class EventDispatcherTest extends TestCase
throw new \RuntimeException();
}
public static function expectsCommandEvent(CommandEvent $event)
{
return false;
}
public static function expectsVariableEvent($event)
{
return false;
}
public static function someMethod()
{
return true;

Loading…
Cancel
Save