Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
Show all changes
139 commits
Select commit Hold shift + click to select a range
09678db
refactor: Rename ClassNode extractor/worker classes to AnalysisNode* …
samsonasik Aug 29, 2026
e11392d
run ci
samsonasik Aug 29, 2026
e66db07
rename collect on analyser
samsonasik Aug 29, 2026
6b8b49b
Merge pull request #363 from boundwize/rename-internal
samsonasik Aug 29, 2026
49072d5
feat: add MayNotExtendClassRule
samsonasik Aug 29, 2026
6f6031f
use sprintf
samsonasik Aug 29, 2026
70984c1
Merge pull request #366 from boundwize/add-maynot-extend
samsonasik Aug 29, 2026
a928b48
feat: Add FunctionNode and AnonymousFunctionNode with function-like r…
samsonasik Aug 30, 2026
a392041
cs fix
samsonasik Aug 30, 2026
ada45f1
rename named cache entries
samsonasik Aug 30, 2026
8feb67e
fix one line static closure
samsonasik Aug 30, 2026
49f54f2
count of --fix result
samsonasik Aug 30, 2026
9c89435
add more test
samsonasik Aug 30, 2026
64b404e
avoid redundant seed
samsonasik Aug 30, 2026
1c1461f
Merge pull request #367 from boundwize/add-f
samsonasik Aug 30, 2026
85bd046
perf: Optimize AnalysisNodeCollector traversal and layer resolution o…
samsonasik Aug 30, 2026
ea5ffcf
clean up
samsonasik Aug 30, 2026
5f3e700
rectify
samsonasik Aug 30, 2026
00cb92e
add more tests
samsonasik Aug 30, 2026
9e26bf7
reduce collector overhead
samsonasik Aug 30, 2026
0aed5dc
fix
samsonasik Aug 30, 2026
a4b8f8d
rectify
samsonasik Aug 30, 2026
8613348
Merge pull request #368 from boundwize/op-col
samsonasik Aug 30, 2026
a63e636
perf: Decode composer.json once per run in Psr4PathResolver
samsonasik Aug 30, 2026
acf0eeb
move logic to ComposerJsonProvider
samsonasik Aug 30, 2026
d53e727
avoid filemtime:size usage
samsonasik Aug 30, 2026
0e7930e
cache improve
samsonasik Aug 30, 2026
480b23a
cs fix
samsonasik Aug 30, 2026
184328c
simplify: reduce loop
samsonasik Aug 30, 2026
59e87f3
add more test
samsonasik Aug 30, 2026
b2c2fed
rectify
samsonasik Aug 30, 2026
64eafec
Merge pull request #370 from boundwize/decode-composer-json
samsonasik Aug 30, 2026
62c1406
perf: skip getMethods() pre-pass, resolve method's class analysis on …
samsonasik Aug 30, 2026
75d98bd
reduce rewalk nodes
samsonasik Aug 30, 2026
9ce78b1
handle enum case
samsonasik Aug 30, 2026
6080e56
add more test
samsonasik Aug 30, 2026
033bab6
Merge pull request #371 from boundwize/loop-reduce
samsonasik Aug 30, 2026
fc20e0f
perf: Remove fflush call from advance method
samsonasik Aug 30, 2026
395a1c7
perf: Reduce array_values(array_unique()) on PhpFileFinder::sourcePat…
samsonasik Aug 30, 2026
76f55ae
perf: directly append violations on RuleViolationCollection::merge()
samsonasik Aug 30, 2026
e824420
update version screenshot
samsonasik Aug 31, 2026
9ab955d
Add MustHaveReturnTypeFunctionRule
samsonasik Aug 31, 2026
4026383
Merge pull request #376 from boundwize/must-have-return-function
samsonasik Aug 31, 2026
5808fa5
Register MayNotExtendClassRule to DDD preset
samsonasik Aug 31, 2026
5b96dd3
fix conflict version
samsonasik Aug 31, 2026
1a09910
Merge pull request #378 from boundwize/maynot-extends
samsonasik Aug 31, 2026
73b5834
Merge branch 'main' into 0.17.x
samsonasik Aug 31, 2026
2ef4017
Merge branch 'main' into 0.17.x
samsonasik Aug 31, 2026
60cb365
refactor: Unify rule interfaces under shared appliesTo()/evaluate() m…
samsonasik Sep 1, 2026
42a7bad
docs update
samsonasik Sep 1, 2026
f368491
fix doc
samsonasik Sep 1, 2026
24a6d8d
Merge pull request #382 from boundwize/refactor-signature
samsonasik Sep 1, 2026
e69206a
perf: Evaluate node rules per node kind via pre-grouped (nodes, rules…
samsonasik Sep 1, 2026
47fa02f
Merge pull request #383 from boundwize/pre-group
samsonasik Sep 1, 2026
881d2a4
Perf: precompute trailing-slash layer-path prefixes in NamespaceLayer…
samsonasik Sep 1, 2026
fbbe2b4
Merge pull request #384 from boundwize/namespace-layer-perf
samsonasik Sep 1, 2026
3c29b4c
refactor: Reuse NodeQueryTrait (renamed from FunctionLikeNodeTrait) i…
samsonasik Sep 1, 2026
8401535
Merge pull request #385 from boundwize/reuse-trait
samsonasik Sep 1, 2026
1cc3857
clean up config ruleset
samsonasik Sep 1, 2026
eabdb84
perf: clean up useless copy config on ComposerJsonProvider::decode()
samsonasik Sep 1, 2026
0fbb6b9
fix merge conflict
samsonasik Sep 1, 2026
0710b5a
cs
samsonasik Sep 1, 2026
03afa1c
rename nodes to classNodes on AnalysisNodeCollector
samsonasik Sep 1, 2026
183c2cf
feat: add Preset::PER() extending PSR-12 with EnumCaseNameMustBePasca…
samsonasik Sep 1, 2026
82d8b63
psr4 first per order
samsonasik Sep 1, 2026
a93069f
Merge pull request #386 from boundwize/add-per
samsonasik Sep 1, 2026
211a540
feat: add fixable EnumMethodMayNotBeProtectedRule and EnumConstantMay…
samsonasik Sep 1, 2026
481efd8
add more tests
samsonasik Sep 1, 2026
6259791
Merge pull request #388 from boundwize/member-enum
samsonasik Sep 1, 2026
6d50d05
feat: add fixable MustUseLowercaseKeywordConstantRule for true/false/…
samsonasik Sep 2, 2026
2315ec4
fix spelling
samsonasik Sep 2, 2026
02eaae7
fix relative
samsonasik Sep 2, 2026
3d39bda
add more test for relative
samsonasik Sep 2, 2026
e39cac6
Merge pull request #389 from boundwize/fixable-keyword
samsonasik Sep 2, 2026
ce515a9
perf: Optimize keyword constant collection hot path
samsonasik Sep 2, 2026
e128ff2
fix early check
samsonasik Sep 2, 2026
2792a53
Merge pull request #391 from boundwize/keyword-perf
samsonasik Sep 2, 2026
8ef45e8
add more test
samsonasik Sep 2, 2026
5365197
perf: Reduce parallel worker cache payload size
samsonasik Sep 2, 2026
7225f60
Merge pull request #393 from boundwize/payload-size
samsonasik Sep 2, 2026
2c479fe
Register MustUseLowercaseKeywordConstantRule in PSR-12 preset
samsonasik Sep 2, 2026
aa66396
Merge pull request #394 from boundwize/register-psr-12
samsonasik Sep 2, 2026
650c996
perf: stream analysis cache file hashing
samsonasik Sep 2, 2026
d4ef089
rectify
samsonasik Sep 2, 2026
b9f66c8
Merge pull request #395 from boundwize/stream-hash
samsonasik Sep 2, 2026
47d17e9
chore: Make use of Node 24 on github workflows
samsonasik Sep 2, 2026
237d734
Merge pull request #396 from boundwize/node24
samsonasik Sep 2, 2026
249dd3c
Add LargeNumericLiteralMustUseSeparatorRule
samsonasik Sep 2, 2026
90cbfbe
fix phpstan
samsonasik Sep 2, 2026
a086e2f
update docs
samsonasik Sep 2, 2026
6ab8aad
add more test
samsonasik Sep 2, 2026
fc36105
Merge pull request #397 from boundwize/large-numeric-literal
samsonasik Sep 2, 2026
cdcec0f
Add CodeQuality preset with MustBeStaticAnonymousFunctionRule and Lar…
samsonasik Sep 2, 2026
6bab9d9
enable CODEQUALITY preset
samsonasik Sep 2, 2026
169ef6b
cs fix
samsonasik Sep 2, 2026
dffb7e8
Merge pull request #398 from boundwize/code-quality
samsonasik Sep 2, 2026
e50cc1f
enable PER preset: already include psr4,psr1,psr12
samsonasik Sep 2, 2026
c62023d
Align PSR-4 Composer rules for missing or invalid configuration
samsonasik Sep 3, 2026
d3a89b9
Merge pull request #399 from boundwize/chore-align
samsonasik Sep 3, 2026
587ef9e
perf: Omit empty lists and the per-node file path from analysis node …
samsonasik Sep 3, 2026
42a61a6
Merge pull request #400 from boundwize/perf-empty
samsonasik Sep 3, 2026
6781d5b
perf: Store class members as positional tuples in analysis node cache…
samsonasik Sep 3, 2026
3d5b34d
update comment
samsonasik Sep 3, 2026
72c7aae
Merge pull request #401 from boundwize/tuple
samsonasik Sep 3, 2026
50c44fe
update minimum number for LargeNumericLiteralMustUseSeparatorRule to …
samsonasik Sep 3, 2026
e578194
chore: Clean up setInstantiated() validation as it post process check…
samsonasik Sep 3, 2026
91ff468
Merge pull request #402 from boundwize/clean-up-setin
samsonasik Sep 3, 2026
afd684f
perf: batch PHP fixer violations by rule and file
samsonasik Sep 3, 2026
dbe37eb
rectify
samsonasik Sep 3, 2026
ed20b5d
fix interface
samsonasik Sep 3, 2026
e506b16
add more test
samsonasik Sep 3, 2026
78bd998
add more test
samsonasik Sep 3, 2026
50d0269
sync on AbstractJsonRecastFixableRule
samsonasik Sep 3, 2026
249984c
Merge pull request #404 from boundwize/batch-fix
samsonasik Sep 3, 2026
9962e02
perf: Only run fixViolations() when rule violation collection is not …
samsonasik Sep 3, 2026
67054f0
check empty once more time
samsonasik Sep 3, 2026
250046c
Merge pull request #405 from boundwize/only-is-empty
samsonasik Sep 3, 2026
2e23cfc
refactor: Collect dependencies, superglobals and language constructs …
samsonasik Sep 3, 2026
78019cf
perf: Dispatch Variable nodes first in AnalysisNodeCollector::enterNo…
samsonasik Sep 3, 2026
3b79792
better comment
samsonasik Sep 3, 2026
52219d7
Merge pull request #406 from boundwize/keyset
samsonasik Sep 3, 2026
818b372
Add AnonymousClassRuleInterface and new AnonymousClassMayNotHaveEmpty…
samsonasik Sep 3, 2026
aa8c1d6
add more test
samsonasik Sep 3, 2026
04d7ab1
more use case
samsonasik Sep 3, 2026
433358f
use existing ->isAnonymous()
samsonasik Sep 3, 2026
3864b61
Merge pull request #407 from boundwize/add-ano-class-interface
samsonasik Sep 3, 2026
7b64e57
clean up add violations
samsonasik Sep 3, 2026
7696fcc
docs: Documentation update for example of usage of AnonymousClassRule…
samsonasik Sep 3, 2026
a4d9ab8
allow recursive parents/interfaces on AnonymousClassNode
samsonasik Sep 3, 2026
d30718b
Merge pull request #408 from boundwize/docs-ano
samsonasik Sep 3, 2026
9529614
Sync AnonymousClassNode with ClassNode: members, body deps, and isRea…
samsonasik Sep 3, 2026
0e9a5c0
update docs
samsonasik Sep 3, 2026
25d7339
Merge pull request #409 from boundwize/ano-dep
samsonasik Sep 3, 2026
a7b4e87
add more test
samsonasik Sep 4, 2026
fb53616
update documentation of make use of TokenAwareVisitorInterface
samsonasik Sep 4, 2026
89089d4
refactor TokenAwareVisitorInterface into AbstractTokenAwareVisitor
samsonasik Sep 4, 2026
d5ad761
refactor LayerAwareRuleInterface into AbstractLayerAwareRule
samsonasik Sep 4, 2026
5d71519
add getDependencyNode() method
samsonasik Sep 4, 2026
62ec576
Merge pull request #410 from boundwize/refactor-layer-aware
samsonasik Sep 4, 2026
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
14 changes: 7 additions & 7 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
@@ -1,10 +1,10 @@
name: ci build

on:
push:
branches: [main]
pull_request:
branches: [main]
pull_request:
push:
branches:
- "main"

jobs:
build:
Expand All @@ -23,7 +23,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup PHP
uses: shivammathur/setup-php@v2
Expand All @@ -37,7 +37,7 @@ jobs:
run: echo "dir=$(composer config cache-files-dir)" >> $GITHUB_OUTPUT

- name: Cache composer dependencies
uses: actions/cache@v4
uses: actions/cache@v6
with:
path: ${{ steps.composer-cache.outputs.dir }}
key: ${{ runner.os }}-composer-${{ hashFiles('**/composer.json') }}
Expand Down Expand Up @@ -68,7 +68,7 @@ jobs:

- name: Upload coverage to Codecov
if: matrix.coverage
uses: codecov/codecov-action@v4
uses: codecov/codecov-action@v7
with:
token: ${{ secrets.CODECOV_TOKEN }}
files: coverage.xml
6 changes: 3 additions & 3 deletions .github/workflows/pages.yml
Original file line number Diff line number Diff line change
Expand Up @@ -18,7 +18,7 @@ jobs:

steps:
- name: Checkout
uses: actions/checkout@v4
uses: actions/checkout@v7

- name: Setup Ruby
uses: ruby/setup-ruby@v1
Expand All @@ -29,14 +29,14 @@ jobs:

- name: Configure Pages
id: pages
uses: actions/configure-pages@v5
uses: actions/configure-pages@v6

- name: Build documentation
working-directory: docs
run: bundle exec jekyll build --baseurl "${{ steps.pages.outputs.base_path }}"

- name: Upload artifact
uses: actions/upload-pages-artifact@v4
uses: actions/upload-pages-artifact@v5
with:
name: github-pages
path: docs/_site
Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/typos.yml
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@ jobs:
runs-on: "ubuntu-latest"

steps:
- uses: actions/checkout@v4
- uses: actions/checkout@v7

- name: "Check for typos"
uses: "crate-ci/typos@v1.46.0"
Expand Down
39 changes: 38 additions & 1 deletion docs/available-rules.md
Original file line number Diff line number Diff line change
Expand Up @@ -63,6 +63,8 @@ Namespace: `Boundwize\StructArmed\Rule\Rules\File`.
| `Psr1SymbolsOrSideEffectsRule` | `new Psr1SymbolsOrSideEffectsRule(sourcePaths: ['src/'])` | A file declares symbols or causes side effects, but does not do both. |
| `Psr1ValidUtf8Rule` | `new Psr1ValidUtf8Rule(sourcePaths: ['src/'])` | PHP files use valid UTF-8 encoding. |
| `Psr1Utf8WithoutBomRule` | `new Psr1Utf8WithoutBomRule(sourcePaths: ['src/'])` | PHP files do not start with a byte order mark. Supports `--fix`. |
| `MustUseLowercaseKeywordConstantRule` | `new MustUseLowercaseKeywordConstantRule(sourcePaths: ['src/'])` | PHP's special keyword constants `true`, `false`, and `null` use their canonical lowercase spelling. Fully qualified forms such as `\TRUE` are preserved as `\true`. Supports `--fix`. |
| `LargeNumericLiteralMustUseSeparatorRule` | `new LargeNumericLiteralMustUseSeparatorRule(minimum: 1_000_000, sourcePaths: ['src/'])` | Plain decimal integer and float literals whose magnitude is at least `minimum` (default `1_000_000`) group their integer digits in threes with `_` separators, so `1000500.001` becomes `1_000_500.001`. Hexadecimal, octal, binary, exponent, and already separated literals are ignored. Supports `--fix`. |
{: .rule-table }

Pass `sourcePaths: null` or omit it to let the rule read PSR-4 paths from `composer.json`.
Expand All @@ -73,13 +75,18 @@ Namespace: `Boundwize\StructArmed\Rule\Rules\Class_`.

| Rule | Constructor | Checks |
|---|---|---|
| `AnonymousClassMayNotHaveEmptyParenthesesRule` | `new AnonymousClassMayNotHaveEmptyParenthesesRule(layer: 'Source')` | Anonymous classes that pass no constructor argument omit the parentheses after `class` (`new class {}`, not `new class () {}`), per [PER Coding Style](https://www.php-fig.org/per/coding-style/#8-anonymous-classes). Supports `--fix` by removing the empty parentheses. |
| `ClassConstantNameMustBeUpperCaseRule` | `new ClassConstantNameMustBeUpperCaseRule(layer: 'Domain')` | Class, interface, and trait constants use upper case with underscore separators. Enums are skipped (PER Coding Style recommends PascalCase enum constants). |
| `ClassImplementingInterfaceMustHaveSuffixRule` | `new ClassImplementingInterfaceMustHaveSuffixRule(layer: 'HTTP', interface: MiddlewareInterface::class, suffix: 'Middleware')` | Classes implementing a specific interface use the required suffix. |
| `ClassNameMustBeStudlyCapsRule` | `new ClassNameMustBeStudlyCapsRule(layer: 'Source')` | Class names use StudlyCaps. |
| `ClassNameMustHaveSuffixRule` | `new ClassNameMustHaveSuffixRule(layer: 'Controller', suffix: 'Controller')` | Classes in a layer have the required suffix. |
| `ClassNameMustNotHavePrefixRule` | `new ClassNameMustNotHavePrefixRule(layer: 'Model', prefix: 'Model')` | Classes in a layer do not use a forbidden prefix. |
| `EnumCaseNameMustBePascalCaseRule` | `new EnumCaseNameMustBePascalCaseRule(layer: 'Source')` | Enum case names use PascalCase, per [PER Coding Style](https://www.php-fig.org/per/coding-style/#9-enumerations). |
| `EnumConstantMayNotBeProtectedRule` | `new EnumConstantMayNotBeProtectedRule(layer: 'Source')` | Enum constants are not declared `protected` — enums cannot be extended, so `private` is used instead, per [PER Coding Style](https://www.php-fig.org/per/coding-style/#9-enumerations). Supports `--fix` by changing `protected` to `private`. |
| `EnumMethodMayNotBeProtectedRule` | `new EnumMethodMayNotBeProtectedRule(layer: 'Source')` | Enum methods are not declared `protected` — enums cannot be extended, so `private` is used instead, per [PER Coding Style](https://www.php-fig.org/per/coding-style/#9-enumerations). Supports `--fix` by changing `protected` to `private`. |
| `ExtendedClassMustBeAbstractOrInstantiatedRule` | `new ExtendedClassMustBeAbstractOrInstantiatedRule(layer: 'Source')` | Classes another scanned class extends are declared `abstract` unless they are also instantiated (`new X`, a `new self`/`new static`/`new parent` resolving to them, a constant class expression such as `new (X::class)` or `new ('App\X')`, or a chained `(new ReflectionClass(X::class))->newInstance*()`). Type hints, `instanceof`, and `::class` keep working on an abstract class, so they do not count. Runtime-fed construction (`new $class` from a parameter, `unserialize()`, container factories) is outside the scanned-code boundary — exclude such factories' targets with rule-scoped `skip()` or `skipRule()`. Supports `--fix` by adding the `abstract` modifier. |
| `MaxDependencyCountRule` | `new MaxDependencyCountRule(layer: 'Controller', maxCount: 5)` | Constructor dependency count stays below the configured limit. |
| `MayNotExtendClassRule` | `new MayNotExtendClassRule(layer: 'Domain', class: 'Illuminate\\Database\\Eloquent\\Model')` | Classes in a layer do not extend a forbidden class, directly or through any parent class. |
| `MayNotImplementInterfaceRule` | `new MayNotImplementInterfaceRule(layer: 'Domain', interface: JsonSerializable::class)` | Classes in a layer do not implement a forbidden interface. |
| `MustBeFinalRule` | `new MustBeFinalRule(layer: 'Domain', classNamePattern: '/Entity$/')` | Matching classes in a layer are declared `final`. Classes extended by another scanned class are skipped (making them `final` would break the child). Supports `--fix`. |
| `MustBeUsedInterfaceRule` | `new MustBeUsedInterfaceRule(layer: 'Source')` | Interfaces are implemented by a scanned class (directly or through inheritance), extended by another scanned interface, or referenced as a dependency (type hint, `instanceof`, `::class`, a class-name string, ...). Supports `--fix` by removing the unused interface (and deleting its file when only boilerplate remains). |
Expand All @@ -95,7 +102,37 @@ Namespace: `Boundwize\StructArmed\Rule\Rules\Class_`.

`classNamePattern` and `excludePattern` are regular expressions matched against the fully-qualified class name.

`Psr4DirectoryExistsRule`, `Psr1PhpTagsRule`, `Psr1Utf8WithoutBomRule`, `ExtendedClassMustBeAbstractOrInstantiatedRule`, `MustBeFinalRule`, `MustBeUsedInterfaceRule`, `MustBeUsedAbstractClassRule`, `MustBeUsedTraitRule`, `MustDeclareConstantVisibilityRule`, `MustDeclareMethodVisibilityRule`, and `MustDeclarePropertyVisibilityRule` implement `Boundwize\StructArmed\Rule\FixableInterface`, so StructArmed can automatically remove PSR-4 mappings for missing directories, normalize invalid PHP opening tags, remove UTF-8 byte order marks, add the `final` or `abstract` class modifier, remove unused interfaces, abstract classes, and traits (deleting their file when only `declare`/`namespace`/`use` boilerplate remains), and add missing constant, method, or property visibility modifiers when you run `vendor/bin/structarmed analyse --fix`.
## Fixable Rules

The following rules implement `Boundwize\StructArmed\Rule\FixableInterface` and can apply their changes when you run `vendor/bin/structarmed analyse --fix`.

| Rule | Automatic fix |
|---|---|
| `Psr4DirectoryExistsRule` | Removes PSR-4 mappings for missing directories. |
| `Psr1PhpTagsRule` | Normalizes invalid PHP opening tags. |
| `Psr1Utf8WithoutBomRule` | Removes the UTF-8 byte order mark. |
| `MustUseLowercaseKeywordConstantRule` | Lowercases `TRUE`, `FALSE`, and `NULL` keyword constants. |
| `LargeNumericLiteralMustUseSeparatorRule` | Adds `_` separators to large numeric literals. |
| `AnonymousClassMayNotHaveEmptyParenthesesRule` | Removes empty parentheses from anonymous classes that pass no constructor arguments. |
| `ExtendedClassMustBeAbstractOrInstantiatedRule` | Adds the `abstract` modifier to an extended class that is not instantiated. |
| `MustBeFinalRule` | Adds the `final` modifier. |
| `MustBeUsedInterfaceRule` | Removes an unused interface, deleting its file when only boilerplate remains. |
| `MustBeUsedAbstractClassRule` | Removes an unused abstract class, deleting its file when only boilerplate remains. |
| `MustBeUsedTraitRule` | Removes an unused trait, deleting its file when only boilerplate remains. |
| `MustDeclareConstantVisibilityRule` | Adds a missing constant visibility modifier. |
| `MustDeclareMethodVisibilityRule` | Adds a missing method visibility modifier. |
| `MustDeclarePropertyVisibilityRule` | Adds a missing property visibility modifier. |
{: .rule-table }

## Function Rules

Namespace: `Boundwize\StructArmed\Rule\Rules\Function_`.

| Rule | Constructor | Checks |
|---|---|---|
| `MustBeStaticAnonymousFunctionRule` | `new MustBeStaticAnonymousFunctionRule(layer: 'Domain')` | Closures and arrow functions in a layer are declared `static`. Anonymous functions that read `$this` (directly or through a nested closure) are skipped, since a static closure cannot access `$this`. Supports `--fix` by adding the `static` modifier. |
| `MustHaveReturnTypeFunctionRule` | `new MustHaveReturnTypeFunctionRule(layer: 'Helper')` | Named function declarations in a layer declare a return type. |
{: .rule-table }

## Layer Rules

Expand Down
1 change: 1 addition & 0 deletions docs/cli.md
Original file line number Diff line number Diff line change
Expand Up @@ -26,6 +26,7 @@ vendor/bin/structarmed init --preset=psr15
vendor/bin/structarmed init --preset=mvc
vendor/bin/structarmed init --preset=ddd
vendor/bin/structarmed init --preset=yagni
vendor/bin/structarmed init --preset=codequality
vendor/bin/structarmed init --preset=all
```

Expand Down
4 changes: 4 additions & 0 deletions docs/configuration.md
Original file line number Diff line number Diff line change
Expand Up @@ -113,4 +113,8 @@ Use [Custom Rules And Presets](../custom-rules-and-presets/) when you want to ad
->withPreset(Preset::PSR4(
sourcePaths: ['src/', 'tests/'], // default: read composer.json PSR-4 paths
))

->withPreset(Preset::CODEQUALITY(
sourcePaths: ['src/', 'tests/'], // default: read composer.json PSR-4 paths
))
```
Loading