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

always show an error message with PHP < 5.4 #66

Merged
merged 1 commit into from
Dec 4, 2014
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
24 changes: 0 additions & 24 deletions src/Symfony/Installer/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -57,7 +57,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
$this->output = $output;

$this
->checkInstalledPhpVersion()
->checkProjectName()
->checkSymfonyVersionIsInstallable()
->download()
Expand All @@ -68,29 +67,6 @@ protected function execute(InputInterface $input, OutputInterface $output)
;
}

/**
* Checks if the system has PHP 5.4 or higher installed, which is a requirement
* to execute the installer.
* @return $this
*/
private function checkInstalledPhpVersion()
{
if (version_compare(PHP_VERSION, '5.4.0', '<')) {
throw new \RuntimeException(sprintf(
"Symfony Installer requires PHP 5.4 version or higher and your system has\n".
"PHP %s version installed.\n\n".
"To solve this issue, upgrade your PHP installation or install Symfony manually\n".
"executing the following command:\n\n".
"composer create-project symfony/framework-standard-edition %s %s",
PHP_VERSION,
$this->projectName,
'latest' !== $this->version ? $this->version : ''
));
}

return $this;
}

/**
* Checks whether it's safe to create a new project for the given name in the
* given directory.
Expand Down
13 changes: 13 additions & 0 deletions symfony
Original file line number Diff line number Diff line change
@@ -1,6 +1,19 @@
#!/usr/bin/env php
<?php

if (PHP_VERSION_ID < 50400) {
file_put_contents('php://stderr', sprintf(
"Symfony Installer requires PHP 5.4 version or higher and your system has\n".
"PHP %s version installed.\n\n".
"To solve this issue, upgrade your PHP installation or install Symfony manually\n".
"executing the following command:\n\n".
"composer create-project symfony/framework-standard-edition <project-name> <symfony-version>\n\n",
PHP_VERSION
));

exit(1);
}

require file_exists(__DIR__.'/vendor/autoload.php')
? __DIR__.'/vendor/autoload.php'
: __DIR__.'/../../autoload.php';
Expand Down