Skip to content

Commit

Permalink
Merge pull request #39 from Soullivaneuh/composer-semver
Browse files Browse the repository at this point in the history
Use composer/semver for compatibility check
  • Loading branch information
soullivaneuh committed Oct 5, 2015
2 parents 1b7cd87 + 7c640f9 commit 35e99e4
Show file tree
Hide file tree
Showing 2 changed files with 4 additions and 2 deletions.
3 changes: 2 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -15,7 +15,8 @@
"symfony/yaml": "~2.3",
"symfony/config": "~2.3",
"symfony/dependency-injection": "~2.3",
"symfony/console": "~2.3"
"symfony/console": "~2.3",
"composer/semver": "~1.0"
},
"require-dev": {
"twig/twig": "~1.22",
Expand Down
3 changes: 2 additions & 1 deletion src/ConfigBridge.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,6 +2,7 @@

namespace SLLH\StyleCIBridge;

use Composer\Semver\Semver;
use SLLH\StyleCIBridge\Exception\LevelConfigException;
use SLLH\StyleCIBridge\StyleCI\Configuration;
use SLLH\StyleCIBridge\StyleCI\Fixers;
Expand Down Expand Up @@ -57,7 +58,7 @@ final class ConfigBridge
*/
public function __construct($styleCIConfigDir = null, $finderDirs = null)
{
if (version_compare(Fixer::VERSION, self::CS_FIXER_MIN_VERSION, '<')) {
if (!Semver::satisfies(Fixer::VERSION, sprintf('>=%s', self::CS_FIXER_MIN_VERSION))) {
throw new \RuntimeException(sprintf(
'PHP-CS-Fixer v%s is not supported, please upgrade to v%s or higher.',
Fixer::VERSION,
Expand Down

0 comments on commit 35e99e4

Please sign in to comment.