Automattic / phpcs-neutron-standard

A set of phpcs sniffs for PHP >7 development
MIT License
94 stars 7 forks source link

Missing dependencies? #21

Closed szepeviktor closed 6 years ago

szepeviktor commented 6 years ago

Could it be that with this composer.json dependencies are not installed?

{
    "require": {
        "automattic/phpcs-neutron-standard": "*"
    }
}

composer update

sirbrillig commented 6 years ago

Hi! 👋 This package doesn't have any non-dev dependencies, unless you mean that it's not being installed correctly. I just tried creating a test project, which you can see below, and the package installed. Am I misunderstanding the problem?

$ cat composer.json
{
    "name": "payton/testpns",
    "type": "project",
    "license": "MIT",
    "require": {
        "automattic/phpcs-neutron-standard": "*"
    }
}
$ composer update
Loading composer repositories with package information
Updating dependencies (including require-dev)
  - Installing automattic/phpcs-neutron-standard (v1.1.0)
    Loading from cache

Writing lock file
Generating autoload files
szepeviktor commented 6 years ago

Hello @sirbrillig !

Thank you for your reply. I mean we have a lot of dependencies: https://github.com/Automattic/phpcs-neutron-standard/blob/master/composer.json#L18-L24

and as composer's help says:

--dev Enables installation of require-dev packages (enabled by default, only present for BC).

So why require-dev-s are not installed?

sirbrillig commented 6 years ago

Ah! I see the confusion. Dev dependencies are only installed when composer is run on the package itself (the root package), not another project which depends on the package. You can read about how composer treats require-dev here.

To put it another way, the following will install the dev dependencies:

git clone https://github.com/Automattic/phpcs-neutron-standard
cd phpcs-neutron-standard
composer install
szepeviktor commented 6 years ago

Thank you for pointing that out! Is there a way to install phpcs-neutron-standard with 1 command?

szepeviktor commented 6 years ago

Yes :)

composer create-project automattic/phpcs-neutron-standard