diff options
Diffstat (limited to 'src/Components/IndexHint.php')
-rw-r--r-- | src/Components/IndexHint.php | 31 |
1 files changed, 13 insertions, 18 deletions
diff --git a/src/Components/IndexHint.php b/src/Components/IndexHint.php index 254152e..9b2f44e 100644 --- a/src/Components/IndexHint.php +++ b/src/Components/IndexHint.php @@ -1,8 +1,8 @@ <?php - /** * Parses an Index hint. */ +declare(strict_types=1); namespace PhpMyAdmin\SqlParser\Components; @@ -13,10 +13,6 @@ use PhpMyAdmin\SqlParser\TokensList; /** * Parses an Index hint. - * - * @category Components - * - * @license https://www.gnu.org/licenses/gpl-2.0.txt GPL-2.0+ */ class IndexHint extends Component { @@ -46,17 +42,15 @@ class IndexHint extends Component * * @var array */ - public $indexes = array(); + public $indexes = []; /** - * Constructor. - * * @param string $type the type of hint (USE/FORCE/IGNORE) * @param string $indexOrKey What the hint is for (INDEX/KEY) * @param string $for the clause for which this hint is (JOIN/ORDER BY/GROUP BY) - * @param string $indexes List of indexes in this hint + * @param array $indexes List of indexes in this hint */ - public function __construct(string $type = null, string $indexOrKey = null, string $for = null, array $indexes = array()) + public function __construct(string $type = null, string $indexOrKey = null, string $for = null, array $indexes = []) { $this->type = $type; $this->indexOrKey = $indexOrKey; @@ -71,10 +65,10 @@ class IndexHint extends Component * * @return IndexHint|Component[] */ - public static function parse(Parser $parser, TokensList $list, array $options = array()) + public static function parse(Parser $parser, TokensList $list, array $options = []) { - $ret = array(); - $expr = new self(); + $ret = []; + $expr = new static(); $expr->type = isset($options['type']) ? $options['type'] : null; /** * The state of the parser. @@ -86,6 +80,7 @@ class IndexHint extends Component * 2 -------------------- [ expr_list ] --------------------> 0 * 3 -------------- [ JOIN/GROUP BY/ORDER BY ] -------------> 4 * 4 -------------------- [ expr_list ] --------------------> 0 + * * @var int */ $state = 0; @@ -143,7 +138,7 @@ class IndexHint extends Component $expr->indexes = ExpressionArray::parse($parser, $list); $state = 0; $ret[] = $expr; - $expr = new self(); + $expr = new static(); } break; case 3: @@ -163,7 +158,7 @@ class IndexHint extends Component $expr->indexes = ExpressionArray::parse($parser, $list); $state = 0; $ret[] = $expr; - $expr = new self(); + $expr = new static(); break; } } @@ -173,12 +168,12 @@ class IndexHint extends Component } /** - * @param ArrayObj|ArrayObj[] $component the component to be built - * @param array $options parameters for building + * @param IndexHint|IndexHint[] $component the component to be built + * @param array $options parameters for building * * @return string */ - public static function build($component, array $options = array()) + public static function build($component, array $options = []) { if (is_array($component)) { return implode(' ', $component); |