Skip to content

Navigation Menu

Sign in
Appearance settings

Search code, repositories, users, issues, pull requests...

Provide feedback

We read every piece of feedback, and take your input very seriously.

Saved searches

Use saved searches to filter your results more quickly

Appearance settings

[DI] Allow imports in string format for YAML #22176

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
Jul 11, 2017
Merged
Show file tree
Hide file tree
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
Original file line number Diff line number Diff line change
Expand Up @@ -177,7 +177,10 @@ private function parseImports(array $content, $file)
$defaultDirectory = dirname($file);
foreach ($content['imports'] as $import) {
if (!is_array($import)) {
throw new InvalidArgumentException(sprintf('The values in the "imports" key should be arrays in %s. Check your YAML syntax.', $file));
$import = array('resource' => $import);
Copy link
Member

Choose a reason for hiding this comment

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

only strings should be allowed to be rewritten that way, not any non-array value

Copy link
Contributor Author

Choose a reason for hiding this comment

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

Do we really care? Whatever the input is; it crashes like before.

imports:
  - { resource: { breakit: config.yml } }
Warning: strlen() expects parameter 1 to be string, array given

Which actually comes from FileLoader::glob(). AFAIK the api describes type mixed for resources. Hence i think we should just pass here... and fix the glob issue of course ^^

}
if (!isset($import['resource'])) {
throw new InvalidArgumentException(sprintf('An import should provide a resource in %s. Check your YAML syntax.', $file));
}

$this->setCurrentDir($defaultDirectory);
Expand Down
Original file line number Diff line number Diff line change
@@ -1,2 +1,2 @@
imports:
- foo.yml
- { resource: ~ }
Original file line number Diff line number Diff line change
@@ -1,5 +1,5 @@
imports:
- { resource: services2.yml }
- services2.yml
- { resource: services3.yml }
- { resource: "../php/simple.php" }
- { resource: "../ini/parameters.ini", class: Symfony\Component\DependencyInjection\Loader\IniFileLoader }
Expand Down
Morty Proxy This is a proxified and sanitized view of the page, visit original site.