Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Extend coding standard with new rules #15

Merged
merged 7 commits into from
Feb 1, 2024
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
23 changes: 23 additions & 0 deletions CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,29 @@
# Changelog
All notable changes to this project will be documented in this file.

## 1.2.0 - 2024-02-01
### Added
- `array_syntax`: Force short syntax for array
- `list_syntax`: Same for list
- `fully_qualified_strict_types`: Remove namespace from classname when there is a `use` statement, and add missing backslash for global namespace
- `no_leading_import_slash`: Remove leading slash from `use` statement
- `nullable_type_declaration_for_default_null_value`: Add missing `?` on type declaration for parameters defaulting to `null`. This will most likely be needed to avoid warnings in PHP 8.4.
- `yoda_style`: forbid yoda style comparision. This replaces `null === $a` by `$a === null`.

## 1.1.1 - 2023-06-23
### Changed
* feat: use php-cs-fixer/shim by @kesselb in https://github.com/nextcloud/coding-standard/pull/13

## 1.1.0 - 2023-04-13
### Changed
* Order imports alphabetically by @come-nc in https://github.com/nextcloud/coding-standard/pull/10
* fix(rules): Replace deprecated braces rules by @nickvergessen in https://github.com/nextcloud/coding-standard/pull/12

## 1.0.0 – 2021-11-10
### Breaking change
* Update php-cs-fixer to 3.x
* See https://github.com/nextcloud/coding-standard#upgrade-from-v0x-to-v10 for instructions.

## 0.5.0 – 2021-01-11
### Added
- New rule: short list syntax
Expand Down
6 changes: 6 additions & 0 deletions src/Config.php
Original file line number Diff line number Diff line change
Expand Up @@ -18,6 +18,7 @@ public function getRules() : array {
'@PSR2' => true,
'align_multiline_comment' => true,
'array_indentation' => true,
'array_syntax' => true,
'binary_operator_spaces' => [
'default' => 'single_space',
],
Expand All @@ -30,21 +31,25 @@ public function getRules() : array {
'elseif' => true,
'encoding' => true,
'full_opening_tag' => true,
'fully_qualified_strict_types' => ['leading_backslash_in_global_namespace' => true],
'function_declaration' => [
'closure_function_spacing' => 'one',
],
'indentation_type' => true,
'line_ending' => true,
'list_syntax' => true,
'lowercase_keywords' => true,
'method_argument_space' => [
'on_multiline' => 'ignore',
],
'no_closing_tag' => true,
'no_leading_import_slash' => true,
'no_spaces_after_function_name' => true,
'no_spaces_inside_parenthesis' => true,
'no_trailing_whitespace' => true,
'no_trailing_whitespace_in_comment' => true,
'no_unused_imports' => true,
'nullable_type_declaration_for_default_null_value' => true,
'ordered_imports' => [
'imports_order' => ['class', 'function', 'const'],
'sort_algorithm' => 'alpha'
Expand All @@ -57,6 +62,7 @@ public function getRules() : array {
'visibility_required' => [
'elements' => ['property', 'method', 'const']
],
'yoda_style' => ['equal' => false, 'identical' => false, 'less_and_greater' => false],
];
}
}
Loading