Skip to content

Commit

Permalink
fix: format files
Browse files Browse the repository at this point in the history
  • Loading branch information
rancoud committed Apr 28, 2023
1 parent 2cd1b5b commit 3bcaad7
Show file tree
Hide file tree
Showing 4 changed files with 34 additions and 28 deletions.
47 changes: 24 additions & 23 deletions .php-cs-fixer.php
Original file line number Diff line number Diff line change
Expand Up @@ -6,9 +6,9 @@
use PhpCsFixer\Finder;

$rules = [
'@Symfony' => true,
'@Symfony' => true,
'@Symfony:risky' => true,
'array_syntax' => [
'array_syntax' => [
'syntax' => 'short'
],
'binary_operator_spaces' => [
Expand All @@ -19,32 +19,32 @@
'concat_space' => [
'spacing' => 'one'
],
'declare_strict_types' => true,
'global_namespace_import' => false,
'declare_strict_types' => true,
'global_namespace_import' => false,
'linebreak_after_opening_tag' => true,
'mb_str_functions' => true,
'native_function_invocation' => [
'mb_str_functions' => true,
'native_function_invocation' => [
'include' => [
'@all'
]
],
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => false,
'no_php4_constructor' => true,
'no_superfluous_phpdoc_tags' => false,
'no_unreachable_default_argument_value' => true,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'single_import_per_statement' => false,
'strict_comparison' => true,
'strict_param' => true,
'single_line_throw' => false,
'trailing_comma_in_multiline' => false,
'yoda_style' => [
'equal' => false,
'identical' => false,
'no_useless_else' => true,
'no_useless_return' => true,
'ordered_imports' => true,
'php_unit_strict' => true,
'phpdoc_order' => true,
'semicolon_after_instruction' => true,
'single_import_per_statement' => false,
'strict_comparison' => true,
'strict_param' => true,
'single_line_throw' => false,
'trailing_comma_in_multiline' => false,
'yoda_style' => [
'equal' => false,
'identical' => false,
'less_and_greater' => false
],
];
Expand All @@ -59,7 +59,8 @@
->ignoreVCS(true);

$config = new Config();

return $config->setFinder($finder)
->setRules($rules)
->setRiskyAllowed(true)
->setUsingCache(true);
->setUsingCache(true);
4 changes: 2 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -225,12 +225,12 @@ Application::removeFromBag('db');
### Settings
#### Mandatory
| Parameter | Type | Description |
| --------- | ----- | -------------------------------------------- |
|-----------|-------|----------------------------------------------|
| folders | array | Folder's list. ROOT and ROUTES are mandatory |

#### Optionals
| Parameter | Type | Default value | Description |
| --------- | ------------------------------- | ------------- | --------------------------- |
|-----------|---------------------------------|---------------|-----------------------------|
| env | Rancoud\Environment\Environment | null | Setup a different .env file |

## Application Methods
Expand Down
7 changes: 6 additions & 1 deletion src/Application.php
Original file line number Diff line number Diff line change
Expand Up @@ -199,7 +199,12 @@ protected function loadRoutes(): void
protected function loadAllRoutesFilesInRoutesFolder(): void
{
$res = \opendir($this->folders['ROUTES']);
while (($routeFile = \readdir($res)) !== false) {
while (true) {
$routeFile = \readdir($res);
if ($routeFile === false) {
break;
}

if (\mb_strripos($routeFile, '.php') === \mb_strlen($routeFile) - 4) {
$this->loadRouteFile($routeFile);
}
Expand Down
4 changes: 2 additions & 2 deletions tests/folders/tests_routes/test_routes.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,8 +18,8 @@
[
'methods' => ['GET'],
'url' => '/',
'callback' => static function ($a, $b) {
return (new Factory())->createResponse(200)->withBody(Stream::create('home'));
'callback' => static function () {
return (new Factory())->createResponse()->withBody(Stream::create('home'));
},
'name' => 'test_home'
]
Expand Down

0 comments on commit 3bcaad7

Please sign in to comment.