Skip to content

Commit 71a02bd

Browse files
committed
coding standards
1 parent 50b63d3 commit 71a02bd

19 files changed

+68
-68
lines changed

README.md

+3-3
Original file line numberDiff line numberDiff line change
@@ -33,7 +33,7 @@ Code is free, new-BSD license. So... fork us!
3333
* [get composer](https://getcomposer.org/download/ 'Composer')
3434
* composer `create-project rocknroot/stray-fw-skeleton`
3535

36-
## Need help ?
36+
## Need help?
3737

3838
You can add an issue on github ;)
3939

@@ -45,7 +45,7 @@ You can add an issue on github ;)
4545

4646
### Technical considerations
4747

48-
The framework follows these standards :
48+
The framework follows these standards:
4949

5050
* [PSR-1: Basic Coding Standard](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-1-basic-coding-standard.md 'PSR-1: Basic Coding Standard')
5151
* [PSR-2: Coding Style Guide](https://github.com/php-fig/fig-standards/blob/master/accepted/PSR-2-coding-style-guide.md 'PSR-2: Coding Style Guide')
@@ -59,4 +59,4 @@ The framework follows these standards :
5959
### Coding standards
6060

6161
$ curl -L https://cs.symfony.com/download/php-cs-fixer-v2.phar -o php-cs-fixer
62-
$ php php-cs-fixer.phar fix src/RocknRoot/StrayFw --rules='{"@PSR2": true,"no_trailing_comma_in_singleline_array":true,"no_singleline_whitespace_before_semicolons":true,"concat_space":{"spacing":"one"},"no_unused_imports":true,"no_whitespace_in_blank_line":true,"ordered_imports":true,"blank_line_after_opening_tag":true,"declare_equal_normalize":{"space":"single"},"function_typehint_space":true,"hash_to_slash_comment":true,"lowercase_cast":true,"method_separation":true,"native_function_casing":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"}}'
62+
$ php php-cs-fixer.phar fix src/RocknRoot/StrayFw --rules='{"@PSR2":true,"no_trailing_comma_in_singleline_array":true,"no_singleline_whitespace_before_semicolons":true,"concat_space":{"spacing":"one"},"no_unused_imports":true,"no_whitespace_in_blank_line":true,"ordered_imports":true,"blank_line_after_opening_tag":true,"declare_equal_normalize":{"space":"single"},"function_typehint_space":true,"hash_to_slash_comment":true,"lowercase_cast":true,"method_separation":true,"native_function_casing":true,"no_blank_lines_after_class_opening":true,"no_blank_lines_after_phpdoc":true,"no_leading_import_slash":true,"no_leading_namespace_whitespace":true,"no_mixed_echo_print":{"use":"echo"},"phpdoc_add_missing_param_annotation":true,"phpdoc_align":true,"phpdoc_indent":true,"phpdoc_no_empty_return":true,"phpdoc_order":true,"phpdoc_scalar":true,"phpdoc_single_line_var_spacing":true,"phpdoc_types_order":true,"phpdoc_var_annotation_correct_order":true}'

src/RocknRoot/StrayFw/Bootstrap.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -78,9 +78,9 @@ public static function init()
7878
* Try to require a file according to the needed class.
7979
*
8080
* @static
81+
* @param string $className needed class name
8182
* @throws BadUse if bootstrap isn't initialized
8283
* @throws UnknownNamespace if needed namespace can't be found
83-
* @param string $className needed class name
8484
*/
8585
public static function loadClass(string $className)
8686
{

src/RocknRoot/StrayFw/Config.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -42,9 +42,9 @@ public static function getSettings() : array
4242
* Get a file content. Load it if not already done.
4343
*
4444
* @static
45+
* @param string $fileName file name
4546
* @throws FileNotReadable if file can't be opened
4647
* @throws FileNotParsable if file can't be parsed
47-
* @param string $fileName file name
4848
* @return array file content
4949
*/
5050
public static function get(string $fileName) : array
@@ -69,9 +69,9 @@ public static function get(string $fileName) : array
6969
* Write a file content. Save it internally.
7070
*
7171
* @static
72-
* @throws FileNotWritable if file can't be written
7372
* @param string $fileName file name
7473
* @param array $content file content
74+
* @throws FileNotWritable if file can't be written
7575
*/
7676
public static function set(string $fileName, array $content)
7777
{

src/RocknRoot/StrayFw/Console/Console.php

+13-13
Original file line numberDiff line numberDiff line change
@@ -103,7 +103,7 @@ public static function run() : void
103103
* Set namespace prefix for incoming routes.
104104
*
105105
* @static
106-
* @param string $namespace namespace prefix
106+
* @param string $namespace namespace prefix
107107
*/
108108
public static function prefix(string $namespace) : void
109109
{
@@ -114,10 +114,10 @@ public static function prefix(string $namespace) : void
114114
* Add route to be considered.
115115
*
116116
* @static
117-
* @param string $path route path
118-
* @param string $usage how to use it, for help screen
119-
* @param string $help route description, for help screen
120-
* @param string $action class and method to call
117+
* @param string $path route path
118+
* @param string $usage how to use it, for help screen
119+
* @param string $help route description, for help screen
120+
* @param string $action class and method to call
121121
*/
122122
public static function route(string $path, string $usage, string $help, string $action) : void
123123
{
@@ -137,10 +137,10 @@ public static function route(string $path, string $usage, string $help, string $
137137
* Add before hook to be considered.
138138
*
139139
* @static
140-
* @param string $path route path
141-
* @param string $usage how to use it, for help screen
142-
* @param string $help route description, for help screen
143-
* @param string $action class and method to call
140+
* @param string $path route path
141+
* @param string $usage how to use it, for help screen
142+
* @param string $help route description, for help screen
143+
* @param string $action class and method to call
144144
*/
145145
public static function before(string $path, string $usage, string $help, string $action) : void
146146
{
@@ -160,10 +160,10 @@ public static function before(string $path, string $usage, string $help, string
160160
* Add after hook to be considered.
161161
*
162162
* @static
163-
* @param string $path route path
164-
* @param string $usage how to use it, for help screen
165-
* @param string $help route description, for help screen
166-
* @param string $action class and method to call
163+
* @param string $path route path
164+
* @param string $usage how to use it, for help screen
165+
* @param string $help route description, for help screen
166+
* @param string $action class and method to call
167167
*/
168168
public static function after(string $path, string $usage, string $help, string $action) : void
169169
{

src/RocknRoot/StrayFw/Console/Request.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -15,8 +15,8 @@ class Request extends BaseRequest
1515
/**
1616
* Parse executed command and choose a route.
1717
*
18-
* @throws InvalidRouteDefinition if a route has an invalid definition
1918
* @param array[] $routes registered routes
19+
* @throws InvalidRouteDefinition if a route has an invalid definition
2020
*/
2121
public function __construct(array $routes)
2222
{

src/RocknRoot/StrayFw/Controllers.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -21,7 +21,7 @@ class Controllers
2121
* Get a controller, creating one if it doesn't exist already.
2222
*
2323
* @static
24-
* @param string $class controller class with namespace
24+
* @param string $class controller class with namespace
2525
* @return object controller
2626
*/
2727
public static function get(string $class)

src/RocknRoot/StrayFw/Exception/Exception.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class Exception extends \Exception
1414
/**
1515
* Exception initialization.
1616
*
17-
* @param string $message exception message to throw
18-
* @param int $code exception code
17+
* @param string $message exception message to throw
18+
* @param int $code exception code
1919
* @param Exception $previous previous exception used for exception chaining
2020
*/
2121
public function __construct(string $message = '', int $code = 0, \Exception $previous = null)

src/RocknRoot/StrayFw/Http/Http.php

+15-15
Original file line numberDiff line numberDiff line change
@@ -42,7 +42,7 @@ abstract class Http
4242
/**
4343
* Current URI prefix.
4444
*
45-
* @var string|null
45+
* @var null|string
4646
*/
4747
protected static $uri;
4848

@@ -56,7 +56,7 @@ abstract class Http
5656
/**
5757
* Current raw request.
5858
*
59-
* @var RawRequest|null
59+
* @var null|RawRequest
6060
*/
6161
protected static $rawRequest;
6262

@@ -156,9 +156,9 @@ public static function run() : void
156156
* Set namespace, subdomain and url prefixes for incoming routes.
157157
*
158158
* @static
159-
* @param string $namespace namespace prefix
160-
* @param string|array $subdomain subdomain prefix
161-
* @param string $uri uri prefix
159+
* @param string $namespace namespace prefix
160+
* @param array|string $subdomain subdomain prefix
161+
* @param string $uri uri prefix
162162
*/
163163
public static function prefix(string $namespace, $subdomain = null, string $uri = null) : void
164164
{
@@ -171,9 +171,9 @@ public static function prefix(string $namespace, $subdomain = null, string $uri
171171
* Add route to be considered.
172172
*
173173
* @static
174-
* @param string $method route HTTP method
175-
* @param string $path route path
176-
* @param string $action class and method to call
174+
* @param string $method route HTTP method
175+
* @param string $path route path
176+
* @param string $action class and method to call
177177
*/
178178
public static function route(string $method, string $path, string $action) : void
179179
{
@@ -194,9 +194,9 @@ public static function route(string $method, string $path, string $action) : voi
194194
* Add before hook to be considered.
195195
*
196196
* @static
197-
* @param string $method route HTTP method
198-
* @param string $path route path
199-
* @param string $action class and method to call
197+
* @param string $method route HTTP method
198+
* @param string $path route path
199+
* @param string $action class and method to call
200200
*/
201201
public static function before(string $method, string $path, string $action) : void
202202
{
@@ -217,9 +217,9 @@ public static function before(string $method, string $path, string $action) : vo
217217
* Add before hook to be considered.
218218
*
219219
* @static
220-
* @param string $method route HTTP method
221-
* @param string $path route path
222-
* @param string $action class and method to call
220+
* @param string $method route HTTP method
221+
* @param string $path route path
222+
* @param string $action class and method to call
223223
*/
224224
public static function after(string $method, string $path, string $action) : void
225225
{
@@ -250,7 +250,7 @@ public static function getRoutes() : array
250250
* Get current raw request.
251251
*
252252
* @static
253-
* @return RawRequest|null
253+
* @return null|RawRequest
254254
*/
255255
public static function getRawRequest() : ?RawRequest
256256
{

src/RocknRoot/StrayFw/Http/RawRequest.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -61,7 +61,7 @@ class RawRequest
6161
/**
6262
* Body JSON content.
6363
*
64-
* @var mixed|null
64+
* @var null|mixed
6565
*/
6666
protected $jsonBodyVars;
6767

@@ -173,7 +173,7 @@ public function getPostVars() : array
173173
/**
174174
* Get JSON body variables.
175175
*
176-
* @return mixed|null
176+
* @return null|mixed
177177
*/
178178
public function getJSONBodyVars()
179179
{

src/RocknRoot/StrayFw/Http/Request.php

+6-6
Original file line numberDiff line numberDiff line change
@@ -30,11 +30,11 @@ class Request extends BaseRequest
3030
/**
3131
* Parse raw request and choose a route.
3232
*
33+
* @param RawRequest $rawRequest base raw request
34+
* @param array[] $routes registered routes
3335
* @throws InvalidRouteDefinition if there is no route
3436
* @throws InvalidRouteDefinition if a route has an invalid definition
35-
* @throws RouteNotFound if no route matches the request
36-
* @param RawRequest $rawRequest base raw request
37-
* @param array[] $routes registered routes
37+
* @throws RouteNotFound if no route matches the request
3838
*/
3939
public function __construct(RawRequest $rawRequest, array $routes)
4040
{
@@ -123,9 +123,9 @@ public function getRawRequest() : RawRequest
123123
* * GET vars
124124
* * $default
125125
*
126-
* @param string $name input searched
127-
* @param mixed $default returned value if nothing is found
128-
* @return mixed found value or default
126+
* @param string $name input searched
127+
* @param mixed $default returned value if nothing is found
128+
* @return mixed found value or default
129129
*/
130130
public function input(string $name, $default = null)
131131
{

src/RocknRoot/StrayFw/Http/Response.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -28,7 +28,7 @@ class Response
2828
/**
2929
* Render object.
3030
*
31-
* @var \RocknRoot\StrayFw\Render\RenderInterface|null
31+
* @var null|\RocknRoot\StrayFw\Render\RenderInterface
3232
*/
3333
protected $renderInst;
3434

@@ -45,7 +45,7 @@ public function __construct()
4545
/**
4646
* Get set render object.
4747
*
48-
* @return \RocknRoot\StrayFw\Render\RenderInterface|null
48+
* @return null|\RocknRoot\StrayFw\Render\RenderInterface
4949
*/
5050
public function getRender() : ?\RocknRoot\StrayFw\Render\RenderInterface
5151
{
@@ -56,7 +56,7 @@ public function getRender() : ?\RocknRoot\StrayFw\Render\RenderInterface
5656
* Set render and status.
5757
*
5858
* @param RenderInterface $render render object
59-
* @param int $status status code
59+
* @param int $status status code
6060
*/
6161
public function render(RenderInterface $render, int $status = 200)
6262
{

src/RocknRoot/StrayFw/Http/Session.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -74,7 +74,7 @@ public static function has(string $name)
7474
*
7575
* @static
7676
* @param string $name key
77-
* @param mixed $value new value
77+
* @param mixed $value new value
7878
*/
7979
public static function set(string $name, $value)
8080
{

src/RocknRoot/StrayFw/Locale/Locale.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ abstract class Locale
4949
* Initialize properties, detect current language and load translations.
5050
*
5151
* @static
52-
* @throws BadUse if locale.default isn\'t defined in settings
5352
* @param RawRequest $request base raw request if applied
53+
* @throws BadUse if locale.default isn\'t defined in settings
5454
*/
5555
public static function init(RawRequest $request = null) : void
5656
{
@@ -80,10 +80,10 @@ public static function init(RawRequest $request = null) : void
8080
* Load translations from directory according to current language.
8181
*
8282
* @static
83-
* @throws InvalidDirectory if directory can't be identified
8483
* @param string $baseDir application directory path
8584
* @param string $localesDir translations directory path
8685
* @param string $prefix prefix for all translations from this directory
86+
* @throws InvalidDirectory if directory can't be identified
8787
*/
8888
public static function registerTranslations(string $baseDir, string $localesDir, string $prefix = null) : void
8989
{

src/RocknRoot/StrayFw/Logger.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -40,10 +40,10 @@ public static function get() : Logger
4040
/**
4141
* Logs with an arbitrary level.
4242
*
43-
* @throws LoggerInvalidArgumentException if level is unknown
4443
* @param mixed $level
4544
* @param string $message
4645
* @param array $context
46+
* @throws LoggerInvalidArgumentException if level is unknown
4747
*/
4848
public function log($level, $message, array $context = array())
4949
{

src/RocknRoot/StrayFw/Render/RenderInterface.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -12,8 +12,8 @@ interface RenderInterface
1212
/**
1313
* Return the generated display.
1414
*
15-
* @param mixed[] $args render data
16-
* @return string content
15+
* @param mixed[] $args render data
16+
* @return string content
1717
*/
1818
public function render(array $args) : string;
1919
}

src/RocknRoot/StrayFw/Render/RenderJson.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -13,9 +13,9 @@ class RenderJson implements RenderInterface
1313
/**
1414
* Return the generated display.
1515
*
16-
* @param mixed[] $args render data
17-
* @param bool $prettyPrint force pretty print parameter
18-
* @return string content
16+
* @param mixed[] $args render data
17+
* @param bool $prettyPrint force pretty print parameter
18+
* @return string content
1919
*/
2020
public function render(array $args, bool $prettyPrint = null) : string
2121
{

src/RocknRoot/StrayFw/Render/RenderRedirect.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -14,8 +14,8 @@ class RenderRedirect implements RenderInterface
1414
/**
1515
* Return the generated display.
1616
*
17-
* @param mixed[] $args render data
18-
* @return string content
17+
* @param mixed[] $args render data
18+
* @return string content
1919
*/
2020
public function render(array $args) : string
2121
{

src/RocknRoot/StrayFw/Render/RenderTwig.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -49,8 +49,8 @@ public function __construct(Request $request, string $templatesDir, string $file
4949
/**
5050
* Return the generated display.
5151
*
52-
* @param mixed[] $args render data
53-
* @return string content
52+
* @param mixed[] $args render data
53+
* @return string content
5454
*/
5555
public function render(array $args) : string
5656
{

0 commit comments

Comments
 (0)