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

Dependencies in bin-files only are not counted as used #28

Open
Idrinth opened this issue Oct 18, 2018 · 2 comments
Open

Dependencies in bin-files only are not counted as used #28

Idrinth opened this issue Oct 18, 2018 · 2 comments
Assignees
Labels
enhancement New feature or request
Milestone

Comments

@Idrinth
Copy link
Contributor

Idrinth commented Oct 18, 2018

Description

Additionally to autoloading composer also allows the declaration of a bin-file array. These files may very well be the only ones using a specific dependency, like in a single command symfony/console application.

Steps to Reproduce

  1. create a single command symfony console application
  2. only use symfony/console in bin/your-command

Example Code

#!/usr/bin/env php
<?php

use Symfony\Component\Console\Application;
use Symfony\Component\Console\Input\InputInterface;
use Symfony\Component\Console\Output\OutputInterface;

require_once '../vendor/autoload.php';
$application = new Application('An App');
$application
    ->register('all')
    ->setCode(function(InputInterface $input, OutputInterface $output) {
        return 0;
    })
    ->getApplication()
    ->setDefaultCommand('all');
$application->run();

Expected behavior: No errors

Actual behavior: "[ERROR] Package "symfony/console" is installed, but never used."

Reproduces how often: always

Versions

Root Package: 1.0.5

Fixing

I assume adding the files of bin to the list as in https://github.com/mediact/dependency-guard/blob/master/src/Composer/Iterator/SourceFileIteratorFactory.php#L59 would be sufficient.

@Idrinth
Copy link
Contributor Author

Idrinth commented Nov 8, 2018

if this is considered either a bug or a valid feature, I'd be happy to implement it.

@janmartenjongerius
Copy link
Contributor

@Idrinth I would be really appreciative of a pull request that pulls in the bin entries in the analysis. Do you concur, @sjokki ? I'm currently less available to write a pull request myself, so if you'd please @Idrinth ?

@janmartenjongerius janmartenjongerius added the enhancement New feature or request label Nov 8, 2018
@janmartenjongerius janmartenjongerius added this to the 1.1.0 milestone Nov 11, 2018
@janmartenjongerius janmartenjongerius modified the milestones: 1.1.0, 1.2.0 Jan 10, 2019
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
enhancement New feature or request
Projects
None yet
Development

No branches or pull requests

2 participants