Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit d67b4ad

Browse files
committed
Improved the error message for "-dev" versions
1 parent 4c26d2b commit d67b4ad

File tree

1 file changed

+14
-2
lines changed

1 file changed

+14
-2
lines changed

src/Symfony/Installer/NewCommand.php

Lines changed: 14 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -113,7 +113,7 @@ protected function checkSymfonyVersionIsInstallable()
113113

114114
// validate semver syntax
115115
if (!preg_match('/^2\.\d(?:\.\d{1,2})?(-(dev|BETA)\d*)?$/', $this->version)) {
116-
throw new \RuntimeException('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99.');
116+
throw new \RuntimeException('The Symfony version should be 2.N or 2.N.M, where N = 0..9 and M = 0..99. The special "-dev" or "-BETA" suffixes are also supported.');
117117
}
118118

119119
if (preg_match('/^2\.\d$/', $this->version)) {
@@ -171,8 +171,20 @@ protected function checkSymfonyVersionIsInstallable()
171171
));
172172
}
173173

174+
// "-dev" versions are not supported because Symfony doesn't provide packages for them
175+
if (preg_match('/^.*\-dev$/', $this->version)) {
176+
throw new \RuntimeException(sprintf(
177+
"The selected version (%s) cannot be installed because it hasn't\n".
178+
"been published as a package yet. Read the following article for\n".
179+
"an alternative installation method:\n\n".
180+
"> How to Install or Upgrade to the Latest, Unreleased Symfony Version\n".
181+
"> http://symfony.com/doc/current/cookbook/install/unstable_versions.html",
182+
$this->version
183+
));
184+
}
185+
174186
// warn the user when downloading an unstable version
175-
if (preg_match('/^.*\-(dev|BETA)\d*$/', $this->version)) {
187+
if (preg_match('/^.*\-BETA\d*$/', $this->version)) {
176188
$this->output->writeln("\n <bg=red> WARNING </> You are downloading an unstable Symfony version.");
177189
}
178190

0 commit comments

Comments
 (0)