Browse Source

Remove BC event and constraint classes

Jordi Boggiano 6 years ago
parent
commit
5a56bb6971

+ 0 - 38
src/Composer/EventDispatcher/EventDispatcher.php

@@ -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;
     }
 

+ 0 - 24
src/Composer/Package/LinkConstraint/EmptyConstraint.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Package/LinkConstraint/LinkConstraintInterface.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Package/LinkConstraint/MultiConstraint.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Package/LinkConstraint/SpecificConstraint.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Package/LinkConstraint/VersionConstraint.php

@@ -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
-{
-}

+ 0 - 22
src/Composer/Script/CommandEvent.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Script/PackageEvent.php

@@ -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
-{
-}

+ 0 - 24
src/Composer/Util/SpdxLicense.php

@@ -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
-{
-}

+ 0 - 31
src/Composer/XdebugHandler.php

@@ -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');
-    }
-}

+ 3 - 36
tests/Composer/Test/EventDispatcher/EventDispatcherTest.php

@@ -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;