Skip to content

Multiple Config loading does not apply rulesets the same way #2675

Closed
@baptistepillot

Description

@baptistepillot

I have goe a ruleset.xml file with this line :

<arg name="tab-width" value="4"/>

If il load the Config twice, they will not both have this rule : the first yes, the second not :

$config1 = new Config();
$ruleset = new Ruleset($config);
$ruleset->populateTokenListeners();
// the tabWidth configuration is set to 4 : everything is ok
// here Config::$overriddenDefaults['tab-width'] is set to tue
$config2 = new Config();
$ruleset = new Ruleset($config);
$ruleset->populateTokenListeners();
// with $overriddenDefaults['tab-width'] set to true, the tabWidth configuration becomes 0 : BAD

I patched it with this one, but it is a dirty patch to ensure my Config object initializes always the same way :

// (...)
$property = new ReflectionProperty(Config::class, 'overriddenDefaults');
$property->setAccessible(true);
$property->setValue([]);
$property->setAccessible(false);
$config2 = new Config();
// everything will be alright now

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Type

    No type

    Projects

    No projects

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions