Changeset View
Changeset View
Standalone View
Standalone View
src/applications/config/custom/PhabricatorConfigRegexOptionType.php
- This file was added.
<?php | |||||
class PhabricatorConfigRegexOptionType | |||||
joshuaspence: Shouldn't this be `final` by preference? I thought there was a linter rule for this. | |||||
extends PhabricatorConfigJSONOptionType { | |||||
public function validateOption(PhabricatorConfigOption $option, $value) { | |||||
foreach ($value as $pattern => $spec) { | |||||
joshuaspenceUnsubmitted Not Done Inline ActionsWhat if $value isn't an array? joshuaspence: What if `$value` isn't an array? | |||||
$ok = preg_match($pattern, ''); | |||||
if ($ok === false) { | |||||
throw new Exception( | |||||
pht( | |||||
'The following regex is malformed and cannot be used: %s', | |||||
$pattern)); | |||||
} | |||||
} | |||||
} | |||||
} |
Shouldn't this be final by preference? I thought there was a linter rule for this.