Skip to content
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
13 changes: 10 additions & 3 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,11 +10,18 @@ To install the PHPStan rules for Symfony UX, you can use Composer:
composer require --dev kocal/phpstan-symfony-ux
```

## Configuration
If you have [phpstan/extension-installer](https://github.com/phpstan/extension-installer) installed (which is the case by default), the extension will be automatically registered and you're ready to go.

If you don't use the extension installer, you'll need to manually add the extension to your `phpstan.neon` or `phpstan.dist.neon` configuration file:

```yaml
includes:
- vendor/kocal/phpstan-symfony-ux/extension.neon
```

After installing the package, you need to configure PHPStan to use the rules.
## Configuration

Each rule can be enabled individually by adding it to your `phpstan.dist.neon` configuration file.
Each rule can be enabled individually by adding it to your `phpstan.neon` or `phpstan.dist.neon` configuration file.

## LiveComponent Rules

Expand Down
14 changes: 12 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
@@ -1,7 +1,7 @@
{
"name": "kocal/phpstan-symfony-ux",
"description": "PHPStan rules for Symfony UX",
"type": "library",
"type": "phpstan-extension",
"license": "MIT",
"authors": [
{
Expand Down Expand Up @@ -40,8 +40,18 @@
"symfony/ux-twig-component": "^2.0",
"symplify/easy-coding-standard": "^13.0"
},
"extra": {
"phpstan": {
"includes": [
"extension.neon"
]
}
},
"config": {
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"minimum-stability": "dev",
"prefer-stable": true
Expand Down
3 changes: 3 additions & 0 deletions extension.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,3 @@
# This file is intentionally empty for backward compatibility purposes.
# Rules must be enabled individually in your phpstan.neon configuration.
# See README.md for available rules and their configuration.
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\LiveComponent\LiveActionMethodsShouldBePublicRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassMustBeFinalRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ClassNameShouldNotEndWithComponentRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ExposePublicPropsShouldBeFalseRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ForbiddenAttributesPropertyRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\ForbiddenClassPropertyRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\MethodsShouldBePublicOrPrivateRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PostMountMethodSignatureRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PreMountMethodSignatureRule
Original file line number Diff line number Diff line change
@@ -1,2 +1,5 @@
includes:
- ../../../../test-extension.neon

rules:
- Kocal\PHPStanSymfonyUX\Rules\TwigComponent\PublicPropertiesShouldBeCamelCaseRule
2 changes: 2 additions & 0 deletions tests/test-extension.neon
Original file line number Diff line number Diff line change
@@ -0,0 +1,2 @@
includes:
- ../extension.neon