private function createFilterDefinition($type, $filterString)
    {
        if ('role' === $type) {
            return new Definition('Behat\Gherkin\Filter\RoleFilter', array($filterString));
        }

        if ('name' === $type) {
            return new Definition('Behat\Gherkin\Filter\NameFilter', array($filterString));
        }

        if ('tags' === $type) {
            return new Definition('Behat\Gherkin\Filter\TagFilter', array($filterString));
        }

        if ('narrative' === $type) {
            return new Definition('Behat\Gherkin\Filter\NarrativeFilter', array($filterString));
        }

        throw new ExtensionException(sprintf(
            '`%s` filter is not supported by the `filters` option of gherkin extension. Supported types are `%s`.',
            $type,
            implode('`, `', array('narrative', 'role', 'name', 'tags'))
        ), 'gherkin');
    }