From 1dd8bffce5d4fbc23521c33f511a862e3f5e7b75 Mon Sep 17 00:00:00 2001 From: Jordi Boggiano Date: Mon, 27 May 2013 10:41:50 +0200 Subject: [PATCH] CS fixes --- src/Composer/Command/InitCommand.php | 12 ++++++++++-- tests/Composer/Test/AllFunctionalTest.php | 10 ++++++++++ tests/Composer/Test/Command/InitCommandTest.php | 10 ++++++++++ tests/Composer/Test/ComposerTest.php | 1 + tests/Composer/Test/InstallerTest.php | 1 + 5 files changed, 32 insertions(+), 2 deletions(-) diff --git a/src/Composer/Command/InitCommand.php b/src/Composer/Command/InitCommand.php index 5109fff8c..2533094ea 100644 --- a/src/Composer/Command/InitCommand.php +++ b/src/Composer/Command/InitCommand.php @@ -490,8 +490,16 @@ EOT protected function isValidEmail($email) { - if (!function_exists('filter_var')) return true; // Bypass if we can't validate it - if (version_compare(PHP_VERSION, '5.3.3', '<')) return true; // ? + // assume it's valid if we can't validate it + if (!function_exists('filter_var')) { + return true; + } + + // php <5.3.3 has a very broken email validator, so bypass checks + if (version_compare(PHP_VERSION, '5.3.3', '<')) { + return true; + } + return false !== filter_var($email, FILTER_VALIDATE_EMAIL); } } diff --git a/tests/Composer/Test/AllFunctionalTest.php b/tests/Composer/Test/AllFunctionalTest.php index 915804f33..03ec4305f 100644 --- a/tests/Composer/Test/AllFunctionalTest.php +++ b/tests/Composer/Test/AllFunctionalTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test; use Symfony\Component\Process\Process; diff --git a/tests/Composer/Test/Command/InitCommandTest.php b/tests/Composer/Test/Command/InitCommandTest.php index 3eb870713..6aa042c21 100644 --- a/tests/Composer/Test/Command/InitCommandTest.php +++ b/tests/Composer/Test/Command/InitCommandTest.php @@ -1,5 +1,15 @@ + * Jordi Boggiano + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + namespace Composer\Test\Command; use Composer\Command\InitCommand; diff --git a/tests/Composer/Test/ComposerTest.php b/tests/Composer/Test/ComposerTest.php index c23488251..023cee1f8 100644 --- a/tests/Composer/Test/ComposerTest.php +++ b/tests/Composer/Test/ComposerTest.php @@ -1,4 +1,5 @@