Skip to content

Commit

Permalink
Update dependencies and fix coding standards issues. (#8)
Browse files Browse the repository at this point in the history
  • Loading branch information
terabytesoftw authored Feb 27, 2024
1 parent 72e5aa7 commit 03db596
Show file tree
Hide file tree
Showing 9 changed files with 64 additions and 16 deletions.
4 changes: 3 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,8 @@
# Change Log

## 0.1.1 Under development
## 0.1.1 February 27, 2024

- Bug #8: Update dependencies and fix coding standards issues (@terabytesoftw)

## 0.1.0 February 26, 2024

Expand Down
2 changes: 1 addition & 1 deletion README.md
Original file line number Diff line number Diff line change
Expand Up @@ -99,7 +99,7 @@ Selectize::widget(

## Testing

[Check the documentation testing](/docs/testing.md) to learn about testing.
[Check the documentation testing](docs/testing.md) to learn about testing.

## Our social networks

Expand Down
4 changes: 3 additions & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,8 @@
"php-forge/support": "^0.1",
"phpunit/phpunit": "^10.5",
"roave/infection-static-analysis-plugin": "^1.34",
"yii2-extensions/phpstan": "dev-main"
"symplify/easy-coding-standard": "^12.1",
"yii2-extensions/phpstan": "^0.1"
},
"autoload": {
"psr-4": {
Expand Down Expand Up @@ -47,6 +48,7 @@
},
"scripts": {
"check-dependencies": "composer-require-checker",
"ecs": "ecs check",
"mutation": "roave-infection-static-analysis-plugin",
"phpstan": "phpstan",
"test": "phpunit"
Expand Down
17 changes: 17 additions & 0 deletions docs/testing.md
Original file line number Diff line number Diff line change
Expand Up @@ -10,6 +10,23 @@ To run the checker, execute the following command:
composer run check-dependencies
```

## Easy coding standard

The code is checked with [Easy Coding Standard](https://github.com/easy-coding-standard/easy-coding-standard) and
[PHP CS Fixer](https://github.com/PHP-CS-Fixer/PHP-CS-Fixer). To run it:

```shell
composer run ecs
```

## Mutation testing

Mutation testing is checked with [Infection](https://infection.github.io/). To run it:

```shell
composer run mutation
```

## Static analysis

The code is statically analyzed with [Phpstan](https://phpstan.org/). To run static analysis:
Expand Down
39 changes: 39 additions & 0 deletions ecs.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,39 @@
<?php

declare(strict_types=1);

use PhpCsFixer\Fixer\ClassNotation\ClassDefinitionFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedClassElementsFixer;
use PhpCsFixer\Fixer\ClassNotation\OrderedTraitsFixer;
use PhpCsFixer\Fixer\Import\NoUnusedImportsFixer;
use Symplify\EasyCodingStandard\Config\ECSConfig;

return ECSConfig::configure()
->withConfiguredRule(
ClassDefinitionFixer::class,
[
'space_before_parenthesis' => true,
],
)
->withFileExtensions(['php'])
->withPaths(
[
__DIR__ . '/src',
__DIR__ . '/tests',
],
)
->withPhpCsFixerSets(perCS20: true)
->withPreparedSets(
cleanCode: true,
comments:true,
docblocks: true,
namespaces: true,
psr12: true
)
->withRules(
[
NoUnusedImportsFixer::class,
OrderedClassElementsFixer::class,
OrderedTraitsFixer::class,
]
);
File renamed without changes.
2 changes: 1 addition & 1 deletion phpstan.neon
Original file line number Diff line number Diff line change
Expand Up @@ -17,5 +17,5 @@ parameters:
- vendor/yiisoft/yii2/Yii.php

yii2:
config_path: %currentWorkingDirectory%/phpstan-yii-config.php
config_path: %currentWorkingDirectory%/phpstan-config.php

9 changes: 0 additions & 9 deletions src/Asset/SelectizeAsset.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,32 +10,23 @@

final class SelectizeAsset extends AssetBundle
{
/**
* @inheritdoc
*/
public $sourcePath = '@npm/selectize--selectize/dist';

/**
* @inheritdoc
*
* @phpstan-var array<array-key, mixed>
*/
public $css = [
'css/selectize.bootstrap5.css',
];

/**
* @inheritdoc
*
* @phpstan-var array<array-key, mixed>
*/
public $js = [
'js/selectize.js',
];

/**
* @inheritdoc
*
* @phpstan-var array<array-key, mixed>
*/
public $depends = [
Expand Down
3 changes: 0 additions & 3 deletions src/Selectize.php
Original file line number Diff line number Diff line change
Expand Up @@ -20,9 +20,6 @@ class Selectize extends InputWidget
public array $items = [];
public string $type = self::TYPE_SELECT;

/**
* @inheritdoc
*/
public function run(): string
{
$html = match ($this->type) {
Expand Down

0 comments on commit 03db596

Please sign in to comment.