Skip to content

[Formatter] Multiline to single line #268

@krissss

Description

@krissss

🐞 Describe the Bug

    public function sample(string $sql, int $time)
    {
        $shouldRecord =
            $sql !== 'select 1' // sql ignore
            && (
                $time > config('log-ext.sql.info_time', 1000) // greater than config
                || preg_match("/^\s*(update|delete|insert|replace)\s*/i", $sql) // update/delete/insert/replace
            );
    }

after format

    public function sample(string $sql, int $time)
    {
        $shouldRecord = $sql !== 'select 1' && ($time > config('log-ext.sql.info_time', 1000) || preg_match("/^\s*(update|delete|insert|replace)\s*/i", $sql)); // sql ignore // greater than config // update/delete/insert/replace
    }

🔄 Steps to Reproduce

See the description.

⚙️ Configuration (mago.toml)

# Mago configuration file
# For more information, see https://mago.carthage.software/#/getting-started/configuration
php_version = "8.2.0"

[source]
paths = ["./app", "./support"]
includes = ["vendor"]
excludes = []

[format]
print_width = 180
tab_width = 4
use_tabs = false

[linter]
default_plugins = true
plugins = ["symfony"]

📜 Command Output

Irrelevant.

📂 PHP Code Sample (If Applicable)

🖥️ Operating System

macOS

📦 How did you install Mago?

Homebrew (brew install mago)

📝 Additional Context

No response

Metadata

Metadata

Assignees

Labels

Type: BugAn issue causing unintended or problematic behavior.

Type

No type

Projects

No projects

Milestone

No milestone

Relationships

None yet

Development

No branches or pull requests

Issue actions