Skip to content

Commit 6a1c800

Browse files
committed
Update code style definition and fix code accordingly
1 parent 3487e2f commit 6a1c800

12 files changed

+154
-84
lines changed

.gitignore

+3-2
Original file line numberDiff line numberDiff line change
@@ -1,2 +1,3 @@
1-
.Build/*
2-
composer.lock
1+
/.Build/*
2+
/composer.lock
3+
/.php_cs.cache

.php_cs

-58
This file was deleted.

.php_cs.dist

+77
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,77 @@
1+
<?php
2+
return PhpCsFixer\Config::create()
3+
->setRiskyAllowed(true)
4+
->setRules([
5+
'@PSR2' => true,
6+
'array_syntax' => [
7+
'syntax' => 'long',
8+
],
9+
'binary_operator_spaces' => true,
10+
'concat_space' => [
11+
'spacing' => 'one',
12+
],
13+
'function_typehint_space' => true,
14+
'hash_to_slash_comment' => true,
15+
'linebreak_after_opening_tag' => true,
16+
'lowercase_cast' => true,
17+
'method_separation' => true,
18+
'native_function_casing' => true,
19+
'new_with_braces' => true,
20+
'no_alias_functions' => true,
21+
'no_blank_lines_after_class_opening' => true,
22+
'no_blank_lines_after_phpdoc' => true,
23+
'no_blank_lines_before_namespace' => true,
24+
'no_empty_comment' => true,
25+
'no_empty_phpdoc' => true,
26+
'no_empty_statement' => true,
27+
'no_extra_consecutive_blank_lines' => [
28+
'continue',
29+
'curly_brace_block',
30+
'extra',
31+
'parenthesis_brace_block',
32+
'square_brace_block',
33+
'throw',
34+
],
35+
'no_leading_import_slash' => true,
36+
'no_leading_namespace_whitespace' => true,
37+
'no_multiline_whitespace_around_double_arrow' => true,
38+
'no_multiline_whitespace_before_semicolons' => true,
39+
'no_short_bool_cast' => true,
40+
'no_singleline_whitespace_before_semicolons' => true,
41+
'no_trailing_comma_in_list_call' => true,
42+
'no_trailing_comma_in_singleline_array' => true,
43+
'no_unneeded_control_parentheses' => [
44+
'break',
45+
'clone',
46+
'continue',
47+
'echo_print',
48+
'return',
49+
'switch_case',
50+
],
51+
'no_unreachable_default_argument_value' => true,
52+
'no_unused_imports' => true,
53+
'no_useless_else' => true,
54+
'no_useless_return' => true,
55+
'no_whitespace_before_comma_in_array' => true,
56+
'no_whitespace_in_blank_line' => true,
57+
'normalize_index_brace' => true,
58+
'ordered_imports' => true,
59+
'phpdoc_add_missing_param_annotation' => true,
60+
'phpdoc_no_package' => true,
61+
'phpdoc_order' => true,
62+
'phpdoc_scalar' => true,
63+
'phpdoc_types' => true,
64+
'self_accessor' => true,
65+
'short_scalar_cast' => true,
66+
'single_quote' => true,
67+
'standardize_not_equals' => true,
68+
'ternary_operator_spaces' => true,
69+
'trailing_comma_in_multiline_array' => true,
70+
'whitespace_after_comma_in_array' => true,
71+
])
72+
->setFinder(
73+
PhpCsFixer\Finder::create()
74+
->in(__DIR__)
75+
->exclude('.Build')
76+
->notName('ext_emconf.php')
77+
);

.styleci.yml

+58
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,58 @@
1+
preset: psr2
2+
3+
enabled:
4+
- alpha_ordered_imports
5+
- binary_operator_spaces
6+
- concat_with_spaces
7+
- function_typehint_space
8+
- hash_to_slash_comment
9+
- linebreak_after_opening_tag
10+
- long_array_syntax
11+
- lowercase_cast
12+
- method_separation
13+
- native_function_casing
14+
- new_with_braces
15+
- no_alias_functions
16+
- no_blank_lines_after_class_opening
17+
- no_blank_lines_after_phpdoc
18+
- no_blank_lines_before_namespace
19+
- no_empty_comment
20+
- no_empty_phpdoc
21+
- no_empty_statement
22+
- no_extra_block_blank_lines
23+
- no_extra_consecutive_blank_lines
24+
- no_leading_import_slash
25+
- no_leading_namespace_whitespace
26+
- no_multiline_whitespace_around_double_arrow
27+
- no_multiline_whitespace_before_semicolons
28+
- no_short_bool_cast
29+
- no_singleline_whitespace_before_semicolons
30+
- no_trailing_comma_in_list_call
31+
- no_trailing_comma_in_singleline_array
32+
- no_unneeded_control_parentheses
33+
- no_unreachable_default_argument_value
34+
- no_unused_imports
35+
- no_useless_else
36+
- no_useless_return
37+
- no_whitespace_before_comma_in_array
38+
- no_whitespace_in_blank_line
39+
- normalize_index_brace
40+
- phpdoc_add_missing_param_annotation
41+
- phpdoc_no_package
42+
- phpdoc_order
43+
- phpdoc_scalar
44+
- phpdoc_types
45+
- self_accessor
46+
- short_scalar_cast
47+
- single_quote
48+
- standardize_not_equals
49+
- ternary_operator_spaces
50+
- trailing_comma_in_multiline_array
51+
- whitespace_after_comma_in_array
52+
53+
finder:
54+
name:
55+
- "*.php"
56+
exclude:
57+
- ".Build"
58+
- "ext_emconf.php"

Classes/Configuration/RecordRenderingConfigurationBuilder.php

+3-3
Original file line numberDiff line numberDiff line change
@@ -36,9 +36,9 @@ public function __construct(RenderingContext $renderingContext)
3636
* @param string $pluginName
3737
* @param string $contextRecord
3838
*
39+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
3940
* @return string[]
4041
*
41-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
4242
*/
4343
public function configurationFor($extensionName, $pluginName, $contextRecord = 'currentPage')
4444
{
@@ -57,9 +57,9 @@ public function configurationFor($extensionName, $pluginName, $contextRecord = '
5757
*
5858
* @param string $contextRecord
5959
*
60+
* @throws ConfigurationBuildingException
6061
* @return string[] table name as first and uid as second index of the array
6162
*
62-
* @throws ConfigurationBuildingException
6363
*/
6464
protected function resolveTableNameAndUidFromContextString($contextRecord)
6565
{
@@ -104,9 +104,9 @@ protected function buildPluginSignature($extensionName, $pluginName)
104104
/**
105105
* @param string $pluginSignature
106106
*
107+
* @throws ConfigurationBuildingException
107108
* @return string
108109
*
109-
* @throws ConfigurationBuildingException
110110
*/
111111
protected function resolveRenderingPath($pluginSignature)
112112
{

Classes/Mvc/Request.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -41,9 +41,9 @@ public function hasArgument($argumentName)
4141
/**
4242
* @param string $argumentName
4343
*
44+
* @throws \InvalidArgumentException
4445
* @return mixed
4546
*
46-
* @throws \InvalidArgumentException
4747
*/
4848
public function getArgument($argumentName)
4949
{

Classes/Mvc/RequestBuilder.php

+1-1
Original file line numberDiff line numberDiff line change
@@ -20,9 +20,9 @@ class RequestBuilder
2020
/**
2121
* @param mixed $rawRequestArgument
2222
*
23+
* @throws \Helhum\TyposcriptRendering\Exception
2324
* @return Request
2425
*
25-
* @throws \Helhum\TyposcriptRendering\Exception
2626
*/
2727
public function build($rawRequestArgument)
2828
{

Classes/RenderingDispatcher.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -79,9 +79,9 @@ public function checkDataSubmission(TypoScriptFrontendController $typoScriptFron
7979
}
8080

8181
/**
82+
* @throws Exception
8283
* @return void
8384
*
84-
* @throws Exception
8585
*/
8686
protected function ensureRequiredEnvironment()
8787
{
@@ -99,9 +99,9 @@ protected function ensureRequiredEnvironment()
9999
/**
100100
* @param Request $request
101101
*
102+
* @throws Exception
102103
* @return RenderingInterface
103104
*
104-
* @throws Exception
105105
*/
106106
protected function resolveRenderer(Request $request)
107107
{

Classes/ViewHelpers/Uri/AjaxActionViewHelper.php

+2-2
Original file line numberDiff line numberDiff line change
@@ -54,9 +54,9 @@ class AjaxActionViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractView
5454
* @param string $addQueryStringMethod Set which parameters will be kept. Only active if $addQueryString = TRUE
5555
* @param string $contextRecord The record that the rendering should depend upon. e.g. current (default: record is fetched from current Extbase plugin), tt_content:12 (tt_content record with uid 12), pages:15 (pages record with uid 15), 'currentPage' record of current page
5656
*
57+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
5758
* @return string Rendered link
5859
*
59-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
6060
*/
6161
public function render($action = null, array $arguments = array(), $controller = null, $extensionName = null, $pluginName = null, $pageUid = null, $section = '', $format = '', $linkAccessRestrictedPages = false, array $additionalParams = array(), $absolute = false, $addQueryString = false, array $argumentsToBeExcludedFromQueryString = array(), $addQueryStringMethod = null, $contextRecord = 'current')
6262
{
@@ -100,9 +100,9 @@ public function render($action = null, array $arguments = array(), $controller =
100100
* @param string $pluginName
101101
* @param string $contextRecord
102102
*
103+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
103104
* @return string[]
104105
*
105-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
106106
*/
107107
public function buildTypoScriptRenderingConfiguration($extensionName, $pluginName, $contextRecord)
108108
{

Classes/ViewHelpers/Widget/LinkViewHelper.php

+3-6
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use Helhum\TyposcriptRendering\Configuration\RecordRenderingConfigurationBuilder;
1717
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
1818

19-
/**
20-
*
21-
*/
2219
class LinkViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractTagBasedViewHelper
2320
{
2421
/**
@@ -61,9 +58,9 @@ public function initializeArguments()
6158
* @param bool $ajax true if the URI should be to an Ajax widget, false otherwise.
6259
* @param string $contextRecord The record that the rendering should depend upon. e.g. current (default: record is fetched from current Extbase plugin), tt_content:12 (tt_content record with uid 12), pages:15 (pages record with uid 15), 'currentPage' record of current page
6360
*
61+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
6462
* @return string The rendered link
6563
*
66-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
6764
*/
6865
public function render($pluginName, $extensionName, $action = null, array $arguments = array(), $section = '', $format = '', $ajax = true, $contextRecord = 'current')
6966
{
@@ -80,9 +77,9 @@ public function render($pluginName, $extensionName, $action = null, array $argum
8077
/**
8178
* Gets the URI for an Ajax Request.
8279
*
80+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
8381
* @return string the Ajax URI
8482
*
85-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
8683
*/
8784
protected function getAjaxUri()
8885
{
@@ -161,9 +158,9 @@ protected function getWidgetUri()
161158
* @param string $pluginName
162159
* @param string $contextRecord
163160
*
161+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
164162
* @return string[]
165163
*
166-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
167164
*/
168165
public function buildTypoScriptRenderingConfiguration($extensionName, $pluginName, $contextRecord)
169166
{

Classes/ViewHelpers/Widget/UriViewHelper.php

+4-8
Original file line numberDiff line numberDiff line change
@@ -16,9 +16,6 @@
1616
use Helhum\TyposcriptRendering\Configuration\RecordRenderingConfigurationBuilder;
1717
use Helhum\TyposcriptRendering\Renderer\RenderingContext;
1818

19-
/**
20-
*
21-
*/
2219
class UriViewHelper extends \TYPO3\CMS\Fluid\Core\ViewHelper\AbstractViewHelper
2320
{
2421
/**
@@ -51,25 +48,24 @@ public function initializeArguments()
5148
* @param bool $ajax true if the URI should be to an Ajax widget, false otherwise.
5249
* @param string $contextRecord The record that the rendering should depend upon. e.g. current (default: record is fetched from current Extbase plugin), tt_content:12 (tt_content record with uid 12), pages:15 (pages record with uid 15), 'currentPage' record of current page
5350
*
51+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
5452
* @return string The rendered link
5553
*
56-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
5754
*/
5855
public function render($pluginName, $extensionName, $action = null, array $arguments = array(), $section = '', $format = '', $ajax = true, $contextRecord = 'current')
5956
{
6057
if ($ajax === true) {
6158
return $this->getAjaxUri();
62-
} else {
63-
return $this->getWidgetUri();
6459
}
60+
return $this->getWidgetUri();
6561
}
6662

6763
/**
6864
* Get the URI for an Ajax Request.
6965
*
66+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
7067
* @return string the Ajax URI
7168
*
72-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
7369
*/
7470
protected function getAjaxUri()
7571
{
@@ -148,9 +144,9 @@ protected function getWidgetUri()
148144
* @param string $pluginName
149145
* @param string $contextRecord
150146
*
147+
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
151148
* @return string[]
152149
*
153-
* @throws \Helhum\TyposcriptRendering\Configuration\ConfigurationBuildingException
154150
*/
155151
public function buildTypoScriptRenderingConfiguration($extensionName, $pluginName, $contextRecord)
156152
{

0 commit comments

Comments
 (0)