Skip to content
This repository was archived by the owner on Nov 14, 2019. It is now read-only.

remove pre-configured platform PHP version #236

Merged
merged 1 commit into from
Apr 1, 2016
Merged
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
12 changes: 12 additions & 0 deletions src/Symfony/Installer/NewCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -350,6 +350,18 @@ protected function updateComposerJson()
unset($contents['description']);
}

if (isset($contents['config']['platform']['php'])) {
unset($contents['config']['platform']['php']);

if (empty($contents['config']['platform'])) {
unset($contents['config']['platform']);
}

if (empty($contents['config'])) {

Choose a reason for hiding this comment

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

What about to make it nested to the previous if statement? The $contents['config'] could be empty only when we unset $contents['config']['platform'], otherwise it probably has at least one item.

            if (empty($contents['config']['platform'])) {
                unset($contents['config']['platform']);

                if (empty($contents['config'])) {
                    unset($contents['config']);
                }
            }

We should use cascade checks here, I think.

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 wanted to avoid nesting control structures too deeply.

Choose a reason for hiding this comment

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

What purpose to do it? Only to reduce complexity?

Copy link
Member Author

Choose a reason for hiding this comment

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

Yes, but I am happy to change it if others feel uncomfortable too with how it is right now.

Choose a reason for hiding this comment

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

OK, let's wait for others a bit, but I think I'm fine to keep it as is

Copy link
Contributor

Choose a reason for hiding this comment

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

I think this does not complexify the behavior, it just simplifies the outputted JSON

unset($contents['config']);
}
}

if (isset($contents['extra']['branch-alias'])) {
unset($contents['extra']['branch-alias']);
}
Expand Down