Skip to content

Commit

Permalink
[TASK] Use package typo3/coding-standards
Browse files Browse the repository at this point in the history
  • Loading branch information
brotkrueml committed Oct 15, 2020
1 parent 024f47f commit 22bf325
Show file tree
Hide file tree
Showing 10 changed files with 69 additions and 112 deletions.
13 changes: 3 additions & 10 deletions .editorconfig
Original file line number Diff line number Diff line change
Expand Up @@ -21,27 +21,24 @@ indent_size = 2
indent_style = tab

# ReST-Files
[{*.rst,*.rst.txt}]
[*.rst]
indent_size = 3
max_line_length = 80

# YAML-Files
[*.{yaml,yml}]
indent_size = 2

# package.json
# .travis.yml
[{package.json,.travis.yml}]
[package.json]
indent_size = 2
indent_style = space

# TypoScript
[*.{typoscript,tsconfig}]
indent_size = 2

# XLF-Files
[*.xlf]
indent_size = 2
indent_style = tab

# SQL-Files
[*.sql]
Expand All @@ -51,7 +48,3 @@ indent_size = 2
# .htaccess
[{_.htaccess,.htaccess}]
indent_style = tab

# composer.json
[composer.json]
indent_style = space
58 changes: 7 additions & 51 deletions .php_cs
Original file line number Diff line number Diff line change
@@ -1,6 +1,7 @@
<?php

$finder = PhpCsFixer\Finder::create()
$config = \TYPO3\CodingStandards\CsFixerConfig::create();
$config->getFinder()
->in(__DIR__ . '/Classes')
->in(__DIR__ . '/Configuration')
->in(__DIR__ . '/Tests')
Expand All @@ -13,53 +14,8 @@ For the full copyright and license information, please read the
LICENSE.txt file that was distributed with this source code.
EOF;

return PhpCsFixer\Config::create()
->setRiskyAllowed(true)
->setRules([
'@DoctrineAnnotation' => true,
'@PSR2' => true,
'array_indentation' => true,
'array_syntax' => ['syntax' => 'short'],
'cast_spaces' => ['space' => 'none'],
'concat_space' => ['spacing' => 'one'],
'declare_equal_normalize' => ['space' => 'none'],
'dir_constant' => true,
'function_typehint_space' => true,
'hash_to_slash_comment' => true,
'header_comment' => ['header' => $header, 'separate' => 'both'],
'lowercase_cast' => true,
'modernize_types_casting' => true,
'native_function_casing' => true,
'no_alias_functions' => true,
'no_blank_lines_after_phpdoc' => true,
'no_empty_phpdoc' => true,
'no_empty_statement' => true,
'no_extra_consecutive_blank_lines' => true,
'no_leading_import_slash' => true,
'no_leading_namespace_whitespace' => true,
'no_null_property_initialization' => true,
'no_short_bool_cast' => true,
'no_singleline_whitespace_before_semicolons' => true,
'no_superfluous_elseif' => true,
'no_trailing_comma_in_singleline_array' => true,
'no_unneeded_control_parentheses' => true,
'no_unused_imports' => true,
'no_useless_else' => true,
'no_whitespace_in_blank_line' => true,
'ordered_imports' => true,
'phpdoc_no_access' => true,
'phpdoc_no_empty_return' => true,
'phpdoc_no_package' => true,
'phpdoc_scalar' => true,
'phpdoc_trim' => true,
'phpdoc_types' => true,
'phpdoc_types_order' => ['null_adjustment' => 'always_last', 'sort_algorithm' => 'none'],
'php_unit_mock_short_will_return' => true,
'php_unit_set_up_tear_down_visibility' => true,
'php_unit_strict' => true,
'php_unit_test_case_static_method_calls' => ['call_type' => 'self'],
'return_type_declaration' => ['space_before' => 'none'],
'single_quote' => true,
'whitespace_after_comma_in_array' => true,
])
->setFinder($finder);
$config->addRules([
'header_comment' => ['header' => $header, 'separate' => 'both'],
]);

