Skip to content

Releases: blumilksoftware/codestyle

v0.4.0 - removing useless docblocks

09 May 07:30
d8e4a5b
Compare
Choose a tag to compare

After this change, all useless comments will be removed:

Before:

<?php

declare(strict_types=1);

/**
 * Class Whatever
 */
class Whatever
{
    public int|string $something;

    /**
     * @throws JsonException
     */
    public function do(): void
    {
        $i = 1 + 1;
        json_encode([$i], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
    }
}

After:

<?php

declare(strict_types=1);

class Whatever
{
    public int|string $something;

    /**
     * @throws JsonException
     */
    public function do(): void
    {
        $i = 1 + 1;
        json_encode([$i], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
    }
}

pipe symbol spacing

12 Apr 09:13
6183605
Compare
Choose a tag to compare

Symbol | can be now used both in union types and bitwise operator:

<?php

declare(strict_types=1);

class Whatever
{
    public int|string $something;

    /**
     * @throws JsonException
     */
    public function do(): void
    {
        $i = 1 + 1;
        json_encode([$i], JSON_THROW_ON_ERROR | JSON_UNESCAPED_SLASHES);
    }
}

arrow function spacing

29 Mar 06:39
7bc71fe
Compare
Choose a tag to compare

There were new fixers added to Blumilk/Configuration/Defaults/CommonAdditionalRules within #11 task:

use Blumilk\Codestyle\Fixers\NoSpacesAfterFunctionNameFixer;
use PhpCsFixer\Fixer\FunctionNotation\UseArrowFunctionsFixer;
use PhpCsFixer\Fixer\FunctionNotation\VoidReturnFixer;
use PhpCsFixer\Fixer\Import\FullyQualifiedStrictTypesFixer;
use PhpCsFixer\Fixer\Import\OrderedImportsFixer;

Arrow functions spacing were broken and it wass working like this:

array_filter([1, 2, 3, 4], fn (int $i): bool => $i % 2 === 0);

Now it's properly formatted into this:

array_filter([1, 2, 3, 4], fn(int $i): bool => $i % 2 === 0);

extended config customization

24 Feb 16:49
57206c9
Compare
Choose a tag to compare

#5 implemented. Now you can easier configure paths, set lists, skipped and additional rules in Config constructor:

<?php

declare(strict_types=1);

use Blumilk\Codestyle\Config;
use Blumilk\Codestyle\Configuration\Defaults\CommonAdditionalRules;
use Blumilk\Codestyle\Configuration\Defaults\CommonSetLists;
use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths;
use Blumilk\Codestyle\Configuration\Utils\Rule;
use PhpCsFixer\Fixer\Alias\NoMixedEchoPrintFixer;
use Symplify\EasyCodingStandard\ValueObject\Set\SetList;

$paths = new LaravelPaths();
$rules = new CommonAdditionalRules();
$sets = new CommonSetLists();

$config = new Config(
    paths: $paths->filter("resources/lang"),
    sets: $sets->filter(SetList::CLEAN_CODE)->add(SetList::COMMENTS),
    rules: $rules->add(new Rule(NoMixedEchoPrintFixer::class, [
        "use" => "echo",
    ]))
);

customizable paths

23 Feb 13:31
d35147f
Compare
Choose a tag to compare

#7 implemented. Now you can configure paths, set lists, skipped and additional rules in Config constructor:

<?php

declare(strict_types=1);

use Blumilk\Codestyle\Config;
use Blumilk\Codestyle\Configuration\Defaults\LaravelPaths;

$paths = new LaravelPaths();

$config = new Config(
    paths: $paths->filter("app", "tests")->add("src")
);

return $config->config();

Or:

<?php

declare(strict_types=1);

use Blumilk\Codestyle\Config;
use Blumilk\Codestyle\Configuration\Defaults\Paths;

$config = new Config(
    paths: new Paths("src")
);

return $config->config();

proof of concept

14 Feb 12:21
16f8ce4
Compare
Choose a tag to compare
0.0.1

#4 - ECS added (#6)