-
-
Notifications
You must be signed in to change notification settings - Fork 101
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Ship a constraint checker to the built PHARs (#116)
This feature is about adding a check in the PHAR stub in order to gracefully fail with a human friendly error when the user is using the PHAR in a non-supported environment, e.g. invalid PHP version or missing extension. The goal is to gather those requirements without requiring any configuration from the user.
- Loading branch information
Showing
63 changed files
with
5,200 additions
and
51 deletions.
There are no files selected for viewing
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,16 @@ | ||
#!/usr/bin/env bash | ||
|
||
set -euf -o pipefail | ||
|
||
readonly DOCKER=$(which docker) | ||
|
||
# Globals | ||
# PWD | ||
|
||
if [[ "$(docker images -q box_php53 2> /dev/null)" == "" ]]; then | ||
$DOCKER build -t box_php53 -f "$PWD/.docker/php53" . | ||
fi | ||
|
||
if [[ "$(docker images -q box_php72 2> /dev/null)" == "" ]]; then | ||
$DOCKER build -t box_php72 -f "$PWD/.docker/php72" . | ||
fi |
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,4 @@ | ||
FROM helder/php-5.3 | ||
|
||
RUN pecl install phar | ||
RUN pecl install json |
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 @@ | ||
FROM php:7.2-cli |
This file was deleted.
Oops, something went wrong.
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,81 @@ | ||
<?php declare(strict_types=1); | ||
|
||
$header = <<<'EOF' | ||
This file is part of the box project. | ||
|
||
(c) Kevin Herrera <kevin@herrera.io> | ||
Théo Fidry <theo.fidry@gmail.com> | ||
|
||
This source file is subject to the MIT license that is bundled | ||
with this source code in the file LICENSE. | ||
EOF; | ||
|
||
$config = PhpCsFixer\Config::create() | ||
->setRiskyAllowed(true) | ||
->setRules([ | ||
'@Symfony' => true, | ||
'@Symfony:risky' => true, | ||
'align_multiline_comment' => true, | ||
'array_syntax' => ['syntax' => 'long'], | ||
'blank_line_before_statement' => [ | ||
'statements' => [ | ||
'continue', | ||
'declare', | ||
'return', | ||
'throw', | ||
'try', | ||
], | ||
], | ||
'combine_consecutive_issets' => true, | ||
'combine_consecutive_unsets' => true, | ||
'compact_nullable_typehint' => true, | ||
'header_comment' => ['header' => $header], | ||
'heredoc_to_nowdoc' => true, | ||
'list_syntax' => ['syntax' => 'long'], | ||
'method_argument_space' => ['ensure_fully_multiline' => true], | ||
'no_extra_consecutive_blank_lines' => [ | ||
'tokens' => [ | ||
'break', | ||
'continue', | ||
'extra', | ||
'return', | ||
'throw', | ||
'use', | ||
'parenthesis_brace_block', | ||
'square_brace_block', | ||
'curly_brace_block' | ||
] | ||
], | ||
'no_null_property_initialization' => true, | ||
'no_short_echo_tag' => true, | ||
'no_superfluous_elseif' => true, | ||
'no_unneeded_curly_braces' => true, | ||
'no_unneeded_final_method' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_useless_else' => true, | ||
'no_useless_return' => true, | ||
'no_unused_imports' => true, | ||
'ordered_imports' => true, | ||
'php_unit_test_class_requires_covers' => true, | ||
'phpdoc_add_missing_param_annotation' => true, | ||
'phpdoc_order' => true, | ||
'phpdoc_types_order' => true, | ||
'semicolon_after_instruction' => true, | ||
'single_line_comment_style' => true, | ||
'strict_param' => true, | ||
'yoda_style' => true, | ||
]) | ||
->setFinder( | ||
PhpCsFixer\Finder::create() | ||
->in('requirement-checker/src') | ||
->append(['requirement-checker/bin/check-requirements.php']) | ||
) | ||
; | ||
|
||
PhpCsFixer\FixerFactory::create() | ||
->registerBuiltInFixers() | ||
->registerCustomFixers($config->getCustomFixers()) | ||
->useRuleSet(new PhpCsFixer\RuleSet($config->getRules())) | ||
; | ||
|
||
return $config; |
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 |
---|---|---|
|
@@ -2,6 +2,9 @@ language: php | |
|
||
sudo: false | ||
|
||
services: | ||
- docker | ||
|
||
branches: | ||
only: | ||
- master | ||
|
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,19 @@ | ||
<?php | ||
|
||
declare(strict_types=1); | ||
|
||
/* | ||
* This file is part of the box project. | ||
* | ||
* (c) Kevin Herrera <kevin@herrera.io> | ||
* Théo Fidry <theo.fidry@gmail.com> | ||
* | ||
* This source file is subject to the MIT license that is bundled | ||
* with this source code in the file LICENSE. | ||
*/ | ||
|
||
(new Phar(__DIR__.'/../requirement-checker/bin/check-requirements.phar'))->extractTo( | ||
__DIR__.'/../.requirement-checker', | ||
null, | ||
true | ||
); |
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.