[ 'pattern' => '', 'replacement' => "\$1\n\$2%s::class,\n\$2", ], ]; /** * Pattern to use to determine if the code item is registered. * * Set in constructor due to PCRE quoting issues. * * @var string */ protected $isRegisteredPattern = ''; /** * Patterns and replacements to use when removing a code item. * * @var string[] */ protected $removalPatterns = [ 'pattern' => '/^\s+%s::class,\s*$/m', 'replacement' => '', ]; /** * {@inheritDoc} * * Sets $isRegisteredPattern and pattern for $injectionPatterns to ensure * proper PCRE quoting. */ public function __construct($projectRoot = '') { $ns = preg_quote('\\'); $this->isRegisteredPattern = '/new (?:' . $ns . '?' . preg_quote('Zend\ConfigAggregator\\') . ')?ConfigAggregator\(\s*(?:array\(|\[).*\s+' . $ns . '?%s::class/s'; $this->injectionPatterns[self::TYPE_CONFIG_PROVIDER]['pattern'] = sprintf( "/(new (?:%s?%s)?ConfigAggregator\(\s*(?:array\(|\[)\s*)(?:\r|\n|\r\n)(\s*)/", preg_quote('\\'), preg_quote('Zend\ConfigAggregator\\') ); parent::__construct($projectRoot); } }