From 528d35a835adf499e9b88344970d506cee98fbf5 Mon Sep 17 00:00:00 2001 From: chr0n1x Date: Sat, 28 Dec 2013 00:40:27 -0500 Subject: [PATCH] ConfigValidator: ensure that require-dev exists during override check - Ensure that require-dev is present before checking for dependeny overrides. - A small grammar update for the warning message. --- src/Composer/Util/ConfigValidator.php | 11 ++++++++--- 1 file changed, 8 insertions(+), 3 deletions(-) diff --git a/src/Composer/Util/ConfigValidator.php b/src/Composer/Util/ConfigValidator.php index 82648d6d3..670c9d755 100644 --- a/src/Composer/Util/ConfigValidator.php +++ b/src/Composer/Util/ConfigValidator.php @@ -108,9 +108,14 @@ class ConfigValidator $warnings[] = "The package type 'composer-installer' is deprecated. Please distribute your custom installers as plugins from now on. See http://getcomposer.org/doc/articles/plugins.md for plugin documentation."; } - $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']); - if (!empty($requireOverrides)) { - $warnings[] = implode(', ', array_keys($requireOverrides)). " is required both in require and require-dev, this can lead to unexpected behavior"; + // check for require-dev overrides + if (isset($manifest['require']) && isset($manifest['require-dev'])) { + $requireOverrides = array_intersect_key($manifest['require'], $manifest['require-dev']); + + if (!empty($requireOverrides)) { + $plural = (count($requireOverrides) > 1) ? 'are' : 'is'; + $warnings[] = implode(', ', array_keys($requireOverrides)). " {$plural} required both in require and require-dev, this can lead to unexpected behavior"; + } } try {