-
Notifications
You must be signed in to change notification settings - Fork 0
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
- Loading branch information
Showing
24 changed files
with
420 additions
and
14 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 |
---|---|---|
|
@@ -2,3 +2,6 @@ | |
/composer.phar | ||
/composer.lock | ||
/vendor/ | ||
|
||
# Temporary files | ||
/.php-cs-fixer.cache |
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,92 @@ | ||
<?php | ||
|
||
$finder = PhpCsFixer\Finder::create() | ||
->in(__DIR__) | ||
->exclude('bin') | ||
->exclude('cache') | ||
->exclude('doc') | ||
->exclude('logs') | ||
->exclude('vendor') | ||
; | ||
|
||
return (new PhpCsFixer\Config()) | ||
->setParallelConfig(PhpCsFixer\Runner\Parallel\ParallelConfigFactory::detect()) | ||
->setRules([ | ||
'@Symfony' => true, | ||
|
||
'array_indentation' => true, | ||
'array_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'trailing_comma_in_multiline' => [ | ||
'elements' => ['arrays', 'arguments', 'parameters'], | ||
], | ||
'dir_constant' => true, | ||
'ereg_to_preg' => true, | ||
'explicit_indirect_variable' => true, | ||
'explicit_string_variable' => true, | ||
'fopen_flag_order' => true, | ||
'single_line_comment_style' => [ | ||
'comment_types' => ['hash'], | ||
], | ||
'heredoc_indentation' => true, | ||
'heredoc_to_nowdoc' => true, | ||
'implode_call' => true, | ||
'is_null' => true, | ||
'linebreak_after_opening_tag' => true, | ||
'list_syntax' => [ | ||
'syntax' => 'short', | ||
], | ||
'logical_operators' => true, | ||
'method_chaining_indentation' => true, | ||
'modernize_types_casting' => true, | ||
'multiline_whitespace_before_semicolons' => true, | ||
'no_alias_functions' => true, | ||
'no_alternative_syntax' => true, | ||
'no_null_property_initialization' => true, | ||
'no_php4_constructor' => true, | ||
'echo_tag_syntax' => [ | ||
'format' => 'long', | ||
], | ||
'no_superfluous_elseif' => true, | ||
'no_unneeded_final_method' => true, | ||
'no_unreachable_default_argument_value' => true, | ||
'no_unset_cast' => true, | ||
'no_unset_on_property' => true, | ||
'no_useless_else' => true, | ||
'ordered_class_elements' => true, | ||
'ordered_interfaces' => true, | ||
'php_unit_expectation' => true, | ||
'php_unit_method_casing' => [ | ||
'case' => 'snake_case', | ||
], | ||
'php_unit_mock_short_will_return' => true, | ||
'php_unit_namespaced' => true, | ||
'php_unit_no_expectation_annotation' => true, | ||
'php_unit_set_up_tear_down_visibility' => true, | ||
'php_unit_strict' => true, | ||
'php_unit_test_annotation' => [ | ||
'style' => 'annotation', | ||
], | ||
'php_unit_test_case_static_method_calls' => [ | ||
'call_type' => 'self', | ||
], | ||
'pow_to_exponentiation' => true, | ||
'protected_to_private' => true, | ||
'psr_autoloading' => true, | ||
'self_accessor' => true, | ||
'set_type_to_cast' => true, | ||
'simple_to_complex_string_variable' => true, | ||
'static_lambda' => true, | ||
'strict_comparison' => true, | ||
'strict_param' => true, | ||
'ternary_to_null_coalescing' => true, | ||
'visibility_required' => [ | ||
'elements' => ['property', 'const'], | ||
], | ||
'void_return' => true, | ||
'declare_strict_types' => true, | ||
]) | ||
->setUsingCache(true) | ||
->setFinder($finder) | ||
; |
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 |
---|---|---|
@@ -1,10 +1,43 @@ | ||
#!/usr/bin/env sh | ||
#!/usr/bin/env bash | ||
|
||
SHORT_HELP="$0 [-h] [-f]'" | ||
|
||
while getopts ":hf" opt; do | ||
case $opt in | ||
h) | ||
echo 'Usage:' | ||
echo " $SHORT_HELP" | ||
echo '' | ||
echo 'Options:' | ||
echo ' -f Fix coding style' | ||
echo '' | ||
exit 0 | ||
;; | ||
f) | ||
echo '' | ||
echo '// Fixing CS...' | ||
echo '' | ||
|
||
vendor/bin/php-cs-fixer fix --allow-risky=yes | ||
exit 0 | ||
;; | ||
\?) | ||
echo '' >&2 | ||
echo " [KO] The \"-$OPTARG\" option does not exist" >&2 | ||
echo '' >&2 | ||
echo " $SHORT_HELP" >&2 | ||
echo '' >&2 | ||
exit 1 | ||
;; | ||
esac | ||
done | ||
unset SHORT_HELP | ||
|
||
echo '' | ||
echo '// Running tests...' | ||
|
||
composer --quiet dump --optimize | ||
|
||
vendor/bin/phpspec --no-interaction run -fdot #&& \ | ||
vendor/bin/phpspec --no-interaction run -fdot && \ | ||
# vendor/bin/phpunit && \ | ||
# PHP_CS_FIXER_IGNORE_ENV=1 vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run | ||
vendor/bin/php-cs-fixer fix --allow-risky=yes --dry-run |
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 |
---|---|---|
@@ -1,17 +1,15 @@ | ||
{ | ||
"name": "ssc/lib", | ||
"type": "project", | ||
"description": "Decoupled PHP libraries", | ||
"license": "MIT", | ||
"type": "project", | ||
"keywords": [ | ||
"ssc" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Loïc Faugeron", | ||
"email": "[email protected]", | ||
"homepage": "https://gnugat.github.io", | ||
"role": "Developer" | ||
"email": "[email protected]" | ||
} | ||
], | ||
"homepage": "https://gnugat.github.io/ssc-lib", | ||
|
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
Empty file.
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 |
---|---|---|
|
@@ -3,12 +3,29 @@ | |
"type": "library", | ||
"description": "SSC - Exception", | ||
"license": "MIT", | ||
"keywords": [ | ||
"ssc" | ||
], | ||
"authors": [ | ||
{ | ||
"name": "Loïc Faugeron", | ||
"email": "[email protected]" | ||
} | ||
], | ||
"homepage": "https://gnugat.github.io/ssc-lib", | ||
"require": { | ||
"php": "^8.3" | ||
}, | ||
"require-dev": { | ||
"friendsofphp/php-cs-fixer": "^3.65", | ||
"phpspec/phpspec": "^7.5" | ||
}, | ||
"autoload": { | ||
"psr-4": { | ||
"Ssc\\Exception\\": "src" | ||
} | ||
}, | ||
"config": { | ||
"sort-packages": 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
Original file line number | Diff line number | Diff line change |
---|---|---|
@@ -0,0 +1,6 @@ | ||
suites: | ||
exception: | ||
namespace: Ssc\Exception | ||
psr4_prefix: Ssc\Exception | ||
src_path: src | ||
spec_path: . |
13 changes: 12 additions & 1 deletion
13
packages/exception/spec/ClientErrorExceptionSpec.php
100755 → 100644
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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the ssc/lib package. | ||
* | ||
* (c) Loïc Faugeron <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\Ssc\Exception; | ||
|
||
use Ssc\Exception\SscException; | ||
use PhpSpec\ObjectBehavior; | ||
use Ssc\Exception\SscException; | ||
|
||
class ClientErrorExceptionSpec extends ObjectBehavior | ||
{ | ||
|
13 changes: 12 additions & 1 deletion
13
packages/exception/spec/ForbiddenExceptionSpec.php
100755 → 100644
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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the ssc/lib package. | ||
* | ||
* (c) Loïc Faugeron <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\Ssc\Exception; | ||
|
||
use Ssc\Exception\SscException; | ||
use PhpSpec\ObjectBehavior; | ||
use Ssc\Exception\SscException; | ||
|
||
class ForbiddenExceptionSpec extends ObjectBehavior | ||
{ | ||
|
13 changes: 12 additions & 1 deletion
13
packages/exception/spec/NotFoundExceptionSpec.php
100755 → 100644
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 |
---|---|---|
@@ -1,9 +1,20 @@ | ||
<?php | ||
|
||
/* | ||
* This file is part of the ssc/lib package. | ||
* | ||
* (c) Loïc Faugeron <[email protected]> | ||
* | ||
* For the full copyright and license information, please view the LICENSE | ||
* file that was distributed with this source code. | ||
*/ | ||
|
||
declare(strict_types=1); | ||
|
||
namespace spec\Ssc\Exception; | ||
|
||
use Ssc\Exception\SscException; | ||
use PhpSpec\ObjectBehavior; | ||
use Ssc\Exception\SscException; | ||
|
||
class NotFoundExceptionSpec extends ObjectBehavior | ||
{ | ||
|
Oops, something went wrong.