Add strict check for BuilderAliasProvider
I have a bundle which uses bundle:path:file.yml syntax. But since the requirements in BuilderAliasProvider are not strict enough (2 == substr_count($name, ':')), my custom Provider is not reached by the ChainProvider.
I suggest checking for smth like:
<?php
namespace Knp\Bundle\MenuBundle\Provider;
use Knp\Menu\Provider\MenuProviderInterface;
class BuilderAliasProvider implements MenuProviderInterface
{
public function has($name, array $options = array())
{
return 0 < preg_match('/^\w+:[\w\\\]+:\w+$/', $name);
}
}
ah, and providers have no priority. that is a pitty, otherwise you could just put your provider first. i think adding a priority option to the container tag should be easy, do you want to do a pull request for that?
@stof is there a problem with the regular expression @vudaltsov proposes? could it lead to things not being accepted that are supposed to be accepted?
I am happy to make a PR on whatever you decide. Imho it will be good to do both things: to add preg_match and priorities.
lets see if @stof says something. if you want to do the priorities, i would feel confident enough to review and merge that. for the preg_match, i am more afraid of side effects and would want input from stof.