@@ -4,42 +4,42 @@ |
||
| 4 | 4 | |
| 5 | 5 | final class PlatformRequirementFilterFactory |
| 6 | 6 | { |
| 7 | - /** |
|
| 8 | - * @param mixed $boolOrList |
|
| 9 | - * |
|
| 10 | - * @return PlatformRequirementFilterInterface |
|
| 11 | - */ |
|
| 12 | - public static function fromBoolOrList($boolOrList) |
|
| 13 | - { |
|
| 14 | - if (is_bool($boolOrList)) { |
|
| 15 | - return $boolOrList ? self::ignoreAll() : self::ignoreNothing(); |
|
| 16 | - } |
|
| 7 | + /** |
|
| 8 | + * @param mixed $boolOrList |
|
| 9 | + * |
|
| 10 | + * @return PlatformRequirementFilterInterface |
|
| 11 | + */ |
|
| 12 | + public static function fromBoolOrList($boolOrList) |
|
| 13 | + { |
|
| 14 | + if (is_bool($boolOrList)) { |
|
| 15 | + return $boolOrList ? self::ignoreAll() : self::ignoreNothing(); |
|
| 16 | + } |
|
| 17 | 17 | |
| 18 | - if (is_array($boolOrList)) { |
|
| 19 | - return new IgnoreListPlatformRequirementFilter($boolOrList); |
|
| 20 | - } |
|
| 18 | + if (is_array($boolOrList)) { |
|
| 19 | + return new IgnoreListPlatformRequirementFilter($boolOrList); |
|
| 20 | + } |
|
| 21 | 21 | |
| 22 | - throw new \InvalidArgumentException( |
|
| 23 | - sprintf( |
|
| 24 | - 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.', |
|
| 25 | - gettype($boolOrList) |
|
| 26 | - ) |
|
| 27 | - ); |
|
| 28 | - } |
|
| 22 | + throw new \InvalidArgumentException( |
|
| 23 | + sprintf( |
|
| 24 | + 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.', |
|
| 25 | + gettype($boolOrList) |
|
| 26 | + ) |
|
| 27 | + ); |
|
| 28 | + } |
|
| 29 | 29 | |
| 30 | - /** |
|
| 31 | - * @return PlatformRequirementFilterInterface |
|
| 32 | - */ |
|
| 33 | - public static function ignoreAll() |
|
| 34 | - { |
|
| 35 | - return new IgnoreAllPlatformRequirementFilter(); |
|
| 36 | - } |
|
| 30 | + /** |
|
| 31 | + * @return PlatformRequirementFilterInterface |
|
| 32 | + */ |
|
| 33 | + public static function ignoreAll() |
|
| 34 | + { |
|
| 35 | + return new IgnoreAllPlatformRequirementFilter(); |
|
| 36 | + } |
|
| 37 | 37 | |
| 38 | - /** |
|
| 39 | - * @return PlatformRequirementFilterInterface |
|
| 40 | - */ |
|
| 41 | - public static function ignoreNothing() |
|
| 42 | - { |
|
| 43 | - return new IgnoreNothingPlatformRequirementFilter(); |
|
| 44 | - } |
|
| 38 | + /** |
|
| 39 | + * @return PlatformRequirementFilterInterface |
|
| 40 | + */ |
|
| 41 | + public static function ignoreNothing() |
|
| 42 | + { |
|
| 43 | + return new IgnoreNothingPlatformRequirementFilter(); |
|
| 44 | + } |
|
| 45 | 45 | } |
@@ -9,20 +9,20 @@ |
||
| 9 | 9 | * |
| 10 | 10 | * @return PlatformRequirementFilterInterface |
| 11 | 11 | */ |
| 12 | - public static function fromBoolOrList($boolOrList) |
|
| 12 | + public static function fromBoolOrList( $boolOrList ) |
|
| 13 | 13 | { |
| 14 | - if (is_bool($boolOrList)) { |
|
| 14 | + if ( is_bool( $boolOrList ) ) { |
|
| 15 | 15 | return $boolOrList ? self::ignoreAll() : self::ignoreNothing(); |
| 16 | 16 | } |
| 17 | 17 | |
| 18 | - if (is_array($boolOrList)) { |
|
| 19 | - return new IgnoreListPlatformRequirementFilter($boolOrList); |
|
| 18 | + if ( is_array( $boolOrList ) ) { |
|
| 19 | + return new IgnoreListPlatformRequirementFilter( $boolOrList ); |
|
| 20 | 20 | } |
| 21 | 21 | |
| 22 | 22 | throw new \InvalidArgumentException( |
| 23 | 23 | sprintf( |
| 24 | 24 | 'PlatformRequirementFilter: Unknown $boolOrList parameter %s. Please report at https://github.com/composer/composer/issues/new.', |
| 25 | - gettype($boolOrList) |
|
| 25 | + gettype( $boolOrList ) |
|
| 26 | 26 | ) |
| 27 | 27 | ); |
| 28 | 28 | } |
@@ -2,15 +2,13 @@ discard block |
||
| 2 | 2 | |
| 3 | 3 | namespace Composer\Filter\PlatformRequirementFilter; |
| 4 | 4 | |
| 5 | -final class PlatformRequirementFilterFactory |
|
| 6 | -{ |
|
| 5 | +final class PlatformRequirementFilterFactory { |
|
| 7 | 6 | /** |
| 8 | 7 | * @param mixed $boolOrList |
| 9 | 8 | * |
| 10 | 9 | * @return PlatformRequirementFilterInterface |
| 11 | 10 | */ |
| 12 | - public static function fromBoolOrList($boolOrList) |
|
| 13 | - { |
|
| 11 | + public static function fromBoolOrList($boolOrList) { |
|
| 14 | 12 | if (is_bool($boolOrList)) { |
| 15 | 13 | return $boolOrList ? self::ignoreAll() : self::ignoreNothing(); |
| 16 | 14 | } |
@@ -30,16 +28,14 @@ discard block |
||
| 30 | 28 | /** |
| 31 | 29 | * @return PlatformRequirementFilterInterface |
| 32 | 30 | */ |
| 33 | - public static function ignoreAll() |
|
| 34 | - { |
|
| 31 | + public static function ignoreAll() { |
|
| 35 | 32 | return new IgnoreAllPlatformRequirementFilter(); |
| 36 | 33 | } |
| 37 | 34 | |
| 38 | 35 | /** |
| 39 | 36 | * @return PlatformRequirementFilterInterface |
| 40 | 37 | */ |
| 41 | - public static function ignoreNothing() |
|
| 42 | - { |
|
| 38 | + public static function ignoreNothing() { |
|
| 43 | 39 | return new IgnoreNothingPlatformRequirementFilter(); |
| 44 | 40 | } |
| 45 | 41 | } |
@@ -14,70 +14,70 @@ |
||
| 14 | 14 | |
| 15 | 15 | final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface |
| 16 | 16 | { |
| 17 | - /** |
|
| 18 | - * @var string |
|
| 19 | - */ |
|
| 20 | - private $ignoreRegex; |
|
| 17 | + /** |
|
| 18 | + * @var string |
|
| 19 | + */ |
|
| 20 | + private $ignoreRegex; |
|
| 21 | 21 | |
| 22 | - /** |
|
| 23 | - * @var string |
|
| 24 | - */ |
|
| 25 | - private $ignoreUpperBoundRegex; |
|
| 22 | + /** |
|
| 23 | + * @var string |
|
| 24 | + */ |
|
| 25 | + private $ignoreUpperBoundRegex; |
|
| 26 | 26 | |
| 27 | - /** |
|
| 28 | - * @param string[] $reqList |
|
| 29 | - */ |
|
| 30 | - public function __construct(array $reqList) |
|
| 31 | - { |
|
| 32 | - $ignoreAll = $ignoreUpperBound = array(); |
|
| 33 | - foreach ($reqList as $req) { |
|
| 34 | - if (substr($req, -1) === '+') { |
|
| 35 | - $ignoreUpperBound[] = substr($req, 0, -1); |
|
| 36 | - } else { |
|
| 37 | - $ignoreAll[] = $req; |
|
| 38 | - } |
|
| 39 | - } |
|
| 40 | - $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll); |
|
| 41 | - $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound); |
|
| 42 | - } |
|
| 27 | + /** |
|
| 28 | + * @param string[] $reqList |
|
| 29 | + */ |
|
| 30 | + public function __construct(array $reqList) |
|
| 31 | + { |
|
| 32 | + $ignoreAll = $ignoreUpperBound = array(); |
|
| 33 | + foreach ($reqList as $req) { |
|
| 34 | + if (substr($req, -1) === '+') { |
|
| 35 | + $ignoreUpperBound[] = substr($req, 0, -1); |
|
| 36 | + } else { |
|
| 37 | + $ignoreAll[] = $req; |
|
| 38 | + } |
|
| 39 | + } |
|
| 40 | + $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll); |
|
| 41 | + $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound); |
|
| 42 | + } |
|
| 43 | 43 | |
| 44 | - /** |
|
| 45 | - * @param string $req |
|
| 46 | - * @return bool |
|
| 47 | - */ |
|
| 48 | - public function isIgnored($req) |
|
| 49 | - { |
|
| 50 | - if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 51 | - return false; |
|
| 52 | - } |
|
| 44 | + /** |
|
| 45 | + * @param string $req |
|
| 46 | + * @return bool |
|
| 47 | + */ |
|
| 48 | + public function isIgnored($req) |
|
| 49 | + { |
|
| 50 | + if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 51 | + return false; |
|
| 52 | + } |
|
| 53 | 53 | |
| 54 | - return Preg::isMatch($this->ignoreRegex, $req); |
|
| 55 | - } |
|
| 54 | + return Preg::isMatch($this->ignoreRegex, $req); |
|
| 55 | + } |
|
| 56 | 56 | |
| 57 | - /** |
|
| 58 | - * @param string $req |
|
| 59 | - * @return ConstraintInterface |
|
| 60 | - */ |
|
| 61 | - public function filterConstraint($req, ConstraintInterface $constraint) |
|
| 62 | - { |
|
| 63 | - if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 64 | - return $constraint; |
|
| 65 | - } |
|
| 57 | + /** |
|
| 58 | + * @param string $req |
|
| 59 | + * @return ConstraintInterface |
|
| 60 | + */ |
|
| 61 | + public function filterConstraint($req, ConstraintInterface $constraint) |
|
| 62 | + { |
|
| 63 | + if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 64 | + return $constraint; |
|
| 65 | + } |
|
| 66 | 66 | |
| 67 | - if (!Preg::isMatch($this->ignoreUpperBoundRegex, $req)) { |
|
| 68 | - return $constraint; |
|
| 69 | - } |
|
| 67 | + if (!Preg::isMatch($this->ignoreUpperBoundRegex, $req)) { |
|
| 68 | + return $constraint; |
|
| 69 | + } |
|
| 70 | 70 | |
| 71 | - if (Preg::isMatch($this->ignoreRegex, $req)) { |
|
| 72 | - return new MatchAllConstraint; |
|
| 73 | - } |
|
| 71 | + if (Preg::isMatch($this->ignoreRegex, $req)) { |
|
| 72 | + return new MatchAllConstraint; |
|
| 73 | + } |
|
| 74 | 74 | |
| 75 | - $intervals = Intervals::get($constraint); |
|
| 76 | - $last = end($intervals['numeric']); |
|
| 77 | - if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) { |
|
| 78 | - $constraint = new MultiConstraint(array($constraint, new Constraint('>=', $last->getEnd()->getVersion())), false); |
|
| 79 | - } |
|
| 75 | + $intervals = Intervals::get($constraint); |
|
| 76 | + $last = end($intervals['numeric']); |
|
| 77 | + if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) { |
|
| 78 | + $constraint = new MultiConstraint(array($constraint, new Constraint('>=', $last->getEnd()->getVersion())), false); |
|
| 79 | + } |
|
| 80 | 80 | |
| 81 | - return $constraint; |
|
| 82 | - } |
|
| 81 | + return $constraint; |
|
| 82 | + } |
|
| 83 | 83 | } |
@@ -27,55 +27,55 @@ |
||
| 27 | 27 | /** |
| 28 | 28 | * @param string[] $reqList |
| 29 | 29 | */ |
| 30 | - public function __construct(array $reqList) |
|
| 30 | + public function __construct( array $reqList ) |
|
| 31 | 31 | { |
| 32 | 32 | $ignoreAll = $ignoreUpperBound = array(); |
| 33 | - foreach ($reqList as $req) { |
|
| 34 | - if (substr($req, -1) === '+') { |
|
| 35 | - $ignoreUpperBound[] = substr($req, 0, -1); |
|
| 33 | + foreach ( $reqList as $req ) { |
|
| 34 | + if ( substr( $req, -1 ) === '+' ) { |
|
| 35 | + $ignoreUpperBound[ ] = substr( $req, 0, -1 ); |
|
| 36 | 36 | } else { |
| 37 | - $ignoreAll[] = $req; |
|
| 37 | + $ignoreAll[ ] = $req; |
|
| 38 | 38 | } |
| 39 | 39 | } |
| 40 | - $this->ignoreRegex = BasePackage::packageNamesToRegexp($ignoreAll); |
|
| 41 | - $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp($ignoreUpperBound); |
|
| 40 | + $this->ignoreRegex = BasePackage::packageNamesToRegexp( $ignoreAll ); |
|
| 41 | + $this->ignoreUpperBoundRegex = BasePackage::packageNamesToRegexp( $ignoreUpperBound ); |
|
| 42 | 42 | } |
| 43 | 43 | |
| 44 | 44 | /** |
| 45 | 45 | * @param string $req |
| 46 | 46 | * @return bool |
| 47 | 47 | */ |
| 48 | - public function isIgnored($req) |
|
| 48 | + public function isIgnored( $req ) |
|
| 49 | 49 | { |
| 50 | - if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 50 | + if ( ! PlatformRepository::isPlatformPackage( $req ) ) { |
|
| 51 | 51 | return false; |
| 52 | 52 | } |
| 53 | 53 | |
| 54 | - return Preg::isMatch($this->ignoreRegex, $req); |
|
| 54 | + return Preg::isMatch( $this->ignoreRegex, $req ); |
|
| 55 | 55 | } |
| 56 | 56 | |
| 57 | 57 | /** |
| 58 | 58 | * @param string $req |
| 59 | 59 | * @return ConstraintInterface |
| 60 | 60 | */ |
| 61 | - public function filterConstraint($req, ConstraintInterface $constraint) |
|
| 61 | + public function filterConstraint( $req, ConstraintInterface $constraint ) |
|
| 62 | 62 | { |
| 63 | - if (!PlatformRepository::isPlatformPackage($req)) { |
|
| 63 | + if ( ! PlatformRepository::isPlatformPackage( $req ) ) { |
|
| 64 | 64 | return $constraint; |
| 65 | 65 | } |
| 66 | 66 | |
| 67 | - if (!Preg::isMatch($this->ignoreUpperBoundRegex, $req)) { |
|
| 67 | + if ( ! Preg::isMatch( $this->ignoreUpperBoundRegex, $req ) ) { |
|
| 68 | 68 | return $constraint; |
| 69 | 69 | } |
| 70 | 70 | |
| 71 | - if (Preg::isMatch($this->ignoreRegex, $req)) { |
|
| 71 | + if ( Preg::isMatch( $this->ignoreRegex, $req ) ) { |
|
| 72 | 72 | return new MatchAllConstraint; |
| 73 | 73 | } |
| 74 | 74 | |
| 75 | - $intervals = Intervals::get($constraint); |
|
| 76 | - $last = end($intervals['numeric']); |
|
| 77 | - if ($last !== false && (string) $last->getEnd() !== (string) Interval::untilPositiveInfinity()) { |
|
| 78 | - $constraint = new MultiConstraint(array($constraint, new Constraint('>=', $last->getEnd()->getVersion())), false); |
|
| 75 | + $intervals = Intervals::get( $constraint ); |
|
| 76 | + $last = end( $intervals[ 'numeric' ] ); |
|
| 77 | + if ( $last !== false && (string)$last->getEnd() !== (string)Interval::untilPositiveInfinity() ) { |
|
| 78 | + $constraint = new MultiConstraint( array( $constraint, new Constraint( '>=', $last->getEnd()->getVersion() ) ), false ); |
|
| 79 | 79 | } |
| 80 | 80 | |
| 81 | 81 | return $constraint; |
@@ -12,8 +12,7 @@ discard block |
||
| 12 | 12 | use Composer\Semver\Interval; |
| 13 | 13 | use Composer\Semver\Intervals; |
| 14 | 14 | |
| 15 | -final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface |
|
| 16 | -{ |
|
| 15 | +final class IgnoreListPlatformRequirementFilter implements PlatformRequirementFilterInterface { |
|
| 17 | 16 | /** |
| 18 | 17 | * @var string |
| 19 | 18 | */ |
@@ -27,8 +26,7 @@ discard block |
||
| 27 | 26 | /** |
| 28 | 27 | * @param string[] $reqList |
| 29 | 28 | */ |
| 30 | - public function __construct(array $reqList) |
|
| 31 | - { |
|
| 29 | + public function __construct(array $reqList) { |
|
| 32 | 30 | $ignoreAll = $ignoreUpperBound = array(); |
| 33 | 31 | foreach ($reqList as $req) { |
| 34 | 32 | if (substr($req, -1) === '+') { |
@@ -45,8 +43,7 @@ discard block |
||
| 45 | 43 | * @param string $req |
| 46 | 44 | * @return bool |
| 47 | 45 | */ |
| 48 | - public function isIgnored($req) |
|
| 49 | - { |
|
| 46 | + public function isIgnored($req) { |
|
| 50 | 47 | if (!PlatformRepository::isPlatformPackage($req)) { |
| 51 | 48 | return false; |
| 52 | 49 | } |
@@ -58,8 +55,7 @@ discard block |
||
| 58 | 55 | * @param string $req |
| 59 | 56 | * @return ConstraintInterface |
| 60 | 57 | */ |
| 61 | - public function filterConstraint($req, ConstraintInterface $constraint) |
|
| 62 | - { |
|
| 58 | + public function filterConstraint($req, ConstraintInterface $constraint) { |
|
| 63 | 59 | if (!PlatformRepository::isPlatformPackage($req)) { |
| 64 | 60 | return $constraint; |
| 65 | 61 | } |