* indexed columns
* @var string[]
*/
- protected array $columns;
+ private array $columns;
/**
* is `true` if index name has been automatically generated
*/
- protected bool $generatedName = false;
+ private bool $generatedName = false;
/**
* name of index
*/
- protected string $name;
+ private string $name;
/**
* type of index (see `*_TYPE` constants)
*/
- protected ?string $type = null;
+ private ?string $type = null;
const DEFAULT_TYPE = null;
/**
* Creates a new `DatabaseTableIndex` object.
*/
- protected function __construct(string $name)
+ private function __construct(string $name)
{
$this->name = $name;
}
* @param string[] $columns indexed columns
* @return $this
*/
- public function columns(array $columns): self
+ public function columns(array $columns): static
{
$this->columns = \array_values($columns);
*
* @return $this
*/
- public function generatedName(string $name): self
+ public function generatedName(string $name): static
{
$this->name($name);
$this->generatedName = true;
*
* @return $this
*/
- public function name(string $name): self
+ public function name(string $name): static
{
$this->name = $name;
*
* @throws \InvalidArgumentException if given type is invalid
*/
- public function type(?string $type): self
+ public function type(?string $type): static
{
if (
$type !== static::DEFAULT_TYPE
/**
* Returns a `DatabaseTableIndex` object with the given name.
*/
- public static function create(string $name): self
+ public static function create(string $name): static
{
- return new self($name);
+ return new static($name);
}
/**
*
* @param array $data data returned by `DatabaseEditor::getIndexInformation()`
*/
- public static function createFromData(string $name, array $data): self
+ public static function createFromData(string $name, array $data): static
{
return self::create($name)
->type($data['type'])