1
0
Fork 0

Remove unknown Rule type

pull/10185/head
Jordi Boggiano 2021-10-18 23:05:31 +02:00
parent 6e04991489
commit 75a8677e8a
No known key found for this signature in database
GPG Key ID: 7BBD42C429EC80BC
3 changed files with 4 additions and 6 deletions

View File

@ -125,7 +125,7 @@ abstract class Rule
}
/**
* @param 255|RuleSet::TYPE_* $type
* @param RuleSet::TYPE_* $type
* @return void
*/
public function setType($type)

View File

@ -32,9 +32,8 @@ class RuleSet implements \IteratorAggregate, \Countable
*/
public $ruleById = array();
/** @var array<255|0|1|4, string> */
/** @var array<0|1|4, string> */
protected static $types = array(
255 => 'UNKNOWN',
self::TYPE_PACKAGE => 'PACKAGE',
self::TYPE_REQUEST => 'REQUEST',
self::TYPE_LEARNED => 'LEARNED',
@ -57,7 +56,7 @@ class RuleSet implements \IteratorAggregate, \Countable
}
/**
* @param 255|self::TYPE_* $type
* @param self::TYPE_* $type
* @return void
*/
public function add(Rule $rule, $type)
@ -182,7 +181,6 @@ class RuleSet implements \IteratorAggregate, \Countable
public function getTypes()
{
$types = self::$types;
unset($types[255]);
return array_keys($types);
}

View File

@ -145,7 +145,7 @@ class RuleSetGenerator
* To be able to directly pass in the result of one of the rule creation
* methods null is allowed which will not insert a rule.
*
* @param 255|RuleSet::TYPE_* $type A TYPE_* constant defining the rule type
* @param RuleSet::TYPE_* $type A TYPE_* constant defining the rule type
* @param Rule $newRule The rule about to be added
*
* @return void