-
Notifications
You must be signed in to change notification settings - Fork 25
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #116 from alexandre-daubois/os-composer-json
Add support for `os-families-exclude` in extensions `composer.json`
- Loading branch information
Showing
26 changed files
with
465 additions
and
9 deletions.
There are no files selected for viewing
Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.
Oops, something went wrong.
35 changes: 35 additions & 0 deletions
35
src/DependencyResolver/IncompatibleOperatingSystemFamily.php
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,35 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\Pie\DependencyResolver; | ||
|
||
use Php\Pie\Platform\OperatingSystemFamily; | ||
use RuntimeException; | ||
|
||
use function array_map; | ||
use function implode; | ||
use function sprintf; | ||
|
||
class IncompatibleOperatingSystemFamily extends RuntimeException | ||
{ | ||
/** @param list<OperatingSystemFamily> $required */ | ||
public static function notInCompatibleOperatingSystemFamilies(array $required, OperatingSystemFamily $current): self | ||
{ | ||
return new self(sprintf( | ||
'This extension does not support the "%s" operating system family. It is compatible with the following families: "%s".', | ||
$current->value, | ||
implode('", "', array_map(static fn (OperatingSystemFamily $osFamily): string => $osFamily->value, $required)), | ||
)); | ||
} | ||
|
||
/** @param list<OperatingSystemFamily> $incompatibleOsFamilies */ | ||
public static function inIncompatibleOperatingSystemFamily(array $incompatibleOsFamilies, OperatingSystemFamily $current): self | ||
{ | ||
return new self(sprintf( | ||
'This extension does not support the "%s" operating system family. It is incompatible with the following families: "%s".', | ||
$current->value, | ||
implode('", "', array_map(static fn (OperatingSystemFamily $osFamily): string => $osFamily->value, $incompatibleOsFamilies)), | ||
)); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,27 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
namespace Php\Pie\Platform; | ||
|
||
use function array_map; | ||
|
||
/** @internal This is not public API for PIE, so should not be depended upon unless you accept the risk of BC breaks */ | ||
enum OperatingSystemFamily: string | ||
{ | ||
case Windows = 'windows'; | ||
case Bsd = 'bsd'; | ||
case Darwin = 'darwin'; | ||
case Solaris = 'solaris'; | ||
case Linux = 'linux'; | ||
case Unknown = 'unknown'; | ||
|
||
/** @return non-empty-list<non-empty-string> */ | ||
public static function asValuesList(): array | ||
{ | ||
return array_map( | ||
static fn (OperatingSystemFamily $osFamily): string => $osFamily->value, | ||
self::cases(), | ||
); | ||
} | ||
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Oops, something went wrong.