diff --git a/src/Composer/Package/Loader/ValidatingArrayLoader.php b/src/Composer/Package/Loader/ValidatingArrayLoader.php index e5d513c41..7e4318b85 100644 --- a/src/Composer/Package/Loader/ValidatingArrayLoader.php +++ b/src/Composer/Package/Loader/ValidatingArrayLoader.php @@ -252,6 +252,7 @@ class ValidatingArrayLoader implements LoaderInterface foreach (array_keys(BasePackage::$supportedLinkTypes) as $linkType) { if ($this->validateArray($linkType) && isset($this->config[$linkType])) { foreach ($this->config[$linkType] as $package => $constraint) { + $package = (string) $package; if (0 === strcasecmp($package, $this->config['name'])) { $this->errors[] = $linkType.'.'.$package.' : a package cannot set a '.$linkType.' on itself'; unset($this->config[$linkType][$package]); diff --git a/src/Composer/Package/RootPackageInterface.php b/src/Composer/Package/RootPackageInterface.php index ad1828570..ef1ab7549 100644 --- a/src/Composer/Package/RootPackageInterface.php +++ b/src/Composer/Package/RootPackageInterface.php @@ -115,15 +115,6 @@ interface RootPackageInterface extends CompletePackageInterface */ public function setReplaces(array $replaces): void; - /** - * Set the repositories - * - * @param mixed[] $repositories - * - * @return void - */ - public function setRepositories(array $repositories): void; - /** * Set the autoload mapping * diff --git a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php index e3d6103e1..4562a2702 100644 --- a/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php +++ b/tests/Composer/Test/Package/Loader/ValidatingArrayLoaderTest.php @@ -419,6 +419,13 @@ class ValidatingArrayLoaderTest extends TestCase 'dist.url : must be present', ), ), + array( + array( + 'name' => 'foo/bar', + 'replace' => array('acme/bar'), + ), + array('replace.0 : invalid version constraint (Could not parse version constraint acme/bar: Invalid version string "acme/bar")') + ), )); }