Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

Commit ecb3967

Browse filesBrowse files
committed
Display a warning message when trying to install Symfony 4.x versions
1 parent 36969e0 commit ecb3967
Copy full SHA for ecb3967

File tree

Expand file treeCollapse file tree

2 files changed

+29
-6
lines changed
Filter options
Expand file treeCollapse file tree

2 files changed

+29
-6
lines changed

‎src/Symfony/Installer/NewCommand.php

Copy file name to clipboardExpand all lines: src/Symfony/Installer/NewCommand.php
+16-6Lines changed: 16 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -139,7 +139,7 @@ protected function checkSymfonyVersionIsInstallable()
139139
throw new \RuntimeException(sprintf(
140140
"The selected branch (%s) does not exist, or is not maintained.\n".
141141
"To solve this issue, install Symfony with the latest stable release:\n\n".
142-
'%s %s %s', $this->version, $_SERVER['PHP_SELF'], $this->getName(), $this->projectDir
142+
'%s %s %s', $this->version, $_SERVER['PHP_SELF'], $this->getName(), $this->projectDir
143143
));
144144
}
145145

@@ -173,11 +173,21 @@ protected function checkSymfonyVersionIsInstallable()
173173
}
174174

175175
// check that the system has the PHP version required by the Symfony version to be installed
176-
if (version_compare($this->version, '3.0.0', '>=') && version_compare(phpversion(), '5.5.9', '<')) {
176+
if (version_compare($this->version, '3.0.0', '>=') && version_compare(PHP_VERSION, '5.5.9', '<')) {
177177
throw new \RuntimeException(sprintf(
178178
"The selected version (%s) cannot be installed because it requires\n".
179179
"PHP 5.5.9 or higher and your system has PHP %s installed.\n",
180-
$this->version, phpversion()
180+
$this->version, PHP_VERSION
181+
));
182+
}
183+
184+
// check that the Symfony version to be installed is not 4.x, which is incompatible with this installer
185+
if (version_compare($this->version, '4.0.0', '>=')) {
186+
throw new \RuntimeException(sprintf(
187+
"The Symfony Installer is not compatible with Symfony 4.x or newer versions.\n".
188+
"Run this other command to install Symfony using Composer instead:\n\n".
189+
'composer create-project symfony/skeleton %s',
190+
$this->projectName
181191
));
182192
}
183193

@@ -329,12 +339,12 @@ protected function updateParameters()
329339
protected function updateComposerConfig()
330340
{
331341
parent::updateComposerConfig();
332-
$this->composerManager->updateProjectConfig([
342+
$this->composerManager->updateProjectConfig(array(
333343
'name' => $this->composerManager->createPackageName($this->projectName),
334344
'license' => 'proprietary',
335345
'description' => null,
336-
'extra' => ['branch-alias' => null],
337-
]);
346+
'extra' => array('branch-alias' => null),
347+
));
338348

339349
return $this;
340350
}

‎tests/Symfony/Installer/Tests/IntegrationTest.php

Copy file name to clipboardExpand all lines: tests/Symfony/Installer/Tests/IntegrationTest.php
+13Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -101,6 +101,19 @@ public function testSymfonyRequiresNewerPhpVersion()
101101
$this->runCommand(sprintf('php %s/symfony.phar new my_test_project 3.0.0', $this->rootDir));
102102
}
103103

104+
/**
105+
* @expectedException \RuntimeException
106+
* @expectedExceptionMessageRegExp /.+The Symfony Installer is not compatible with Symfony 4\.x or newer versions.*Run this other command to install Symfony using Composer instead:.*composer create-project symfony\/skeleton .+/s
107+
*/
108+
public function testUseComposerToInstallSymfony4()
109+
{
110+
if (PHP_VERSION_ID < 50500) {
111+
$this->markTestSkipped('This test requires PHP 5.5 or newer.');
112+
}
113+
114+
$this->runCommand(sprintf('php %s/symfony.phar new my_test_project', $this->rootDir));
115+
}
116+
104117
public function testSymfonyInstallationInCurrentDirectory()
105118
{
106119
$projectDir = sprintf('%s/my_test_project', sys_get_temp_dir());

0 commit comments

Comments
0 (0)
Morty Proxy This is a proxified and sanitized view of the page, visit original site.