Skip to content

[FrameworkBundle] fix yaml:lint when yaml is not installed along side framework-bundle #20066

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

Merged
merged 1 commit into from
Sep 28, 2016

Conversation

fabpot
Copy link
Member

@fabpot fabpot commented Sep 28, 2016

Q A
Branch? master
Bug fix? yes
New feature? no
BC breaks? no
Deprecations? no
Tests pass? yes
Fixed tickets n/a
License MIT
Doc PR n/a

YAML is not an explicit dependency of FrameworkBundle. If it is not installed, the console is broken as the yaml:lint commands tries to extends the one in the YAML component. This bug only exists in master as this refactoring happened in 3.2

parent::configure();
$this->setName('lint:yaml');

if (!$this->isEnabled() && null !== $this->command) {
Copy link
Member

Choose a reason for hiding this comment

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

Do we need this? configure() should never be called if the command is not enabled.

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, this is needed as configure() is called by the constructor.

@javiereguiluz javiereguiluz changed the title [FrameworkBundle] fix yaml:lint when yaml is not installed along side framwork-bundle [FrameworkBundle] fix yaml:lint when yaml is not installed along side framework-bundle Sep 28, 2016
private $directoryIteratorProvider;
private $isReadableProvider;

public function __construct($name = null, $directoryIteratorProvider = null, $isReadableProvider = null)
Copy link
Member

Choose a reason for hiding this comment

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

Couldn't $directoryIteratorProvider and $isReadableProvider be type-hinted as callable?

Copy link
Member Author

Choose a reason for hiding this comment

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

They could

}

return parent::getDirectoryIterator($directory);
return class_exists('Symfony\Component\Yaml\Command\LintCommand') && parent::isEnabled();
Copy link
Member

Choose a reason for hiding this comment

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

Could be class_exists(BaseLintCommand::class)

Copy link
Member Author

Choose a reason for hiding this comment

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

done

@fabpot fabpot merged commit b1c5a68 into symfony:master Sep 28, 2016
fabpot added a commit that referenced this pull request Sep 28, 2016
… along side framework-bundle (fabpot)

This PR was merged into the 3.2-dev branch.

Discussion
----------

[FrameworkBundle] fix yaml:lint when yaml is not installed along side framework-bundle

| Q             | A
| ------------- | ---
| Branch?       | master
| Bug fix?      | yes
| New feature?  | no
| BC breaks?    | no
| Deprecations? | no
| Tests pass?   | yes
| Fixed tickets | n/a
| License       | MIT
| Doc PR        | n/a

YAML is not an explicit dependency of FrameworkBundle. If it is not installed, the console is broken as the yaml:lint commands tries to extends the one in the YAML component. This bug only exists in master as this refactoring happened in 3.2

Commits
-------

b1c5a68 [FrameworkBundle] fixed yaml:lint when yaml is not installed along side framwork-bundle
@fabpot fabpot deleted the yaml-command branch September 28, 2016 14:38
@fabpot fabpot mentioned this pull request Oct 27, 2016
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Projects
None yet
Development

Successfully merging this pull request may close these issues.

4 participants