janus-sicherheit / php-codestyle
Custom code style standards, code inspections and PHP_CodeSniffer sniffs for JANUS projects
Package info
github.com/janus-sicherheit/php-codestyle
Type:composer-plugin
pkg:composer/janus-sicherheit/php-codestyle
v0.7
2026-08-17 09:39 UTC
Requires
- php: >=8.4
- composer-plugin-api: ^2.0
- squizlabs/php_codesniffer: ^4.0.4
Requires (Dev)
- composer/composer: ^2.8
- phpunit/phpunit: ^13.0
README
Custom code style standards, code inspections and PHP_CodeSniffer sniffs for JANUS projects
Installation
composer require janus-sicherheit/php-codestyle
On composer install and composer update, this package copies the following files into the consumer project root (overwriting existing files):
.editorconfigcode_inspection.xmlcode_style.xmlphpcs.xml
Usage
vendor/bin/phpcs Janus
What the sniffs do
Arrays
NoInlineCommentedArrayItemSniff: Comments cannot be on the same line as an array item. The comment must be on its own line.
Classes
ClassMemberSpacingSniff: Enforces blank lines between class members. Same groups have no blank line, different groups have two blank lines, methods have one or two blank lines.
Commenting
SeeUsesTagSpacingSniff: Requires exactly one space after@seeand@uses.VariableCommentSniff: Validates property docblocks. Special case: missing@varis allowed when@inheritdocis present.
Functions
ArrowFunctionDeclarationSniff: Validates arrow function (fn) formatting. No space before(, exactly one space around=>, and clean indentation for wrapped lines.
Operators
MethodChainingSniff: Validates method chains. Long or multiline chains must be wrapped and indented consistently, including semicolon placement.
WhiteSpace
ArrayUnionIndentationSniff: Aligns the closing]correctly in specific multiline array union cases.ConstantDeclarationSpacingSniff: In typedconstdeclarations, requires exactly one space between the type and constant name.SemicolonSpacingSniff: Disallows whitespace before;. Also applies rules for method chains and multiline string concatenation.SingleArgumentNotMultilineSniff: Prevents simple single argument calls from being split across multiple lines without need.