Skip to content

Strict paths solver #71

Description

@krzysztofrewak

The 0.x codestyle with ECS underneath threw errors when one of provided paths was not in the project. Since 1.x codestyle just goes further without any notice.

AC: I would like to get error when I'm trying to scan non-existing directory/file. Default behaviour should still be silent mode, but it should be configurable. I have four (!) implementations in mind and I'm open to discussion:

Option 1️⃣:

<?php

declare(strict_types=1);

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

$paths = new LaravelPaths();
$config = new Config(
    paths: $paths->add("codestyle.php"),
    strictPaths: true,
);

return $config->config();

Option 2️⃣:

<?php

declare(strict_types=1);

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

$paths = new LaravelPaths();
$config = new Config(
    paths: $paths->add("codestyle.php"),
);

return $config->withStrictPaths()->config();

Option 3️⃣:

<?php

declare(strict_types=1);

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

$paths = new LaravelPaths();
$config = new Config(
    paths: $paths->add("codestyle.php"),
    config: ["paths" => "strict"]
);

return $config->config();

Option 4️⃣:

<?php

declare(strict_types=1);

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

$paths = new LaravelPaths(strict: true);
$config = new Config(
    paths: $paths->add("codestyle.php"),
);

return $config->config();

"Strict paths" is just a placeholder. We can switch it with other proposition.

Activity

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Metadata

Metadata

Assignees

No one assigned

    Labels

    Type

    No type

    Projects

    No projects

      Milestone

      No milestone

      Relationships

      None yet

      Development

      No branches or pull requests

      Issue actions