-
Notifications
You must be signed in to change notification settings - Fork 24
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Add support for
os-families
and os-families-exclude
in extensions…
… `composer.json`
- Loading branch information
1 parent
3abe8f5
commit f934832
Showing
25 changed files
with
492 additions
and
2 deletions.
There are no files selected for viewing
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 array<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
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.