diff --git a/src/Composer/Command/RemoveCommand.php b/src/Composer/Command/RemoveCommand.php index 8ab9cd35f..771f7b042 100644 --- a/src/Composer/Command/RemoveCommand.php +++ b/src/Composer/Command/RemoveCommand.php @@ -97,6 +97,7 @@ EOT } // Update packages + $this->resetComposer(); $composer = $this->getComposer(true, $input->getOption('no-plugins')); $composer->getDownloadManager()->setOutputProgress(!$input->getOption('no-progress')); diff --git a/src/Composer/Console/Application.php b/src/Composer/Console/Application.php index b433b6fcc..320a48994 100644 --- a/src/Composer/Console/Application.php +++ b/src/Composer/Console/Application.php @@ -189,7 +189,7 @@ class Application extends BaseApplication } // Check system temp folder for usability as it can cause weird runtime issues otherwise - Silencer::call(function() { + Silencer::call(function () use ($io) { $tempfile = sys_get_temp_dir() . '/temp-' . md5(microtime()); if (!(file_put_contents($tempfile, __FILE__) && (file_get_contents($tempfile) == __FILE__) && unlink($tempfile) && !file_exists($tempfile))) { $io->writeError(sprintf('PHP temp directory (%s) does not exist or is not writable to Composer. Set sys_temp_dir in your php.ini', sys_get_temp_dir())); diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index 9fa0ef0dd..38fc9fe7c 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -151,6 +151,7 @@ class ValidatingArrayLoader implements LoaderInterface } $unboundConstraint = new Constraint('=', $this->versionParser->normalize('dev-master')); + $stableConstraint = new Constraint('=', '1.0.0'); foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { if ($this->validateArray($linkType) && isset($this->config[$linkType])) { @@ -183,6 +184,7 @@ class ValidatingArrayLoader implements LoaderInterface ($this->flags & self::CHECK_STRICT_CONSTRAINTS) && 'require' === $linkType && substr($linkConstraint, 0, 1) === '=' + && $stableConstraint->versionCompare($stableConstraint, $linkConstraint, '<=') ) { $this->warnings[] = $linkType.'.'.$package.' : exact version constraints ('.$constraint.') should be avoided if the package follows semantic versioning'; } diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index 7027b033b..983d99862 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -327,6 +327,18 @@ class ValidatingArrayLoaderTest extends \PHPUnit_Framework_TestCase ), false, ), + array( + array( + 'name' => 'foo/bar', + 'require' => array( + 'bar/unstable' => '0.3.0', + ), + ), + array( + // using an exact version constraint for an unstable version should not trigger a warning + ), + false, + ), array( array( 'name' => 'foo/bar',