You signed in with another tab or window. Reload to refresh your session.You signed out in another tab or window. Reload to refresh your session.You switched accounts on another tab or window. Reload to refresh your session.Dismiss alert
Error {#2549
#message: "Typed property Symfony\Component\Config\Loader\Loader::$resolver must not be accessed before initialization"
#code: 0
#file: "D:\inetroot\websites\demo\vendor\symfony\config\Loader\Loader.php"
#line: 60
}
The line in question is: $loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);, however, the defined property is protected LoaderResolverInterface $resolver; (line 35).
How to reproduce
class MyBundle extends AbstractBundle
{
public function configure(DefinitionConfigurator $definition): void
{
$definition->import(dirname(__DIR__) . '/config/*.yaml', 'yaml');
}
}
Please disregard the fact that I'm attempting to load YAML in the below reproduction code. Apparently there isn't built-in support for loading YAML configuration in bundles...
…xabbuh)
This PR was merged into the 7.0 branch.
Discussion
----------
[Config] gracefully handle cases when no resolver is set
| Q | A
| ------------- | ---
| Branch? | 7.0
| Bug fix? | yes
| New feature? | no
| Deprecations? | no
| Issues | Fix#57066
| License | MIT
Commits
-------
aefeb67 gracefully handle cases when no resolver is set
Symfony version(s) affected
6.x, 7.x
Description
I am receiving the following error:
The line in question is:
$loader = null === $this->resolver ? false : $this->resolver->resolve($resource, $type);
, however, the defined property isprotected LoaderResolverInterface $resolver;
(line 35).How to reproduce
Please disregard the fact that I'm attempting to load YAML in the below reproduction code. Apparently there isn't built-in support for loading YAML configuration in bundles...
Possible Solution
I suggest the either of the following changes:
$loader = isset($this->resolver) ? $this->resolver->resolve($resource, $type) : false;
protected ?LoaderResolverInterface $resolver
andpublic function getResolver(): ?LoaderResolverInterface
Additional Context
No response
The text was updated successfully, but these errors were encountered: