Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

#65 - purge mode #86

Merged
merged 3 commits into from
May 30, 2023
Merged

#65 - purge mode #86

merged 3 commits into from
May 30, 2023

Conversation

krzysztofrewak
Copy link
Member

For new Laravel instances sometimes I would like yo get rid of all comments, especially in configuration files. This should allow it by entering "purge mode" in codestyle.php for one run:

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

With purge mode this:

return [
    /*
    |--------------------------------------------------------------------------
    | Default Database Connection Name
    |--------------------------------------------------------------------------
    |
    | Here you may specify which of the database connections below you wish
    | to use as your default connection for all database work. Of course
    | you may use many connections at once using the Database library.
    |
    */

    "default" => env("DB_CONNECTION", "mysql"),

    /*
    |--------------------------------------------------------------------------
    | Database Connections
    |--------------------------------------------------------------------------
    |
    | Here are each of the database connections setup for your application.
    | Of course, examples of configuring each database platform that is
    | supported by Laravel is shown below to make development simple.
    |
    |
    | All database work in Laravel is done through the PHP PDO facilities
    | so make sure you have the driver for your particular database of
    | choice installed on your machine before you begin development.
    |
    */

    "connections" => [
        "sqlite" => [
            "driver" => "sqlite",
            "url" => env("DATABASE_URL"),
            "database" => env("DB_DATABASE", database_path("database.sqlite")),
            "prefix" => "",
            "foreign_key_constraints" => env("DB_FOREIGN_KEYS", true),
        ],

will be refactored into this:

return [
    "default" => env("DB_CONNECTION", "mysql"),

    "connections" => [
        "sqlite" => [
            "driver" => "sqlite",
            "url" => env("DATABASE_URL"),
            "database" => env("DB_DATABASE", database_path("database.sqlite")),
            "prefix" => "",
            "foreign_key_constraints" => env("DB_FOREIGN_KEYS", true),
        ],

This should close #65.

@krzysztofrewak krzysztofrewak marked this pull request as ready for review December 11, 2022 13:43

return [
"default" => env("DB_CONNECTION", "mysql"),

Copy link
Member

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We need that space?

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I don't get it why it's working like this. According to this (https://mlocati.github.io/php-cs-fixer-configurator/#version:3.8|fixer:no_extra_blank_lines example 6) these empty lines should be removed.

Copy link
Member Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

I created a task for that: #87

src/Configuration/Defaults/CommonRules.php Outdated Show resolved Hide resolved
src/Fixers/NoCommentFixer.php Show resolved Hide resolved
@kamilpiech97
Copy link
Member

conflicts @krzysztofrewak

# Conflicts:
#	src/Configuration/Defaults/CommonRules.php
#	tests/codestyle/CodestyleTest.php
@krzysztofrewak
Copy link
Member Author

conflicts @krzysztofrewak

Resolved.

@krzysztofrewak krzysztofrewak merged commit f858620 into main May 30, 2023
@krzysztofrewak krzysztofrewak deleted the #65-purge-mode branch May 30, 2023 13:36
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
None yet
Projects
None yet
Development

Successfully merging this pull request may close these issues.

Create separate config for cleaning up fresh Laravel installation
3 participants