return $config;
1 change: 1 addition & 0 deletions Classes/DataProcessing/FlexFormProcessor.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
1 change: 1 addition & 0 deletions Classes/Service/ProgrammingLanguages.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
1 change: 1 addition & 0 deletions Classes/ViewHelpers/CssViewHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
1 change: 1 addition & 0 deletions Classes/ViewHelpers/PrismViewHelper.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
1 change: 1 addition & 0 deletions Tests/Unit/ViewHelpers/CssViewHelperTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
1 change: 1 addition & 0 deletions Tests/Unit/ViewHelpers/PrismViewHelperTest.php
Original file line number Diff line number Diff line change
@@ -1,4 +1,5 @@
<?php

declare(strict_types=1);

/*
Expand Down
103 changes: 52 additions & 51 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,53 +1,54 @@
{
"name": "brotkrueml/codehighlight",
"type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"description": "Code highlighter for various programming languages",
"authors": [
{
"name": "Chris Müller",
"role": "Developer"
}
],
"keywords": [
"TYPO3 CMS",
"TYPO3 extension",
"Syntax highlighting",
"Code highlighting"
],
"require": {
"typo3/cms-backend": "^9.5.5 || ^10.4",
"typo3/cms-core": "^9.5.5 || ^10.4",
"typo3/cms-fluid": "^9.5.5 || ^10.4",
"typo3/cms-fluid-styled-content": "^9.5.5 || ^10.4",
"typo3/cms-frontend": "^9.5.5 || ^10.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^8.5 || ^9.1"
},
"suggest": {
"typo3/cms-t3editor": "Add syntax highlighting in backend form"
},
"autoload": {
"psr-4": {
"Brotkrueml\\CodeHighlight\\": "Classes/"
}
},
"config": {
"sort-packages": true,
"vendor-dir": ".Build/vendor",
"bin-dir": ".Build/bin"
},
"extra": {
"typo3/cms": {
"app-dir": ".Build",
"web-dir": ".Build/web"
}
},
"scripts": {
"zip": "grep -Po \"(?<='version' => ')([0-9]+\\.[0-9]+\\.[0-9]+)\" ext_emconf.php | xargs -I {version} sh -c 'mkdir -p ../zip; git archive -v -o \"../zip/${PWD##*/}_{version}.zip\" v{version}'",
"fix-cs": ".Build/bin/php-cs-fixer fix"
}
"name": "brotkrueml/codehighlight",
"type": "typo3-cms-extension",
"license": "GPL-2.0-or-later",
"description": "Code highlighter for various programming languages",
"authors": [
{
"name": "Chris Müller",
"role": "Developer"
}
],
"keywords": [
"TYPO3 CMS",
"TYPO3 extension",
"Syntax highlighting",
"Code highlighting"
],
"require": {
"typo3/cms-backend": "^9.5.5 || ^10.4",
"typo3/cms-core": "^9.5.5 || ^10.4",
"typo3/cms-fluid": "^9.5.5 || ^10.4",
"typo3/cms-fluid-styled-content": "^9.5.5 || ^10.4",
"typo3/cms-frontend": "^9.5.5 || ^10.4"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^2.16",
"php-coveralls/php-coveralls": "^2.2",
"phpunit/phpunit": "^8.5 || ^9.1",
"typo3/coding-standards": "^0.2"
},
"suggest": {
"typo3/cms-t3editor": "Add syntax highlighting in backend form"
},
"autoload": {
"psr-4": {
"Brotkrueml\\CodeHighlight\\": "Classes/"
}
},
"config": {
"sort-packages": true,
"vendor-dir": ".Build/vendor",
"bin-dir": ".Build/bin"
},
"extra": {
"typo3/cms": {
"app-dir": ".Build",
"web-dir": ".Build/web"
}
},
"scripts": {
"zip": "grep -Po \"(?<='version' => ')([0-9]+\\.[0-9]+\\.[0-9]+)\" ext_emconf.php | xargs -I {version} sh -c 'mkdir -p ../zip; git archive -v -o \"../zip/${PWD##*/}_{version}.zip\" v{version}'",
"fix-cs": ".Build/bin/php-cs-fixer fix"
}
}

0 comments on commit 22bf325

Please sign in to comment.