+ * $q = new Doctrine_Query();
+ * $e = $q->expr;
+ * $q->select('*')->from('table')
+ * ->where($e->eq('id', $e->not('null'));
+ *
+ *
+ * @param string $expression
+ *
+ * @return string The logical expression.
+ */
+ public function getNotExpression($expression)
+ {
+ return 'NOT(' . $expression . ')';
+ }
+
+ /**
+ * Returns the SQL that checks if an expression is null.
+ *
+ * @param string $expression The expression that should be compared to null.
+ *
+ * @return string The logical expression.
+ */
+ public function getIsNullExpression($expression)
+ {
+ return $expression . ' IS NULL';
+ }
+
+ /**
+ * Returns the SQL that checks if an expression is not null.
+ *
+ * @param string $expression The expression that should be compared to null.
+ *
+ * @return string The logical expression.
+ */
+ public function getIsNotNullExpression($expression)
+ {
+ return $expression . ' IS NOT NULL';
+ }
+
+ /**
+ * Returns the SQL that checks if an expression evaluates to a value between two values.
+ *
+ * The parameter $expression is checked if it is between $value1 and $value2.
+ *
+ * Note: There is a slight difference in the way BETWEEN works on some databases.
+ * http://www.w3schools.com/sql/sql_between.asp. If you want complete database
+ * independence you should avoid using between().
+ *
+ * @param string $expression The value to compare to.
+ * @param string $value1 The lower value to compare with.
+ * @param string $value2 The higher value to compare with.
+ *
+ * @return string The logical expression.
+ */
+ public function getBetweenExpression($expression, $value1, $value2)
+ {
+ return $expression . ' BETWEEN ' . $value1 . ' AND ' . $value2;
+ }
+
+ /**
+ * Returns the SQL to get the arccosine of a value.
+ *
+ * @param string $value
+ *
+ * @return string
+ */
+ public function getAcosExpression($value)
+ {
+ return 'ACOS(' . $value . ')';
+ }
+
+ /**
+ * Returns the SQL to get the sine of a value.
+ *
+ * @param string $value
+ *
+ * @return string
+ */
+ public function getSinExpression($value)
+ {
+ return 'SIN(' . $value . ')';
+ }
+
+ /**
+ * Returns the SQL to get the PI value.
+ *
+ * @return string
+ */
+ public function getPiExpression()
+ {
+ return 'PI()';
+ }
+
+ /**
+ * Returns the SQL to get the cosine of a value.
+ *
+ * @param string $value
+ *
+ * @return string
+ */
+ public function getCosExpression($value)
+ {
+ return 'COS(' . $value . ')';
+ }
+
+ /**
+ * Returns the SQL to calculate the difference in days between the two passed dates.
+ *
+ * Computes diff = date1 - date2.
+ *
+ * @param string $date1
+ * @param string $date2
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to add the number of given seconds to a date.
+ *
+ * @param string $date
+ * @param int $seconds
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddSecondsExpression($date, $seconds)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $seconds, DateIntervalUnit::SECOND);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given seconds from a date.
+ *
+ * @param string $date
+ * @param int $seconds
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubSecondsExpression($date, $seconds)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $seconds, DateIntervalUnit::SECOND);
+ }
+
+ /**
+ * Returns the SQL to add the number of given minutes to a date.
+ *
+ * @param string $date
+ * @param int $minutes
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddMinutesExpression($date, $minutes)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $minutes, DateIntervalUnit::MINUTE);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given minutes from a date.
+ *
+ * @param string $date
+ * @param int $minutes
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubMinutesExpression($date, $minutes)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $minutes, DateIntervalUnit::MINUTE);
+ }
+
+ /**
+ * Returns the SQL to add the number of given hours to a date.
+ *
+ * @param string $date
+ * @param int $hours
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddHourExpression($date, $hours)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $hours, DateIntervalUnit::HOUR);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given hours to a date.
+ *
+ * @param string $date
+ * @param int $hours
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubHourExpression($date, $hours)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $hours, DateIntervalUnit::HOUR);
+ }
+
+ /**
+ * Returns the SQL to add the number of given days to a date.
+ *
+ * @param string $date
+ * @param int $days
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddDaysExpression($date, $days)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $days, DateIntervalUnit::DAY);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given days to a date.
+ *
+ * @param string $date
+ * @param int $days
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubDaysExpression($date, $days)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $days, DateIntervalUnit::DAY);
+ }
+
+ /**
+ * Returns the SQL to add the number of given weeks to a date.
+ *
+ * @param string $date
+ * @param int $weeks
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddWeeksExpression($date, $weeks)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $weeks, DateIntervalUnit::WEEK);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given weeks from a date.
+ *
+ * @param string $date
+ * @param int $weeks
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubWeeksExpression($date, $weeks)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $weeks, DateIntervalUnit::WEEK);
+ }
+
+ /**
+ * Returns the SQL to add the number of given months to a date.
+ *
+ * @param string $date
+ * @param int $months
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddMonthExpression($date, $months)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $months, DateIntervalUnit::MONTH);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given months to a date.
+ *
+ * @param string $date
+ * @param int $months
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubMonthExpression($date, $months)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $months, DateIntervalUnit::MONTH);
+ }
+
+ /**
+ * Returns the SQL to add the number of given quarters to a date.
+ *
+ * @param string $date
+ * @param int $quarters
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddQuartersExpression($date, $quarters)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $quarters, DateIntervalUnit::QUARTER);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given quarters from a date.
+ *
+ * @param string $date
+ * @param int $quarters
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubQuartersExpression($date, $quarters)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $quarters, DateIntervalUnit::QUARTER);
+ }
+
+ /**
+ * Returns the SQL to add the number of given years to a date.
+ *
+ * @param string $date
+ * @param int $years
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateAddYearsExpression($date, $years)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '+', $years, DateIntervalUnit::YEAR);
+ }
+
+ /**
+ * Returns the SQL to subtract the number of given years from a date.
+ *
+ * @param string $date
+ * @param int $years
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateSubYearsExpression($date, $years)
+ {
+ return $this->getDateArithmeticIntervalExpression($date, '-', $years, DateIntervalUnit::YEAR);
+ }
+
+ /**
+ * Returns the SQL for a date arithmetic expression.
+ *
+ * @param string $date The column or literal representing a date to perform the arithmetic operation on.
+ * @param string $operator The arithmetic operator (+ or -).
+ * @param int $interval The interval that shall be calculated into the date.
+ * @param string $unit The unit of the interval that shall be calculated into the date.
+ * One of the DATE_INTERVAL_UNIT_* constants.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL bit AND comparison expression.
+ *
+ * @param string $value1
+ * @param string $value2
+ *
+ * @return string
+ */
+ public function getBitAndComparisonExpression($value1, $value2)
+ {
+ return '(' . $value1 . ' & ' . $value2 . ')';
+ }
+
+ /**
+ * Returns the SQL bit OR comparison expression.
+ *
+ * @param string $value1
+ * @param string $value2
+ *
+ * @return string
+ */
+ public function getBitOrComparisonExpression($value1, $value2)
+ {
+ return '(' . $value1 . ' | ' . $value2 . ')';
+ }
+
+ /**
+ * Returns the FOR UPDATE expression.
+ *
+ * @return string
+ */
+ public function getForUpdateSQL()
+ {
+ return 'FOR UPDATE';
+ }
+
+ /**
+ * Honors that some SQL vendors such as MsSql use table hints for locking instead of the ANSI SQL FOR UPDATE specification.
+ *
+ * @param string $fromClause The FROM clause to append the hint for the given lock mode to.
+ * @param int|null $lockMode One of the Doctrine\DBAL\LockMode::* constants. If null is given, nothing will
+ * be appended to the FROM clause.
+ *
+ * @return string
+ */
+ public function appendLockHint($fromClause, $lockMode)
+ {
+ return $fromClause;
+ }
+
+ /**
+ * Returns the SQL snippet to append to any SELECT statement which locks rows in shared read lock.
+ *
+ * This defaults to the ANSI SQL "FOR UPDATE", which is an exclusive lock (Write). Some database
+ * vendors allow to lighten this constraint up to be a real read lock.
+ *
+ * @return string
+ */
+ public function getReadLockSQL()
+ {
+ return $this->getForUpdateSQL();
+ }
+
+ /**
+ * Returns the SQL snippet to append to any SELECT statement which obtains an exclusive lock on the rows.
+ *
+ * The semantics of this lock mode should equal the SELECT .. FOR UPDATE of the ANSI SQL standard.
+ *
+ * @return string
+ */
+ public function getWriteLockSQL()
+ {
+ return $this->getForUpdateSQL();
+ }
+
+ /**
+ * Returns the SQL snippet to drop an existing database.
+ *
+ * @param string $database The name of the database that should be dropped.
+ *
+ * @return string
+ */
+ public function getDropDatabaseSQL($database)
+ {
+ return 'DROP DATABASE ' . $database;
+ }
+
+ /**
+ * Returns the SQL snippet to drop an existing table.
+ *
+ * @param Table|string $table
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getDropTableSQL($table)
+ {
+ $tableArg = $table;
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ if (! is_string($table)) {
+ throw new InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
+
+ if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaDropTable)) {
+ $eventArgs = new SchemaDropTableEventArgs($tableArg, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaDropTable, $eventArgs);
+
+ if ($eventArgs->isDefaultPrevented()) {
+ return $eventArgs->getSql();
+ }
+ }
+
+ return 'DROP TABLE ' . $table;
+ }
+
+ /**
+ * Returns the SQL to safely drop a temporary table WITHOUT implicitly committing an open transaction.
+ *
+ * @param Table|string $table
+ *
+ * @return string
+ */
+ public function getDropTemporaryTableSQL($table)
+ {
+ return $this->getDropTableSQL($table);
+ }
+
+ /**
+ * Returns the SQL to drop an index from a table.
+ *
+ * @param Index|string $index
+ * @param Table|string $table
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getDropIndexSQL($index, $table = null)
+ {
+ if ($index instanceof Index) {
+ $index = $index->getQuotedName($this);
+ } elseif (! is_string($index)) {
+ throw new InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
+ }
+
+ return 'DROP INDEX ' . $index;
+ }
+
+ /**
+ * Returns the SQL to drop a constraint.
+ *
+ * @param Constraint|string $constraint
+ * @param Table|string $table
+ *
+ * @return string
+ */
+ public function getDropConstraintSQL($constraint, $table)
+ {
+ if (! $constraint instanceof Constraint) {
+ $constraint = new Identifier($constraint);
+ }
+
+ if (! $table instanceof Table) {
+ $table = new Identifier($table);
+ }
+
+ $constraint = $constraint->getQuotedName($this);
+ $table = $table->getQuotedName($this);
+
+ return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $constraint;
+ }
+
+ /**
+ * Returns the SQL to drop a foreign key.
+ *
+ * @param ForeignKeyConstraint|string $foreignKey
+ * @param Table|string $table
+ *
+ * @return string
+ */
+ public function getDropForeignKeySQL($foreignKey, $table)
+ {
+ if (! $foreignKey instanceof ForeignKeyConstraint) {
+ $foreignKey = new Identifier($foreignKey);
+ }
+
+ if (! $table instanceof Table) {
+ $table = new Identifier($table);
+ }
+
+ $foreignKey = $foreignKey->getQuotedName($this);
+ $table = $table->getQuotedName($this);
+
+ return 'ALTER TABLE ' . $table . ' DROP FOREIGN KEY ' . $foreignKey;
+ }
+
+ /**
+ * Returns the SQL statement(s) to create a table with the specified name, columns and constraints
+ * on this platform.
+ *
+ * @param int $createFlags
+ *
+ * @return string[] The sequence of SQL statements.
+ *
+ * @throws DBALException
+ * @throws InvalidArgumentException
+ */
+ public function getCreateTableSQL(Table $table, $createFlags = self::CREATE_INDEXES)
+ {
+ if (! is_int($createFlags)) {
+ throw new InvalidArgumentException('Second argument of AbstractPlatform::getCreateTableSQL() has to be integer.');
+ }
+
+ if (count($table->getColumns()) === 0) {
+ throw DBALException::noColumnsSpecifiedForTable($table->getName());
+ }
+
+ $tableName = $table->getQuotedName($this);
+ $options = $table->getOptions();
+ $options['uniqueConstraints'] = [];
+ $options['indexes'] = [];
+ $options['primary'] = [];
+
+ if (($createFlags&self::CREATE_INDEXES) > 0) {
+ foreach ($table->getIndexes() as $index) {
+ /** @var $index Index */
+ if ($index->isPrimary()) {
+ $options['primary'] = $index->getQuotedColumns($this);
+ $options['primary_index'] = $index;
+ } else {
+ $options['indexes'][$index->getQuotedName($this)] = $index;
+ }
+ }
+ }
+
+ $columnSql = [];
+ $columns = [];
+
+ foreach ($table->getColumns() as $column) {
+ if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaCreateTableColumn)) {
+ $eventArgs = new SchemaCreateTableColumnEventArgs($column, $table, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaCreateTableColumn, $eventArgs);
+
+ $columnSql = array_merge($columnSql, $eventArgs->getSql());
+
+ if ($eventArgs->isDefaultPrevented()) {
+ continue;
+ }
+ }
+
+ $columnData = $column->toArray();
+ $columnData['name'] = $column->getQuotedName($this);
+ $columnData['version'] = $column->hasPlatformOption('version') ? $column->getPlatformOption('version') : false;
+ $columnData['comment'] = $this->getColumnComment($column);
+
+ if ($columnData['type'] instanceof Types\StringType && $columnData['length'] === null) {
+ $columnData['length'] = 255;
+ }
+
+ if (in_array($column->getName(), $options['primary'])) {
+ $columnData['primary'] = true;
+ }
+
+ $columns[$columnData['name']] = $columnData;
+ }
+
+ if (($createFlags&self::CREATE_FOREIGNKEYS) > 0) {
+ $options['foreignKeys'] = [];
+ foreach ($table->getForeignKeys() as $fkConstraint) {
+ $options['foreignKeys'][] = $fkConstraint;
+ }
+ }
+
+ if ($this->_eventManager !== null && $this->_eventManager->hasListeners(Events::onSchemaCreateTable)) {
+ $eventArgs = new SchemaCreateTableEventArgs($table, $columns, $options, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaCreateTable, $eventArgs);
+
+ if ($eventArgs->isDefaultPrevented()) {
+ return array_merge($eventArgs->getSql(), $columnSql);
+ }
+ }
+
+ $sql = $this->_getCreateTableSQL($tableName, $columns, $options);
+ if ($this->supportsCommentOnStatement()) {
+ foreach ($table->getColumns() as $column) {
+ $comment = $this->getColumnComment($column);
+
+ if ($comment === null || $comment === '') {
+ continue;
+ }
+
+ $sql[] = $this->getCommentOnColumnSQL($tableName, $column->getQuotedName($this), $comment);
+ }
+ }
+
+ return array_merge($sql, $columnSql);
+ }
+
+ /**
+ * @param string $tableName
+ * @param string $columnName
+ * @param string $comment
+ *
+ * @return string
+ */
+ public function getCommentOnColumnSQL($tableName, $columnName, $comment)
+ {
+ $tableName = new Identifier($tableName);
+ $columnName = new Identifier($columnName);
+ $comment = $this->quoteStringLiteral($comment);
+
+ return sprintf(
+ 'COMMENT ON COLUMN %s.%s IS %s',
+ $tableName->getQuotedName($this),
+ $columnName->getQuotedName($this),
+ $comment
+ );
+ }
+
+ /**
+ * Returns the SQL to create inline comment on a column.
+ *
+ * @param string $comment
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getInlineColumnCommentSQL($comment)
+ {
+ if (! $this->supportsInlineColumnComments()) {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ return 'COMMENT ' . $this->quoteStringLiteral($comment);
+ }
+
+ /**
+ * Returns the SQL used to create a table.
+ *
+ * @param string $tableName
+ * @param mixed[][] $columns
+ * @param mixed[] $options
+ *
+ * @return string[]
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $columnListSql = $this->getColumnDeclarationListSQL($columns);
+
+ if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
+ foreach ($options['uniqueConstraints'] as $name => $definition) {
+ $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
+ }
+ }
+
+ if (isset($options['primary']) && ! empty($options['primary'])) {
+ $columnListSql .= ', PRIMARY KEY(' . implode(', ', array_unique(array_values($options['primary']))) . ')';
+ }
+
+ if (isset($options['indexes']) && ! empty($options['indexes'])) {
+ foreach ($options['indexes'] as $index => $definition) {
+ $columnListSql .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
+ }
+ }
+
+ $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;
+
+ $check = $this->getCheckDeclarationSQL($columns);
+ if (! empty($check)) {
+ $query .= ', ' . $check;
+ }
+ $query .= ')';
+
+ $sql[] = $query;
+
+ if (isset($options['foreignKeys'])) {
+ foreach ((array) $options['foreignKeys'] as $definition) {
+ $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * @return string
+ */
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return 'CREATE TEMPORARY TABLE';
+ }
+
+ /**
+ * Returns the SQL to create a sequence on this platform.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getCreateSequenceSQL(Sequence $sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to change a sequence on this platform.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getAlterSequenceSQL(Sequence $sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to create a constraint on a table on this platform.
+ *
+ * @param Table|string $table
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getCreateConstraintSQL(Constraint $constraint, $table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ $query = 'ALTER TABLE ' . $table . ' ADD CONSTRAINT ' . $constraint->getQuotedName($this);
+
+ $columnList = '(' . implode(', ', $constraint->getQuotedColumns($this)) . ')';
+
+ $referencesClause = '';
+ if ($constraint instanceof Index) {
+ if ($constraint->isPrimary()) {
+ $query .= ' PRIMARY KEY';
+ } elseif ($constraint->isUnique()) {
+ $query .= ' UNIQUE';
+ } else {
+ throw new InvalidArgumentException(
+ 'Can only create primary or unique constraints, no common indexes with getCreateConstraintSQL().'
+ );
+ }
+ } elseif ($constraint instanceof ForeignKeyConstraint) {
+ $query .= ' FOREIGN KEY';
+
+ $referencesClause = ' REFERENCES ' . $constraint->getQuotedForeignTableName($this) .
+ ' (' . implode(', ', $constraint->getQuotedForeignColumns($this)) . ')';
+ }
+ $query .= ' ' . $columnList . $referencesClause;
+
+ return $query;
+ }
+
+ /**
+ * Returns the SQL to create an index on a table on this platform.
+ *
+ * @param Table|string $table The name of the table on which the index is to be created.
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getCreateIndexSQL(Index $index, $table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+ $name = $index->getQuotedName($this);
+ $columns = $index->getColumns();
+
+ if (count($columns) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ if ($index->isPrimary()) {
+ return $this->getCreatePrimaryKeySQL($index, $table);
+ }
+
+ $query = 'CREATE ' . $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name . ' ON ' . $table;
+ $query .= ' (' . $this->getIndexFieldDeclarationListSQL($index) . ')' . $this->getPartialIndexSQL($index);
+
+ return $query;
+ }
+
+ /**
+ * Adds condition for partial index.
+ *
+ * @return string
+ */
+ protected function getPartialIndexSQL(Index $index)
+ {
+ if ($this->supportsPartialIndexes() && $index->hasOption('where')) {
+ return ' WHERE ' . $index->getOption('where');
+ }
+
+ return '';
+ }
+
+ /**
+ * Adds additional flags for index generation.
+ *
+ * @return string
+ */
+ protected function getCreateIndexSQLFlags(Index $index)
+ {
+ return $index->isUnique() ? 'UNIQUE ' : '';
+ }
+
+ /**
+ * Returns the SQL to create an unnamed primary key constraint.
+ *
+ * @param Table|string $table
+ *
+ * @return string
+ */
+ public function getCreatePrimaryKeySQL(Index $index, $table)
+ {
+ return 'ALTER TABLE ' . $table . ' ADD PRIMARY KEY (' . $this->getIndexFieldDeclarationListSQL($index) . ')';
+ }
+
+ /**
+ * Returns the SQL to create a named schema.
+ *
+ * @param string $schemaName
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getCreateSchemaSQL($schemaName)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Quotes a string so that it can be safely used as a table or column name,
+ * even if it is a reserved word of the platform. This also detects identifier
+ * chains separated by dot and quotes them independently.
+ *
+ * NOTE: Just because you CAN use quoted identifiers doesn't mean
+ * you SHOULD use them. In general, they end up causing way more
+ * problems than they solve.
+ *
+ * @param string $str The identifier name to be quoted.
+ *
+ * @return string The quoted identifier string.
+ */
+ public function quoteIdentifier($str)
+ {
+ if (strpos($str, '.') !== false) {
+ $parts = array_map([$this, 'quoteSingleIdentifier'], explode('.', $str));
+
+ return implode('.', $parts);
+ }
+
+ return $this->quoteSingleIdentifier($str);
+ }
+
+ /**
+ * Quotes a single identifier (no dot chain separation).
+ *
+ * @param string $str The identifier name to be quoted.
+ *
+ * @return string The quoted identifier string.
+ */
+ public function quoteSingleIdentifier($str)
+ {
+ $c = $this->getIdentifierQuoteCharacter();
+
+ return $c . str_replace($c, $c . $c, $str) . $c;
+ }
+
+ /**
+ * Returns the SQL to create a new foreign key.
+ *
+ * @param ForeignKeyConstraint $foreignKey The foreign key constraint.
+ * @param Table|string $table The name of the table on which the foreign key is to be created.
+ *
+ * @return string
+ */
+ public function getCreateForeignKeySQL(ForeignKeyConstraint $foreignKey, $table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'ALTER TABLE ' . $table . ' ADD ' . $this->getForeignKeyDeclarationSQL($foreignKey);
+ }
+
+ /**
+ * Gets the SQL statements for altering an existing table.
+ *
+ * This method returns an array of SQL statements, since some platforms need several statements.
+ *
+ * @return string[]
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param mixed[] $columnSql
+ *
+ * @return bool
+ */
+ protected function onSchemaAlterTableAddColumn(Column $column, TableDiff $diff, &$columnSql)
+ {
+ if ($this->_eventManager === null) {
+ return false;
+ }
+
+ if (! $this->_eventManager->hasListeners(Events::onSchemaAlterTableAddColumn)) {
+ return false;
+ }
+
+ $eventArgs = new SchemaAlterTableAddColumnEventArgs($column, $diff, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableAddColumn, $eventArgs);
+
+ $columnSql = array_merge($columnSql, $eventArgs->getSql());
+
+ return $eventArgs->isDefaultPrevented();
+ }
+
+ /**
+ * @param string[] $columnSql
+ *
+ * @return bool
+ */
+ protected function onSchemaAlterTableRemoveColumn(Column $column, TableDiff $diff, &$columnSql)
+ {
+ if ($this->_eventManager === null) {
+ return false;
+ }
+
+ if (! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRemoveColumn)) {
+ return false;
+ }
+
+ $eventArgs = new SchemaAlterTableRemoveColumnEventArgs($column, $diff, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRemoveColumn, $eventArgs);
+
+ $columnSql = array_merge($columnSql, $eventArgs->getSql());
+
+ return $eventArgs->isDefaultPrevented();
+ }
+
+ /**
+ * @param string[] $columnSql
+ *
+ * @return bool
+ */
+ protected function onSchemaAlterTableChangeColumn(ColumnDiff $columnDiff, TableDiff $diff, &$columnSql)
+ {
+ if ($this->_eventManager === null) {
+ return false;
+ }
+
+ if (! $this->_eventManager->hasListeners(Events::onSchemaAlterTableChangeColumn)) {
+ return false;
+ }
+
+ $eventArgs = new SchemaAlterTableChangeColumnEventArgs($columnDiff, $diff, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableChangeColumn, $eventArgs);
+
+ $columnSql = array_merge($columnSql, $eventArgs->getSql());
+
+ return $eventArgs->isDefaultPrevented();
+ }
+
+ /**
+ * @param string $oldColumnName
+ * @param string[] $columnSql
+ *
+ * @return bool
+ */
+ protected function onSchemaAlterTableRenameColumn($oldColumnName, Column $column, TableDiff $diff, &$columnSql)
+ {
+ if ($this->_eventManager === null) {
+ return false;
+ }
+
+ if (! $this->_eventManager->hasListeners(Events::onSchemaAlterTableRenameColumn)) {
+ return false;
+ }
+
+ $eventArgs = new SchemaAlterTableRenameColumnEventArgs($oldColumnName, $column, $diff, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaAlterTableRenameColumn, $eventArgs);
+
+ $columnSql = array_merge($columnSql, $eventArgs->getSql());
+
+ return $eventArgs->isDefaultPrevented();
+ }
+
+ /**
+ * @param string[] $sql
+ *
+ * @return bool
+ */
+ protected function onSchemaAlterTable(TableDiff $diff, &$sql)
+ {
+ if ($this->_eventManager === null) {
+ return false;
+ }
+
+ if (! $this->_eventManager->hasListeners(Events::onSchemaAlterTable)) {
+ return false;
+ }
+
+ $eventArgs = new SchemaAlterTableEventArgs($diff, $this);
+ $this->_eventManager->dispatchEvent(Events::onSchemaAlterTable, $eventArgs);
+
+ $sql = array_merge($sql, $eventArgs->getSql());
+
+ return $eventArgs->isDefaultPrevented();
+ }
+
+ /**
+ * @return string[]
+ */
+ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ $tableName = $diff->getName($this)->getQuotedName($this);
+
+ $sql = [];
+ if ($this->supportsForeignKeyConstraints()) {
+ foreach ($diff->removedForeignKeys as $foreignKey) {
+ $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
+ }
+ foreach ($diff->changedForeignKeys as $foreignKey) {
+ $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
+ }
+ }
+
+ foreach ($diff->removedIndexes as $index) {
+ $sql[] = $this->getDropIndexSQL($index, $tableName);
+ }
+ foreach ($diff->changedIndexes as $index) {
+ $sql[] = $this->getDropIndexSQL($index, $tableName);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * @return string[]
+ */
+ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ $tableName = $diff->newName !== false
+ ? $diff->getNewName()->getQuotedName($this)
+ : $diff->getName($this)->getQuotedName($this);
+
+ $sql = [];
+
+ if ($this->supportsForeignKeyConstraints()) {
+ foreach ($diff->addedForeignKeys as $foreignKey) {
+ $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
+ }
+
+ foreach ($diff->changedForeignKeys as $foreignKey) {
+ $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
+ }
+ }
+
+ foreach ($diff->addedIndexes as $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+
+ foreach ($diff->changedIndexes as $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+
+ foreach ($diff->renamedIndexes as $oldIndexName => $index) {
+ $oldIndexName = new Identifier($oldIndexName);
+ $sql = array_merge(
+ $sql,
+ $this->getRenameIndexSQL($oldIndexName->getQuotedName($this), $index, $tableName)
+ );
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Returns the SQL for renaming an index on a table.
+ *
+ * @param string $oldIndexName The name of the index to rename from.
+ * @param Index $index The definition of the index to rename to.
+ * @param string $tableName The table to rename the given index on.
+ *
+ * @return string[] The sequence of SQL statements for renaming the given index.
+ */
+ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
+ {
+ return [
+ $this->getDropIndexSQL($oldIndexName, $tableName),
+ $this->getCreateIndexSQL($index, $tableName),
+ ];
+ }
+
+ /**
+ * Common code for alter table statement generation that updates the changed Index and Foreign Key definitions.
+ *
+ * @return string[]
+ */
+ protected function _getAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ return array_merge($this->getPreAlterTableIndexForeignKeySQL($diff), $this->getPostAlterTableIndexForeignKeySQL($diff));
+ }
+
+ /**
+ * Gets declaration of a number of fields in bulk.
+ *
+ * @param mixed[][] $fields A multidimensional associative array.
+ * The first dimension determines the field name, while the second
+ * dimension is keyed with the name of the properties
+ * of the field being declared as array indexes. Currently, the types
+ * of supported field properties are as follows:
+ *
+ * length
+ * Integer value that determines the maximum length of the text
+ * field. If this argument is missing the field should be
+ * declared to have the longest length allowed by the DBMS.
+ *
+ * default
+ * Text value to be used as default for this field.
+ *
+ * notnull
+ * Boolean flag that indicates whether this field is constrained
+ * to not be set to null.
+ * charset
+ * Text value with the default CHARACTER SET for this field.
+ * collation
+ * Text value with the default COLLATION for this field.
+ * unique
+ * unique constraint
+ *
+ * @return string
+ */
+ public function getColumnDeclarationListSQL(array $fields)
+ {
+ $queryFields = [];
+
+ foreach ($fields as $fieldName => $field) {
+ $queryFields[] = $this->getColumnDeclarationSQL($fieldName, $field);
+ }
+
+ return implode(', ', $queryFields);
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to declare a generic type
+ * field to be used in statements like CREATE TABLE.
+ *
+ * @param string $name The name the field to be declared.
+ * @param mixed[] $field An associative array with the name of the properties
+ * of the field being declared as array indexes. Currently, the types
+ * of supported field properties are as follows:
+ *
+ * length
+ * Integer value that determines the maximum length of the text
+ * field. If this argument is missing the field should be
+ * declared to have the longest length allowed by the DBMS.
+ *
+ * default
+ * Text value to be used as default for this field.
+ *
+ * notnull
+ * Boolean flag that indicates whether this field is constrained
+ * to not be set to null.
+ * charset
+ * Text value with the default CHARACTER SET for this field.
+ * collation
+ * Text value with the default COLLATION for this field.
+ * unique
+ * unique constraint
+ * check
+ * column check constraint
+ * columnDefinition
+ * a string that defines the complete column
+ *
+ * @return string DBMS specific SQL code portion that should be used to declare the column.
+ */
+ public function getColumnDeclarationSQL($name, array $field)
+ {
+ if (isset($field['columnDefinition'])) {
+ $columnDef = $this->getCustomTypeDeclarationSQL($field);
+ } else {
+ $default = $this->getDefaultValueDeclarationSQL($field);
+
+ $charset = isset($field['charset']) && $field['charset'] ?
+ ' ' . $this->getColumnCharsetDeclarationSQL($field['charset']) : '';
+
+ $collation = isset($field['collation']) && $field['collation'] ?
+ ' ' . $this->getColumnCollationDeclarationSQL($field['collation']) : '';
+
+ $notnull = isset($field['notnull']) && $field['notnull'] ? ' NOT NULL' : '';
+
+ $unique = isset($field['unique']) && $field['unique'] ?
+ ' ' . $this->getUniqueFieldDeclarationSQL() : '';
+
+ $check = isset($field['check']) && $field['check'] ?
+ ' ' . $field['check'] : '';
+
+ $typeDecl = $field['type']->getSQLDeclaration($field, $this);
+ $columnDef = $typeDecl . $charset . $default . $notnull . $unique . $check . $collation;
+
+ if ($this->supportsInlineColumnComments() && isset($field['comment']) && $field['comment'] !== '') {
+ $columnDef .= ' ' . $this->getInlineColumnCommentSQL($field['comment']);
+ }
+ }
+
+ return $name . ' ' . $columnDef;
+ }
+
+ /**
+ * Returns the SQL snippet that declares a floating point column of arbitrary precision.
+ *
+ * @param mixed[] $columnDef
+ *
+ * @return string
+ */
+ public function getDecimalTypeDeclarationSQL(array $columnDef)
+ {
+ $columnDef['precision'] = ! isset($columnDef['precision']) || empty($columnDef['precision'])
+ ? 10 : $columnDef['precision'];
+ $columnDef['scale'] = ! isset($columnDef['scale']) || empty($columnDef['scale'])
+ ? 0 : $columnDef['scale'];
+
+ return 'NUMERIC(' . $columnDef['precision'] . ', ' . $columnDef['scale'] . ')';
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set a default value
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param mixed[] $field The field definition array.
+ *
+ * @return string DBMS specific SQL code portion needed to set a default value.
+ */
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ if (! isset($field['default'])) {
+ return empty($field['notnull']) ? ' DEFAULT NULL' : '';
+ }
+
+ $default = $field['default'];
+
+ if (! isset($field['type'])) {
+ return " DEFAULT '" . $default . "'";
+ }
+
+ $type = $field['type'];
+
+ if ($type instanceof Types\PhpIntegerMappingType) {
+ return ' DEFAULT ' . $default;
+ }
+
+ if ($type instanceof Types\PhpDateTimeMappingType && $default === $this->getCurrentTimestampSQL()) {
+ return ' DEFAULT ' . $this->getCurrentTimestampSQL();
+ }
+
+ if ($type instanceof Types\TimeType && $default === $this->getCurrentTimeSQL()) {
+ return ' DEFAULT ' . $this->getCurrentTimeSQL();
+ }
+
+ if ($type instanceof Types\DateType && $default === $this->getCurrentDateSQL()) {
+ return ' DEFAULT ' . $this->getCurrentDateSQL();
+ }
+
+ if ($type instanceof Types\BooleanType) {
+ return " DEFAULT '" . $this->convertBooleans($default) . "'";
+ }
+
+ return " DEFAULT '" . $default . "'";
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set a CHECK constraint
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param mixed[][] $definition The check definition.
+ *
+ * @return string DBMS specific SQL code portion needed to set a CHECK constraint.
+ */
+ public function getCheckDeclarationSQL(array $definition)
+ {
+ $constraints = [];
+ foreach ($definition as $field => $def) {
+ if (is_string($def)) {
+ $constraints[] = 'CHECK (' . $def . ')';
+ } else {
+ if (isset($def['min'])) {
+ $constraints[] = 'CHECK (' . $field . ' >= ' . $def['min'] . ')';
+ }
+
+ if (isset($def['max'])) {
+ $constraints[] = 'CHECK (' . $field . ' <= ' . $def['max'] . ')';
+ }
+ }
+ }
+
+ return implode(', ', $constraints);
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set a unique
+ * constraint declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $name The name of the unique constraint.
+ * @param Index $index The index definition.
+ *
+ * @return string DBMS specific SQL code portion needed to set a constraint.
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getUniqueConstraintDeclarationSQL($name, Index $index)
+ {
+ $columns = $index->getColumns();
+ $name = new Identifier($name);
+
+ if (count($columns) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ return 'CONSTRAINT ' . $name->getQuotedName($this) . ' UNIQUE ('
+ . $this->getIndexFieldDeclarationListSQL($index)
+ . ')' . $this->getPartialIndexSQL($index);
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set an index
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $name The name of the index.
+ * @param Index $index The index definition.
+ *
+ * @return string DBMS specific SQL code portion needed to set an index.
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getIndexDeclarationSQL($name, Index $index)
+ {
+ $columns = $index->getColumns();
+ $name = new Identifier($name);
+
+ if (count($columns) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ return $this->getCreateIndexSQLFlags($index) . 'INDEX ' . $name->getQuotedName($this) . ' ('
+ . $this->getIndexFieldDeclarationListSQL($index)
+ . ')' . $this->getPartialIndexSQL($index);
+ }
+
+ /**
+ * Obtains SQL code portion needed to create a custom column,
+ * e.g. when a field has the "columnDefinition" keyword.
+ * Only "AUTOINCREMENT" and "PRIMARY KEY" are added if appropriate.
+ *
+ * @param mixed[] $columnDef
+ *
+ * @return string
+ */
+ public function getCustomTypeDeclarationSQL(array $columnDef)
+ {
+ return $columnDef['columnDefinition'];
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set an index
+ * declaration to be used in statements like CREATE TABLE.
+ *
+ * @param mixed[]|Index $columnsOrIndex array declaration is deprecated, prefer passing Index to this method
+ */
+ public function getIndexFieldDeclarationListSQL($columnsOrIndex) : string
+ {
+ if ($columnsOrIndex instanceof Index) {
+ return implode(', ', $columnsOrIndex->getQuotedColumns($this));
+ }
+
+ if (! is_array($columnsOrIndex)) {
+ throw new InvalidArgumentException('Fields argument should be an Index or array.');
+ }
+
+ $ret = [];
+
+ foreach ($columnsOrIndex as $column => $definition) {
+ if (is_array($definition)) {
+ $ret[] = $column;
+ } else {
+ $ret[] = $definition;
+ }
+ }
+
+ return implode(', ', $ret);
+ }
+
+ /**
+ * Returns the required SQL string that fits between CREATE ... TABLE
+ * to create the table as a temporary table.
+ *
+ * Should be overridden in driver classes to return the correct string for the
+ * specific database type.
+ *
+ * The default is to return the string "TEMPORARY" - this will result in a
+ * SQL error for any database that does not support temporary tables, or that
+ * requires a different SQL command from "CREATE TEMPORARY TABLE".
+ *
+ * @return string The string required to be placed between "CREATE" and "TABLE"
+ * to generate a temporary table, if possible.
+ */
+ public function getTemporaryTableSQL()
+ {
+ return 'TEMPORARY';
+ }
+
+ /**
+ * Some vendors require temporary table names to be qualified specially.
+ *
+ * @param string $tableName
+ *
+ * @return string
+ */
+ public function getTemporaryTableName($tableName)
+ {
+ return $tableName;
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @return string DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration.
+ */
+ public function getForeignKeyDeclarationSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $sql = $this->getForeignKeyBaseDeclarationSQL($foreignKey);
+ $sql .= $this->getAdvancedForeignKeyOptionsSQL($foreignKey);
+
+ return $sql;
+ }
+
+ /**
+ * Returns the FOREIGN KEY query section dealing with non-standard options
+ * as MATCH, INITIALLY DEFERRED, ON UPDATE, ...
+ *
+ * @param ForeignKeyConstraint $foreignKey The foreign key definition.
+ *
+ * @return string
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $query = '';
+ if ($this->supportsForeignKeyOnUpdate() && $foreignKey->hasOption('onUpdate')) {
+ $query .= ' ON UPDATE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onUpdate'));
+ }
+ if ($foreignKey->hasOption('onDelete')) {
+ $query .= ' ON DELETE ' . $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete'));
+ }
+
+ return $query;
+ }
+
+ /**
+ * Returns the given referential action in uppercase if valid, otherwise throws an exception.
+ *
+ * @param string $action The foreign key referential action.
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException If unknown referential action given.
+ */
+ public function getForeignKeyReferentialActionSQL($action)
+ {
+ $upper = strtoupper($action);
+ switch ($upper) {
+ case 'CASCADE':
+ case 'SET NULL':
+ case 'NO ACTION':
+ case 'RESTRICT':
+ case 'SET DEFAULT':
+ return $upper;
+ default:
+ throw new InvalidArgumentException('Invalid foreign key action: ' . $upper);
+ }
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set the FOREIGN KEY constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $sql = '';
+ if (strlen($foreignKey->getName())) {
+ $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
+ }
+ $sql .= 'FOREIGN KEY (';
+
+ if (count($foreignKey->getLocalColumns()) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'local' required.");
+ }
+ if (count($foreignKey->getForeignColumns()) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'foreign' required.");
+ }
+ if (strlen($foreignKey->getForeignTableName()) === 0) {
+ throw new InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
+ }
+
+ return $sql . implode(', ', $foreignKey->getQuotedLocalColumns($this))
+ . ') REFERENCES '
+ . $foreignKey->getQuotedForeignTableName($this) . ' ('
+ . implode(', ', $foreignKey->getQuotedForeignColumns($this)) . ')';
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set the UNIQUE constraint
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @return string DBMS specific SQL code portion needed to set the UNIQUE constraint
+ * of a field declaration.
+ */
+ public function getUniqueFieldDeclarationSQL()
+ {
+ return 'UNIQUE';
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set the CHARACTER SET
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $charset The name of the charset.
+ *
+ * @return string DBMS specific SQL code portion needed to set the CHARACTER SET
+ * of a field declaration.
+ */
+ public function getColumnCharsetDeclarationSQL($charset)
+ {
+ return '';
+ }
+
+ /**
+ * Obtains DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @param string $collation The name of the collation.
+ *
+ * @return string DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration.
+ */
+ public function getColumnCollationDeclarationSQL($collation)
+ {
+ return $this->supportsColumnCollation() ? 'COLLATE ' . $collation : '';
+ }
+
+ /**
+ * Whether the platform prefers sequences for ID generation.
+ * Subclasses should override this method to return TRUE if they prefer sequences.
+ *
+ * @return bool
+ */
+ public function prefersSequences()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform prefers identity columns (eg. autoincrement) for ID generation.
+ * Subclasses should override this method to return TRUE if they prefer identity columns.
+ *
+ * @return bool
+ */
+ public function prefersIdentityColumns()
+ {
+ return false;
+ }
+
+ /**
+ * Some platforms need the boolean values to be converted.
+ *
+ * The default conversion in this implementation converts to integers (false => 0, true => 1).
+ *
+ * Note: if the input is not a boolean the original input might be returned.
+ *
+ * There are two contexts when converting booleans: Literals and Prepared Statements.
+ * This method should handle the literal case
+ *
+ * @param mixed $item A boolean or an array of them.
+ *
+ * @return mixed A boolean database value or an array of them.
+ */
+ public function convertBooleans($item)
+ {
+ if (is_array($item)) {
+ foreach ($item as $k => $value) {
+ if (! is_bool($value)) {
+ continue;
+ }
+
+ $item[$k] = (int) $value;
+ }
+ } elseif (is_bool($item)) {
+ $item = (int) $item;
+ }
+
+ return $item;
+ }
+
+ /**
+ * Some platforms have boolean literals that needs to be correctly converted
+ *
+ * The default conversion tries to convert value into bool "(bool)$item"
+ *
+ * @param mixed $item
+ *
+ * @return bool|null
+ */
+ public function convertFromBoolean($item)
+ {
+ return $item === null ? null: (bool) $item;
+ }
+
+ /**
+ * This method should handle the prepared statements case. When there is no
+ * distinction, it's OK to use the same method.
+ *
+ * Note: if the input is not a boolean the original input might be returned.
+ *
+ * @param mixed $item A boolean or an array of them.
+ *
+ * @return mixed A boolean database value or an array of them.
+ */
+ public function convertBooleansToDatabaseValue($item)
+ {
+ return $this->convertBooleans($item);
+ }
+
+ /**
+ * Returns the SQL specific for the platform to get the current date.
+ *
+ * @return string
+ */
+ public function getCurrentDateSQL()
+ {
+ return 'CURRENT_DATE';
+ }
+
+ /**
+ * Returns the SQL specific for the platform to get the current time.
+ *
+ * @return string
+ */
+ public function getCurrentTimeSQL()
+ {
+ return 'CURRENT_TIME';
+ }
+
+ /**
+ * Returns the SQL specific for the platform to get the current timestamp
+ *
+ * @return string
+ */
+ public function getCurrentTimestampSQL()
+ {
+ return 'CURRENT_TIMESTAMP';
+ }
+
+ /**
+ * Returns the SQL for a given transaction isolation level Connection constant.
+ *
+ * @param int $level
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException
+ */
+ protected function _getTransactionIsolationLevelSQL($level)
+ {
+ switch ($level) {
+ case TransactionIsolationLevel::READ_UNCOMMITTED:
+ return 'READ UNCOMMITTED';
+ case TransactionIsolationLevel::READ_COMMITTED:
+ return 'READ COMMITTED';
+ case TransactionIsolationLevel::REPEATABLE_READ:
+ return 'REPEATABLE READ';
+ case TransactionIsolationLevel::SERIALIZABLE:
+ return 'SERIALIZABLE';
+ default:
+ throw new InvalidArgumentException('Invalid isolation level:' . $level);
+ }
+ }
+
+ /**
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListDatabasesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL statement for retrieving the namespaces defined in the database.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListNamespacesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $database
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListSequencesSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $table
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListTableConstraintsSQL($table)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $table
+ * @param string|null $database
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListTablesSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListUsersSQL()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to list all views of a database or user.
+ *
+ * @param string $database
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListViewsSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the list of indexes for the current database.
+ *
+ * The current database parameter is optional but will always be passed
+ * when using the SchemaManager API and is the database the given table is in.
+ *
+ * Attention: Some platforms only support currentDatabase when they
+ * are connected with that database. Cross-database information schema
+ * requests may be impossible.
+ *
+ * @param string $table
+ * @param string $currentDatabase
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $table
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getListTableForeignKeysSQL($table)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $name
+ * @param string $sql
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDropViewSQL($name)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL snippet to drop an existing sequence.
+ *
+ * @param Sequence|string $sequence
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDropSequenceSQL($sequence)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param string $sequenceName
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to create a new database.
+ *
+ * @param string $database The name of the database that should be created.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getCreateDatabaseSQL($database)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Returns the SQL to set the transaction isolation level.
+ *
+ * @param int $level
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtains DBMS specific SQL to be used to create datetime fields in
+ * statements like CREATE TABLE.
+ *
+ * @param mixed[] $fieldDeclaration
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtains DBMS specific SQL to be used to create datetime with timezone offset fields.
+ *
+ * @param mixed[] $fieldDeclaration
+ *
+ * @return string
+ */
+ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return $this->getDateTimeTypeDeclarationSQL($fieldDeclaration);
+ }
+
+
+ /**
+ * Obtains DBMS specific SQL to be used to create date fields in statements
+ * like CREATE TABLE.
+ *
+ * @param mixed[] $fieldDeclaration
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Obtains DBMS specific SQL to be used to create time fields in statements
+ * like CREATE TABLE.
+ *
+ * @param mixed[] $fieldDeclaration
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * @param mixed[] $fieldDeclaration
+ *
+ * @return string
+ */
+ public function getFloatDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DOUBLE PRECISION';
+ }
+
+ /**
+ * Gets the default transaction isolation level of the platform.
+ *
+ * @see TransactionIsolationLevel
+ *
+ * @return int The default isolation level.
+ */
+ public function getDefaultTransactionIsolationLevel()
+ {
+ return TransactionIsolationLevel::READ_COMMITTED;
+ }
+
+ /* supports*() methods */
+
+ /**
+ * Whether the platform supports sequences.
+ *
+ * @return bool
+ */
+ public function supportsSequences()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports identity columns.
+ *
+ * Identity columns are columns that receive an auto-generated value from the
+ * database on insert of a row.
+ *
+ * @return bool
+ */
+ public function supportsIdentityColumns()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform emulates identity columns through sequences.
+ *
+ * Some platforms that do not support identity columns natively
+ * but support sequences can emulate identity columns by using
+ * sequences.
+ *
+ * @return bool
+ */
+ public function usesSequenceEmulatedIdentityColumns()
+ {
+ return false;
+ }
+
+ /**
+ * Returns the name of the sequence for a particular identity column in a particular table.
+ *
+ * @see usesSequenceEmulatedIdentityColumns
+ *
+ * @param string $tableName The name of the table to return the sequence name for.
+ * @param string $columnName The name of the identity column in the table to return the sequence name for.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getIdentitySequenceName($tableName, $columnName)
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Whether the platform supports indexes.
+ *
+ * @return bool
+ */
+ public function supportsIndexes()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports partial indexes.
+ *
+ * @return bool
+ */
+ public function supportsPartialIndexes()
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports indexes with column length definitions.
+ */
+ public function supportsColumnLengthIndexes() : bool
+ {
+ return false;
+ }
+
+ /**
+ * Whether the platform supports altering tables.
+ *
+ * @return bool
+ */
+ public function supportsAlterTable()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports transactions.
+ *
+ * @return bool
+ */
+ public function supportsTransactions()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports savepoints.
+ *
+ * @return bool
+ */
+ public function supportsSavepoints()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports releasing savepoints.
+ *
+ * @return bool
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return $this->supportsSavepoints();
+ }
+
+ /**
+ * Whether the platform supports primary key constraints.
+ *
+ * @return bool
+ */
+ public function supportsPrimaryConstraints()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports foreign key constraints.
+ *
+ * @return bool
+ */
+ public function supportsForeignKeyConstraints()
+ {
+ return true;
+ }
+
+ /**
+ * Whether this platform supports onUpdate in foreign key constraints.
+ *
+ * @return bool
+ */
+ public function supportsForeignKeyOnUpdate()
+ {
+ return $this->supportsForeignKeyConstraints() && true;
+ }
+
+ /**
+ * Whether the platform supports database schemas.
+ *
+ * @return bool
+ */
+ public function supportsSchemas()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this platform can emulate schemas.
+ *
+ * Platforms that either support or emulate schemas don't automatically
+ * filter a schema for the namespaced elements in {@link
+ * AbstractManager#createSchema}.
+ *
+ * @return bool
+ */
+ public function canEmulateSchemas()
+ {
+ return false;
+ }
+
+ /**
+ * Returns the default schema name.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ public function getDefaultSchemaName()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Whether this platform supports create database.
+ *
+ * Some databases don't allow to create and drop databases at all or only with certain tools.
+ *
+ * @return bool
+ */
+ public function supportsCreateDropDatabase()
+ {
+ return true;
+ }
+
+ /**
+ * Whether the platform supports getting the affected rows of a recent update/delete type query.
+ *
+ * @return bool
+ */
+ public function supportsGettingAffectedRows()
+ {
+ return true;
+ }
+
+ /**
+ * Whether this platform support to add inline column comments as postfix.
+ *
+ * @return bool
+ */
+ public function supportsInlineColumnComments()
+ {
+ return false;
+ }
+
+ /**
+ * Whether this platform support the proprietary syntax "COMMENT ON asset".
+ *
+ * @return bool
+ */
+ public function supportsCommentOnStatement()
+ {
+ return false;
+ }
+
+ /**
+ * Does this platform have native guid type.
+ *
+ * @return bool
+ */
+ public function hasNativeGuidType()
+ {
+ return false;
+ }
+
+ /**
+ * Does this platform have native JSON type.
+ *
+ * @return bool
+ */
+ public function hasNativeJsonType()
+ {
+ return false;
+ }
+
+ /**
+ * @deprecated
+ *
+ * @todo Remove in 3.0
+ */
+ public function getIdentityColumnNullInsertSQL()
+ {
+ return '';
+ }
+
+ /**
+ * Whether this platform supports views.
+ *
+ * @return bool
+ */
+ public function supportsViews()
+ {
+ return true;
+ }
+
+ /**
+ * Does this platform support column collation?
+ *
+ * @return bool
+ */
+ public function supportsColumnCollation()
+ {
+ return false;
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored datetime value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateTimeFormatString()
+ {
+ return 'Y-m-d H:i:s';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored datetime with timezone value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return 'Y-m-d H:i:s';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored date value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getDateFormatString()
+ {
+ return 'Y-m-d';
+ }
+
+ /**
+ * Gets the format string, as accepted by the date() function, that describes
+ * the format of a stored time value of this platform.
+ *
+ * @return string The format string.
+ */
+ public function getTimeFormatString()
+ {
+ return 'H:i:s';
+ }
+
+ /**
+ * Adds an driver-specific LIMIT clause to the query.
+ *
+ * @param string $query
+ * @param int|null $limit
+ * @param int|null $offset
+ *
+ * @return string
+ *
+ * @throws DBALException
+ */
+ final public function modifyLimitQuery($query, $limit, $offset = null)
+ {
+ if ($limit !== null) {
+ $limit = (int) $limit;
+ }
+
+ $offset = (int) $offset;
+
+ if ($offset < 0) {
+ throw new DBALException(sprintf(
+ 'Offset must be a positive integer or zero, %d given',
+ $offset
+ ));
+ }
+
+ if ($offset > 0 && ! $this->supportsLimitOffset()) {
+ throw new DBALException(sprintf(
+ 'Platform %s does not support offset values in limit queries.',
+ $this->getName()
+ ));
+ }
+
+ return $this->doModifyLimitQuery($query, $limit, $offset);
+ }
+
+ /**
+ * Adds an platform-specific LIMIT clause to the query.
+ *
+ * @param string $query
+ * @param int|null $limit
+ * @param int|null $offset
+ *
+ * @return string
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset)
+ {
+ if ($limit !== null) {
+ $query .= ' LIMIT ' . $limit;
+ }
+
+ if ($offset > 0) {
+ $query .= ' OFFSET ' . $offset;
+ }
+
+ return $query;
+ }
+
+ /**
+ * Whether the database platform support offsets in modify limit clauses.
+ *
+ * @return bool
+ */
+ public function supportsLimitOffset()
+ {
+ return true;
+ }
+
+ /**
+ * Gets the character casing of a column in an SQL result set of this platform.
+ *
+ * @param string $column The column name for which to get the correct character casing.
+ *
+ * @return string The column name in the character casing used in SQL result sets.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return $column;
+ }
+
+ /**
+ * Makes any fixes to a name of a schema element (table, sequence, ...) that are required
+ * by restrictions of the platform, like a maximum length.
+ *
+ * @param string $schemaElementName
+ *
+ * @return string
+ */
+ public function fixSchemaElementName($schemaElementName)
+ {
+ return $schemaElementName;
+ }
+
+ /**
+ * Maximum length of any given database identifier, like tables or column names.
+ *
+ * @return int
+ */
+ public function getMaxIdentifierLength()
+ {
+ return 63;
+ }
+
+ /**
+ * Returns the insert SQL for an empty insert statement.
+ *
+ * @param string $tableName
+ * @param string $identifierColumnName
+ *
+ * @return string
+ */
+ public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
+ {
+ return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (null)';
+ }
+
+ /**
+ * Generates a Truncate Table SQL statement for a given table.
+ *
+ * Cascade is not supported on many platforms but would optionally cascade the truncate by
+ * following the foreign keys.
+ *
+ * @param string $tableName
+ * @param bool $cascade
+ *
+ * @return string
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ $tableIdentifier = new Identifier($tableName);
+
+ return 'TRUNCATE ' . $tableIdentifier->getQuotedName($this);
+ }
+
+ /**
+ * This is for test reasons, many vendors have special requirements for dummy statements.
+ *
+ * @return string
+ */
+ public function getDummySelectSQL()
+ {
+ $expression = func_num_args() > 0 ? func_get_arg(0) : '1';
+
+ return sprintf('SELECT %s', $expression);
+ }
+
+ /**
+ * Returns the SQL to create a new savepoint.
+ *
+ * @param string $savepoint
+ *
+ * @return string
+ */
+ public function createSavePoint($savepoint)
+ {
+ return 'SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Returns the SQL to release a savepoint.
+ *
+ * @param string $savepoint
+ *
+ * @return string
+ */
+ public function releaseSavePoint($savepoint)
+ {
+ return 'RELEASE SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Returns the SQL to rollback a savepoint.
+ *
+ * @param string $savepoint
+ *
+ * @return string
+ */
+ public function rollbackSavePoint($savepoint)
+ {
+ return 'ROLLBACK TO SAVEPOINT ' . $savepoint;
+ }
+
+ /**
+ * Returns the keyword list instance of this platform.
+ *
+ * @return KeywordList
+ *
+ * @throws DBALException If no keyword list is specified.
+ */
+ final public function getReservedKeywordsList()
+ {
+ // Check for an existing instantiation of the keywords class.
+ if ($this->_keywords) {
+ return $this->_keywords;
+ }
+
+ $class = $this->getReservedKeywordsClass();
+ $keywords = new $class();
+ if (! $keywords instanceof KeywordList) {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ // Store the instance so it doesn't need to be generated on every request.
+ $this->_keywords = $keywords;
+
+ return $keywords;
+ }
+
+ /**
+ * Returns the class name of the reserved keywords list.
+ *
+ * @return string
+ *
+ * @throws DBALException If not supported on this platform.
+ */
+ protected function getReservedKeywordsClass()
+ {
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * Quotes a literal string.
+ * This method is NOT meant to fix SQL injections!
+ * It is only meant to escape this platform's string literal
+ * quote character inside the given literal string.
+ *
+ * @param string $str The literal string to be quoted.
+ *
+ * @return string The quoted literal string.
+ */
+ public function quoteStringLiteral($str)
+ {
+ $c = $this->getStringLiteralQuoteCharacter();
+
+ return $c . str_replace($c, $c . $c, $str) . $c;
+ }
+
+ /**
+ * Gets the character used for string literal quoting.
+ *
+ * @return string
+ */
+ public function getStringLiteralQuoteCharacter()
+ {
+ return "'";
+ }
+
+ /**
+ * Escapes metacharacters in a string intended to be used with a LIKE
+ * operator.
+ *
+ * @param string $inputString a literal, unquoted string
+ * @param string $escapeChar should be reused by the caller in the LIKE
+ * expression.
+ */
+ final public function escapeStringForLike(string $inputString, string $escapeChar) : string
+ {
+ return preg_replace(
+ '~([' . preg_quote($this->getLikeWildcardCharacters() . $escapeChar, '~') . '])~u',
+ addcslashes($escapeChar, '\\') . '$1',
+ $inputString
+ );
+ }
+
+ protected function getLikeWildcardCharacters() : string
+ {
+ return '%_';
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php
new file mode 100644
index 000000000..605122115
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DB2Platform.php
@@ -0,0 +1,896 @@
+getCharMaxLength();
+ }
+
+ return parent::getVarcharTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ // todo blob(n) with $field['length'];
+ return 'BLOB(1M)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'smallint' => 'smallint',
+ 'bigint' => 'bigint',
+ 'integer' => 'integer',
+ 'time' => 'time',
+ 'date' => 'date',
+ 'varchar' => 'string',
+ 'character' => 'string',
+ 'varbinary' => 'binary',
+ 'binary' => 'binary',
+ 'clob' => 'text',
+ 'blob' => 'blob',
+ 'decimal' => 'decimal',
+ 'double' => 'float',
+ 'real' => 'float',
+ 'timestamp' => 'datetime',
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function isCommentedDoctrineType(Type $doctrineType)
+ {
+ if ($doctrineType->getName() === Type::BOOLEAN) {
+ // We require a commented boolean type in order to distinguish between boolean and smallint
+ // as both (have to) map to the same native type.
+ return true;
+ }
+
+ return parent::isCommentedDoctrineType($doctrineType);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(254)')
+ : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $this->getVarcharTypeDeclarationSQLSnippet($length, $fixed) . ' FOR BIT DATA';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ // todo clob(n) with $field['length'];
+ return 'CLOB(1M)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return 'db2';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBooleanTypeDeclarationSQL(array $columnDef)
+ {
+ return 'SMALLINT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ return 'INTEGER' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $columnDef)
+ {
+ return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $columnDef)
+ {
+ return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $autoinc = '';
+ if (! empty($columnDef['autoincrement'])) {
+ $autoinc = ' GENERATED BY DEFAULT AS IDENTITY';
+ }
+
+ return $autoinc;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBitAndComparisonExpression($value1, $value2)
+ {
+ return 'BITAND(' . $value1 . ', ' . $value2 . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBitOrComparisonExpression($value1, $value2)
+ {
+ return 'BITOR(' . $value1 . ', ' . $value2 . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ switch ($unit) {
+ case DateIntervalUnit::WEEK:
+ $interval *= 7;
+ $unit = DateIntervalUnit::DAY;
+ break;
+
+ case DateIntervalUnit::QUARTER:
+ $interval *= 3;
+ $unit = DateIntervalUnit::MONTH;
+ break;
+ }
+
+ return $date . ' ' . $operator . ' ' . $interval . ' ' . $unit;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ return 'DAYS(' . $date1 . ') - DAYS(' . $date2 . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
+ return 'TIMESTAMP(0) WITH DEFAULT';
+ }
+
+ return 'TIMESTAMP(0)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ $tableIdentifier = new Identifier($tableName);
+
+ return 'TRUNCATE ' . $tableIdentifier->getQuotedName($this) . ' IMMEDIATE';
+ }
+
+ /**
+ * This code fragment is originally from the Zend_Db_Adapter_Db2 class, but has been edited.
+ *
+ * @param string $table
+ * @param string $database
+ *
+ * @return string
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ $table = $this->quoteStringLiteral($table);
+
+ // We do the funky subquery and join syscat.columns.default this crazy way because
+ // as of db2 v10, the column is CLOB(64k) and the distinct operator won't allow a CLOB,
+ // it wants shorter stuff like a varchar.
+ return "
+ SELECT
+ cols.default,
+ subq.*
+ FROM (
+ SELECT DISTINCT
+ c.tabschema,
+ c.tabname,
+ c.colname,
+ c.colno,
+ c.typename,
+ c.nulls,
+ c.length,
+ c.scale,
+ c.identity,
+ tc.type AS tabconsttype,
+ c.remarks AS comment,
+ k.colseq,
+ CASE
+ WHEN c.generated = 'D' THEN 1
+ ELSE 0
+ END AS autoincrement
+ FROM syscat.columns c
+ LEFT JOIN (syscat.keycoluse k JOIN syscat.tabconst tc
+ ON (k.tabschema = tc.tabschema
+ AND k.tabname = tc.tabname
+ AND tc.type = 'P'))
+ ON (c.tabschema = k.tabschema
+ AND c.tabname = k.tabname
+ AND c.colname = k.colname)
+ WHERE UPPER(c.tabname) = UPPER(" . $table . ')
+ ORDER BY c.colno
+ ) subq
+ JOIN syscat.columns cols
+ ON subq.tabschema = cols.tabschema
+ AND subq.tabname = cols.tabname
+ AND subq.colno = cols.colno
+ ORDER BY subq.colno
+ ';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTablesSQL()
+ {
+ return "SELECT NAME FROM SYSIBM.SYSTABLES WHERE TYPE = 'T'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListViewsSQL($database)
+ {
+ return 'SELECT NAME, TEXT FROM SYSIBM.SYSVIEWS';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ $table = $this->quoteStringLiteral($table);
+
+ return "SELECT idx.INDNAME AS key_name,
+ idxcol.COLNAME AS column_name,
+ CASE
+ WHEN idx.UNIQUERULE = 'P' THEN 1
+ ELSE 0
+ END AS primary,
+ CASE
+ WHEN idx.UNIQUERULE = 'D' THEN 1
+ ELSE 0
+ END AS non_unique
+ FROM SYSCAT.INDEXES AS idx
+ JOIN SYSCAT.INDEXCOLUSE AS idxcol
+ ON idx.INDSCHEMA = idxcol.INDSCHEMA AND idx.INDNAME = idxcol.INDNAME
+ WHERE idx.TABNAME = UPPER(" . $table . ')
+ ORDER BY idxcol.COLSEQ ASC';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableForeignKeysSQL($table)
+ {
+ $table = $this->quoteStringLiteral($table);
+
+ return "SELECT fkcol.COLNAME AS local_column,
+ fk.REFTABNAME AS foreign_table,
+ pkcol.COLNAME AS foreign_column,
+ fk.CONSTNAME AS index_name,
+ CASE
+ WHEN fk.UPDATERULE = 'R' THEN 'RESTRICT'
+ ELSE NULL
+ END AS on_update,
+ CASE
+ WHEN fk.DELETERULE = 'C' THEN 'CASCADE'
+ WHEN fk.DELETERULE = 'N' THEN 'SET NULL'
+ WHEN fk.DELETERULE = 'R' THEN 'RESTRICT'
+ ELSE NULL
+ END AS on_delete
+ FROM SYSCAT.REFERENCES AS fk
+ JOIN SYSCAT.KEYCOLUSE AS fkcol
+ ON fk.CONSTNAME = fkcol.CONSTNAME
+ AND fk.TABSCHEMA = fkcol.TABSCHEMA
+ AND fk.TABNAME = fkcol.TABNAME
+ JOIN SYSCAT.KEYCOLUSE AS pkcol
+ ON fk.REFKEYNAME = pkcol.CONSTNAME
+ AND fk.REFTABSCHEMA = pkcol.TABSCHEMA
+ AND fk.REFTABNAME = pkcol.TABNAME
+ WHERE fk.TABNAME = UPPER(" . $table . ')
+ ORDER BY fkcol.COLSEQ ASC';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ return 'CREATE VIEW ' . $name . ' AS ' . $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropViewSQL($name)
+ {
+ return 'DROP VIEW ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateDatabaseSQL($database)
+ {
+ return 'CREATE DATABASE ' . $database;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropDatabaseSQL($database)
+ {
+ return 'DROP DATABASE ' . $database;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsCreateDropDatabase()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsCommentOnStatement()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCurrentDateSQL()
+ {
+ return 'CURRENT DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCurrentTimeSQL()
+ {
+ return 'CURRENT TIME';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCurrentTimestampSQL()
+ {
+ return 'CURRENT TIMESTAMP';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIndexDeclarationSQL($name, Index $index)
+ {
+ // Index declaration in statements like CREATE TABLE is not supported.
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $indexes = [];
+ if (isset($options['indexes'])) {
+ $indexes = $options['indexes'];
+ }
+ $options['indexes'] = [];
+
+ $sqls = parent::_getCreateTableSQL($tableName, $columns, $options);
+
+ foreach ($indexes as $definition) {
+ $sqls[] = $this->getCreateIndexSQL($definition, $tableName);
+ }
+ return $sqls;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $sql = [];
+ $columnSql = [];
+ $commentsSQL = [];
+
+ $queryParts = [];
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $columnDef = $column->toArray();
+ $queryPart = 'ADD COLUMN ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnDef);
+
+ // Adding non-nullable columns to a table requires a default value to be specified.
+ if (! empty($columnDef['notnull']) &&
+ ! isset($columnDef['default']) &&
+ empty($columnDef['autoincrement'])
+ ) {
+ $queryPart .= ' WITH DEFAULT';
+ }
+
+ $queryParts[] = $queryPart;
+
+ $comment = $this->getColumnComment($column);
+
+ if ($comment === null || $comment === '') {
+ continue;
+ }
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $comment
+ );
+ }
+
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $queryParts[] = 'DROP COLUMN ' . $column->getQuotedName($this);
+ }
+
+ foreach ($diff->changedColumns as $columnDiff) {
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ if ($columnDiff->hasChanged('comment')) {
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $columnDiff->column->getQuotedName($this),
+ $this->getColumnComment($columnDiff->column)
+ );
+
+ if (count($columnDiff->changedProperties) === 1) {
+ continue;
+ }
+ }
+
+ $this->gatherAlterColumnSQL($diff->fromTable, $columnDiff, $sql, $queryParts);
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $oldColumnName = new Identifier($oldColumnName);
+
+ $queryParts[] = 'RENAME COLUMN ' . $oldColumnName->getQuotedName($this) .
+ ' TO ' . $column->getQuotedName($this);
+ }
+
+ $tableSql = [];
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ if (count($queryParts) > 0) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(' ', $queryParts);
+ }
+
+ // Some table alteration operations require a table reorganization.
+ if (! empty($diff->removedColumns) || ! empty($diff->changedColumns)) {
+ $sql[] = "CALL SYSPROC.ADMIN_CMD ('REORG TABLE " . $diff->getName($this)->getQuotedName($this) . "')";
+ }
+
+ $sql = array_merge($sql, $commentsSQL);
+
+ if ($diff->newName !== false) {
+ $sql[] = 'RENAME TABLE ' . $diff->getName($this)->getQuotedName($this) . ' TO ' . $diff->getNewName()->getQuotedName($this);
+ }
+
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * Gathers the table alteration SQL for a given column diff.
+ *
+ * @param Table $table The table to gather the SQL for.
+ * @param ColumnDiff $columnDiff The column diff to evaluate.
+ * @param string[] $sql The sequence of table alteration statements to fill.
+ * @param mixed[] $queryParts The sequence of column alteration clauses to fill.
+ */
+ private function gatherAlterColumnSQL(Table $table, ColumnDiff $columnDiff, array &$sql, array &$queryParts)
+ {
+ $alterColumnClauses = $this->getAlterColumnClausesSQL($columnDiff);
+
+ if (empty($alterColumnClauses)) {
+ return;
+ }
+
+ // If we have a single column alteration, we can append the clause to the main query.
+ if (count($alterColumnClauses) === 1) {
+ $queryParts[] = current($alterColumnClauses);
+
+ return;
+ }
+
+ // We have multiple alterations for the same column,
+ // so we need to trigger a complete ALTER TABLE statement
+ // for each ALTER COLUMN clause.
+ foreach ($alterColumnClauses as $alterColumnClause) {
+ $sql[] = 'ALTER TABLE ' . $table->getQuotedName($this) . ' ' . $alterColumnClause;
+ }
+ }
+
+ /**
+ * Returns the ALTER COLUMN SQL clauses for altering a column described by the given column diff.
+ *
+ * @param ColumnDiff $columnDiff The column diff to evaluate.
+ *
+ * @return string[]
+ */
+ private function getAlterColumnClausesSQL(ColumnDiff $columnDiff)
+ {
+ $column = $columnDiff->column->toArray();
+
+ $alterClause = 'ALTER COLUMN ' . $columnDiff->column->getQuotedName($this);
+
+ if ($column['columnDefinition']) {
+ return [$alterClause . ' ' . $column['columnDefinition']];
+ }
+
+ $clauses = [];
+
+ if ($columnDiff->hasChanged('type') ||
+ $columnDiff->hasChanged('length') ||
+ $columnDiff->hasChanged('precision') ||
+ $columnDiff->hasChanged('scale') ||
+ $columnDiff->hasChanged('fixed')
+ ) {
+ $clauses[] = $alterClause . ' SET DATA TYPE ' . $column['type']->getSQLDeclaration($column, $this);
+ }
+
+ if ($columnDiff->hasChanged('notnull')) {
+ $clauses[] = $column['notnull'] ? $alterClause . ' SET NOT NULL' : $alterClause . ' DROP NOT NULL';
+ }
+
+ if ($columnDiff->hasChanged('default')) {
+ if (isset($column['default'])) {
+ $defaultClause = $this->getDefaultValueDeclarationSQL($column);
+
+ if ($defaultClause) {
+ $clauses[] = $alterClause . ' SET' . $defaultClause;
+ }
+ } else {
+ $clauses[] = $alterClause . ' DROP DEFAULT';
+ }
+ }
+
+ return $clauses;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ $sql = [];
+ $table = $diff->getName($this)->getQuotedName($this);
+
+ foreach ($diff->removedIndexes as $remKey => $remIndex) {
+ foreach ($diff->addedIndexes as $addKey => $addIndex) {
+ if ($remIndex->getColumns() === $addIndex->getColumns()) {
+ if ($remIndex->isPrimary()) {
+ $sql[] = 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
+ } elseif ($remIndex->isUnique()) {
+ $sql[] = 'ALTER TABLE ' . $table . ' DROP UNIQUE ' . $remIndex->getQuotedName($this);
+ } else {
+ $sql[] = $this->getDropIndexSQL($remIndex, $table);
+ }
+
+ $sql[] = $this->getCreateIndexSQL($addIndex, $table);
+
+ unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]);
+
+ break;
+ }
+ }
+ }
+
+ $sql = array_merge($sql, parent::getPreAlterTableIndexForeignKeySQL($diff));
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
+ {
+ if (strpos($tableName, '.') !== false) {
+ [$schema] = explode('.', $tableName);
+ $oldIndexName = $schema . '.' . $oldIndexName;
+ }
+
+ return ['RENAME INDEX ' . $oldIndexName . ' TO ' . $index->getQuotedName($this)];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ if (! empty($field['autoincrement'])) {
+ return '';
+ }
+
+ if (isset($field['version']) && $field['version']) {
+ if ((string) $field['type'] !== 'DateTime') {
+ $field['default'] = '1';
+ }
+ }
+
+ return parent::getDefaultValueDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getEmptyIdentityInsertSQL($tableName, $identifierColumnName)
+ {
+ return 'INSERT INTO ' . $tableName . ' (' . $identifierColumnName . ') VALUES (DEFAULT)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return 'DECLARE GLOBAL TEMPORARY TABLE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTemporaryTableName($tableName)
+ {
+ return 'SESSION.' . $tableName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset = null)
+ {
+ $where = [];
+
+ if ($offset > 0) {
+ $where[] = sprintf('db22.DC_ROWNUM >= %d', $offset + 1);
+ }
+
+ if ($limit !== null) {
+ $where[] = sprintf('db22.DC_ROWNUM <= %d', $offset + $limit);
+ }
+
+ if (empty($where)) {
+ return $query;
+ }
+
+ // Todo OVER() needs ORDER BY data!
+ return sprintf(
+ 'SELECT db22.* FROM (SELECT db21.*, ROW_NUMBER() OVER() AS DC_ROWNUM FROM (%s) db21) db22 WHERE %s',
+ $query,
+ implode(' AND ', $where)
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos === false) {
+ return 'LOCATE(' . $substr . ', ' . $str . ')';
+ }
+
+ return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSubstringExpression($value, $from, $length = null)
+ {
+ if ($length === null) {
+ return 'SUBSTR(' . $value . ', ' . $from . ')';
+ }
+
+ return 'SUBSTR(' . $value . ', ' . $from . ', ' . $length . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * DB2 returns all column names in SQL result sets in uppercase.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return strtoupper($column);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getForUpdateSQL()
+ {
+ return ' WITH RR USE AND KEEP UPDATE LOCKS';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDummySelectSQL()
+ {
+ $expression = func_num_args() > 0 ? func_get_arg(0) : '1';
+
+ return sprintf('SELECT %s FROM sysibm.sysdummy1', $expression);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * DB2 supports savepoints, but they work semantically different than on other vendor platforms.
+ *
+ * TODO: We have to investigate how to get DB2 up and running with savepoints.
+ */
+ public function supportsSavepoints()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\DB2Keywords::class;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php
new file mode 100644
index 000000000..ec97d0ef3
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/DateIntervalUnit.php
@@ -0,0 +1,28 @@
+_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $autoinc = '';
+ if (! empty($columnDef['autoincrement'])) {
+ $autoinc = ' AUTO_INCREMENT';
+ }
+
+ return $autoinc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $field)
+ {
+ return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $field)
+ {
+ return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return 'VARBINARY(' . ($length ?: 255) . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'boolean' => 'boolean',
+ 'varchar' => 'string',
+ 'varbinary' => 'binary',
+ 'integer' => 'integer',
+ 'blob' => 'blob',
+ 'decimal' => 'decimal',
+ 'datetime' => 'datetime',
+ 'date' => 'date',
+ 'time' => 'time',
+ 'text' => 'text',
+ 'timestamp' => 'datetime',
+ 'double' => 'float',
+ 'bigint' => 'bigint',
+ ];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ return 'TEXT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ return 'BLOB';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateDatabaseSQL($name)
+ {
+ return 'CREATE DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropDatabaseSQL($name)
+ {
+ return 'DROP DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $queryFields = $this->getColumnDeclarationListSQL($columns);
+
+ if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
+ foreach ($options['uniqueConstraints'] as $index => $definition) {
+ $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition);
+ }
+ }
+
+ // add all indexes
+ if (isset($options['indexes']) && ! empty($options['indexes'])) {
+ foreach ($options['indexes'] as $index => $definition) {
+ $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
+ }
+ }
+
+ // attach all primary keys
+ if (isset($options['primary']) && ! empty($options['primary'])) {
+ $keyColumns = array_unique(array_values($options['primary']));
+ $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
+ }
+
+ $query = 'CREATE ';
+
+ if (! empty($options['temporary'])) {
+ $query .= 'TEMPORARY ';
+ }
+
+ $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') ';
+ $query .= $this->buildTableOptions($options);
+ $query .= $this->buildPartitionOptions($options);
+
+ $sql = [$query];
+
+ if (isset($options['foreignKeys'])) {
+ foreach ((array) $options['foreignKeys'] as $definition) {
+ $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Build SQL for table options
+ *
+ * @param mixed[] $options
+ *
+ * @return string
+ */
+ private function buildTableOptions(array $options)
+ {
+ if (isset($options['table_options'])) {
+ return $options['table_options'];
+ }
+
+ $tableOptions = [];
+
+ // Collate
+ if (! isset($options['collate'])) {
+ $options['collate'] = 'utf8_unicode_ci';
+ }
+
+ $tableOptions[] = sprintf('COLLATE %s', $options['collate']);
+
+ // Engine
+ if (! isset($options['engine'])) {
+ $options['engine'] = 'InnoDB';
+ }
+
+ $tableOptions[] = sprintf('ENGINE = %s', $options['engine']);
+
+ // Auto increment
+ if (isset($options['auto_increment'])) {
+ $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']);
+ }
+
+ // Comment
+ if (isset($options['comment'])) {
+ $comment = trim($options['comment'], " '");
+
+ $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($comment));
+ }
+
+ // Row format
+ if (isset($options['row_format'])) {
+ $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']);
+ }
+
+ return implode(' ', $tableOptions);
+ }
+
+ /**
+ * Build SQL for partition options.
+ *
+ * @param mixed[] $options
+ *
+ * @return string
+ */
+ private function buildPartitionOptions(array $options)
+ {
+ return isset($options['partition_options'])
+ ? ' ' . $options['partition_options']
+ : '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListDatabasesSQL()
+ {
+ return "SELECT SCHEMA_NAME FROM INFORMATION_SCHEMA.SCHEMATA WHERE CATALOG_NAME='LOCAL'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\DrizzleKeywords::class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTablesSQL()
+ {
+ return "SELECT TABLE_NAME FROM INFORMATION_SCHEMA.TABLES WHERE TABLE_TYPE='BASE' AND TABLE_SCHEMA=DATABASE()";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ if ($database) {
+ $databaseSQL = $this->quoteStringLiteral($database);
+ } else {
+ $databaseSQL = 'DATABASE()';
+ }
+
+ return 'SELECT COLUMN_NAME, DATA_TYPE, COLUMN_COMMENT, IS_NULLABLE, IS_AUTO_INCREMENT, CHARACTER_MAXIMUM_LENGTH, COLUMN_DEFAULT,' .
+ ' NUMERIC_PRECISION, NUMERIC_SCALE, COLLATION_NAME' .
+ ' FROM DATA_DICTIONARY.COLUMNS' .
+ ' WHERE TABLE_SCHEMA=' . $databaseSQL . ' AND TABLE_NAME = ' . $this->quoteStringLiteral($table);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableForeignKeysSQL($table, $database = null)
+ {
+ if ($database) {
+ $databaseSQL = $this->quoteStringLiteral($database);
+ } else {
+ $databaseSQL = 'DATABASE()';
+ }
+
+ return 'SELECT CONSTRAINT_NAME, CONSTRAINT_COLUMNS, REFERENCED_TABLE_NAME, REFERENCED_TABLE_COLUMNS, UPDATE_RULE, DELETE_RULE' .
+ ' FROM DATA_DICTIONARY.FOREIGN_KEYS' .
+ ' WHERE CONSTRAINT_SCHEMA=' . $databaseSQL . ' AND CONSTRAINT_TABLE=' . $this->quoteStringLiteral($table);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableIndexesSQL($table, $database = null)
+ {
+ if ($database) {
+ $databaseSQL = $this->quoteStringLiteral($database);
+ } else {
+ $databaseSQL = 'DATABASE()';
+ }
+
+ return "SELECT INDEX_NAME AS 'key_name', COLUMN_NAME AS 'column_name', IS_USED_IN_PRIMARY AS 'primary', IS_UNIQUE=0 AS 'non_unique'" .
+ ' FROM DATA_DICTIONARY.INDEX_PARTS' .
+ ' WHERE TABLE_SCHEMA=' . $databaseSQL . ' AND TABLE_NAME=' . $this->quoteStringLiteral($table);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsInlineColumnComments()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsViews()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsColumnCollation()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropIndexSQL($index, $table = null)
+ {
+ if ($index instanceof Index) {
+ $indexName = $index->getQuotedName($this);
+ } elseif (is_string($index)) {
+ $indexName = $index;
+ } else {
+ throw new InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
+ }
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ } elseif (! is_string($table)) {
+ throw new InvalidArgumentException('DrizzlePlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
+
+ if ($index instanceof Index && $index->isPrimary()) {
+ // drizzle primary keys are always named "PRIMARY",
+ // so we cannot use them in statements because of them being keyword.
+ return $this->getDropPrimaryKeySQL($table);
+ }
+
+ return 'DROP INDEX ' . $indexName . ' ON ' . $table;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getDropPrimaryKeySQL($table)
+ {
+ return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
+ return 'TIMESTAMP';
+ }
+
+ return 'DATETIME';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $columnSql = [];
+ $queryParts = [];
+
+ if ($diff->newName !== false) {
+ $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this);
+ }
+
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $queryParts[] = 'DROP ' . $column->getQuotedName($this);
+ }
+
+ foreach ($diff->changedColumns as $columnDiff) {
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ $column = $columnDiff->column;
+ $columnArray = $column->toArray();
+
+ // Do not generate column alteration clause if type is binary and only fixed property has changed.
+ // Drizzle only supports binary type columns with variable length.
+ // Avoids unnecessary table alteration statements.
+ if ($columnArray['type'] instanceof BinaryType &&
+ $columnDiff->hasChanged('fixed') &&
+ count($columnDiff->changedProperties) === 1
+ ) {
+ continue;
+ }
+
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $oldColumnName = new Identifier($oldColumnName);
+
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' '
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ $sql = [];
+ $tableSql = [];
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ if (count($queryParts) > 0) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(', ', $queryParts);
+ }
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropTemporaryTableSQL($table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ } elseif (! is_string($table)) {
+ throw new InvalidArgumentException('getDropTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
+
+ return 'DROP TEMPORARY TABLE ' . $table;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function convertBooleans($item)
+ {
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ if (! is_bool($value) && ! is_numeric($item)) {
+ continue;
+ }
+
+ $item[$key] = $value ? 'true' : 'false';
+ }
+ } elseif (is_bool($item) || is_numeric($item)) {
+ $item = $item ? 'true' : 'false';
+ }
+
+ return $item;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos === false) {
+ return 'LOCATE(' . $substr . ', ' . $str . ')';
+ }
+
+ return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated Use application-generated UUIDs instead
+ */
+ public function getGuidExpression()
+ {
+ return 'UUID()';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getRegexpExpression()
+ {
+ return 'RLIKE';
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
new file mode 100644
index 000000000..8533f579d
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/DB2Keywords.php
@@ -0,0 +1,420 @@
+keywords === null) {
+ $this->initializeKeywords();
+ }
+
+ return isset($this->keywords[strtoupper($word)]);
+ }
+
+ /**
+ * @return void
+ */
+ protected function initializeKeywords()
+ {
+ $this->keywords = array_flip(array_map('strtoupper', $this->getKeywords()));
+ }
+
+ /**
+ * Returns the list of keywords.
+ *
+ * @return string[]
+ */
+ abstract protected function getKeywords();
+
+ /**
+ * Returns the name of this keyword list.
+ *
+ * @return string
+ */
+ abstract public function getName();
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php
new file mode 100644
index 000000000..1b31c7682
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/MariaDb102Keywords.php
@@ -0,0 +1,274 @@
+keywordLists = $keywordLists;
+ }
+
+ /**
+ * @return string[]
+ */
+ public function getViolations()
+ {
+ return $this->violations;
+ }
+
+ /**
+ * @param string $word
+ *
+ * @return string[]
+ */
+ private function isReservedWord($word)
+ {
+ if ($word[0] === '`') {
+ $word = str_replace('`', '', $word);
+ }
+
+ $keywordLists = [];
+ foreach ($this->keywordLists as $keywordList) {
+ if (! $keywordList->isKeyword($word)) {
+ continue;
+ }
+
+ $keywordLists[] = $keywordList->getName();
+ }
+
+ return $keywordLists;
+ }
+
+ /**
+ * @param string $asset
+ * @param string[] $violatedPlatforms
+ *
+ * @return void
+ */
+ private function addViolation($asset, $violatedPlatforms)
+ {
+ if (! $violatedPlatforms) {
+ return;
+ }
+
+ $this->violations[] = $asset . ' keyword violations: ' . implode(', ', $violatedPlatforms);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptColumn(Table $table, Column $column)
+ {
+ $this->addViolation(
+ 'Table ' . $table->getName() . ' column ' . $column->getName(),
+ $this->isReservedWord($column->getName())
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptForeignKey(Table $localTable, ForeignKeyConstraint $fkConstraint)
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptIndex(Table $table, Index $index)
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptSchema(Schema $schema)
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptSequence(Sequence $sequence)
+ {
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function acceptTable(Table $table)
+ {
+ $this->addViolation(
+ 'Table ' . $table->getName(),
+ $this->isReservedWord($table->getName())
+ );
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php
new file mode 100644
index 000000000..09513c577
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/Keywords/SQLAnywhere11Keywords.php
@@ -0,0 +1,39 @@
+doctrineTypeMapping['json'] = Type::JSON;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
new file mode 100644
index 000000000..71ef6ca96
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL57Platform.php
@@ -0,0 +1,71 @@
+getQuotedName($this)];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\MySQL57Keywords::class;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ parent::initializeDoctrineTypeMappings();
+
+ $this->doctrineTypeMapping['json'] = Type::JSON;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php
new file mode 100644
index 000000000..f6d4be9dc
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/MySQL80Platform.php
@@ -0,0 +1,17 @@
+ 0) {
+ $query .= ' OFFSET ' . $offset;
+ }
+ } elseif ($offset > 0) {
+ // 2^64-1 is the maximum of unsigned BIGINT, the biggest limit possible
+ $query .= ' LIMIT 18446744073709551615 OFFSET ' . $offset;
+ }
+
+ return $query;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIdentifierQuoteCharacter()
+ {
+ return '`';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getRegexpExpression()
+ {
+ return 'RLIKE';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated Use application-generated UUIDs instead
+ */
+ public function getGuidExpression()
+ {
+ return 'UUID()';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos === false) {
+ return 'LOCATE(' . $substr . ', ' . $str . ')';
+ }
+
+ return 'LOCATE(' . $substr . ', ' . $str . ', ' . $startPos . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getConcatExpression()
+ {
+ return sprintf('CONCAT(%s)', implode(', ', func_get_args()));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ $function = $operator === '+' ? 'DATE_ADD' : 'DATE_SUB';
+
+ return $function . '(' . $date . ', INTERVAL ' . $interval . ' ' . $unit . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ return 'DATEDIFF(' . $date1 . ', ' . $date2 . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListDatabasesSQL()
+ {
+ return 'SHOW DATABASES';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableConstraintsSQL($table)
+ {
+ return 'SHOW INDEX FROM ' . $table;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Two approaches to listing the table indexes. The information_schema is
+ * preferred, because it doesn't cause problems with SQL keywords such as "order" or "table".
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ if ($currentDatabase) {
+ $currentDatabase = $this->quoteStringLiteral($currentDatabase);
+ $table = $this->quoteStringLiteral($table);
+
+ return 'SELECT TABLE_NAME AS `Table`, NON_UNIQUE AS Non_Unique, INDEX_NAME AS Key_name, ' .
+ 'SEQ_IN_INDEX AS Seq_in_index, COLUMN_NAME AS Column_Name, COLLATION AS Collation, ' .
+ 'CARDINALITY AS Cardinality, SUB_PART AS Sub_Part, PACKED AS Packed, ' .
+ 'NULLABLE AS `Null`, INDEX_TYPE AS Index_Type, COMMENT AS Comment ' .
+ 'FROM information_schema.STATISTICS WHERE TABLE_NAME = ' . $table . ' AND TABLE_SCHEMA = ' . $currentDatabase .
+ ' ORDER BY SEQ_IN_INDEX ASC';
+ }
+
+ return 'SHOW INDEX FROM ' . $table;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListViewsSQL($database)
+ {
+ $database = $this->quoteStringLiteral($database);
+
+ return 'SELECT * FROM information_schema.VIEWS WHERE TABLE_SCHEMA = ' . $database;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableForeignKeysSQL($table, $database = null)
+ {
+ $table = $this->quoteStringLiteral($table);
+
+ if ($database !== null) {
+ $database = $this->quoteStringLiteral($database);
+ }
+
+ $sql = 'SELECT DISTINCT k.`CONSTRAINT_NAME`, k.`COLUMN_NAME`, k.`REFERENCED_TABLE_NAME`, ' .
+ 'k.`REFERENCED_COLUMN_NAME` /*!50116 , c.update_rule, c.delete_rule */ ' .
+ 'FROM information_schema.key_column_usage k /*!50116 ' .
+ 'INNER JOIN information_schema.referential_constraints c ON ' .
+ ' c.constraint_name = k.constraint_name AND ' .
+ ' c.table_name = ' . $table . ' */ WHERE k.table_name = ' . $table;
+
+ $databaseNameSql = $database ?? 'DATABASE()';
+
+ $sql .= ' AND k.table_schema = ' . $databaseNameSql . ' /*!50116 AND c.constraint_schema = ' . $databaseNameSql . ' */';
+ $sql .= ' AND k.`REFERENCED_COLUMN_NAME` is not NULL';
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ return 'CREATE VIEW ' . $name . ' AS ' . $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropViewSQL($name)
+ {
+ return 'DROP VIEW ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
+ : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? 'BINARY(' . ($length ?: 255) . ')' : 'VARBINARY(' . ($length ?: 255) . ')';
+ }
+
+ /**
+ * Gets the SQL snippet used to declare a CLOB column type.
+ * TINYTEXT : 2 ^ 8 - 1 = 255
+ * TEXT : 2 ^ 16 - 1 = 65535
+ * MEDIUMTEXT : 2 ^ 24 - 1 = 16777215
+ * LONGTEXT : 2 ^ 32 - 1 = 4294967295
+ *
+ * {@inheritDoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ if (! empty($field['length']) && is_numeric($field['length'])) {
+ $length = $field['length'];
+
+ if ($length <= static::LENGTH_LIMIT_TINYTEXT) {
+ return 'TINYTEXT';
+ }
+
+ if ($length <= static::LENGTH_LIMIT_TEXT) {
+ return 'TEXT';
+ }
+
+ if ($length <= static::LENGTH_LIMIT_MEDIUMTEXT) {
+ return 'MEDIUMTEXT';
+ }
+ }
+
+ return 'LONGTEXT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ if (isset($fieldDeclaration['version']) && $fieldDeclaration['version'] === true) {
+ return 'TIMESTAMP';
+ }
+
+ return 'DATETIME';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBooleanTypeDeclarationSQL(array $field)
+ {
+ return 'TINYINT(1)';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration to be used in statements like CREATE TABLE.
+ *
+ * @deprecated Deprecated since version 2.5, Use {@link self::getColumnCollationDeclarationSQL()} instead.
+ *
+ * @param string $collation name of the collation
+ *
+ * @return string DBMS specific SQL code portion needed to set the COLLATION
+ * of a field declaration.
+ */
+ public function getCollationFieldDeclaration($collation)
+ {
+ return $this->getColumnCollationDeclarationSQL($collation);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * MySql prefers "autoincrement" identity columns since sequences can only
+ * be emulated with a table.
+ */
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * MySql supports this through AUTO_INCREMENT columns.
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsInlineColumnComments()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsColumnCollation()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTablesSQL()
+ {
+ return "SHOW FULL TABLES WHERE Table_type = 'BASE TABLE'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ $table = $this->quoteStringLiteral($table);
+
+ if ($database) {
+ $database = $this->quoteStringLiteral($database);
+ } else {
+ $database = 'DATABASE()';
+ }
+
+ return 'SELECT COLUMN_NAME AS Field, COLUMN_TYPE AS Type, IS_NULLABLE AS `Null`, ' .
+ 'COLUMN_KEY AS `Key`, COLUMN_DEFAULT AS `Default`, EXTRA AS Extra, COLUMN_COMMENT AS Comment, ' .
+ 'CHARACTER_SET_NAME AS CharacterSet, COLLATION_NAME AS Collation ' .
+ 'FROM information_schema.COLUMNS WHERE TABLE_SCHEMA = ' . $database . ' AND TABLE_NAME = ' . $table .
+ ' ORDER BY ORDINAL_POSITION ASC';
+ }
+
+ public function getListTableMetadataSQL(string $table, ?string $database = null) : string
+ {
+ return sprintf(
+ <<<'SQL'
+SELECT ENGINE, AUTO_INCREMENT, TABLE_COLLATION, TABLE_COMMENT, CREATE_OPTIONS
+FROM information_schema.TABLES
+WHERE TABLE_TYPE = 'BASE TABLE' AND TABLE_SCHEMA = %s AND TABLE_NAME = %s
+SQL
+ ,
+ $database ? $this->quoteStringLiteral($database) : 'DATABASE()',
+ $this->quoteStringLiteral($table)
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateDatabaseSQL($name)
+ {
+ return 'CREATE DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropDatabaseSQL($name)
+ {
+ return 'DROP DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $queryFields = $this->getColumnDeclarationListSQL($columns);
+
+ if (isset($options['uniqueConstraints']) && ! empty($options['uniqueConstraints'])) {
+ foreach ($options['uniqueConstraints'] as $index => $definition) {
+ $queryFields .= ', ' . $this->getUniqueConstraintDeclarationSQL($index, $definition);
+ }
+ }
+
+ // add all indexes
+ if (isset($options['indexes']) && ! empty($options['indexes'])) {
+ foreach ($options['indexes'] as $index => $definition) {
+ $queryFields .= ', ' . $this->getIndexDeclarationSQL($index, $definition);
+ }
+ }
+
+ // attach all primary keys
+ if (isset($options['primary']) && ! empty($options['primary'])) {
+ $keyColumns = array_unique(array_values($options['primary']));
+ $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
+ }
+
+ $query = 'CREATE ';
+
+ if (! empty($options['temporary'])) {
+ $query .= 'TEMPORARY ';
+ }
+
+ $query .= 'TABLE ' . $tableName . ' (' . $queryFields . ') ';
+ $query .= $this->buildTableOptions($options);
+ $query .= $this->buildPartitionOptions($options);
+
+ $sql = [$query];
+ $engine = 'INNODB';
+
+ if (isset($options['engine'])) {
+ $engine = strtoupper(trim($options['engine']));
+ }
+
+ // Propagate foreign key constraints only for InnoDB.
+ if (isset($options['foreignKeys']) && $engine === 'INNODB') {
+ foreach ((array) $options['foreignKeys'] as $definition) {
+ $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ // Unset the default value if the given field definition does not allow default values.
+ if ($field['type'] instanceof TextType || $field['type'] instanceof BlobType) {
+ $field['default'] = null;
+ }
+
+ return parent::getDefaultValueDeclarationSQL($field);
+ }
+
+ /**
+ * Build SQL for table options
+ *
+ * @param mixed[] $options
+ *
+ * @return string
+ */
+ private function buildTableOptions(array $options)
+ {
+ if (isset($options['table_options'])) {
+ return $options['table_options'];
+ }
+
+ $tableOptions = [];
+
+ // Charset
+ if (! isset($options['charset'])) {
+ $options['charset'] = 'utf8';
+ }
+
+ $tableOptions[] = sprintf('DEFAULT CHARACTER SET %s', $options['charset']);
+
+ // Collate
+ if (! isset($options['collate'])) {
+ $options['collate'] = $options['charset'] . '_unicode_ci';
+ }
+
+ $tableOptions[] = sprintf('COLLATE %s', $options['collate']);
+
+ // Engine
+ if (! isset($options['engine'])) {
+ $options['engine'] = 'InnoDB';
+ }
+
+ $tableOptions[] = sprintf('ENGINE = %s', $options['engine']);
+
+ // Auto increment
+ if (isset($options['auto_increment'])) {
+ $tableOptions[] = sprintf('AUTO_INCREMENT = %s', $options['auto_increment']);
+ }
+
+ // Comment
+ if (isset($options['comment'])) {
+ $comment = trim($options['comment'], " '");
+
+ $tableOptions[] = sprintf('COMMENT = %s ', $this->quoteStringLiteral($comment));
+ }
+
+ // Row format
+ if (isset($options['row_format'])) {
+ $tableOptions[] = sprintf('ROW_FORMAT = %s', $options['row_format']);
+ }
+
+ return implode(' ', $tableOptions);
+ }
+
+ /**
+ * Build SQL for partition options.
+ *
+ * @param mixed[] $options
+ *
+ * @return string
+ */
+ private function buildPartitionOptions(array $options)
+ {
+ return isset($options['partition_options'])
+ ? ' ' . $options['partition_options']
+ : '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $columnSql = [];
+ $queryParts = [];
+ if ($diff->newName !== false) {
+ $queryParts[] = 'RENAME TO ' . $diff->getNewName()->getQuotedName($this);
+ }
+
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $queryParts[] = 'DROP ' . $column->getQuotedName($this);
+ }
+
+ foreach ($diff->changedColumns as $columnDiff) {
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ $column = $columnDiff->column;
+ $columnArray = $column->toArray();
+
+ // Don't propagate default value changes for unsupported column types.
+ if ($columnDiff->hasChanged('default') &&
+ count($columnDiff->changedProperties) === 1 &&
+ ($columnArray['type'] instanceof TextType || $columnArray['type'] instanceof BlobType)
+ ) {
+ continue;
+ }
+
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'CHANGE ' . ($columnDiff->getOldColumnName()->getQuotedName($this)) . ' '
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $oldColumnName = new Identifier($oldColumnName);
+ $columnArray = $column->toArray();
+ $columnArray['comment'] = $this->getColumnComment($column);
+ $queryParts[] = 'CHANGE ' . $oldColumnName->getQuotedName($this) . ' '
+ . $this->getColumnDeclarationSQL($column->getQuotedName($this), $columnArray);
+ }
+
+ if (isset($diff->addedIndexes['primary'])) {
+ $keyColumns = array_unique(array_values($diff->addedIndexes['primary']->getColumns()));
+ $queryParts[] = 'ADD PRIMARY KEY (' . implode(', ', $keyColumns) . ')';
+ unset($diff->addedIndexes['primary']);
+ }
+
+ $sql = [];
+ $tableSql = [];
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ if (count($queryParts) > 0) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . implode(', ', $queryParts);
+ }
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getPreAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ $sql = [];
+ $table = $diff->getName($this)->getQuotedName($this);
+
+ foreach ($diff->changedIndexes as $changedIndex) {
+ $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $changedIndex));
+ }
+
+ foreach ($diff->removedIndexes as $remKey => $remIndex) {
+ $sql = array_merge($sql, $this->getPreAlterTableAlterPrimaryKeySQL($diff, $remIndex));
+
+ foreach ($diff->addedIndexes as $addKey => $addIndex) {
+ if ($remIndex->getColumns() === $addIndex->getColumns()) {
+ $indexClause = 'INDEX ' . $addIndex->getName();
+
+ if ($addIndex->isPrimary()) {
+ $indexClause = 'PRIMARY KEY';
+ } elseif ($addIndex->isUnique()) {
+ $indexClause = 'UNIQUE INDEX ' . $addIndex->getName();
+ }
+
+ $query = 'ALTER TABLE ' . $table . ' DROP INDEX ' . $remIndex->getName() . ', ';
+ $query .= 'ADD ' . $indexClause;
+ $query .= ' (' . $this->getIndexFieldDeclarationListSQL($addIndex) . ')';
+
+ $sql[] = $query;
+
+ unset($diff->removedIndexes[$remKey], $diff->addedIndexes[$addKey]);
+
+ break;
+ }
+ }
+ }
+
+ $engine = 'INNODB';
+
+ if ($diff->fromTable instanceof Table && $diff->fromTable->hasOption('engine')) {
+ $engine = strtoupper(trim($diff->fromTable->getOption('engine')));
+ }
+
+ // Suppress foreign key constraint propagation on non-supporting engines.
+ if ($engine !== 'INNODB') {
+ $diff->addedForeignKeys = [];
+ $diff->changedForeignKeys = [];
+ $diff->removedForeignKeys = [];
+ }
+
+ $sql = array_merge(
+ $sql,
+ $this->getPreAlterTableAlterIndexForeignKeySQL($diff),
+ parent::getPreAlterTableIndexForeignKeySQL($diff),
+ $this->getPreAlterTableRenameIndexForeignKeySQL($diff)
+ );
+
+ return $sql;
+ }
+
+ /**
+ * @return string[]
+ */
+ private function getPreAlterTableAlterPrimaryKeySQL(TableDiff $diff, Index $index)
+ {
+ $sql = [];
+
+ if (! $index->isPrimary() || ! $diff->fromTable instanceof Table) {
+ return $sql;
+ }
+
+ $tableName = $diff->getName($this)->getQuotedName($this);
+
+ // Dropping primary keys requires to unset autoincrement attribute on the particular column first.
+ foreach ($index->getColumns() as $columnName) {
+ if (! $diff->fromTable->hasColumn($columnName)) {
+ continue;
+ }
+
+ $column = $diff->fromTable->getColumn($columnName);
+
+ if ($column->getAutoincrement() !== true) {
+ continue;
+ }
+
+ $column->setAutoincrement(false);
+
+ $sql[] = 'ALTER TABLE ' . $tableName . ' MODIFY ' .
+ $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+
+ // original autoincrement information might be needed later on by other parts of the table alteration
+ $column->setAutoincrement(true);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * @param TableDiff $diff The table diff to gather the SQL for.
+ *
+ * @return string[]
+ */
+ private function getPreAlterTableAlterIndexForeignKeySQL(TableDiff $diff)
+ {
+ $sql = [];
+ $table = $diff->getName($this)->getQuotedName($this);
+
+ foreach ($diff->changedIndexes as $changedIndex) {
+ // Changed primary key
+ if (! $changedIndex->isPrimary() || ! ($diff->fromTable instanceof Table)) {
+ continue;
+ }
+
+ foreach ($diff->fromTable->getPrimaryKeyColumns() as $columnName) {
+ $column = $diff->fromTable->getColumn($columnName);
+
+ // Check if an autoincrement column was dropped from the primary key.
+ if (! $column->getAutoincrement() || in_array($columnName, $changedIndex->getColumns())) {
+ continue;
+ }
+
+ // The autoincrement attribute needs to be removed from the dropped column
+ // before we can drop and recreate the primary key.
+ $column->setAutoincrement(false);
+
+ $sql[] = 'ALTER TABLE ' . $table . ' MODIFY ' .
+ $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+
+ // Restore the autoincrement attribute as it might be needed later on
+ // by other parts of the table alteration.
+ $column->setAutoincrement(true);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * @param TableDiff $diff The table diff to gather the SQL for.
+ *
+ * @return string[]
+ */
+ protected function getPreAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
+ {
+ $sql = [];
+ $tableName = $diff->getName($this)->getQuotedName($this);
+
+ foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) {
+ if (in_array($foreignKey, $diff->changedForeignKeys, true)) {
+ continue;
+ }
+
+ $sql[] = $this->getDropForeignKeySQL($foreignKey, $tableName);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Returns the remaining foreign key constraints that require one of the renamed indexes.
+ *
+ * "Remaining" here refers to the diff between the foreign keys currently defined in the associated
+ * table and the foreign keys to be removed.
+ *
+ * @param TableDiff $diff The table diff to evaluate.
+ *
+ * @return ForeignKeyConstraint[]
+ */
+ private function getRemainingForeignKeyConstraintsRequiringRenamedIndexes(TableDiff $diff)
+ {
+ if (empty($diff->renamedIndexes) || ! $diff->fromTable instanceof Table) {
+ return [];
+ }
+
+ $foreignKeys = [];
+ /** @var ForeignKeyConstraint[] $remainingForeignKeys */
+ $remainingForeignKeys = array_diff_key(
+ $diff->fromTable->getForeignKeys(),
+ $diff->removedForeignKeys
+ );
+
+ foreach ($remainingForeignKeys as $foreignKey) {
+ foreach ($diff->renamedIndexes as $index) {
+ if ($foreignKey->intersectsIndexColumns($index)) {
+ $foreignKeys[] = $foreignKey;
+
+ break;
+ }
+ }
+ }
+
+ return $foreignKeys;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getPostAlterTableIndexForeignKeySQL(TableDiff $diff)
+ {
+ return array_merge(
+ parent::getPostAlterTableIndexForeignKeySQL($diff),
+ $this->getPostAlterTableRenameIndexForeignKeySQL($diff)
+ );
+ }
+
+ /**
+ * @param TableDiff $diff The table diff to gather the SQL for.
+ *
+ * @return string[]
+ */
+ protected function getPostAlterTableRenameIndexForeignKeySQL(TableDiff $diff)
+ {
+ $sql = [];
+ $tableName = $diff->newName !== false
+ ? $diff->getNewName()->getQuotedName($this)
+ : $diff->getName($this)->getQuotedName($this);
+
+ foreach ($this->getRemainingForeignKeyConstraintsRequiringRenamedIndexes($diff) as $foreignKey) {
+ if (in_array($foreignKey, $diff->changedForeignKeys, true)) {
+ continue;
+ }
+
+ $sql[] = $this->getCreateForeignKeySQL($foreignKey, $tableName);
+ }
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getCreateIndexSQLFlags(Index $index)
+ {
+ $type = '';
+ if ($index->isUnique()) {
+ $type .= 'UNIQUE ';
+ } elseif ($index->hasFlag('fulltext')) {
+ $type .= 'FULLTEXT ';
+ } elseif ($index->hasFlag('spatial')) {
+ $type .= 'SPATIAL ';
+ }
+
+ return $type;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIntegerTypeDeclarationSQL(array $field)
+ {
+ return 'INT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $field)
+ {
+ return 'BIGINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $field)
+ {
+ return 'SMALLINT' . $this->_getCommonIntegerTypeDeclarationSQL($field);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getFloatDeclarationSQL(array $field)
+ {
+ return 'DOUBLE PRECISION' . $this->getUnsignedDeclaration($field);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDecimalTypeDeclarationSQL(array $columnDef)
+ {
+ return parent::getDecimalTypeDeclarationSQL($columnDef) . $this->getUnsignedDeclaration($columnDef);
+ }
+
+ /**
+ * Get unsigned declaration for a column.
+ *
+ * @param mixed[] $columnDef
+ *
+ * @return string
+ */
+ private function getUnsignedDeclaration(array $columnDef)
+ {
+ return ! empty($columnDef['unsigned']) ? ' UNSIGNED' : '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $autoinc = '';
+ if (! empty($columnDef['autoincrement'])) {
+ $autoinc = ' AUTO_INCREMENT';
+ }
+
+ return $this->getUnsignedDeclaration($columnDef) . $autoinc;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $query = '';
+ if ($foreignKey->hasOption('match')) {
+ $query .= ' MATCH ' . $foreignKey->getOption('match');
+ }
+ $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
+
+ return $query;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropIndexSQL($index, $table = null)
+ {
+ if ($index instanceof Index) {
+ $indexName = $index->getQuotedName($this);
+ } elseif (is_string($index)) {
+ $indexName = $index;
+ } else {
+ throw new InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
+ }
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ } elseif (! is_string($table)) {
+ throw new InvalidArgumentException('MysqlPlatform::getDropIndexSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
+
+ if ($index instanceof Index && $index->isPrimary()) {
+ // mysql primary keys are always named "PRIMARY",
+ // so we cannot use them in statements because of them being keyword.
+ return $this->getDropPrimaryKeySQL($table);
+ }
+
+ return 'DROP INDEX ' . $indexName . ' ON ' . $table;
+ }
+
+ /**
+ * @param string $table
+ *
+ * @return string
+ */
+ protected function getDropPrimaryKeySQL($table)
+ {
+ return 'ALTER TABLE ' . $table . ' DROP PRIMARY KEY';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ return 'SET SESSION TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return 'mysql';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getReadLockSQL()
+ {
+ return 'LOCK IN SHARE MODE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'tinyint' => 'boolean',
+ 'smallint' => 'smallint',
+ 'mediumint' => 'integer',
+ 'int' => 'integer',
+ 'integer' => 'integer',
+ 'bigint' => 'bigint',
+ 'tinytext' => 'text',
+ 'mediumtext' => 'text',
+ 'longtext' => 'text',
+ 'text' => 'text',
+ 'varchar' => 'string',
+ 'string' => 'string',
+ 'char' => 'string',
+ 'date' => 'date',
+ 'datetime' => 'datetime',
+ 'timestamp' => 'datetime',
+ 'time' => 'time',
+ 'float' => 'float',
+ 'double' => 'float',
+ 'real' => 'float',
+ 'decimal' => 'decimal',
+ 'numeric' => 'decimal',
+ 'year' => 'date',
+ 'longblob' => 'blob',
+ 'blob' => 'blob',
+ 'mediumblob' => 'blob',
+ 'tinyblob' => 'blob',
+ 'binary' => 'binary',
+ 'varbinary' => 'binary',
+ 'set' => 'simple_array',
+ ];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getVarcharMaxLength()
+ {
+ return 65535;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryMaxLength()
+ {
+ return 65535;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\MySQLKeywords::class;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * MySQL commits a transaction implicitly when DROP TABLE is executed, however not
+ * if DROP TEMPORARY TABLE is executed.
+ */
+ public function getDropTemporaryTableSQL($table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ } elseif (! is_string($table)) {
+ throw new InvalidArgumentException('getDropTemporaryTableSQL() expects $table parameter to be string or \Doctrine\DBAL\Schema\Table.');
+ }
+
+ return 'DROP TEMPORARY TABLE ' . $table;
+ }
+
+ /**
+ * Gets the SQL Snippet used to declare a BLOB column type.
+ * TINYBLOB : 2 ^ 8 - 1 = 255
+ * BLOB : 2 ^ 16 - 1 = 65535
+ * MEDIUMBLOB : 2 ^ 24 - 1 = 16777215
+ * LONGBLOB : 2 ^ 32 - 1 = 4294967295
+ *
+ * {@inheritDoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ if (! empty($field['length']) && is_numeric($field['length'])) {
+ $length = $field['length'];
+
+ if ($length <= static::LENGTH_LIMIT_TINYBLOB) {
+ return 'TINYBLOB';
+ }
+
+ if ($length <= static::LENGTH_LIMIT_BLOB) {
+ return 'BLOB';
+ }
+
+ if ($length <= static::LENGTH_LIMIT_MEDIUMBLOB) {
+ return 'MEDIUMBLOB';
+ }
+ }
+
+ return 'LONGBLOB';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function quoteStringLiteral($str)
+ {
+ $str = str_replace('\\', '\\\\', $str); // MySQL requires backslashes to be escaped aswell.
+
+ return parent::quoteStringLiteral($str);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultTransactionIsolationLevel()
+ {
+ return TransactionIsolationLevel::REPEATABLE_READ;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsColumnLengthIndexes() : bool
+ {
+ return true;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
new file mode 100644
index 000000000..537a566ba
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/OraclePlatform.php
@@ -0,0 +1,1175 @@
+getBitAndComparisonExpression($value1, $value2)
+ . '+' . $value2 . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Need to specifiy minvalue, since start with is hidden in the system and MINVALUE <= START WITH.
+ * Therefore we can use MINVALUE to be able to get a hint what START WITH was for later introspection
+ * in {@see listSequences()}
+ */
+ public function getCreateSequenceSQL(Sequence $sequence)
+ {
+ return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' START WITH ' . $sequence->getInitialValue() .
+ ' MINVALUE ' . $sequence->getInitialValue() .
+ ' INCREMENT BY ' . $sequence->getAllocationSize() .
+ $this->getSequenceCacheSQL($sequence);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterSequenceSQL(Sequence $sequence)
+ {
+ return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize()
+ . $this->getSequenceCacheSQL($sequence);
+ }
+
+ /**
+ * Cache definition for sequences
+ *
+ * @return string
+ */
+ private function getSequenceCacheSQL(Sequence $sequence)
+ {
+ if ($sequence->getCache() === 0) {
+ return ' NOCACHE';
+ } elseif ($sequence->getCache() === 1) {
+ return ' NOCACHE';
+ } elseif ($sequence->getCache() > 1) {
+ return ' CACHE ' . $sequence->getCache();
+ }
+
+ return '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ return 'SELECT ' . $sequenceName . '.nextval FROM DUAL';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ return 'SET TRANSACTION ISOLATION LEVEL ' . $this->_getTransactionIsolationLevelSQL($level);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getTransactionIsolationLevelSQL($level)
+ {
+ switch ($level) {
+ case TransactionIsolationLevel::READ_UNCOMMITTED:
+ return 'READ UNCOMMITTED';
+ case TransactionIsolationLevel::READ_COMMITTED:
+ return 'READ COMMITTED';
+ case TransactionIsolationLevel::REPEATABLE_READ:
+ case TransactionIsolationLevel::SERIALIZABLE:
+ return 'SERIALIZABLE';
+ default:
+ return parent::_getTransactionIsolationLevelSQL($level);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBooleanTypeDeclarationSQL(array $field)
+ {
+ return 'NUMBER(1)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIntegerTypeDeclarationSQL(array $field)
+ {
+ return 'NUMBER(10)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $field)
+ {
+ return 'NUMBER(20)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $field)
+ {
+ return 'NUMBER(5)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIMESTAMP(0)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIMESTAMP(0) WITH TIME ZONE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ return '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(2000)')
+ : ($length ? 'VARCHAR2(' . $length . ')' : 'VARCHAR2(4000)');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return 'RAW(' . ($length ?: $this->getBinaryMaxLength()) . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryMaxLength()
+ {
+ return 2000;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ return 'CLOB';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListDatabasesSQL()
+ {
+ return 'SELECT username FROM all_users';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListSequencesSQL($database)
+ {
+ $database = $this->normalizeIdentifier($database);
+ $database = $this->quoteStringLiteral($database->getName());
+
+ return 'SELECT sequence_name, min_value, increment_by FROM sys.all_sequences ' .
+ 'WHERE SEQUENCE_OWNER = ' . $database;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCreateTableSQL($table, array $columns, array $options = [])
+ {
+ $indexes = $options['indexes'] ?? [];
+ $options['indexes'] = [];
+ $sql = parent::_getCreateTableSQL($table, $columns, $options);
+
+ foreach ($columns as $name => $column) {
+ if (isset($column['sequence'])) {
+ $sql[] = $this->getCreateSequenceSQL($column['sequence']);
+ }
+
+ if (! isset($column['autoincrement']) || ! $column['autoincrement'] &&
+ (! isset($column['autoinc']) || ! $column['autoinc'])) {
+ continue;
+ }
+
+ $sql = array_merge($sql, $this->getCreateAutoincrementSql($name, $table));
+ }
+
+ if (isset($indexes) && ! empty($indexes)) {
+ foreach ($indexes as $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $table);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaOracleReader.html
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ $table = $this->normalizeIdentifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ return "SELECT uind_col.index_name AS name,
+ (
+ SELECT uind.index_type
+ FROM user_indexes uind
+ WHERE uind.index_name = uind_col.index_name
+ ) AS type,
+ decode(
+ (
+ SELECT uind.uniqueness
+ FROM user_indexes uind
+ WHERE uind.index_name = uind_col.index_name
+ ),
+ 'NONUNIQUE',
+ 0,
+ 'UNIQUE',
+ 1
+ ) AS is_unique,
+ uind_col.column_name AS column_name,
+ uind_col.column_position AS column_pos,
+ (
+ SELECT ucon.constraint_type
+ FROM user_constraints ucon
+ WHERE ucon.index_name = uind_col.index_name
+ ) AS is_primary
+ FROM user_ind_columns uind_col
+ WHERE uind_col.table_name = " . $table . '
+ ORDER BY uind_col.column_position ASC';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTablesSQL()
+ {
+ return 'SELECT * FROM sys.user_tables';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListViewsSQL($database)
+ {
+ return 'SELECT view_name, text FROM sys.user_views';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ return 'CREATE VIEW ' . $name . ' AS ' . $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropViewSQL($name)
+ {
+ return 'DROP VIEW ' . $name;
+ }
+
+ /**
+ * @param string $name
+ * @param string $table
+ * @param int $start
+ *
+ * @return string[]
+ */
+ public function getCreateAutoincrementSql($name, $table, $start = 1)
+ {
+ $tableIdentifier = $this->normalizeIdentifier($table);
+ $quotedTableName = $tableIdentifier->getQuotedName($this);
+ $unquotedTableName = $tableIdentifier->getName();
+
+ $nameIdentifier = $this->normalizeIdentifier($name);
+ $quotedName = $nameIdentifier->getQuotedName($this);
+ $unquotedName = $nameIdentifier->getName();
+
+ $sql = [];
+
+ $autoincrementIdentifierName = $this->getAutoincrementIdentifierName($tableIdentifier);
+
+ $idx = new Index($autoincrementIdentifierName, [$quotedName], true, true);
+
+ $sql[] = 'DECLARE
+ constraints_Count NUMBER;
+BEGIN
+ SELECT COUNT(CONSTRAINT_NAME) INTO constraints_Count FROM USER_CONSTRAINTS WHERE TABLE_NAME = \'' . $unquotedTableName . '\' AND CONSTRAINT_TYPE = \'P\';
+ IF constraints_Count = 0 OR constraints_Count = \'\' THEN
+ EXECUTE IMMEDIATE \'' . $this->getCreateConstraintSQL($idx, $quotedTableName) . '\';
+ END IF;
+END;';
+
+ $sequenceName = $this->getIdentitySequenceName(
+ $tableIdentifier->isQuoted() ? $quotedTableName : $unquotedTableName,
+ $nameIdentifier->isQuoted() ? $quotedName : $unquotedName
+ );
+ $sequence = new Sequence($sequenceName, $start);
+ $sql[] = $this->getCreateSequenceSQL($sequence);
+
+ $sql[] = 'CREATE TRIGGER ' . $autoincrementIdentifierName . '
+ BEFORE INSERT
+ ON ' . $quotedTableName . '
+ FOR EACH ROW
+DECLARE
+ last_Sequence NUMBER;
+ last_InsertID NUMBER;
+BEGIN
+ SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $quotedName . ' FROM DUAL;
+ IF (:NEW.' . $quotedName . ' IS NULL OR :NEW.' . $quotedName . ' = 0) THEN
+ SELECT ' . $sequenceName . '.NEXTVAL INTO :NEW.' . $quotedName . ' FROM DUAL;
+ ELSE
+ SELECT NVL(Last_Number, 0) INTO last_Sequence
+ FROM User_Sequences
+ WHERE Sequence_Name = \'' . $sequence->getName() . '\';
+ SELECT :NEW.' . $quotedName . ' INTO last_InsertID FROM DUAL;
+ WHILE (last_InsertID > last_Sequence) LOOP
+ SELECT ' . $sequenceName . '.NEXTVAL INTO last_Sequence FROM DUAL;
+ END LOOP;
+ END IF;
+END;';
+
+ return $sql;
+ }
+
+ /**
+ * Returns the SQL statements to drop the autoincrement for the given table name.
+ *
+ * @param string $table The table name to drop the autoincrement for.
+ *
+ * @return string[]
+ */
+ public function getDropAutoincrementSql($table)
+ {
+ $table = $this->normalizeIdentifier($table);
+ $autoincrementIdentifierName = $this->getAutoincrementIdentifierName($table);
+ $identitySequenceName = $this->getIdentitySequenceName(
+ $table->isQuoted() ? $table->getQuotedName($this) : $table->getName(),
+ ''
+ );
+
+ return [
+ 'DROP TRIGGER ' . $autoincrementIdentifierName,
+ $this->getDropSequenceSQL($identitySequenceName),
+ $this->getDropConstraintSQL($autoincrementIdentifierName, $table->getQuotedName($this)),
+ ];
+ }
+
+ /**
+ * Normalizes the given identifier.
+ *
+ * Uppercases the given identifier if it is not quoted by intention
+ * to reflect Oracle's internal auto uppercasing strategy of unquoted identifiers.
+ *
+ * @param string $name The identifier to normalize.
+ *
+ * @return Identifier The normalized identifier.
+ */
+ private function normalizeIdentifier($name)
+ {
+ $identifier = new Identifier($name);
+
+ return $identifier->isQuoted() ? $identifier : new Identifier(strtoupper($name));
+ }
+
+ /**
+ * Returns the autoincrement primary key identifier name for the given table identifier.
+ *
+ * Quotes the autoincrement primary key identifier name
+ * if the given table name is quoted by intention.
+ *
+ * @param Identifier $table The table identifier to return the autoincrement primary key identifier name for.
+ *
+ * @return string
+ */
+ private function getAutoincrementIdentifierName(Identifier $table)
+ {
+ $identifierName = $table->getName() . '_AI_PK';
+
+ return $table->isQuoted()
+ ? $this->quoteSingleIdentifier($identifierName)
+ : $identifierName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableForeignKeysSQL($table)
+ {
+ $table = $this->normalizeIdentifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ return "SELECT alc.constraint_name,
+ alc.DELETE_RULE,
+ cols.column_name \"local_column\",
+ cols.position,
+ (
+ SELECT r_cols.table_name
+ FROM user_cons_columns r_cols
+ WHERE alc.r_constraint_name = r_cols.constraint_name
+ AND r_cols.position = cols.position
+ ) AS \"references_table\",
+ (
+ SELECT r_cols.column_name
+ FROM user_cons_columns r_cols
+ WHERE alc.r_constraint_name = r_cols.constraint_name
+ AND r_cols.position = cols.position
+ ) AS \"foreign_column\"
+ FROM user_cons_columns cols
+ JOIN user_constraints alc
+ ON alc.constraint_name = cols.constraint_name
+ AND alc.constraint_type = 'R'
+ AND alc.table_name = " . $table . '
+ ORDER BY cols.constraint_name ASC, cols.position ASC';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableConstraintsSQL($table)
+ {
+ $table = $this->normalizeIdentifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ return 'SELECT * FROM user_constraints WHERE table_name = ' . $table;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ $table = $this->normalizeIdentifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ $tabColumnsTableName = 'user_tab_columns';
+ $colCommentsTableName = 'user_col_comments';
+ $tabColumnsOwnerCondition = '';
+ $colCommentsOwnerCondition = '';
+
+ if ($database !== null && $database !== '/') {
+ $database = $this->normalizeIdentifier($database);
+ $database = $this->quoteStringLiteral($database->getName());
+ $tabColumnsTableName = 'all_tab_columns';
+ $colCommentsTableName = 'all_col_comments';
+ $tabColumnsOwnerCondition = ' AND c.owner = ' . $database;
+ $colCommentsOwnerCondition = ' AND d.OWNER = c.OWNER';
+ }
+
+ return sprintf(
+ <<<'SQL'
+SELECT c.*,
+ (
+ SELECT d.comments
+ FROM %s d
+ WHERE d.TABLE_NAME = c.TABLE_NAME%s
+ AND d.COLUMN_NAME = c.COLUMN_NAME
+ ) AS comments
+FROM %s c
+WHERE c.table_name = %s%s
+ORDER BY c.column_id
+SQL
+ ,
+ $colCommentsTableName,
+ $colCommentsOwnerCondition,
+ $tabColumnsTableName,
+ $table,
+ $tabColumnsOwnerCondition
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropSequenceSQL($sequence)
+ {
+ if ($sequence instanceof Sequence) {
+ $sequence = $sequence->getQuotedName($this);
+ }
+
+ return 'DROP SEQUENCE ' . $sequence;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropForeignKeySQL($foreignKey, $table)
+ {
+ if (! $foreignKey instanceof ForeignKeyConstraint) {
+ $foreignKey = new Identifier($foreignKey);
+ }
+
+ if (! $table instanceof Table) {
+ $table = new Identifier($table);
+ }
+
+ $foreignKey = $foreignKey->getQuotedName($this);
+ $table = $table->getQuotedName($this);
+
+ return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $referentialAction = null;
+
+ if ($foreignKey->hasOption('onDelete')) {
+ $referentialAction = $this->getForeignKeyReferentialActionSQL($foreignKey->getOption('onDelete'));
+ }
+
+ return $referentialAction ? ' ON DELETE ' . $referentialAction : '';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getForeignKeyReferentialActionSQL($action)
+ {
+ $action = strtoupper($action);
+
+ switch ($action) {
+ case 'RESTRICT': // RESTRICT is not supported, therefore falling back to NO ACTION.
+ case 'NO ACTION':
+ // NO ACTION cannot be declared explicitly,
+ // therefore returning empty string to indicate to OMIT the referential clause.
+ return '';
+
+ case 'CASCADE':
+ case 'SET NULL':
+ return $action;
+
+ default:
+ // SET DEFAULT is not supported, throw exception instead.
+ throw new InvalidArgumentException('Invalid foreign key action: ' . $action);
+ }
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropDatabaseSQL($database)
+ {
+ return 'DROP USER ' . $database . ' CASCADE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $sql = [];
+ $commentsSQL = [];
+ $columnSql = [];
+
+ $fields = [];
+
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $fields[] = $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ $comment = $this->getColumnComment($column);
+
+ if (! $comment) {
+ continue;
+ }
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $comment
+ );
+ }
+
+ if (count($fields)) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ADD (' . implode(', ', $fields) . ')';
+ }
+
+ $fields = [];
+ foreach ($diff->changedColumns as $columnDiff) {
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ $column = $columnDiff->column;
+
+ // Do not generate column alteration clause if type is binary and only fixed property has changed.
+ // Oracle only supports binary type columns with variable length.
+ // Avoids unnecessary table alteration statements.
+ if ($column->getType() instanceof BinaryType &&
+ $columnDiff->hasChanged('fixed') &&
+ count($columnDiff->changedProperties) === 1
+ ) {
+ continue;
+ }
+
+ $columnHasChangedComment = $columnDiff->hasChanged('comment');
+
+ /**
+ * Do not add query part if only comment has changed
+ */
+ if (! ($columnHasChangedComment && count($columnDiff->changedProperties) === 1)) {
+ $columnInfo = $column->toArray();
+
+ if (! $columnDiff->hasChanged('notnull')) {
+ unset($columnInfo['notnull']);
+ }
+
+ $fields[] = $column->getQuotedName($this) . $this->getColumnDeclarationSQL('', $columnInfo);
+ }
+
+ if (! $columnHasChangedComment) {
+ continue;
+ }
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $this->getColumnComment($column)
+ );
+ }
+
+ if (count($fields)) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' MODIFY (' . implode(', ', $fields) . ')';
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $oldColumnName = new Identifier($oldColumnName);
+
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) .
+ ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this);
+ }
+
+ $fields = [];
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $fields[] = $column->getQuotedName($this);
+ }
+
+ if (count($fields)) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' DROP (' . implode(', ', $fields) . ')';
+ }
+
+ $tableSql = [];
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ $sql = array_merge($sql, $commentsSQL);
+
+ if ($diff->newName !== false) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' RENAME TO ' . $diff->getNewName()->getQuotedName($this);
+ }
+
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getColumnDeclarationSQL($name, array $field)
+ {
+ if (isset($field['columnDefinition'])) {
+ $columnDef = $this->getCustomTypeDeclarationSQL($field);
+ } else {
+ $default = $this->getDefaultValueDeclarationSQL($field);
+
+ $notnull = '';
+
+ if (isset($field['notnull'])) {
+ $notnull = $field['notnull'] ? ' NOT NULL' : ' NULL';
+ }
+
+ $unique = isset($field['unique']) && $field['unique'] ?
+ ' ' . $this->getUniqueFieldDeclarationSQL() : '';
+
+ $check = isset($field['check']) && $field['check'] ?
+ ' ' . $field['check'] : '';
+
+ $typeDecl = $field['type']->getSQLDeclaration($field, $this);
+ $columnDef = $typeDecl . $default . $notnull . $unique . $check;
+ }
+
+ return $name . ' ' . $columnDef;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
+ {
+ if (strpos($tableName, '.') !== false) {
+ [$schema] = explode('.', $tableName);
+ $oldIndexName = $schema . '.' . $oldIndexName;
+ }
+
+ return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function prefersSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function usesSequenceEmulatedIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIdentitySequenceName($tableName, $columnName)
+ {
+ $table = new Identifier($tableName);
+
+ // No usage of column name to preserve BC compatibility with <2.5
+ $identitySequenceName = $table->getName() . '_SEQ';
+
+ if ($table->isQuoted()) {
+ $identitySequenceName = '"' . $identitySequenceName . '"';
+ }
+
+ $identitySequenceIdentifier = $this->normalizeIdentifier($identitySequenceName);
+
+ return $identitySequenceIdentifier->getQuotedName($this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsCommentOnStatement()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return 'oracle';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset = null)
+ {
+ if ($limit === null && $offset <= 0) {
+ return $query;
+ }
+
+ if (preg_match('/^\s*SELECT/i', $query)) {
+ if (! preg_match('/\sFROM\s/i', $query)) {
+ $query .= ' FROM dual';
+ }
+
+ $columns = ['a.*'];
+
+ if ($offset > 0) {
+ $columns[] = 'ROWNUM AS doctrine_rownum';
+ }
+
+ $query = sprintf('SELECT %s FROM (%s) a', implode(', ', $columns), $query);
+
+ if ($limit !== null) {
+ $query .= sprintf(' WHERE ROWNUM <= %d', $offset + $limit);
+ }
+
+ if ($offset > 0) {
+ $query = sprintf('SELECT * FROM (%s) WHERE doctrine_rownum >= %d', $query, $offset + 1);
+ }
+ }
+
+ return $query;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Oracle returns all column names in SQL result sets in uppercase.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return strtoupper($column);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return 'CREATE GLOBAL TEMPORARY TABLE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return 'Y-m-d H:i:sP';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateFormatString()
+ {
+ return 'Y-m-d 00:00:00';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeFormatString()
+ {
+ return '1900-01-01 H:i:s';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function fixSchemaElementName($schemaElementName)
+ {
+ if (strlen($schemaElementName) > 30) {
+ // Trim it
+ return substr($schemaElementName, 0, 30);
+ }
+
+ return $schemaElementName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getMaxIdentifierLength()
+ {
+ return 30;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsForeignKeyOnUpdate()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ $tableIdentifier = new Identifier($tableName);
+
+ return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDummySelectSQL()
+ {
+ $expression = func_num_args() > 0 ? func_get_arg(0) : '1';
+
+ return sprintf('SELECT %s FROM DUAL', $expression);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'integer' => 'integer',
+ 'number' => 'integer',
+ 'pls_integer' => 'boolean',
+ 'binary_integer' => 'boolean',
+ 'varchar' => 'string',
+ 'varchar2' => 'string',
+ 'nvarchar2' => 'string',
+ 'char' => 'string',
+ 'nchar' => 'string',
+ 'date' => 'date',
+ 'timestamp' => 'datetime',
+ 'timestamptz' => 'datetimetz',
+ 'float' => 'float',
+ 'binary_float' => 'float',
+ 'binary_double' => 'float',
+ 'long' => 'string',
+ 'clob' => 'text',
+ 'nclob' => 'text',
+ 'raw' => 'binary',
+ 'long raw' => 'blob',
+ 'rowid' => 'string',
+ 'urowid' => 'string',
+ 'blob' => 'blob',
+ ];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function releaseSavePoint($savepoint)
+ {
+ return '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\OracleKeywords::class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ return 'BLOB';
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php
new file mode 100644
index 000000000..cfb079f94
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL100Platform.php
@@ -0,0 +1,33 @@
+quoteStringLiteral($database) . "
+ AND sequence_schema NOT LIKE 'pg\_%'
+ AND sequence_schema != 'information_schema'";
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php
new file mode 100644
index 000000000..f55840983
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL91Platform.php
@@ -0,0 +1,46 @@
+quoteSingleIdentifier($collation);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ $sql = parent::getListTableColumnsSQL($table, $database);
+ $parts = explode('AS complete_type,', $sql, 2);
+
+ return $parts[0] . 'AS complete_type, (SELECT tc.collcollate FROM pg_catalog.pg_collation tc WHERE tc.oid = a.attcollation) AS collation,' . $parts[1];
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
new file mode 100644
index 000000000..b302c0ceb
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL92Platform.php
@@ -0,0 +1,69 @@
+doctrineTypeMapping['json'] = Type::JSON;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCloseActiveDatabaseConnectionsSQL($database)
+ {
+ return sprintf(
+ 'SELECT pg_terminate_backend(pid) FROM pg_stat_activity WHERE datname = %s',
+ $this->quoteStringLiteral($database)
+ );
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
new file mode 100644
index 000000000..9db0ecbbd
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSQL94Platform.php
@@ -0,0 +1,41 @@
+doctrineTypeMapping['jsonb'] = Type::JSON;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
new file mode 100644
index 000000000..cb4603f51
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/PostgreSqlPlatform.php
@@ -0,0 +1,1248 @@
+ [
+ 't',
+ 'true',
+ 'y',
+ 'yes',
+ 'on',
+ '1',
+ ],
+ 'false' => [
+ 'f',
+ 'false',
+ 'n',
+ 'no',
+ 'off',
+ '0',
+ ],
+ ];
+
+ /**
+ * PostgreSQL has different behavior with some drivers
+ * with regard to how booleans have to be handled.
+ *
+ * Enables use of 'true'/'false' or otherwise 1 and 0 instead.
+ *
+ * @param bool $flag
+ */
+ public function setUseBooleanTrueFalseStrings($flag)
+ {
+ $this->useBooleanTrueFalseStrings = (bool) $flag;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSubstringExpression($value, $from, $length = null)
+ {
+ if ($length === null) {
+ return 'SUBSTRING(' . $value . ' FROM ' . $from . ')';
+ }
+
+ return 'SUBSTRING(' . $value . ' FROM ' . $from . ' FOR ' . $length . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getNowExpression()
+ {
+ return 'LOCALTIMESTAMP(0)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getRegexpExpression()
+ {
+ return 'SIMILAR TO';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos !== false) {
+ $str = $this->getSubstringExpression($str, $startPos);
+
+ return 'CASE WHEN (POSITION(' . $substr . ' IN ' . $str . ') = 0) THEN 0 ELSE (POSITION(' . $substr . ' IN ' . $str . ') + ' . ($startPos-1) . ') END';
+ }
+
+ return 'POSITION(' . $substr . ' IN ' . $str . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ if ($unit === DateIntervalUnit::QUARTER) {
+ $interval *= 3;
+ $unit = DateIntervalUnit::MONTH;
+ }
+
+ return '(' . $date . ' ' . $operator . ' (' . $interval . " || ' " . $unit . "')::interval)";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ return '(DATE(' . $date1 . ')-DATE(' . $date2 . '))';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsSchemas()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultSchemaName()
+ {
+ return 'public';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsPartialIndexes()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function usesSequenceEmulatedIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIdentitySequenceName($tableName, $columnName)
+ {
+ return $tableName . '_' . $columnName . '_seq';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsCommentOnStatement()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function prefersSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function hasNativeGuidType()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListDatabasesSQL()
+ {
+ return 'SELECT datname FROM pg_database';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListNamespacesSQL()
+ {
+ return "SELECT schema_name AS nspname
+ FROM information_schema.schemata
+ WHERE schema_name NOT LIKE 'pg\_%'
+ AND schema_name != 'information_schema'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListSequencesSQL($database)
+ {
+ return "SELECT sequence_name AS relname,
+ sequence_schema AS schemaname
+ FROM information_schema.sequences
+ WHERE sequence_schema NOT LIKE 'pg\_%'
+ AND sequence_schema != 'information_schema'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTablesSQL()
+ {
+ return "SELECT quote_ident(table_name) AS table_name,
+ table_schema AS schema_name
+ FROM information_schema.tables
+ WHERE table_schema NOT LIKE 'pg\_%'
+ AND table_schema != 'information_schema'
+ AND table_name != 'geometry_columns'
+ AND table_name != 'spatial_ref_sys'
+ AND table_type != 'VIEW'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListViewsSQL($database)
+ {
+ return 'SELECT quote_ident(table_name) AS viewname,
+ table_schema AS schemaname,
+ view_definition AS definition
+ FROM information_schema.views
+ WHERE view_definition IS NOT NULL';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableForeignKeysSQL($table, $database = null)
+ {
+ return 'SELECT quote_ident(r.conname) as conname, pg_catalog.pg_get_constraintdef(r.oid, true) as condef
+ FROM pg_catalog.pg_constraint r
+ WHERE r.conrelid =
+ (
+ SELECT c.oid
+ FROM pg_catalog.pg_class c, pg_catalog.pg_namespace n
+ WHERE ' . $this->getTableWhereClause($table) . " AND n.oid = c.relnamespace
+ )
+ AND r.contype = 'f'";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ return 'CREATE VIEW ' . $name . ' AS ' . $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropViewSQL($name)
+ {
+ return 'DROP VIEW ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableConstraintsSQL($table)
+ {
+ $table = new Identifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ return sprintf(
+ <<<'SQL'
+SELECT
+ quote_ident(relname) as relname
+FROM
+ pg_class
+WHERE oid IN (
+ SELECT indexrelid
+ FROM pg_index, pg_class
+ WHERE pg_class.relname = %s
+ AND pg_class.oid = pg_index.indrelid
+ AND (indisunique = 't' OR indisprimary = 't')
+ )
+SQL
+ ,
+ $table
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ return 'SELECT quote_ident(relname) as relname, pg_index.indisunique, pg_index.indisprimary,
+ pg_index.indkey, pg_index.indrelid,
+ pg_get_expr(indpred, indrelid) AS where
+ FROM pg_class, pg_index
+ WHERE oid IN (
+ SELECT indexrelid
+ FROM pg_index si, pg_class sc, pg_namespace sn
+ WHERE ' . $this->getTableWhereClause($table, 'sc', 'sn') . ' AND sc.oid=si.indrelid AND sc.relnamespace = sn.oid
+ ) AND pg_index.indexrelid = oid';
+ }
+
+ /**
+ * @param string $table
+ * @param string $classAlias
+ * @param string $namespaceAlias
+ *
+ * @return string
+ */
+ private function getTableWhereClause($table, $classAlias = 'c', $namespaceAlias = 'n')
+ {
+ $whereClause = $namespaceAlias . ".nspname NOT IN ('pg_catalog', 'information_schema', 'pg_toast') AND ";
+ if (strpos($table, '.') !== false) {
+ [$schema, $table] = explode('.', $table);
+ $schema = $this->quoteStringLiteral($schema);
+ } else {
+ $schema = "ANY(string_to_array((select replace(replace(setting,'\"\$user\"',user),' ','') from pg_catalog.pg_settings where name = 'search_path'),','))";
+ }
+
+ $table = new Identifier($table);
+ $table = $this->quoteStringLiteral($table->getName());
+
+ return $whereClause . sprintf(
+ '%s.relname = %s AND %s.nspname = %s',
+ $classAlias,
+ $table,
+ $namespaceAlias,
+ $schema
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ return "SELECT
+ a.attnum,
+ quote_ident(a.attname) AS field,
+ t.typname AS type,
+ format_type(a.atttypid, a.atttypmod) AS complete_type,
+ (SELECT t1.typname FROM pg_catalog.pg_type t1 WHERE t1.oid = t.typbasetype) AS domain_type,
+ (SELECT format_type(t2.typbasetype, t2.typtypmod) FROM
+ pg_catalog.pg_type t2 WHERE t2.typtype = 'd' AND t2.oid = a.atttypid) AS domain_complete_type,
+ a.attnotnull AS isnotnull,
+ (SELECT 't'
+ FROM pg_index
+ WHERE c.oid = pg_index.indrelid
+ AND pg_index.indkey[0] = a.attnum
+ AND pg_index.indisprimary = 't'
+ ) AS pri,
+ (SELECT pg_get_expr(adbin, adrelid)
+ FROM pg_attrdef
+ WHERE c.oid = pg_attrdef.adrelid
+ AND pg_attrdef.adnum=a.attnum
+ ) AS default,
+ (SELECT pg_description.description
+ FROM pg_description WHERE pg_description.objoid = c.oid AND a.attnum = pg_description.objsubid
+ ) AS comment
+ FROM pg_attribute a, pg_class c, pg_type t, pg_namespace n
+ WHERE " . $this->getTableWhereClause($table, 'c', 'n') . '
+ AND a.attnum > 0
+ AND a.attrelid = c.oid
+ AND a.atttypid = t.oid
+ AND n.oid = c.relnamespace
+ ORDER BY a.attnum';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateDatabaseSQL($name)
+ {
+ return 'CREATE DATABASE ' . $name;
+ }
+
+ /**
+ * Returns the SQL statement for disallowing new connections on the given database.
+ *
+ * This is useful to force DROP DATABASE operations which could fail because of active connections.
+ *
+ * @param string $database The name of the database to disallow new connections for.
+ *
+ * @return string
+ */
+ public function getDisallowDatabaseConnectionsSQL($database)
+ {
+ return "UPDATE pg_database SET datallowconn = 'false' WHERE datname = " . $this->quoteStringLiteral($database);
+ }
+
+ /**
+ * Returns the SQL statement for closing currently active connections on the given database.
+ *
+ * This is useful to force DROP DATABASE operations which could fail because of active connections.
+ *
+ * @param string $database The name of the database to close currently active connections for.
+ *
+ * @return string
+ */
+ public function getCloseActiveDatabaseConnectionsSQL($database)
+ {
+ return 'SELECT pg_terminate_backend(procpid) FROM pg_stat_activity WHERE datname = '
+ . $this->quoteStringLiteral($database);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $query = '';
+
+ if ($foreignKey->hasOption('match')) {
+ $query .= ' MATCH ' . $foreignKey->getOption('match');
+ }
+
+ $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
+
+ if ($foreignKey->hasOption('deferrable') && $foreignKey->getOption('deferrable') !== false) {
+ $query .= ' DEFERRABLE';
+ } else {
+ $query .= ' NOT DEFERRABLE';
+ }
+
+ if (($foreignKey->hasOption('feferred') && $foreignKey->getOption('feferred') !== false)
+ || ($foreignKey->hasOption('deferred') && $foreignKey->getOption('deferred') !== false)
+ ) {
+ $query .= ' INITIALLY DEFERRED';
+ } else {
+ $query .= ' INITIALLY IMMEDIATE';
+ }
+
+ return $query;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $sql = [];
+ $commentsSQL = [];
+ $columnSql = [];
+
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $query = 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+
+ $comment = $this->getColumnComment($column);
+
+ if ($comment === null || $comment === '') {
+ continue;
+ }
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $comment
+ );
+ }
+
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $query = 'DROP ' . $column->getQuotedName($this);
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+
+ foreach ($diff->changedColumns as $columnDiff) {
+ /** @var $columnDiff \Doctrine\DBAL\Schema\ColumnDiff */
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ if ($this->isUnchangedBinaryColumn($columnDiff)) {
+ continue;
+ }
+
+ $oldColumnName = $columnDiff->getOldColumnName()->getQuotedName($this);
+ $column = $columnDiff->column;
+
+ if ($columnDiff->hasChanged('type') || $columnDiff->hasChanged('precision') || $columnDiff->hasChanged('scale') || $columnDiff->hasChanged('fixed')) {
+ $type = $column->getType();
+
+ // SERIAL/BIGSERIAL are not "real" types and we can't alter a column to that type
+ $columnDefinition = $column->toArray();
+ $columnDefinition['autoincrement'] = false;
+
+ // here was a server version check before, but DBAL API does not support this anymore.
+ $query = 'ALTER ' . $oldColumnName . ' TYPE ' . $type->getSQLDeclaration($columnDefinition, $this);
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+
+ if ($columnDiff->hasChanged('default') || $this->typeChangeBreaksDefaultValue($columnDiff)) {
+ $defaultClause = $column->getDefault() === null
+ ? ' DROP DEFAULT'
+ : ' SET' . $this->getDefaultValueDeclarationSQL($column->toArray());
+ $query = 'ALTER ' . $oldColumnName . $defaultClause;
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+
+ if ($columnDiff->hasChanged('notnull')) {
+ $query = 'ALTER ' . $oldColumnName . ' ' . ($column->getNotnull() ? 'SET' : 'DROP') . ' NOT NULL';
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+
+ if ($columnDiff->hasChanged('autoincrement')) {
+ if ($column->getAutoincrement()) {
+ // add autoincrement
+ $seqName = $this->getIdentitySequenceName($diff->name, $oldColumnName);
+
+ $sql[] = 'CREATE SEQUENCE ' . $seqName;
+ $sql[] = "SELECT setval('" . $seqName . "', (SELECT MAX(" . $oldColumnName . ') FROM ' . $diff->getName($this)->getQuotedName($this) . '))';
+ $query = 'ALTER ' . $oldColumnName . " SET DEFAULT nextval('" . $seqName . "')";
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ } else {
+ // Drop autoincrement, but do NOT drop the sequence. It might be re-used by other tables or have
+ $query = 'ALTER ' . $oldColumnName . ' DROP DEFAULT';
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+ }
+
+ $newComment = $this->getColumnComment($column);
+ $oldComment = $this->getOldColumnComment($columnDiff);
+
+ if ($columnDiff->hasChanged('comment') || ($columnDiff->fromColumn !== null && $oldComment !== $newComment)) {
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $newComment
+ );
+ }
+
+ if (! $columnDiff->hasChanged('length')) {
+ continue;
+ }
+
+ $query = 'ALTER ' . $oldColumnName . ' TYPE ' . $column->getType()->getSQLDeclaration($column->toArray(), $this);
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' ' . $query;
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $oldColumnName = new Identifier($oldColumnName);
+
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) .
+ ' RENAME COLUMN ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this);
+ }
+
+ $tableSql = [];
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ $sql = array_merge($sql, $commentsSQL);
+
+ if ($diff->newName !== false) {
+ $sql[] = 'ALTER TABLE ' . $diff->getName($this)->getQuotedName($this) . ' RENAME TO ' . $diff->getNewName()->getQuotedName($this);
+ }
+
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * Checks whether a given column diff is a logically unchanged binary type column.
+ *
+ * Used to determine whether a column alteration for a binary type column can be skipped.
+ * Doctrine's {@link \Doctrine\DBAL\Types\BinaryType} and {@link \Doctrine\DBAL\Types\BlobType}
+ * are mapped to the same database column type on this platform as this platform
+ * does not have a native VARBINARY/BINARY column type. Therefore the {@link \Doctrine\DBAL\Schema\Comparator}
+ * might detect differences for binary type columns which do not have to be propagated
+ * to database as there actually is no difference at database level.
+ *
+ * @param ColumnDiff $columnDiff The column diff to check against.
+ *
+ * @return bool True if the given column diff is an unchanged binary type column, false otherwise.
+ */
+ private function isUnchangedBinaryColumn(ColumnDiff $columnDiff)
+ {
+ $columnType = $columnDiff->column->getType();
+
+ if (! $columnType instanceof BinaryType && ! $columnType instanceof BlobType) {
+ return false;
+ }
+
+ $fromColumn = $columnDiff->fromColumn instanceof Column ? $columnDiff->fromColumn : null;
+
+ if ($fromColumn) {
+ $fromColumnType = $fromColumn->getType();
+
+ if (! $fromColumnType instanceof BinaryType && ! $fromColumnType instanceof BlobType) {
+ return false;
+ }
+
+ return count(array_diff($columnDiff->changedProperties, ['type', 'length', 'fixed'])) === 0;
+ }
+
+ if ($columnDiff->hasChanged('type')) {
+ return false;
+ }
+
+ return count(array_diff($columnDiff->changedProperties, ['length', 'fixed'])) === 0;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
+ {
+ if (strpos($tableName, '.') !== false) {
+ [$schema] = explode('.', $tableName);
+ $oldIndexName = $schema . '.' . $oldIndexName;
+ }
+
+ return ['ALTER INDEX ' . $oldIndexName . ' RENAME TO ' . $index->getQuotedName($this)];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCommentOnColumnSQL($tableName, $columnName, $comment)
+ {
+ $tableName = new Identifier($tableName);
+ $columnName = new Identifier($columnName);
+ $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment);
+
+ return sprintf(
+ 'COMMENT ON COLUMN %s.%s IS %s',
+ $tableName->getQuotedName($this),
+ $columnName->getQuotedName($this),
+ $comment
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateSequenceSQL(Sequence $sequence)
+ {
+ return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize() .
+ ' MINVALUE ' . $sequence->getInitialValue() .
+ ' START ' . $sequence->getInitialValue() .
+ $this->getSequenceCacheSQL($sequence);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getAlterSequenceSQL(Sequence $sequence)
+ {
+ return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize() .
+ $this->getSequenceCacheSQL($sequence);
+ }
+
+ /**
+ * Cache definition for sequences
+ *
+ * @return string
+ */
+ private function getSequenceCacheSQL(Sequence $sequence)
+ {
+ if ($sequence->getCache() > 1) {
+ return ' CACHE ' . $sequence->getCache();
+ }
+
+ return '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropSequenceSQL($sequence)
+ {
+ if ($sequence instanceof Sequence) {
+ $sequence = $sequence->getQuotedName($this);
+ }
+
+ return 'DROP SEQUENCE ' . $sequence . ' CASCADE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateSchemaSQL($schemaName)
+ {
+ return 'CREATE SCHEMA ' . $schemaName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropForeignKeySQL($foreignKey, $table)
+ {
+ return $this->getDropConstraintSQL($foreignKey, $table);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $queryFields = $this->getColumnDeclarationListSQL($columns);
+
+ if (isset($options['primary']) && ! empty($options['primary'])) {
+ $keyColumns = array_unique(array_values($options['primary']));
+ $queryFields .= ', PRIMARY KEY(' . implode(', ', $keyColumns) . ')';
+ }
+
+ $query = 'CREATE TABLE ' . $tableName . ' (' . $queryFields . ')';
+
+ $sql = [$query];
+
+ if (isset($options['indexes']) && ! empty($options['indexes'])) {
+ foreach ($options['indexes'] as $index) {
+ $sql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+ }
+
+ if (isset($options['foreignKeys'])) {
+ foreach ((array) $options['foreignKeys'] as $definition) {
+ $sql[] = $this->getCreateForeignKeySQL($definition, $tableName);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Converts a single boolean value.
+ *
+ * First converts the value to its native PHP boolean type
+ * and passes it to the given callback function to be reconverted
+ * into any custom representation.
+ *
+ * @param mixed $value The value to convert.
+ * @param callable $callback The callback function to use for converting the real boolean value.
+ *
+ * @return mixed
+ *
+ * @throws UnexpectedValueException
+ */
+ private function convertSingleBooleanValue($value, $callback)
+ {
+ if ($value === null) {
+ return $callback(null);
+ }
+
+ if (is_bool($value) || is_numeric($value)) {
+ return $callback($value ? true : false);
+ }
+
+ if (! is_string($value)) {
+ return $callback(true);
+ }
+
+ /**
+ * Better safe than sorry: http://php.net/in_array#106319
+ */
+ if (in_array(strtolower(trim($value)), $this->booleanLiterals['false'], true)) {
+ return $callback(false);
+ }
+
+ if (in_array(strtolower(trim($value)), $this->booleanLiterals['true'], true)) {
+ return $callback(true);
+ }
+
+ throw new UnexpectedValueException("Unrecognized boolean literal '${value}'");
+ }
+
+ /**
+ * Converts one or multiple boolean values.
+ *
+ * First converts the value(s) to their native PHP boolean type
+ * and passes them to the given callback function to be reconverted
+ * into any custom representation.
+ *
+ * @param mixed $item The value(s) to convert.
+ * @param callable $callback The callback function to use for converting the real boolean value(s).
+ *
+ * @return mixed
+ */
+ private function doConvertBooleans($item, $callback)
+ {
+ if (is_array($item)) {
+ foreach ($item as $key => $value) {
+ $item[$key] = $this->convertSingleBooleanValue($value, $callback);
+ }
+
+ return $item;
+ }
+
+ return $this->convertSingleBooleanValue($item, $callback);
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Postgres wants boolean values converted to the strings 'true'/'false'.
+ */
+ public function convertBooleans($item)
+ {
+ if (! $this->useBooleanTrueFalseStrings) {
+ return parent::convertBooleans($item);
+ }
+
+ return $this->doConvertBooleans(
+ $item,
+ static function ($boolean) {
+ if ($boolean === null) {
+ return 'NULL';
+ }
+
+ return $boolean === true ? 'true' : 'false';
+ }
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function convertBooleansToDatabaseValue($item)
+ {
+ if (! $this->useBooleanTrueFalseStrings) {
+ return parent::convertBooleansToDatabaseValue($item);
+ }
+
+ return $this->doConvertBooleans(
+ $item,
+ static function ($boolean) {
+ return $boolean === null ? null : (int) $boolean;
+ }
+ );
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function convertFromBoolean($item)
+ {
+ if (in_array(strtolower($item), $this->booleanLiterals['false'], true)) {
+ return false;
+ }
+
+ return parent::convertFromBoolean($item);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ return "SELECT NEXTVAL('" . $sequenceName . "')";
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ return 'SET SESSION CHARACTERISTICS AS TRANSACTION ISOLATION LEVEL '
+ . $this->_getTransactionIsolationLevelSQL($level);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBooleanTypeDeclarationSQL(array $field)
+ {
+ return 'BOOLEAN';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getIntegerTypeDeclarationSQL(array $field)
+ {
+ if (! empty($field['autoincrement'])) {
+ return 'SERIAL';
+ }
+
+ return 'INT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $field)
+ {
+ if (! empty($field['autoincrement'])) {
+ return 'BIGSERIAL';
+ }
+
+ return 'BIGINT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $field)
+ {
+ return 'SMALLINT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getGuidTypeDeclarationSQL(array $field)
+ {
+ return 'UUID';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIMESTAMP(0) WITHOUT TIME ZONE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIMESTAMP(0) WITH TIME ZONE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME(0) WITHOUT TIME ZONE';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * @deprecated Use application-generated UUIDs instead
+ */
+ public function getGuidExpression()
+ {
+ return 'UUID_GENERATE_V4()';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ return '';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(255)')
+ : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(255)');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return 'BYTEA';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ return 'TEXT';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getName()
+ {
+ return 'postgresql';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * PostgreSQL returns all column names in SQL result sets in lowercase.
+ */
+ public function getSQLResultCasing($column)
+ {
+ return strtolower($column);
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return 'Y-m-d H:i:sO';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getEmptyIdentityInsertSQL($quotedTableName, $quotedIdentifierColumnName)
+ {
+ return 'INSERT INTO ' . $quotedTableName . ' (' . $quotedIdentifierColumnName . ') VALUES (DEFAULT)';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ $tableIdentifier = new Identifier($tableName);
+ $sql = 'TRUNCATE ' . $tableIdentifier->getQuotedName($this);
+
+ if ($cascade) {
+ $sql .= ' CASCADE';
+ }
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getReadLockSQL()
+ {
+ return 'FOR SHARE';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'smallint' => 'smallint',
+ 'int2' => 'smallint',
+ 'serial' => 'integer',
+ 'serial4' => 'integer',
+ 'int' => 'integer',
+ 'int4' => 'integer',
+ 'integer' => 'integer',
+ 'bigserial' => 'bigint',
+ 'serial8' => 'bigint',
+ 'bigint' => 'bigint',
+ 'int8' => 'bigint',
+ 'bool' => 'boolean',
+ 'boolean' => 'boolean',
+ 'text' => 'text',
+ 'tsvector' => 'text',
+ 'varchar' => 'string',
+ 'interval' => 'string',
+ '_varchar' => 'string',
+ 'char' => 'string',
+ 'bpchar' => 'string',
+ 'inet' => 'string',
+ 'date' => 'date',
+ 'datetime' => 'datetime',
+ 'timestamp' => 'datetime',
+ 'timestamptz' => 'datetimetz',
+ 'time' => 'time',
+ 'timetz' => 'time',
+ 'float' => 'float',
+ 'float4' => 'float',
+ 'float8' => 'float',
+ 'double' => 'float',
+ 'double precision' => 'float',
+ 'real' => 'float',
+ 'decimal' => 'decimal',
+ 'money' => 'decimal',
+ 'numeric' => 'decimal',
+ 'year' => 'date',
+ 'uuid' => 'guid',
+ 'bytea' => 'blob',
+ ];
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getVarcharMaxLength()
+ {
+ return 65535;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryMaxLength()
+ {
+ return 0;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryDefaultLength()
+ {
+ return 0;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\PostgreSQLKeywords::class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ return 'BYTEA';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultValueDeclarationSQL($field)
+ {
+ if ($this->isSerialField($field)) {
+ return '';
+ }
+
+ return parent::getDefaultValueDeclarationSQL($field);
+ }
+
+ /**
+ * @param mixed[] $field
+ */
+ private function isSerialField(array $field) : bool
+ {
+ return $field['autoincrement'] ?? false === true && isset($field['type'])
+ && $this->isNumericType($field['type']);
+ }
+
+ /**
+ * Check whether the type of a column is changed in a way that invalidates the default value for the column
+ */
+ private function typeChangeBreaksDefaultValue(ColumnDiff $columnDiff) : bool
+ {
+ if (! $columnDiff->fromColumn) {
+ return $columnDiff->hasChanged('type');
+ }
+
+ $oldTypeIsNumeric = $this->isNumericType($columnDiff->fromColumn->getType());
+ $newTypeIsNumeric = $this->isNumericType($columnDiff->column->getType());
+
+ // default should not be changed when switching between numeric types and the default comes from a sequence
+ return $columnDiff->hasChanged('type')
+ && ! ($oldTypeIsNumeric && $newTypeIsNumeric && $columnDiff->column->getAutoincrement());
+ }
+
+ private function isNumericType(Type $type) : bool
+ {
+ return $type instanceof IntegerType || $type instanceof BigIntType;
+ }
+
+ private function getOldColumnComment(ColumnDiff $columnDiff) : ?string
+ {
+ return $columnDiff->fromColumn ? $this->getColumnComment($columnDiff->fromColumn) : null;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php
new file mode 100644
index 000000000..a46ae9352
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere11Platform.php
@@ -0,0 +1,26 @@
+getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize() .
+ ' START WITH ' . $sequence->getInitialValue() .
+ ' MINVALUE ' . $sequence->getInitialValue();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAlterSequenceSQL(Sequence $sequence)
+ {
+ return 'ALTER SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return 'Y-m-d H:i:s.uP';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTimeTzTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIMESTAMP WITH TIME ZONE';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDropSequenceSQL($sequence)
+ {
+ if ($sequence instanceof Sequence) {
+ $sequence = $sequence->getQuotedName($this);
+ }
+
+ return 'DROP SEQUENCE ' . $sequence;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListSequencesSQL($database)
+ {
+ return 'SELECT sequence_name, increment_by, start_with, min_value FROM SYS.SYSSEQUENCE';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ return 'SELECT ' . $sequenceName . '.NEXTVAL';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getAdvancedIndexOptionsSQL(Index $index)
+ {
+ if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_not_distinct')) {
+ return ' WITH NULLS NOT DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
+ }
+
+ return parent::getAdvancedIndexOptionsSQL($index);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\SQLAnywhere12Keywords::class;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ parent::initializeDoctrineTypeMappings();
+ $this->doctrineTypeMapping['timestamp with time zone'] = 'datetime';
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php
new file mode 100644
index 000000000..35d4238e4
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywhere16Platform.php
@@ -0,0 +1,39 @@
+hasFlag('with_nulls_distinct') && $index->hasFlag('with_nulls_not_distinct')) {
+ throw new UnexpectedValueException(
+ 'An Index can either have a "with_nulls_distinct" or "with_nulls_not_distinct" flag but not both.'
+ );
+ }
+
+ if (! $index->isPrimary() && $index->isUnique() && $index->hasFlag('with_nulls_distinct')) {
+ return ' WITH NULLS DISTINCT' . parent::getAdvancedIndexOptionsSQL($index);
+ }
+
+ return parent::getAdvancedIndexOptionsSQL($index);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\SQLAnywhere16Keywords::class;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
new file mode 100644
index 000000000..ec3ef9334
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAnywherePlatform.php
@@ -0,0 +1,1501 @@
+getMaxIdentifierLength();
+
+ if (strlen($schemaElementName) > $maxIdentifierLength) {
+ return substr($schemaElementName, 0, $maxIdentifierLength);
+ }
+
+ return $schemaElementName;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAdvancedForeignKeyOptionsSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $query = '';
+
+ if ($foreignKey->hasOption('match')) {
+ $query = ' MATCH ' . $this->getForeignKeyMatchClauseSQL($foreignKey->getOption('match'));
+ }
+
+ $query .= parent::getAdvancedForeignKeyOptionsSQL($foreignKey);
+
+ if ($foreignKey->hasOption('check_on_commit') && (bool) $foreignKey->getOption('check_on_commit')) {
+ $query .= ' CHECK ON COMMIT';
+ }
+
+ if ($foreignKey->hasOption('clustered') && (bool) $foreignKey->getOption('clustered')) {
+ $query .= ' CLUSTERED';
+ }
+
+ if ($foreignKey->hasOption('for_olap_workload') && (bool) $foreignKey->getOption('for_olap_workload')) {
+ $query .= ' FOR OLAP WORKLOAD';
+ }
+
+ return $query;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getAlterTableSQL(TableDiff $diff)
+ {
+ $sql = [];
+ $columnSql = [];
+ $commentsSQL = [];
+ $tableSql = [];
+ $alterClauses = [];
+
+ foreach ($diff->addedColumns as $column) {
+ if ($this->onSchemaAlterTableAddColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $alterClauses[] = $this->getAlterTableAddColumnClause($column);
+
+ $comment = $this->getColumnComment($column);
+
+ if ($comment === null || $comment === '') {
+ continue;
+ }
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $comment
+ );
+ }
+
+ foreach ($diff->removedColumns as $column) {
+ if ($this->onSchemaAlterTableRemoveColumn($column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $alterClauses[] = $this->getAlterTableRemoveColumnClause($column);
+ }
+
+ foreach ($diff->changedColumns as $columnDiff) {
+ if ($this->onSchemaAlterTableChangeColumn($columnDiff, $diff, $columnSql)) {
+ continue;
+ }
+
+ $alterClause = $this->getAlterTableChangeColumnClause($columnDiff);
+
+ if ($alterClause !== null) {
+ $alterClauses[] = $alterClause;
+ }
+
+ if (! $columnDiff->hasChanged('comment')) {
+ continue;
+ }
+
+ $column = $columnDiff->column;
+
+ $commentsSQL[] = $this->getCommentOnColumnSQL(
+ $diff->getName($this)->getQuotedName($this),
+ $column->getQuotedName($this),
+ $this->getColumnComment($column)
+ );
+ }
+
+ foreach ($diff->renamedColumns as $oldColumnName => $column) {
+ if ($this->onSchemaAlterTableRenameColumn($oldColumnName, $column, $diff, $columnSql)) {
+ continue;
+ }
+
+ $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' .
+ $this->getAlterTableRenameColumnClause($oldColumnName, $column);
+ }
+
+ if (! $this->onSchemaAlterTable($diff, $tableSql)) {
+ if (! empty($alterClauses)) {
+ $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' . implode(', ', $alterClauses);
+ }
+
+ $sql = array_merge($sql, $commentsSQL);
+
+ if ($diff->newName !== false) {
+ $sql[] = $this->getAlterTableClause($diff->getName($this)) . ' ' .
+ $this->getAlterTableRenameTableClause($diff->getNewName());
+ }
+
+ $sql = array_merge(
+ $this->getPreAlterTableIndexForeignKeySQL($diff),
+ $sql,
+ $this->getPostAlterTableIndexForeignKeySQL($diff)
+ );
+ }
+
+ return array_merge($sql, $tableSql, $columnSql);
+ }
+
+ /**
+ * Returns the SQL clause for creating a column in a table alteration.
+ *
+ * @param Column $column The column to add.
+ *
+ * @return string
+ */
+ protected function getAlterTableAddColumnClause(Column $column)
+ {
+ return 'ADD ' . $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+ }
+
+ /**
+ * Returns the SQL clause for altering a table.
+ *
+ * @param Identifier $tableName The quoted name of the table to alter.
+ *
+ * @return string
+ */
+ protected function getAlterTableClause(Identifier $tableName)
+ {
+ return 'ALTER TABLE ' . $tableName->getQuotedName($this);
+ }
+
+ /**
+ * Returns the SQL clause for dropping a column in a table alteration.
+ *
+ * @param Column $column The column to drop.
+ *
+ * @return string
+ */
+ protected function getAlterTableRemoveColumnClause(Column $column)
+ {
+ return 'DROP ' . $column->getQuotedName($this);
+ }
+
+ /**
+ * Returns the SQL clause for renaming a column in a table alteration.
+ *
+ * @param string $oldColumnName The quoted name of the column to rename.
+ * @param Column $column The column to rename to.
+ *
+ * @return string
+ */
+ protected function getAlterTableRenameColumnClause($oldColumnName, Column $column)
+ {
+ $oldColumnName = new Identifier($oldColumnName);
+
+ return 'RENAME ' . $oldColumnName->getQuotedName($this) . ' TO ' . $column->getQuotedName($this);
+ }
+
+ /**
+ * Returns the SQL clause for renaming a table in a table alteration.
+ *
+ * @param Identifier $newTableName The quoted name of the table to rename to.
+ *
+ * @return string
+ */
+ protected function getAlterTableRenameTableClause(Identifier $newTableName)
+ {
+ return 'RENAME ' . $newTableName->getQuotedName($this);
+ }
+
+ /**
+ * Returns the SQL clause for altering a column in a table alteration.
+ *
+ * This method returns null in case that only the column comment has changed.
+ * Changes in column comments have to be handled differently.
+ *
+ * @param ColumnDiff $columnDiff The diff of the column to alter.
+ *
+ * @return string|null
+ */
+ protected function getAlterTableChangeColumnClause(ColumnDiff $columnDiff)
+ {
+ $column = $columnDiff->column;
+
+ // Do not return alter clause if only comment has changed.
+ if (! ($columnDiff->hasChanged('comment') && count($columnDiff->changedProperties) === 1)) {
+ $columnAlterationClause = 'ALTER ' .
+ $this->getColumnDeclarationSQL($column->getQuotedName($this), $column->toArray());
+
+ if ($columnDiff->hasChanged('default') && $column->getDefault() === null) {
+ $columnAlterationClause .= ', ALTER ' . $column->getQuotedName($this) . ' DROP DEFAULT';
+ }
+
+ return $columnAlterationClause;
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBigIntTypeDeclarationSQL(array $columnDef)
+ {
+ $columnDef['integer_type'] = 'BIGINT';
+
+ return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryDefaultLength()
+ {
+ return 1;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBinaryMaxLength()
+ {
+ return 32767;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getBlobTypeDeclarationSQL(array $field)
+ {
+ return 'LONG BINARY';
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * BIT type columns require an explicit NULL declaration
+ * in SQL Anywhere if they shall be nullable.
+ * Otherwise by just omitting the NOT NULL clause,
+ * SQL Anywhere will declare them NOT NULL nonetheless.
+ */
+ public function getBooleanTypeDeclarationSQL(array $columnDef)
+ {
+ $nullClause = isset($columnDef['notnull']) && (bool) $columnDef['notnull'] === false ? ' NULL' : '';
+
+ return 'BIT' . $nullClause;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getClobTypeDeclarationSQL(array $field)
+ {
+ return 'TEXT';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCommentOnColumnSQL($tableName, $columnName, $comment)
+ {
+ $tableName = new Identifier($tableName);
+ $columnName = new Identifier($columnName);
+ $comment = $comment === null ? 'NULL' : $this->quoteStringLiteral($comment);
+
+ return sprintf(
+ 'COMMENT ON COLUMN %s.%s IS %s',
+ $tableName->getQuotedName($this),
+ $columnName->getQuotedName($this),
+ $comment
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getConcatExpression()
+ {
+ return 'STRING(' . implode(', ', (array) func_get_args()) . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreateConstraintSQL(Constraint $constraint, $table)
+ {
+ if ($constraint instanceof ForeignKeyConstraint) {
+ return $this->getCreateForeignKeySQL($constraint, $table);
+ }
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'ALTER TABLE ' . $table .
+ ' ADD ' . $this->getTableConstraintDeclarationSQL($constraint, $constraint->getQuotedName($this));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreateDatabaseSQL($database)
+ {
+ $database = new Identifier($database);
+
+ return "CREATE DATABASE '" . $database->getName() . "'";
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * Appends SQL Anywhere specific flags if given.
+ */
+ public function getCreateIndexSQL(Index $index, $table)
+ {
+ return parent::getCreateIndexSQL($index, $table) . $this->getAdvancedIndexOptionsSQL($index);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreatePrimaryKeySQL(Index $index, $table)
+ {
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return 'ALTER TABLE ' . $table . ' ADD ' . $this->getPrimaryKeyDeclarationSQL($index);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreateTemporaryTableSnippetSQL()
+ {
+ return 'CREATE ' . $this->getTemporaryTableSQL() . ' TABLE';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreateViewSQL($name, $sql)
+ {
+ return 'CREATE VIEW ' . $name . ' AS ' . $sql;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCurrentDateSQL()
+ {
+ return 'CURRENT DATE';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCurrentTimeSQL()
+ {
+ return 'CURRENT TIME';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCurrentTimestampSQL()
+ {
+ return 'CURRENT TIMESTAMP';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ $factorClause = '';
+
+ if ($operator === '-') {
+ $factorClause = '-1 * ';
+ }
+
+ return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ return 'DATEDIFF(day, ' . $date2 . ', ' . $date1 . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTimeFormatString()
+ {
+ return 'Y-m-d H:i:s.u';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATETIME';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTimeTzFormatString()
+ {
+ return $this->getDateTimeFormatString();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDateTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'DATE';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultTransactionIsolationLevel()
+ {
+ return TransactionIsolationLevel::READ_UNCOMMITTED;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDropDatabaseSQL($database)
+ {
+ $database = new Identifier($database);
+
+ return "DROP DATABASE '" . $database->getName() . "'";
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDropIndexSQL($index, $table = null)
+ {
+ if ($index instanceof Index) {
+ $index = $index->getQuotedName($this);
+ }
+
+ if (! is_string($index)) {
+ throw new InvalidArgumentException(
+ 'SQLAnywherePlatform::getDropIndexSQL() expects $index parameter to be string or ' . Index::class . '.'
+ );
+ }
+
+ if (! isset($table)) {
+ return 'DROP INDEX ' . $index;
+ }
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ if (! is_string($table)) {
+ throw new InvalidArgumentException(
+ 'SQLAnywherePlatform::getDropIndexSQL() expects $table parameter to be string or ' . Index::class . '.'
+ );
+ }
+
+ return 'DROP INDEX ' . $table . '.' . $index;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDropViewSQL($name)
+ {
+ return 'DROP VIEW ' . $name;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getForeignKeyBaseDeclarationSQL(ForeignKeyConstraint $foreignKey)
+ {
+ $sql = '';
+ $foreignKeyName = $foreignKey->getName();
+ $localColumns = $foreignKey->getQuotedLocalColumns($this);
+ $foreignColumns = $foreignKey->getQuotedForeignColumns($this);
+ $foreignTableName = $foreignKey->getQuotedForeignTableName($this);
+
+ if (! empty($foreignKeyName)) {
+ $sql .= 'CONSTRAINT ' . $foreignKey->getQuotedName($this) . ' ';
+ }
+
+ if (empty($localColumns)) {
+ throw new InvalidArgumentException("Incomplete definition. 'local' required.");
+ }
+
+ if (empty($foreignColumns)) {
+ throw new InvalidArgumentException("Incomplete definition. 'foreign' required.");
+ }
+
+ if (empty($foreignTableName)) {
+ throw new InvalidArgumentException("Incomplete definition. 'foreignTable' required.");
+ }
+
+ if ($foreignKey->hasOption('notnull') && (bool) $foreignKey->getOption('notnull')) {
+ $sql .= 'NOT NULL ';
+ }
+
+ return $sql .
+ 'FOREIGN KEY (' . $this->getIndexFieldDeclarationListSQL($localColumns) . ') ' .
+ 'REFERENCES ' . $foreignKey->getQuotedForeignTableName($this) .
+ ' (' . $this->getIndexFieldDeclarationListSQL($foreignColumns) . ')';
+ }
+
+ /**
+ * Returns foreign key MATCH clause for given type.
+ *
+ * @param int $type The foreign key match type
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException If unknown match type given.
+ */
+ public function getForeignKeyMatchClauseSQL($type)
+ {
+ switch ((int) $type) {
+ case self::FOREIGN_KEY_MATCH_SIMPLE:
+ return 'SIMPLE';
+ break;
+ case self::FOREIGN_KEY_MATCH_FULL:
+ return 'FULL';
+ break;
+ case self::FOREIGN_KEY_MATCH_SIMPLE_UNIQUE:
+ return 'UNIQUE SIMPLE';
+ break;
+ case self::FOREIGN_KEY_MATCH_FULL_UNIQUE:
+ return 'UNIQUE FULL';
+ default:
+ throw new InvalidArgumentException('Invalid foreign key match type: ' . $type);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getForeignKeyReferentialActionSQL($action)
+ {
+ // NO ACTION is not supported, therefore falling back to RESTRICT.
+ if (strtoupper($action) === 'NO ACTION') {
+ return 'RESTRICT';
+ }
+
+ return parent::getForeignKeyReferentialActionSQL($action);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getForUpdateSQL()
+ {
+ return '';
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @deprecated Use application-generated UUIDs instead
+ */
+ public function getGuidExpression()
+ {
+ return 'NEWID()';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getGuidTypeDeclarationSQL(array $field)
+ {
+ return 'UNIQUEIDENTIFIER';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIndexDeclarationSQL($name, Index $index)
+ {
+ // Index declaration in statements like CREATE TABLE is not supported.
+ throw DBALException::notSupported(__METHOD__);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $columnDef['integer_type'] = 'INT';
+
+ return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListDatabasesSQL()
+ {
+ return 'SELECT db_name(number) AS name FROM sa_db_list()';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListTableColumnsSQL($table, $database = null)
+ {
+ $user = 'USER_NAME()';
+
+ if (strpos($table, '.') !== false) {
+ [$user, $table] = explode('.', $table);
+ $user = $this->quoteStringLiteral($user);
+ }
+
+ return sprintf(
+ <<<'SQL'
+SELECT col.column_name,
+ COALESCE(def.user_type_name, def.domain_name) AS 'type',
+ def.declared_width AS 'length',
+ def.scale,
+ CHARINDEX('unsigned', def.domain_name) AS 'unsigned',
+ IF col.nulls = 'Y' THEN 0 ELSE 1 ENDIF AS 'notnull',
+ col."default",
+ def.is_autoincrement AS 'autoincrement',
+ rem.remarks AS 'comment'
+FROM sa_describe_query('SELECT * FROM "%s"') AS def
+JOIN SYS.SYSTABCOL AS col
+ON col.table_id = def.base_table_id AND col.column_id = def.base_column_id
+LEFT JOIN SYS.SYSREMARK AS rem
+ON col.object_id = rem.object_id
+WHERE def.base_owner_name = %s
+ORDER BY def.base_column_id ASC
+SQL
+ ,
+ $table,
+ $user
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @todo Where is this used? Which information should be retrieved?
+ */
+ public function getListTableConstraintsSQL($table)
+ {
+ $user = '';
+
+ if (strpos($table, '.') !== false) {
+ [$user, $table] = explode('.', $table);
+ $user = $this->quoteStringLiteral($user);
+ $table = $this->quoteStringLiteral($table);
+ } else {
+ $table = $this->quoteStringLiteral($table);
+ }
+
+ return sprintf(
+ <<<'SQL'
+SELECT con.*
+FROM SYS.SYSCONSTRAINT AS con
+JOIN SYS.SYSTAB AS tab ON con.table_object_id = tab.object_id
+WHERE tab.table_name = %s
+AND tab.creator = USER_ID(%s)
+SQL
+ ,
+ $table,
+ $user
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListTableForeignKeysSQL($table)
+ {
+ $user = '';
+
+ if (strpos($table, '.') !== false) {
+ [$user, $table] = explode('.', $table);
+ $user = $this->quoteStringLiteral($user);
+ $table = $this->quoteStringLiteral($table);
+ } else {
+ $table = $this->quoteStringLiteral($table);
+ }
+
+ return sprintf(
+ <<<'SQL'
+SELECT fcol.column_name AS local_column,
+ ptbl.table_name AS foreign_table,
+ pcol.column_name AS foreign_column,
+ idx.index_name,
+ IF fk.nulls = 'N'
+ THEN 1
+ ELSE NULL
+ ENDIF AS notnull,
+ CASE ut.referential_action
+ WHEN 'C' THEN 'CASCADE'
+ WHEN 'D' THEN 'SET DEFAULT'
+ WHEN 'N' THEN 'SET NULL'
+ WHEN 'R' THEN 'RESTRICT'
+ ELSE NULL
+ END AS on_update,
+ CASE dt.referential_action
+ WHEN 'C' THEN 'CASCADE'
+ WHEN 'D' THEN 'SET DEFAULT'
+ WHEN 'N' THEN 'SET NULL'
+ WHEN 'R' THEN 'RESTRICT'
+ ELSE NULL
+ END AS on_delete,
+ IF fk.check_on_commit = 'Y'
+ THEN 1
+ ELSE NULL
+ ENDIF AS check_on_commit, -- check_on_commit flag
+ IF ftbl.clustered_index_id = idx.index_id
+ THEN 1
+ ELSE NULL
+ ENDIF AS 'clustered', -- clustered flag
+ IF fk.match_type = 0
+ THEN NULL
+ ELSE fk.match_type
+ ENDIF AS 'match', -- match option
+ IF pidx.max_key_distance = 1
+ THEN 1
+ ELSE NULL
+ ENDIF AS for_olap_workload -- for_olap_workload flag
+FROM SYS.SYSFKEY AS fk
+JOIN SYS.SYSIDX AS idx
+ON fk.foreign_table_id = idx.table_id
+AND fk.foreign_index_id = idx.index_id
+JOIN SYS.SYSPHYSIDX pidx
+ON idx.table_id = pidx.table_id
+AND idx.phys_index_id = pidx.phys_index_id
+JOIN SYS.SYSTAB AS ptbl
+ON fk.primary_table_id = ptbl.table_id
+JOIN SYS.SYSTAB AS ftbl
+ON fk.foreign_table_id = ftbl.table_id
+JOIN SYS.SYSIDXCOL AS idxcol
+ON idx.table_id = idxcol.table_id
+AND idx.index_id = idxcol.index_id
+JOIN SYS.SYSTABCOL AS pcol
+ON ptbl.table_id = pcol.table_id
+AND idxcol.primary_column_id = pcol.column_id
+JOIN SYS.SYSTABCOL AS fcol
+ON ftbl.table_id = fcol.table_id
+AND idxcol.column_id = fcol.column_id
+LEFT JOIN SYS.SYSTRIGGER ut
+ON fk.foreign_table_id = ut.foreign_table_id
+AND fk.foreign_index_id = ut.foreign_key_id
+AND ut.event = 'C'
+LEFT JOIN SYS.SYSTRIGGER dt
+ON fk.foreign_table_id = dt.foreign_table_id
+AND fk.foreign_index_id = dt.foreign_key_id
+AND dt.event = 'D'
+WHERE ftbl.table_name = %s
+AND ftbl.creator = USER_ID(%s)
+ORDER BY fk.foreign_index_id ASC, idxcol.sequence ASC
+SQL
+ ,
+ $table,
+ $user
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListTableIndexesSQL($table, $currentDatabase = null)
+ {
+ $user = '';
+
+ if (strpos($table, '.') !== false) {
+ [$user, $table] = explode('.', $table);
+ $user = $this->quoteStringLiteral($user);
+ $table = $this->quoteStringLiteral($table);
+ } else {
+ $table = $this->quoteStringLiteral($table);
+ }
+
+ return sprintf(
+ <<<'SQL'
+SELECT idx.index_name AS key_name,
+ IF idx.index_category = 1
+ THEN 1
+ ELSE 0
+ ENDIF AS 'primary',
+ col.column_name,
+ IF idx."unique" IN(1, 2, 5)
+ THEN 0
+ ELSE 1
+ ENDIF AS non_unique,
+ IF tbl.clustered_index_id = idx.index_id
+ THEN 1
+ ELSE NULL
+ ENDIF AS 'clustered', -- clustered flag
+ IF idx."unique" = 5
+ THEN 1
+ ELSE NULL
+ ENDIF AS with_nulls_not_distinct, -- with_nulls_not_distinct flag
+ IF pidx.max_key_distance = 1
+ THEN 1
+ ELSE NULL
+ ENDIF AS for_olap_workload -- for_olap_workload flag
+FROM SYS.SYSIDX AS idx
+JOIN SYS.SYSPHYSIDX pidx
+ON idx.table_id = pidx.table_id
+AND idx.phys_index_id = pidx.phys_index_id
+JOIN SYS.SYSIDXCOL AS idxcol
+ON idx.table_id = idxcol.table_id AND idx.index_id = idxcol.index_id
+JOIN SYS.SYSTABCOL AS col
+ON idxcol.table_id = col.table_id AND idxcol.column_id = col.column_id
+JOIN SYS.SYSTAB AS tbl
+ON idx.table_id = tbl.table_id
+WHERE tbl.table_name = %s
+AND tbl.creator = USER_ID(%s)
+AND idx.index_category != 2 -- exclude indexes implicitly created by foreign key constraints
+ORDER BY idx.index_id ASC, idxcol.sequence ASC
+SQL
+ ,
+ $table,
+ $user
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListTablesSQL()
+ {
+ return "SELECT tbl.table_name
+ FROM SYS.SYSTAB AS tbl
+ JOIN SYS.SYSUSER AS usr ON tbl.creator = usr.user_id
+ JOIN dbo.SYSOBJECTS AS obj ON tbl.object_id = obj.id
+ WHERE tbl.table_type IN(1, 3) -- 'BASE', 'GBL TEMP'
+ AND usr.user_name NOT IN('SYS', 'dbo', 'rs_systabgroup') -- exclude system users
+ AND obj.type = 'U' -- user created tables only
+ ORDER BY tbl.table_name ASC";
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @todo Where is this used? Which information should be retrieved?
+ */
+ public function getListUsersSQL()
+ {
+ return 'SELECT * FROM SYS.SYSUSER ORDER BY user_name ASC';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListViewsSQL($database)
+ {
+ return "SELECT tbl.table_name, v.view_def
+ FROM SYS.SYSVIEW v
+ JOIN SYS.SYSTAB tbl ON v.view_object_id = tbl.object_id
+ JOIN SYS.SYSUSER usr ON tbl.creator = usr.user_id
+ JOIN dbo.SYSOBJECTS obj ON tbl.object_id = obj.id
+ WHERE usr.user_name NOT IN('SYS', 'dbo', 'rs_systabgroup') -- exclude system users
+ ORDER BY tbl.table_name ASC";
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getLocateExpression($str, $substr, $startPos = false)
+ {
+ if ($startPos === false) {
+ return 'LOCATE(' . $str . ', ' . $substr . ')';
+ }
+
+ return 'LOCATE(' . $str . ', ' . $substr . ', ' . $startPos . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMaxIdentifierLength()
+ {
+ return 128;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getMd5Expression($column)
+ {
+ return 'HASH(' . $column . ", 'MD5')";
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getName()
+ {
+ return 'sqlanywhere';
+ }
+
+ /**
+ * Obtain DBMS specific SQL code portion needed to set a primary key
+ * declaration to be used in statements like ALTER TABLE.
+ *
+ * @param Index $index Index definition
+ * @param string $name Name of the primary key
+ *
+ * @return string DBMS specific SQL code portion needed to set a primary key
+ *
+ * @throws InvalidArgumentException If the given index is not a primary key.
+ */
+ public function getPrimaryKeyDeclarationSQL(Index $index, $name = null)
+ {
+ if (! $index->isPrimary()) {
+ throw new InvalidArgumentException(
+ 'Can only create primary key declarations with getPrimaryKeyDeclarationSQL()'
+ );
+ }
+
+ return $this->getTableConstraintDeclarationSQL($index, $name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSetTransactionIsolationSQL($level)
+ {
+ return 'SET TEMPORARY OPTION isolation_level = ' . $this->_getTransactionIsolationLevelSQL($level);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSmallIntTypeDeclarationSQL(array $columnDef)
+ {
+ $columnDef['integer_type'] = 'SMALLINT';
+
+ return $this->_getCommonIntegerTypeDeclarationSQL($columnDef);
+ }
+
+ /**
+ * Returns the SQL statement for starting an existing database.
+ *
+ * In SQL Anywhere you can start and stop databases on a
+ * database server instance.
+ * This is a required statement after having created a new database
+ * as it has to be explicitly started to be usable.
+ * SQL Anywhere does not automatically start a database after creation!
+ *
+ * @param string $database Name of the database to start.
+ *
+ * @return string
+ */
+ public function getStartDatabaseSQL($database)
+ {
+ $database = new Identifier($database);
+
+ return "START DATABASE '" . $database->getName() . "' AUTOSTOP OFF";
+ }
+
+ /**
+ * Returns the SQL statement for stopping a running database.
+ *
+ * In SQL Anywhere you can start and stop databases on a
+ * database server instance.
+ * This is a required statement before dropping an existing database
+ * as it has to be explicitly stopped before it can be dropped.
+ *
+ * @param string $database Name of the database to stop.
+ *
+ * @return string
+ */
+ public function getStopDatabaseSQL($database)
+ {
+ $database = new Identifier($database);
+
+ return 'STOP DATABASE "' . $database->getName() . '" UNCONDITIONALLY';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSubstringExpression($value, $from, $length = null)
+ {
+ if ($length === null) {
+ return 'SUBSTRING(' . $value . ', ' . $from . ')';
+ }
+
+ return 'SUBSTRING(' . $value . ', ' . $from . ', ' . $length . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTemporaryTableSQL()
+ {
+ return 'GLOBAL TEMPORARY';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTimeFormatString()
+ {
+ return 'H:i:s.u';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTimeTypeDeclarationSQL(array $fieldDeclaration)
+ {
+ return 'TIME';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTrimExpression($str, $pos = TrimMode::UNSPECIFIED, $char = false)
+ {
+ if (! $char) {
+ switch ($pos) {
+ case TrimMode::LEADING:
+ return $this->getLtrimExpression($str);
+ case TrimMode::TRAILING:
+ return $this->getRtrimExpression($str);
+ default:
+ return 'TRIM(' . $str . ')';
+ }
+ }
+
+ $pattern = "'%[^' + " . $char . " + ']%'";
+
+ switch ($pos) {
+ case TrimMode::LEADING:
+ return 'SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))';
+ case TrimMode::TRAILING:
+ return 'REVERSE(SUBSTR(REVERSE(' . $str . '), PATINDEX(' . $pattern . ', REVERSE(' . $str . '))))';
+ default:
+ return 'REVERSE(SUBSTR(REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))), ' .
+ 'PATINDEX(' . $pattern . ', REVERSE(SUBSTR(' . $str . ', PATINDEX(' . $pattern . ', ' . $str . '))))))';
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getTruncateTableSQL($tableName, $cascade = false)
+ {
+ $tableIdentifier = new Identifier($tableName);
+
+ return 'TRUNCATE TABLE ' . $tableIdentifier->getQuotedName($this);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getUniqueConstraintDeclarationSQL($name, Index $index)
+ {
+ if ($index->isPrimary()) {
+ throw new InvalidArgumentException(
+ 'Cannot create primary key constraint declarations with getUniqueConstraintDeclarationSQL().'
+ );
+ }
+
+ if (! $index->isUnique()) {
+ throw new InvalidArgumentException(
+ 'Can only create unique constraint declarations, no common index declarations with ' .
+ 'getUniqueConstraintDeclarationSQL().'
+ );
+ }
+
+ return $this->getTableConstraintDeclarationSQL($index, $name);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getVarcharDefaultLength()
+ {
+ return 1;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getVarcharMaxLength()
+ {
+ return 32767;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function hasNativeGuidType()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsCommentOnStatement()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getCommonIntegerTypeDeclarationSQL(array $columnDef)
+ {
+ $unsigned = ! empty($columnDef['unsigned']) ? 'UNSIGNED ' : '';
+ $autoincrement = ! empty($columnDef['autoincrement']) ? ' IDENTITY' : '';
+
+ return $unsigned . $columnDef['integer_type'] . $autoincrement;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getCreateTableSQL($tableName, array $columns, array $options = [])
+ {
+ $columnListSql = $this->getColumnDeclarationListSQL($columns);
+ $indexSql = [];
+
+ if (! empty($options['uniqueConstraints'])) {
+ foreach ((array) $options['uniqueConstraints'] as $name => $definition) {
+ $columnListSql .= ', ' . $this->getUniqueConstraintDeclarationSQL($name, $definition);
+ }
+ }
+
+ if (! empty($options['indexes'])) {
+ /** @var Index $index */
+ foreach ((array) $options['indexes'] as $index) {
+ $indexSql[] = $this->getCreateIndexSQL($index, $tableName);
+ }
+ }
+
+ if (! empty($options['primary'])) {
+ $flags = '';
+
+ if (isset($options['primary_index']) && $options['primary_index']->hasFlag('clustered')) {
+ $flags = ' CLUSTERED ';
+ }
+
+ $columnListSql .= ', PRIMARY KEY' . $flags . ' (' . implode(', ', array_unique(array_values((array) $options['primary']))) . ')';
+ }
+
+ if (! empty($options['foreignKeys'])) {
+ foreach ((array) $options['foreignKeys'] as $definition) {
+ $columnListSql .= ', ' . $this->getForeignKeyDeclarationSQL($definition);
+ }
+ }
+
+ $query = 'CREATE TABLE ' . $tableName . ' (' . $columnListSql;
+ $check = $this->getCheckDeclarationSQL($columns);
+
+ if (! empty($check)) {
+ $query .= ', ' . $check;
+ }
+
+ $query .= ')';
+
+ return array_merge([$query], $indexSql);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getTransactionIsolationLevelSQL($level)
+ {
+ switch ($level) {
+ case TransactionIsolationLevel::READ_UNCOMMITTED:
+ return 0;
+ case TransactionIsolationLevel::READ_COMMITTED:
+ return 1;
+ case TransactionIsolationLevel::REPEATABLE_READ:
+ return 2;
+ case TransactionIsolationLevel::SERIALIZABLE:
+ return 3;
+ default:
+ throw new InvalidArgumentException('Invalid isolation level:' . $level);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset)
+ {
+ $limitOffsetClause = $this->getTopClauseSQL($limit, $offset);
+
+ return $limitOffsetClause === ''
+ ? $query
+ : preg_replace('/^\s*(SELECT\s+(DISTINCT\s+)?)/i', '\1' . $limitOffsetClause . ' ', $query);
+ }
+
+ private function getTopClauseSQL(?int $limit, ?int $offset) : string
+ {
+ if ($offset > 0) {
+ return sprintf('TOP %s START AT %d', $limit ?? 'ALL', $offset + 1);
+ }
+
+ return $limit === null ? '' : 'TOP ' . $limit;
+ }
+
+ /**
+ * Return the INDEX query section dealing with non-standard
+ * SQL Anywhere options.
+ *
+ * @param Index $index Index definition
+ *
+ * @return string
+ */
+ protected function getAdvancedIndexOptionsSQL(Index $index)
+ {
+ $sql = '';
+
+ if (! $index->isPrimary() && $index->hasFlag('for_olap_workload')) {
+ $sql .= ' FOR OLAP WORKLOAD';
+ }
+
+ return $sql;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getBinaryTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed
+ ? 'BINARY(' . ($length ?: $this->getBinaryDefaultLength()) . ')'
+ : 'VARBINARY(' . ($length ?: $this->getBinaryDefaultLength()) . ')';
+ }
+
+ /**
+ * Returns the SQL snippet for creating a table constraint.
+ *
+ * @param Constraint $constraint The table constraint to create the SQL snippet for.
+ * @param string|null $name The table constraint name to use if any.
+ *
+ * @return string
+ *
+ * @throws InvalidArgumentException If the given table constraint type is not supported by this method.
+ */
+ protected function getTableConstraintDeclarationSQL(Constraint $constraint, $name = null)
+ {
+ if ($constraint instanceof ForeignKeyConstraint) {
+ return $this->getForeignKeyDeclarationSQL($constraint);
+ }
+
+ if (! $constraint instanceof Index) {
+ throw new InvalidArgumentException('Unsupported constraint type: ' . get_class($constraint));
+ }
+
+ if (! $constraint->isPrimary() && ! $constraint->isUnique()) {
+ throw new InvalidArgumentException(
+ 'Can only create primary, unique or foreign key constraint declarations, no common index declarations ' .
+ 'with getTableConstraintDeclarationSQL().'
+ );
+ }
+
+ $constraintColumns = $constraint->getQuotedColumns($this);
+
+ if (empty($constraintColumns)) {
+ throw new InvalidArgumentException("Incomplete definition. 'columns' required.");
+ }
+
+ $sql = '';
+ $flags = '';
+
+ if (! empty($name)) {
+ $name = new Identifier($name);
+ $sql .= 'CONSTRAINT ' . $name->getQuotedName($this) . ' ';
+ }
+
+ if ($constraint->hasFlag('clustered')) {
+ $flags = 'CLUSTERED ';
+ }
+
+ if ($constraint->isPrimary()) {
+ return $sql . 'PRIMARY KEY ' . $flags . '(' . $this->getIndexFieldDeclarationListSQL($constraintColumns) . ')';
+ }
+
+ return $sql . 'UNIQUE ' . $flags . '(' . $this->getIndexFieldDeclarationListSQL($constraintColumns) . ')';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getCreateIndexSQLFlags(Index $index)
+ {
+ $type = '';
+ if ($index->hasFlag('virtual')) {
+ $type .= 'VIRTUAL ';
+ }
+
+ if ($index->isUnique()) {
+ $type .= 'UNIQUE ';
+ }
+
+ if ($index->hasFlag('clustered')) {
+ $type .= 'CLUSTERED ';
+ }
+
+ return $type;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getRenameIndexSQL($oldIndexName, Index $index, $tableName)
+ {
+ return ['ALTER INDEX ' . $oldIndexName . ' ON ' . $tableName . ' RENAME TO ' . $index->getQuotedName($this)];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\SQLAnywhereKeywords::class;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getVarcharTypeDeclarationSQLSnippet($length, $fixed)
+ {
+ return $fixed
+ ? ($length ? 'CHAR(' . $length . ')' : 'CHAR(' . $this->getVarcharDefaultLength() . ')')
+ : ($length ? 'VARCHAR(' . $length . ')' : 'VARCHAR(' . $this->getVarcharDefaultLength() . ')');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function initializeDoctrineTypeMappings()
+ {
+ $this->doctrineTypeMapping = [
+ 'char' => 'string',
+ 'long nvarchar' => 'text',
+ 'long varchar' => 'text',
+ 'nchar' => 'string',
+ 'ntext' => 'text',
+ 'nvarchar' => 'string',
+ 'text' => 'text',
+ 'uniqueidentifierstr' => 'guid',
+ 'varchar' => 'string',
+ 'xml' => 'text',
+ 'bigint' => 'bigint',
+ 'unsigned bigint' => 'bigint',
+ 'bit' => 'boolean',
+ 'decimal' => 'decimal',
+ 'double' => 'float',
+ 'float' => 'float',
+ 'int' => 'integer',
+ 'integer' => 'integer',
+ 'unsigned int' => 'integer',
+ 'numeric' => 'decimal',
+ 'smallint' => 'smallint',
+ 'unsigned smallint' => 'smallint',
+ 'tinyint' => 'smallint',
+ 'unsigned tinyint' => 'smallint',
+ 'money' => 'decimal',
+ 'smallmoney' => 'decimal',
+ 'long varbit' => 'text',
+ 'varbit' => 'string',
+ 'date' => 'date',
+ 'datetime' => 'datetime',
+ 'smalldatetime' => 'datetime',
+ 'time' => 'time',
+ 'timestamp' => 'datetime',
+ 'binary' => 'binary',
+ 'image' => 'blob',
+ 'long binary' => 'blob',
+ 'uniqueidentifier' => 'guid',
+ 'varbinary' => 'binary',
+ ];
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
new file mode 100644
index 000000000..a104848f8
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLAzurePlatform.php
@@ -0,0 +1,33 @@
+hasOption('azure.federatedOnColumnName')) {
+ $distributionName = $table->getOption('azure.federatedOnDistributionName');
+ $columnName = $table->getOption('azure.federatedOnColumnName');
+ $stmt = ' FEDERATED ON (' . $distributionName . ' = ' . $columnName . ')';
+
+ $sql[0] .= $stmt;
+ }
+
+ return $sql;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
new file mode 100644
index 000000000..1026a934f
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2005Platform.php
@@ -0,0 +1,46 @@
+doctrineTypeMapping['datetime2'] = 'datetime';
+ $this->doctrineTypeMapping['date'] = 'date';
+ $this->doctrineTypeMapping['time'] = 'time';
+ $this->doctrineTypeMapping['datetimeoffset'] = 'datetimetz';
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * Returns Microsoft SQL Server 2008 specific keywords class
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\SQLServer2008Keywords::class;
+ }
+
+ protected function getLikeWildcardCharacters() : string
+ {
+ return parent::getLikeWildcardCharacters() . '[]^';
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
new file mode 100644
index 000000000..009a37d33
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServer2012Platform.php
@@ -0,0 +1,143 @@
+getQuotedName($this) .
+ ' INCREMENT BY ' . $sequence->getAllocationSize();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCreateSequenceSQL(Sequence $sequence)
+ {
+ return 'CREATE SEQUENCE ' . $sequence->getQuotedName($this) .
+ ' START WITH ' . $sequence->getInitialValue() .
+ ' INCREMENT BY ' . $sequence->getAllocationSize() .
+ ' MINVALUE ' . $sequence->getInitialValue();
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDropSequenceSQL($sequence)
+ {
+ if ($sequence instanceof Sequence) {
+ $sequence = $sequence->getQuotedName($this);
+ }
+
+ return 'DROP SEQUENCE ' . $sequence;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getListSequencesSQL($database)
+ {
+ return 'SELECT seq.name,
+ CAST(
+ seq.increment AS VARCHAR(MAX)
+ ) AS increment, -- CAST avoids driver error for sql_variant type
+ CAST(
+ seq.start_value AS VARCHAR(MAX)
+ ) AS start_value -- CAST avoids driver error for sql_variant type
+ FROM sys.sequences AS seq';
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getSequenceNextValSQL($sequenceName)
+ {
+ return 'SELECT NEXT VALUE FOR ' . $sequenceName;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsSequences()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * Returns Microsoft SQL Server 2012 specific keywords class
+ */
+ protected function getReservedKeywordsClass()
+ {
+ return Keywords\SQLServer2012Keywords::class;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function doModifyLimitQuery($query, $limit, $offset = null)
+ {
+ if ($limit === null && $offset <= 0) {
+ return $query;
+ }
+
+ // Queries using OFFSET... FETCH MUST have an ORDER BY clause
+ // Find the position of the last instance of ORDER BY and ensure it is not within a parenthetical statement
+ // but can be in a newline
+ $matches = [];
+ $matchesCount = preg_match_all('/[\\s]+order\\s+by\\s/im', $query, $matches, PREG_OFFSET_CAPTURE);
+ $orderByPos = false;
+ if ($matchesCount > 0) {
+ $orderByPos = $matches[0][($matchesCount - 1)][1];
+ }
+
+ if ($orderByPos === false
+ || substr_count($query, '(', $orderByPos) - substr_count($query, ')', $orderByPos)
+ ) {
+ if (preg_match('/^SELECT\s+DISTINCT/im', $query)) {
+ // SQL Server won't let us order by a non-selected column in a DISTINCT query,
+ // so we have to do this madness. This says, order by the first column in the
+ // result. SQL Server's docs say that a nonordered query's result order is non-
+ // deterministic anyway, so this won't do anything that a bunch of update and
+ // deletes to the table wouldn't do anyway.
+ $query .= ' ORDER BY 1';
+ } else {
+ // In another DBMS, we could do ORDER BY 0, but SQL Server gets angry if you
+ // use constant expressions in the order by list.
+ $query .= ' ORDER BY (SELECT 0)';
+ }
+ }
+
+ if ($offset === null) {
+ $offset = 0;
+ }
+
+ // This looks somewhat like MYSQL, but limit/offset are in inverse positions
+ // Supposedly SQL:2008 core standard.
+ // Per TSQL spec, FETCH NEXT n ROWS ONLY is not valid without OFFSET n ROWS.
+ $query .= ' OFFSET ' . (int) $offset . ' ROWS';
+
+ if ($limit !== null) {
+ $query .= ' FETCH NEXT ' . (int) $limit . ' ROWS ONLY';
+ }
+
+ return $query;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
new file mode 100644
index 000000000..dc8775e61
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Platforms/SQLServerPlatform.php
@@ -0,0 +1,1679 @@
+getConvertExpression('date', 'GETDATE()');
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getCurrentTimeSQL()
+ {
+ return $this->getConvertExpression('time', 'GETDATE()');
+ }
+
+ /**
+ * Returns an expression that converts an expression of one data type to another.
+ *
+ * @param string $dataType The target native data type. Alias data types cannot be used.
+ * @param string $expression The SQL expression to convert.
+ *
+ * @return string
+ */
+ private function getConvertExpression($dataType, $expression)
+ {
+ return sprintf('CONVERT(%s, %s)', $dataType, $expression);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function getDateArithmeticIntervalExpression($date, $operator, $interval, $unit)
+ {
+ $factorClause = '';
+
+ if ($operator === '-') {
+ $factorClause = '-1 * ';
+ }
+
+ return 'DATEADD(' . $unit . ', ' . $factorClause . $interval . ', ' . $date . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDateDiffExpression($date1, $date2)
+ {
+ return 'DATEDIFF(day, ' . $date2 . ',' . $date1 . ')';
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Microsoft SQL Server prefers "autoincrement" identity columns
+ * since sequences can only be emulated with a table.
+ */
+ public function prefersIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ *
+ * Microsoft SQL Server supports this through AUTO_INCREMENT columns.
+ */
+ public function supportsIdentityColumns()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsReleaseSavepoints()
+ {
+ return false;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function supportsSchemas()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getDefaultSchemaName()
+ {
+ return 'dbo';
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsColumnCollation()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function hasNativeGuidType()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateDatabaseSQL($name)
+ {
+ return 'CREATE DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropDatabaseSQL($name)
+ {
+ return 'DROP DATABASE ' . $name;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function supportsCreateDropDatabase()
+ {
+ return true;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getCreateSchemaSQL($schemaName)
+ {
+ return 'CREATE SCHEMA ' . $schemaName;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropForeignKeySQL($foreignKey, $table)
+ {
+ if (! $foreignKey instanceof ForeignKeyConstraint) {
+ $foreignKey = new Identifier($foreignKey);
+ }
+
+ if (! $table instanceof Table) {
+ $table = new Identifier($table);
+ }
+
+ $foreignKey = $foreignKey->getQuotedName($this);
+ $table = $table->getQuotedName($this);
+
+ return 'ALTER TABLE ' . $table . ' DROP CONSTRAINT ' . $foreignKey;
+ }
+
+ /**
+ * {@inheritDoc}
+ */
+ public function getDropIndexSQL($index, $table = null)
+ {
+ if ($index instanceof Index) {
+ $index = $index->getQuotedName($this);
+ } elseif (! is_string($index)) {
+ throw new InvalidArgumentException('AbstractPlatform::getDropIndexSQL() expects $index parameter to be string or \Doctrine\DBAL\Schema\Index.');
+ }
+
+ if (! isset($table)) {
+ return 'DROP INDEX ' . $index;
+ }
+
+ if ($table instanceof Table) {
+ $table = $table->getQuotedName($this);
+ }
+
+ return sprintf(
+ <<
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u')
+ * ->from('users', 'u')
+ * ->where($qb->expr()->eq('u.id', 1));
+ *
+ *
+ * For more complex expression construction, consider storing the expression
+ * builder object in a local variable.
+ *
+ * @return ExpressionBuilder
+ */
+ public function expr()
+ {
+ return $this->connection->getExpressionBuilder();
+ }
+
+ /**
+ * Gets the type of the currently built query.
+ *
+ * @return int
+ */
+ public function getType()
+ {
+ return $this->type;
+ }
+
+ /**
+ * Gets the associated DBAL Connection for this query builder.
+ *
+ * @return Connection
+ */
+ public function getConnection()
+ {
+ return $this->connection;
+ }
+
+ /**
+ * Gets the state of this query builder instance.
+ *
+ * @return int Either QueryBuilder::STATE_DIRTY or QueryBuilder::STATE_CLEAN.
+ */
+ public function getState()
+ {
+ return $this->state;
+ }
+
+ /**
+ * Executes this query using the bound parameters and their types.
+ *
+ * Uses {@see Connection::executeQuery} for select statements and {@see Connection::executeUpdate}
+ * for insert, update and delete statements.
+ *
+ * @return Statement|int
+ */
+ public function execute()
+ {
+ if ($this->type === self::SELECT) {
+ return $this->connection->executeQuery($this->getSQL(), $this->params, $this->paramTypes);
+ }
+
+ return $this->connection->executeUpdate($this->getSQL(), $this->params, $this->paramTypes);
+ }
+
+ /**
+ * Gets the complete SQL string formed by the current specifications of this QueryBuilder.
+ *
+ *
+ * $qb = $em->createQueryBuilder()
+ * ->select('u')
+ * ->from('User', 'u')
+ * echo $qb->getSQL(); // SELECT u FROM User u
+ *
+ *
+ * @return string The SQL query string.
+ */
+ public function getSQL()
+ {
+ if ($this->sql !== null && $this->state === self::STATE_CLEAN) {
+ return $this->sql;
+ }
+
+ switch ($this->type) {
+ case self::INSERT:
+ $sql = $this->getSQLForInsert();
+ break;
+ case self::DELETE:
+ $sql = $this->getSQLForDelete();
+ break;
+
+ case self::UPDATE:
+ $sql = $this->getSQLForUpdate();
+ break;
+
+ case self::SELECT:
+ default:
+ $sql = $this->getSQLForSelect();
+ break;
+ }
+
+ $this->state = self::STATE_CLEAN;
+ $this->sql = $sql;
+
+ return $sql;
+ }
+
+ /**
+ * Sets a query parameter for the query being constructed.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u')
+ * ->from('users', 'u')
+ * ->where('u.id = :user_id')
+ * ->setParameter(':user_id', 1);
+ *
+ *
+ * @param string|int $key The parameter position or name.
+ * @param mixed $value The parameter value.
+ * @param string|int|null $type One of the {@link \Doctrine\DBAL\ParameterType} constants.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function setParameter($key, $value, $type = null)
+ {
+ if ($type !== null) {
+ $this->paramTypes[$key] = $type;
+ }
+
+ $this->params[$key] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Sets a collection of query parameters for the query being constructed.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u')
+ * ->from('users', 'u')
+ * ->where('u.id = :user_id1 OR u.id = :user_id2')
+ * ->setParameters(array(
+ * ':user_id1' => 1,
+ * ':user_id2' => 2
+ * ));
+ *
+ *
+ * @param mixed[] $params The query parameters to set.
+ * @param int[]|string[] $types The query parameters types to set.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function setParameters(array $params, array $types = [])
+ {
+ $this->paramTypes = $types;
+ $this->params = $params;
+
+ return $this;
+ }
+
+ /**
+ * Gets all defined query parameters for the query being constructed indexed by parameter index or name.
+ *
+ * @return mixed[] The currently defined query parameters indexed by parameter index or name.
+ */
+ public function getParameters()
+ {
+ return $this->params;
+ }
+
+ /**
+ * Gets a (previously set) query parameter of the query being constructed.
+ *
+ * @param mixed $key The key (index or name) of the bound parameter.
+ *
+ * @return mixed The value of the bound parameter.
+ */
+ public function getParameter($key)
+ {
+ return $this->params[$key] ?? null;
+ }
+
+ /**
+ * Gets all defined query parameter types for the query being constructed indexed by parameter index or name.
+ *
+ * @return int[]|string[] The currently defined query parameter types indexed by parameter index or name.
+ */
+ public function getParameterTypes()
+ {
+ return $this->paramTypes;
+ }
+
+ /**
+ * Gets a (previously set) query parameter type of the query being constructed.
+ *
+ * @param mixed $key The key (index or name) of the bound parameter type.
+ *
+ * @return mixed The value of the bound parameter type.
+ */
+ public function getParameterType($key)
+ {
+ return $this->paramTypes[$key] ?? null;
+ }
+
+ /**
+ * Sets the position of the first result to retrieve (the "offset").
+ *
+ * @param int $firstResult The first result to return.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function setFirstResult($firstResult)
+ {
+ $this->state = self::STATE_DIRTY;
+ $this->firstResult = $firstResult;
+
+ return $this;
+ }
+
+ /**
+ * Gets the position of the first result the query object was set to retrieve (the "offset").
+ * Returns NULL if {@link setFirstResult} was not applied to this QueryBuilder.
+ *
+ * @return int The position of the first result.
+ */
+ public function getFirstResult()
+ {
+ return $this->firstResult;
+ }
+
+ /**
+ * Sets the maximum number of results to retrieve (the "limit").
+ *
+ * @param int $maxResults The maximum number of results to retrieve.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function setMaxResults($maxResults)
+ {
+ $this->state = self::STATE_DIRTY;
+ $this->maxResults = $maxResults;
+
+ return $this;
+ }
+
+ /**
+ * Gets the maximum number of results the query object was set to retrieve (the "limit").
+ * Returns NULL if {@link setMaxResults} was not applied to this query builder.
+ *
+ * @return int The maximum number of results.
+ */
+ public function getMaxResults()
+ {
+ return $this->maxResults;
+ }
+
+ /**
+ * Either appends to or replaces a single, generic query part.
+ *
+ * The available parts are: 'select', 'from', 'set', 'where',
+ * 'groupBy', 'having' and 'orderBy'.
+ *
+ * @param string $sqlPartName
+ * @param string $sqlPart
+ * @param bool $append
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function add($sqlPartName, $sqlPart, $append = false)
+ {
+ $isArray = is_array($sqlPart);
+ $isMultiple = is_array($this->sqlParts[$sqlPartName]);
+
+ if ($isMultiple && ! $isArray) {
+ $sqlPart = [$sqlPart];
+ }
+
+ $this->state = self::STATE_DIRTY;
+
+ if ($append) {
+ if ($sqlPartName === 'orderBy' || $sqlPartName === 'groupBy' || $sqlPartName === 'select' || $sqlPartName === 'set') {
+ foreach ($sqlPart as $part) {
+ $this->sqlParts[$sqlPartName][] = $part;
+ }
+ } elseif ($isArray && is_array($sqlPart[key($sqlPart)])) {
+ $key = key($sqlPart);
+ $this->sqlParts[$sqlPartName][$key][] = $sqlPart[$key];
+ } elseif ($isMultiple) {
+ $this->sqlParts[$sqlPartName][] = $sqlPart;
+ } else {
+ $this->sqlParts[$sqlPartName] = $sqlPart;
+ }
+
+ return $this;
+ }
+
+ $this->sqlParts[$sqlPartName] = $sqlPart;
+
+ return $this;
+ }
+
+ /**
+ * Specifies an item that is to be returned in the query result.
+ * Replaces any previously specified selections, if any.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.id', 'p.id')
+ * ->from('users', 'u')
+ * ->leftJoin('u', 'phonenumbers', 'p', 'u.id = p.user_id');
+ *
+ *
+ * @param mixed $select The selection expressions.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function select($select = null)
+ {
+ $this->type = self::SELECT;
+
+ if (empty($select)) {
+ return $this;
+ }
+
+ $selects = is_array($select) ? $select : func_get_args();
+
+ return $this->add('select', $selects);
+ }
+
+ /**
+ * Adds an item that is to be returned in the query result.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.id')
+ * ->addSelect('p.id')
+ * ->from('users', 'u')
+ * ->leftJoin('u', 'phonenumbers', 'u.id = p.user_id');
+ *
+ *
+ * @param mixed $select The selection expression.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function addSelect($select = null)
+ {
+ $this->type = self::SELECT;
+
+ if (empty($select)) {
+ return $this;
+ }
+
+ $selects = is_array($select) ? $select : func_get_args();
+
+ return $this->add('select', $selects, true);
+ }
+
+ /**
+ * Turns the query being built into a bulk delete query that ranges over
+ * a certain table.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->delete('users', 'u')
+ * ->where('u.id = :user_id');
+ * ->setParameter(':user_id', 1);
+ *
+ *
+ * @param string $delete The table whose rows are subject to the deletion.
+ * @param string $alias The table alias used in the constructed query.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function delete($delete = null, $alias = null)
+ {
+ $this->type = self::DELETE;
+
+ if (! $delete) {
+ return $this;
+ }
+
+ return $this->add('from', [
+ 'table' => $delete,
+ 'alias' => $alias,
+ ]);
+ }
+
+ /**
+ * Turns the query being built into a bulk update query that ranges over
+ * a certain table
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->update('counters', 'c')
+ * ->set('c.value', 'c.value + 1')
+ * ->where('c.id = ?');
+ *
+ *
+ * @param string $update The table whose rows are subject to the update.
+ * @param string $alias The table alias used in the constructed query.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function update($update = null, $alias = null)
+ {
+ $this->type = self::UPDATE;
+
+ if (! $update) {
+ return $this;
+ }
+
+ return $this->add('from', [
+ 'table' => $update,
+ 'alias' => $alias,
+ ]);
+ }
+
+ /**
+ * Turns the query being built into an insert query that inserts into
+ * a certain table
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->insert('users')
+ * ->values(
+ * array(
+ * 'name' => '?',
+ * 'password' => '?'
+ * )
+ * );
+ *
+ *
+ * @param string $insert The table into which the rows should be inserted.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function insert($insert = null)
+ {
+ $this->type = self::INSERT;
+
+ if (! $insert) {
+ return $this;
+ }
+
+ return $this->add('from', ['table' => $insert]);
+ }
+
+ /**
+ * Creates and adds a query root corresponding to the table identified by the
+ * given alias, forming a cartesian product with any existing query roots.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.id')
+ * ->from('users', 'u')
+ *
+ *
+ * @param string $from The table.
+ * @param string|null $alias The alias of the table.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function from($from, $alias = null)
+ {
+ return $this->add('from', [
+ 'table' => $from,
+ 'alias' => $alias,
+ ], true);
+ }
+
+ /**
+ * Creates and adds a join to the query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->join('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ *
+ *
+ * @param string $fromAlias The alias that points to a from clause.
+ * @param string $join The table name to join.
+ * @param string $alias The alias of the join table.
+ * @param string $condition The condition for the join.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function join($fromAlias, $join, $alias, $condition = null)
+ {
+ return $this->innerJoin($fromAlias, $join, $alias, $condition);
+ }
+
+ /**
+ * Creates and adds a join to the query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->innerJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ *
+ *
+ * @param string $fromAlias The alias that points to a from clause.
+ * @param string $join The table name to join.
+ * @param string $alias The alias of the join table.
+ * @param string $condition The condition for the join.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function innerJoin($fromAlias, $join, $alias, $condition = null)
+ {
+ return $this->add('join', [
+ $fromAlias => [
+ 'joinType' => 'inner',
+ 'joinTable' => $join,
+ 'joinAlias' => $alias,
+ 'joinCondition' => $condition,
+ ],
+ ], true);
+ }
+
+ /**
+ * Creates and adds a left join to the query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->leftJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ *
+ *
+ * @param string $fromAlias The alias that points to a from clause.
+ * @param string $join The table name to join.
+ * @param string $alias The alias of the join table.
+ * @param string $condition The condition for the join.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function leftJoin($fromAlias, $join, $alias, $condition = null)
+ {
+ return $this->add('join', [
+ $fromAlias => [
+ 'joinType' => 'left',
+ 'joinTable' => $join,
+ 'joinAlias' => $alias,
+ 'joinCondition' => $condition,
+ ],
+ ], true);
+ }
+
+ /**
+ * Creates and adds a right join to the query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->rightJoin('u', 'phonenumbers', 'p', 'p.is_primary = 1');
+ *
+ *
+ * @param string $fromAlias The alias that points to a from clause.
+ * @param string $join The table name to join.
+ * @param string $alias The alias of the join table.
+ * @param string $condition The condition for the join.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function rightJoin($fromAlias, $join, $alias, $condition = null)
+ {
+ return $this->add('join', [
+ $fromAlias => [
+ 'joinType' => 'right',
+ 'joinTable' => $join,
+ 'joinAlias' => $alias,
+ 'joinCondition' => $condition,
+ ],
+ ], true);
+ }
+
+ /**
+ * Sets a new value for a column in a bulk update query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->update('counters', 'c')
+ * ->set('c.value', 'c.value + 1')
+ * ->where('c.id = ?');
+ *
+ *
+ * @param string $key The column to set.
+ * @param string $value The value, expression, placeholder, etc.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function set($key, $value)
+ {
+ return $this->add('set', $key . ' = ' . $value, true);
+ }
+
+ /**
+ * Specifies one or more restrictions to the query result.
+ * Replaces any previously specified restrictions, if any.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('c.value')
+ * ->from('counters', 'c')
+ * ->where('c.id = ?');
+ *
+ * // You can optionally programatically build and/or expressions
+ * $qb = $conn->createQueryBuilder();
+ *
+ * $or = $qb->expr()->orx();
+ * $or->add($qb->expr()->eq('c.id', 1));
+ * $or->add($qb->expr()->eq('c.id', 2));
+ *
+ * $qb->update('counters', 'c')
+ * ->set('c.value', 'c.value + 1')
+ * ->where($or);
+ *
+ *
+ * @param mixed $predicates The restriction predicates.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function where($predicates)
+ {
+ if (! (func_num_args() === 1 && $predicates instanceof CompositeExpression)) {
+ $predicates = new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args());
+ }
+
+ return $this->add('where', $predicates);
+ }
+
+ /**
+ * Adds one or more restrictions to the query results, forming a logical
+ * conjunction with any previously specified restrictions.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u')
+ * ->from('users', 'u')
+ * ->where('u.username LIKE ?')
+ * ->andWhere('u.is_active = 1');
+ *
+ *
+ * @see where()
+ *
+ * @param mixed $where The query restrictions.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function andWhere($where)
+ {
+ $args = func_get_args();
+ $where = $this->getQueryPart('where');
+
+ if ($where instanceof CompositeExpression && $where->getType() === CompositeExpression::TYPE_AND) {
+ $where->addMultiple($args);
+ } else {
+ array_unshift($args, $where);
+ $where = new CompositeExpression(CompositeExpression::TYPE_AND, $args);
+ }
+
+ return $this->add('where', $where, true);
+ }
+
+ /**
+ * Adds one or more restrictions to the query results, forming a logical
+ * disjunction with any previously specified restrictions.
+ *
+ *
+ * $qb = $em->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->where('u.id = 1')
+ * ->orWhere('u.id = 2');
+ *
+ *
+ * @see where()
+ *
+ * @param mixed $where The WHERE statement.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function orWhere($where)
+ {
+ $args = func_get_args();
+ $where = $this->getQueryPart('where');
+
+ if ($where instanceof CompositeExpression && $where->getType() === CompositeExpression::TYPE_OR) {
+ $where->addMultiple($args);
+ } else {
+ array_unshift($args, $where);
+ $where = new CompositeExpression(CompositeExpression::TYPE_OR, $args);
+ }
+
+ return $this->add('where', $where, true);
+ }
+
+ /**
+ * Specifies a grouping over the results of the query.
+ * Replaces any previously specified groupings, if any.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->groupBy('u.id');
+ *
+ *
+ * @param mixed $groupBy The grouping expression.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function groupBy($groupBy)
+ {
+ if (empty($groupBy)) {
+ return $this;
+ }
+
+ $groupBy = is_array($groupBy) ? $groupBy : func_get_args();
+
+ return $this->add('groupBy', $groupBy, false);
+ }
+
+
+ /**
+ * Adds a grouping expression to the query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->select('u.name')
+ * ->from('users', 'u')
+ * ->groupBy('u.lastLogin');
+ * ->addGroupBy('u.createdAt')
+ *
+ *
+ * @param mixed $groupBy The grouping expression.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function addGroupBy($groupBy)
+ {
+ if (empty($groupBy)) {
+ return $this;
+ }
+
+ $groupBy = is_array($groupBy) ? $groupBy : func_get_args();
+
+ return $this->add('groupBy', $groupBy, true);
+ }
+
+ /**
+ * Sets a value for a column in an insert query.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->insert('users')
+ * ->values(
+ * array(
+ * 'name' => '?'
+ * )
+ * )
+ * ->setValue('password', '?');
+ *
+ *
+ * @param string $column The column into which the value should be inserted.
+ * @param string $value The value that should be inserted into the column.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function setValue($column, $value)
+ {
+ $this->sqlParts['values'][$column] = $value;
+
+ return $this;
+ }
+
+ /**
+ * Specifies values for an insert query indexed by column names.
+ * Replaces any previous values, if any.
+ *
+ *
+ * $qb = $conn->createQueryBuilder()
+ * ->insert('users')
+ * ->values(
+ * array(
+ * 'name' => '?',
+ * 'password' => '?'
+ * )
+ * );
+ *
+ *
+ * @param mixed[] $values The values to specify for the insert query indexed by column names.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function values(array $values)
+ {
+ return $this->add('values', $values);
+ }
+
+ /**
+ * Specifies a restriction over the groups of the query.
+ * Replaces any previous having restrictions, if any.
+ *
+ * @param mixed $having The restriction over the groups.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function having($having)
+ {
+ if (! (func_num_args() === 1 && $having instanceof CompositeExpression)) {
+ $having = new CompositeExpression(CompositeExpression::TYPE_AND, func_get_args());
+ }
+
+ return $this->add('having', $having);
+ }
+
+ /**
+ * Adds a restriction over the groups of the query, forming a logical
+ * conjunction with any existing having restrictions.
+ *
+ * @param mixed $having The restriction to append.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function andHaving($having)
+ {
+ $args = func_get_args();
+ $having = $this->getQueryPart('having');
+
+ if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_AND) {
+ $having->addMultiple($args);
+ } else {
+ array_unshift($args, $having);
+ $having = new CompositeExpression(CompositeExpression::TYPE_AND, $args);
+ }
+
+ return $this->add('having', $having);
+ }
+
+ /**
+ * Adds a restriction over the groups of the query, forming a logical
+ * disjunction with any existing having restrictions.
+ *
+ * @param mixed $having The restriction to add.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function orHaving($having)
+ {
+ $args = func_get_args();
+ $having = $this->getQueryPart('having');
+
+ if ($having instanceof CompositeExpression && $having->getType() === CompositeExpression::TYPE_OR) {
+ $having->addMultiple($args);
+ } else {
+ array_unshift($args, $having);
+ $having = new CompositeExpression(CompositeExpression::TYPE_OR, $args);
+ }
+
+ return $this->add('having', $having);
+ }
+
+ /**
+ * Specifies an ordering for the query results.
+ * Replaces any previously specified orderings, if any.
+ *
+ * @param string $sort The ordering expression.
+ * @param string $order The ordering direction.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function orderBy($sort, $order = null)
+ {
+ return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), false);
+ }
+
+ /**
+ * Adds an ordering to the query results.
+ *
+ * @param string $sort The ordering expression.
+ * @param string $order The ordering direction.
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function addOrderBy($sort, $order = null)
+ {
+ return $this->add('orderBy', $sort . ' ' . (! $order ? 'ASC' : $order), true);
+ }
+
+ /**
+ * Gets a query part by its name.
+ *
+ * @param string $queryPartName
+ *
+ * @return mixed
+ */
+ public function getQueryPart($queryPartName)
+ {
+ return $this->sqlParts[$queryPartName];
+ }
+
+ /**
+ * Gets all query parts.
+ *
+ * @return mixed[]
+ */
+ public function getQueryParts()
+ {
+ return $this->sqlParts;
+ }
+
+ /**
+ * Resets SQL parts.
+ *
+ * @param string[]|null $queryPartNames
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function resetQueryParts($queryPartNames = null)
+ {
+ if ($queryPartNames === null) {
+ $queryPartNames = array_keys($this->sqlParts);
+ }
+
+ foreach ($queryPartNames as $queryPartName) {
+ $this->resetQueryPart($queryPartName);
+ }
+
+ return $this;
+ }
+
+ /**
+ * Resets a single SQL part.
+ *
+ * @param string $queryPartName
+ *
+ * @return $this This QueryBuilder instance.
+ */
+ public function resetQueryPart($queryPartName)
+ {
+ $this->sqlParts[$queryPartName] = is_array($this->sqlParts[$queryPartName])
+ ? [] : null;
+
+ $this->state = self::STATE_DIRTY;
+
+ return $this;
+ }
+
+ /**
+ * @return string
+ *
+ * @throws QueryException
+ */
+ private function getSQLForSelect()
+ {
+ $query = 'SELECT ' . implode(', ', $this->sqlParts['select']);
+
+ $query .= ($this->sqlParts['from'] ? ' FROM ' . implode(', ', $this->getFromClauses()) : '')
+ . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '')
+ . ($this->sqlParts['groupBy'] ? ' GROUP BY ' . implode(', ', $this->sqlParts['groupBy']) : '')
+ . ($this->sqlParts['having'] !== null ? ' HAVING ' . ((string) $this->sqlParts['having']) : '')
+ . ($this->sqlParts['orderBy'] ? ' ORDER BY ' . implode(', ', $this->sqlParts['orderBy']) : '');
+
+ if ($this->isLimitQuery()) {
+ return $this->connection->getDatabasePlatform()->modifyLimitQuery(
+ $query,
+ $this->maxResults,
+ $this->firstResult
+ );
+ }
+
+ return $query;
+ }
+
+ /**
+ * @return string[]
+ */
+ private function getFromClauses()
+ {
+ $fromClauses = [];
+ $knownAliases = [];
+
+ // Loop through all FROM clauses
+ foreach ($this->sqlParts['from'] as $from) {
+ if ($from['alias'] === null) {
+ $tableSql = $from['table'];
+ $tableReference = $from['table'];
+ } else {
+ $tableSql = $from['table'] . ' ' . $from['alias'];
+ $tableReference = $from['alias'];
+ }
+
+ $knownAliases[$tableReference] = true;
+
+ $fromClauses[$tableReference] = $tableSql . $this->getSQLForJoins($tableReference, $knownAliases);
+ }
+
+ $this->verifyAllAliasesAreKnown($knownAliases);
+
+ return $fromClauses;
+ }
+
+ /**
+ * @param string[] $knownAliases
+ *
+ * @throws QueryException
+ */
+ private function verifyAllAliasesAreKnown(array $knownAliases)
+ {
+ foreach ($this->sqlParts['join'] as $fromAlias => $joins) {
+ if (! isset($knownAliases[$fromAlias])) {
+ throw QueryException::unknownAlias($fromAlias, array_keys($knownAliases));
+ }
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ private function isLimitQuery()
+ {
+ return $this->maxResults !== null || $this->firstResult !== null;
+ }
+
+ /**
+ * Converts this instance into an INSERT string in SQL.
+ *
+ * @return string
+ */
+ private function getSQLForInsert()
+ {
+ return 'INSERT INTO ' . $this->sqlParts['from']['table'] .
+ ' (' . implode(', ', array_keys($this->sqlParts['values'])) . ')' .
+ ' VALUES(' . implode(', ', $this->sqlParts['values']) . ')';
+ }
+
+ /**
+ * Converts this instance into an UPDATE string in SQL.
+ *
+ * @return string
+ */
+ private function getSQLForUpdate()
+ {
+ $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');
+ return 'UPDATE ' . $table
+ . ' SET ' . implode(', ', $this->sqlParts['set'])
+ . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
+ }
+
+ /**
+ * Converts this instance into a DELETE string in SQL.
+ *
+ * @return string
+ */
+ private function getSQLForDelete()
+ {
+ $table = $this->sqlParts['from']['table'] . ($this->sqlParts['from']['alias'] ? ' ' . $this->sqlParts['from']['alias'] : '');
+ return 'DELETE FROM ' . $table . ($this->sqlParts['where'] !== null ? ' WHERE ' . ((string) $this->sqlParts['where']) : '');
+ }
+
+ /**
+ * Gets a string representation of this QueryBuilder which corresponds to
+ * the final SQL query being constructed.
+ *
+ * @return string The string representation of this QueryBuilder.
+ */
+ public function __toString()
+ {
+ return $this->getSQL();
+ }
+
+ /**
+ * Creates a new named parameter and bind the value $value to it.
+ *
+ * This method provides a shortcut for PDOStatement::bindValue
+ * when using prepared statements.
+ *
+ * The parameter $value specifies the value that you want to bind. If
+ * $placeholder is not provided bindValue() will automatically create a
+ * placeholder for you. An automatic placeholder will be of the name
+ * ':dcValue1', ':dcValue2' etc.
+ *
+ * For more information see {@link http://php.net/pdostatement-bindparam}
+ *
+ * Example:
+ *
+ * $value = 2;
+ * $q->eq( 'id', $q->bindValue( $value ) );
+ * $stmt = $q->executeQuery(); // executed with 'id = 2'
+ *
+ *
+ * @link http://www.zetacomponents.org
+ *
+ * @param mixed $value
+ * @param mixed $type
+ * @param string $placeHolder The name to bind with. The string must start with a colon ':'.
+ *
+ * @return string the placeholder name used.
+ */
+ public function createNamedParameter($value, $type = ParameterType::STRING, $placeHolder = null)
+ {
+ if ($placeHolder === null) {
+ $this->boundCounter++;
+ $placeHolder = ':dcValue' . $this->boundCounter;
+ }
+ $this->setParameter(substr($placeHolder, 1), $value, $type);
+
+ return $placeHolder;
+ }
+
+ /**
+ * Creates a new positional parameter and bind the given value to it.
+ *
+ * Attention: If you are using positional parameters with the query builder you have
+ * to be very careful to bind all parameters in the order they appear in the SQL
+ * statement , otherwise they get bound in the wrong order which can lead to serious
+ * bugs in your code.
+ *
+ * Example:
+ *
+ * $qb = $conn->createQueryBuilder();
+ * $qb->select('u.*')
+ * ->from('users', 'u')
+ * ->where('u.username = ' . $qb->createPositionalParameter('Foo', ParameterType::STRING))
+ * ->orWhere('u.username = ' . $qb->createPositionalParameter('Bar', ParameterType::STRING))
+ *
+ *
+ * @param mixed $value
+ * @param int $type
+ *
+ * @return string
+ */
+ public function createPositionalParameter($value, $type = ParameterType::STRING)
+ {
+ $this->boundCounter++;
+ $this->setParameter($this->boundCounter, $value, $type);
+
+ return '?';
+ }
+
+ /**
+ * @param string $fromAlias
+ * @param string[] $knownAliases
+ *
+ * @return string
+ *
+ * @throws QueryException
+ */
+ private function getSQLForJoins($fromAlias, array &$knownAliases)
+ {
+ $sql = '';
+
+ if (isset($this->sqlParts['join'][$fromAlias])) {
+ foreach ($this->sqlParts['join'][$fromAlias] as $join) {
+ if (array_key_exists($join['joinAlias'], $knownAliases)) {
+ throw QueryException::nonUniqueAlias($join['joinAlias'], array_keys($knownAliases));
+ }
+ $sql .= ' ' . strtoupper($join['joinType'])
+ . ' JOIN ' . $join['joinTable'] . ' ' . $join['joinAlias']
+ . ' ON ' . ((string) $join['joinCondition']);
+ $knownAliases[$join['joinAlias']] = true;
+ }
+
+ foreach ($this->sqlParts['join'][$fromAlias] as $join) {
+ $sql .= $this->getSQLForJoins($join['joinAlias'], $knownAliases);
+ }
+ }
+
+ return $sql;
+ }
+
+ /**
+ * Deep clone of all expression objects in the SQL parts.
+ *
+ * @return void
+ */
+ public function __clone()
+ {
+ foreach ($this->sqlParts as $part => $elements) {
+ if (is_array($this->sqlParts[$part])) {
+ foreach ($this->sqlParts[$part] as $idx => $element) {
+ if (! is_object($element)) {
+ continue;
+ }
+
+ $this->sqlParts[$part][$idx] = clone $element;
+ }
+ } elseif (is_object($elements)) {
+ $this->sqlParts[$part] = clone $elements;
+ }
+ }
+
+ foreach ($this->params as $name => $param) {
+ if (! is_object($param)) {
+ continue;
+ }
+
+ $this->params[$name] = clone $param;
+ }
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php
new file mode 100644
index 000000000..3fcb3b480
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Query/QueryException.php
@@ -0,0 +1,35 @@
+ integer pair (indexed from zero) for a positional statement
+ * and a string => int[] pair for a named statement.
+ *
+ * @param string $statement
+ * @param bool $isPositional
+ *
+ * @return int[]
+ */
+ public static function getPlaceholderPositions($statement, $isPositional = true)
+ {
+ $match = $isPositional ? '?' : ':';
+ if (strpos($statement, $match) === false) {
+ return [];
+ }
+
+ $token = $isPositional ? self::POSITIONAL_TOKEN : self::NAMED_TOKEN;
+ $paramMap = [];
+
+ foreach (self::getUnquotedStatementFragments($statement) as $fragment) {
+ preg_match_all('/' . $token . '/', $fragment[0], $matches, PREG_OFFSET_CAPTURE);
+ foreach ($matches[0] as $placeholder) {
+ if ($isPositional) {
+ $paramMap[] = $placeholder[1] + $fragment[1];
+ } else {
+ $pos = $placeholder[1] + $fragment[1];
+ $paramMap[$pos] = substr($placeholder[0], 1, strlen($placeholder[0]));
+ }
+ }
+ }
+
+ return $paramMap;
+ }
+
+ /**
+ * For a positional query this method can rewrite the sql statement with regard to array parameters.
+ *
+ * @param string $query The SQL query to execute.
+ * @param mixed[] $params The parameters to bind to the query.
+ * @param int[]|string[] $types The types the previous parameters are in.
+ *
+ * @return mixed[]
+ *
+ * @throws SQLParserUtilsException
+ */
+ public static function expandListParameters($query, $params, $types)
+ {
+ $isPositional = is_int(key($params));
+ $arrayPositions = [];
+ $bindIndex = -1;
+
+ if ($isPositional) {
+ ksort($params);
+ ksort($types);
+ }
+
+ foreach ($types as $name => $type) {
+ ++$bindIndex;
+
+ if ($type !== Connection::PARAM_INT_ARRAY && $type !== Connection::PARAM_STR_ARRAY) {
+ continue;
+ }
+
+ if ($isPositional) {
+ $name = $bindIndex;
+ }
+
+ $arrayPositions[$name] = false;
+ }
+
+ if (( ! $arrayPositions && $isPositional)) {
+ return [$query, $params, $types];
+ }
+
+ $paramPos = self::getPlaceholderPositions($query, $isPositional);
+
+ if ($isPositional) {
+ $paramOffset = 0;
+ $queryOffset = 0;
+ $params = array_values($params);
+ $types = array_values($types);
+
+ foreach ($paramPos as $needle => $needlePos) {
+ if (! isset($arrayPositions[$needle])) {
+ continue;
+ }
+
+ $needle += $paramOffset;
+ $needlePos += $queryOffset;
+ $count = count($params[$needle]);
+
+ $params = array_merge(
+ array_slice($params, 0, $needle),
+ $params[$needle],
+ array_slice($params, $needle + 1)
+ );
+
+ $types = array_merge(
+ array_slice($types, 0, $needle),
+ $count ?
+ // array needles are at {@link \Doctrine\DBAL\ParameterType} constants
+ // + {@link Doctrine\DBAL\Connection::ARRAY_PARAM_OFFSET}
+ array_fill(0, $count, $types[$needle] - Connection::ARRAY_PARAM_OFFSET) :
+ [],
+ array_slice($types, $needle + 1)
+ );
+
+ $expandStr = $count ? implode(', ', array_fill(0, $count, '?')) : 'NULL';
+ $query = substr($query, 0, $needlePos) . $expandStr . substr($query, $needlePos + 1);
+
+ $paramOffset += ($count - 1); // Grows larger by number of parameters minus the replaced needle.
+ $queryOffset += (strlen($expandStr) - 1);
+ }
+
+ return [$query, $params, $types];
+ }
+
+ $queryOffset = 0;
+ $typesOrd = [];
+ $paramsOrd = [];
+
+ foreach ($paramPos as $pos => $paramName) {
+ $paramLen = strlen($paramName) + 1;
+ $value = static::extractParam($paramName, $params, true);
+
+ if (! isset($arrayPositions[$paramName]) && ! isset($arrayPositions[':' . $paramName])) {
+ $pos += $queryOffset;
+ $queryOffset -= ($paramLen - 1);
+ $paramsOrd[] = $value;
+ $typesOrd[] = static::extractParam($paramName, $types, false, ParameterType::STRING);
+ $query = substr($query, 0, $pos) . '?' . substr($query, ($pos + $paramLen));
+
+ continue;
+ }
+
+ $count = count($value);
+ $expandStr = $count > 0 ? implode(', ', array_fill(0, $count, '?')) : 'NULL';
+
+ foreach ($value as $val) {
+ $paramsOrd[] = $val;
+ $typesOrd[] = static::extractParam($paramName, $types, false) - Connection::ARRAY_PARAM_OFFSET;
+ }
+
+ $pos += $queryOffset;
+ $queryOffset += (strlen($expandStr) - $paramLen);
+ $query = substr($query, 0, $pos) . $expandStr . substr($query, ($pos + $paramLen));
+ }
+
+ return [$query, $paramsOrd, $typesOrd];
+ }
+
+ /**
+ * Slice the SQL statement around pairs of quotes and
+ * return string fragments of SQL outside of quoted literals.
+ * Each fragment is captured as a 2-element array:
+ *
+ * 0 => matched fragment string,
+ * 1 => offset of fragment in $statement
+ *
+ * @param string $statement
+ *
+ * @return mixed[][]
+ */
+ private static function getUnquotedStatementFragments($statement)
+ {
+ $literal = self::ESCAPED_SINGLE_QUOTED_TEXT . '|' .
+ self::ESCAPED_DOUBLE_QUOTED_TEXT . '|' .
+ self::ESCAPED_BACKTICK_QUOTED_TEXT . '|' .
+ self::ESCAPED_BRACKET_QUOTED_TEXT;
+ $expression = sprintf('/((.+(?i:ARRAY)\\[.+\\])|([^\'"`\\[]+))(?:%s)?/s', $literal);
+
+ preg_match_all($expression, $statement, $fragments, PREG_OFFSET_CAPTURE);
+
+ return $fragments[1];
+ }
+
+ /**
+ * @param string $paramName The name of the parameter (without a colon in front)
+ * @param mixed $paramsOrTypes A hash of parameters or types
+ * @param bool $isParam
+ * @param mixed $defaultValue An optional default value. If omitted, an exception is thrown
+ *
+ * @return mixed
+ *
+ * @throws SQLParserUtilsException
+ */
+ private static function extractParam($paramName, $paramsOrTypes, $isParam, $defaultValue = null)
+ {
+ if (array_key_exists($paramName, $paramsOrTypes)) {
+ return $paramsOrTypes[$paramName];
+ }
+
+ // Hash keys can be prefixed with a colon for compatibility
+ if (array_key_exists(':' . $paramName, $paramsOrTypes)) {
+ return $paramsOrTypes[':' . $paramName];
+ }
+
+ if ($defaultValue !== null) {
+ return $defaultValue;
+ }
+
+ if ($isParam) {
+ throw SQLParserUtilsException::missingParam($paramName);
+ }
+
+ throw SQLParserUtilsException::missingType($paramName);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php
new file mode 100644
index 000000000..a500ed52d
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/SQLParserUtilsException.php
@@ -0,0 +1,31 @@
+ Table($tableName)); if you want to rename the table, you have to make sure
+ */
+abstract class AbstractAsset
+{
+ /** @var string */
+ protected $_name;
+
+ /**
+ * Namespace of the asset. If none isset the default namespace is assumed.
+ *
+ * @var string|null
+ */
+ protected $_namespace = null;
+
+ /** @var bool */
+ protected $_quoted = false;
+
+ /**
+ * Sets the name of this asset.
+ *
+ * @param string $name
+ *
+ * @return void
+ */
+ protected function _setName($name)
+ {
+ if ($this->isIdentifierQuoted($name)) {
+ $this->_quoted = true;
+ $name = $this->trimQuotes($name);
+ }
+ if (strpos($name, '.') !== false) {
+ $parts = explode('.', $name);
+ $this->_namespace = $parts[0];
+ $name = $parts[1];
+ }
+ $this->_name = $name;
+ }
+
+ /**
+ * Is this asset in the default namespace?
+ *
+ * @param string $defaultNamespaceName
+ *
+ * @return bool
+ */
+ public function isInDefaultNamespace($defaultNamespaceName)
+ {
+ return $this->_namespace === $defaultNamespaceName || $this->_namespace === null;
+ }
+
+ /**
+ * Gets the namespace name of this asset.
+ *
+ * If NULL is returned this means the default namespace is used.
+ *
+ * @return string|null
+ */
+ public function getNamespaceName()
+ {
+ return $this->_namespace;
+ }
+
+ /**
+ * The shortest name is stripped of the default namespace. All other
+ * namespaced elements are returned as full-qualified names.
+ *
+ * @param string $defaultNamespaceName
+ *
+ * @return string
+ */
+ public function getShortestName($defaultNamespaceName)
+ {
+ $shortestName = $this->getName();
+ if ($this->_namespace === $defaultNamespaceName) {
+ $shortestName = $this->_name;
+ }
+
+ return strtolower($shortestName);
+ }
+
+ /**
+ * The normalized name is full-qualified and lowerspaced. Lowerspacing is
+ * actually wrong, but we have to do it to keep our sanity. If you are
+ * using database objects that only differentiate in the casing (FOO vs
+ * Foo) then you will NOT be able to use Doctrine Schema abstraction.
+ *
+ * Every non-namespaced element is prefixed with the default namespace
+ * name which is passed as argument to this method.
+ *
+ * @param string $defaultNamespaceName
+ *
+ * @return string
+ */
+ public function getFullQualifiedName($defaultNamespaceName)
+ {
+ $name = $this->getName();
+ if (! $this->_namespace) {
+ $name = $defaultNamespaceName . '.' . $name;
+ }
+
+ return strtolower($name);
+ }
+
+ /**
+ * Checks if this asset's name is quoted.
+ *
+ * @return bool
+ */
+ public function isQuoted()
+ {
+ return $this->_quoted;
+ }
+
+ /**
+ * Checks if this identifier is quoted.
+ *
+ * @param string $identifier
+ *
+ * @return bool
+ */
+ protected function isIdentifierQuoted($identifier)
+ {
+ return isset($identifier[0]) && ($identifier[0] === '`' || $identifier[0] === '"' || $identifier[0] === '[');
+ }
+
+ /**
+ * Trim quotes from the identifier.
+ *
+ * @param string $identifier
+ *
+ * @return string
+ */
+ protected function trimQuotes($identifier)
+ {
+ return str_replace(['`', '"', '[', ']'], '', $identifier);
+ }
+
+ /**
+ * Returns the name of this schema asset.
+ *
+ * @return string
+ */
+ public function getName()
+ {
+ if ($this->_namespace) {
+ return $this->_namespace . '.' . $this->_name;
+ }
+
+ return $this->_name;
+ }
+
+ /**
+ * Gets the quoted representation of this asset but only if it was defined with one. Otherwise
+ * return the plain unquoted value as inserted.
+ *
+ * @return string
+ */
+ public function getQuotedName(AbstractPlatform $platform)
+ {
+ $keywords = $platform->getReservedKeywordsList();
+ $parts = explode('.', $this->getName());
+ foreach ($parts as $k => $v) {
+ $parts[$k] = $this->_quoted || $keywords->isKeyword($v) ? $platform->quoteIdentifier($v) : $v;
+ }
+
+ return implode('.', $parts);
+ }
+
+ /**
+ * Generates an identifier from a list of column names obeying a certain string length.
+ *
+ * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars,
+ * however building idents automatically for foreign keys, composite keys or such can easily create
+ * very long names.
+ *
+ * @param string[] $columnNames
+ * @param string $prefix
+ * @param int $maxSize
+ *
+ * @return string
+ */
+ protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30)
+ {
+ $hash = implode('', array_map(static function ($column) {
+ return dechex(crc32($column));
+ }, $columnNames));
+
+ return strtoupper(substr($prefix . '_' . $hash, 0, $maxSize));
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
new file mode 100644
index 000000000..9b917427f
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/AbstractSchemaManager.php
@@ -0,0 +1,1130 @@
+_conn = $conn;
+ $this->_platform = $platform ?: $this->_conn->getDatabasePlatform();
+ }
+
+ /**
+ * Returns the associated platform.
+ *
+ * @return AbstractPlatform
+ */
+ public function getDatabasePlatform()
+ {
+ return $this->_platform;
+ }
+
+ /**
+ * Tries any method on the schema manager. Normally a method throws an
+ * exception when your DBMS doesn't support it or if an error occurs.
+ * This method allows you to try and method on your SchemaManager
+ * instance and will return false if it does not work or is not supported.
+ *
+ *
+ * $result = $sm->tryMethod('dropView', 'view_name');
+ *
+ *
+ * @return mixed
+ */
+ public function tryMethod()
+ {
+ $args = func_get_args();
+ $method = $args[0];
+ unset($args[0]);
+ $args = array_values($args);
+
+ try {
+ return call_user_func_array([$this, $method], $args);
+ } catch (Throwable $e) {
+ return false;
+ }
+ }
+
+ /**
+ * Lists the available databases for this connection.
+ *
+ * @return string[]
+ */
+ public function listDatabases()
+ {
+ $sql = $this->_platform->getListDatabasesSQL();
+
+ $databases = $this->_conn->fetchAll($sql);
+
+ return $this->_getPortableDatabasesList($databases);
+ }
+
+ /**
+ * Returns a list of all namespaces in the current database.
+ *
+ * @return string[]
+ */
+ public function listNamespaceNames()
+ {
+ $sql = $this->_platform->getListNamespacesSQL();
+
+ $namespaces = $this->_conn->fetchAll($sql);
+
+ return $this->getPortableNamespacesList($namespaces);
+ }
+
+ /**
+ * Lists the available sequences for this connection.
+ *
+ * @param string|null $database
+ *
+ * @return Sequence[]
+ */
+ public function listSequences($database = null)
+ {
+ if ($database === null) {
+ $database = $this->_conn->getDatabase();
+ }
+ $sql = $this->_platform->getListSequencesSQL($database);
+
+ $sequences = $this->_conn->fetchAll($sql);
+
+ return $this->filterAssetNames($this->_getPortableSequencesList($sequences));
+ }
+
+ /**
+ * Lists the columns for a given table.
+ *
+ * In contrast to other libraries and to the old version of Doctrine,
+ * this column definition does try to contain the 'primary' field for
+ * the reason that it is not portable across different RDBMS. Use
+ * {@see listTableIndexes($tableName)} to retrieve the primary key
+ * of a table. We're a RDBMS specifies more details these are held
+ * in the platformDetails array.
+ *
+ * @param string $table The name of the table.
+ * @param string|null $database
+ *
+ * @return Column[]
+ */
+ public function listTableColumns($table, $database = null)
+ {
+ if (! $database) {
+ $database = $this->_conn->getDatabase();
+ }
+
+ $sql = $this->_platform->getListTableColumnsSQL($table, $database);
+
+ $tableColumns = $this->_conn->fetchAll($sql);
+
+ return $this->_getPortableTableColumnList($table, $database, $tableColumns);
+ }
+
+ /**
+ * Lists the indexes for a given table returning an array of Index instances.
+ *
+ * Keys of the portable indexes list are all lower-cased.
+ *
+ * @param string $table The name of the table.
+ *
+ * @return Index[]
+ */
+ public function listTableIndexes($table)
+ {
+ $sql = $this->_platform->getListTableIndexesSQL($table, $this->_conn->getDatabase());
+
+ $tableIndexes = $this->_conn->fetchAll($sql);
+
+ return $this->_getPortableTableIndexesList($tableIndexes, $table);
+ }
+
+ /**
+ * Returns true if all the given tables exist.
+ *
+ * @param string[] $tableNames
+ *
+ * @return bool
+ */
+ public function tablesExist($tableNames)
+ {
+ $tableNames = array_map('strtolower', (array) $tableNames);
+
+ return count($tableNames) === count(array_intersect($tableNames, array_map('strtolower', $this->listTableNames())));
+ }
+
+ /**
+ * Returns a list of all tables in the current database.
+ *
+ * @return string[]
+ */
+ public function listTableNames()
+ {
+ $sql = $this->_platform->getListTablesSQL();
+
+ $tables = $this->_conn->fetchAll($sql);
+ $tableNames = $this->_getPortableTablesList($tables);
+
+ return $this->filterAssetNames($tableNames);
+ }
+
+ /**
+ * Filters asset names if they are configured to return only a subset of all
+ * the found elements.
+ *
+ * @param mixed[] $assetNames
+ *
+ * @return mixed[]
+ */
+ protected function filterAssetNames($assetNames)
+ {
+ $filter = $this->_conn->getConfiguration()->getSchemaAssetsFilter();
+ if (! $filter) {
+ return $assetNames;
+ }
+
+ return array_values(array_filter($assetNames, $filter));
+ }
+
+ /**
+ * @deprecated Use Configuration::getSchemaAssetsFilter() instead
+ *
+ * @return string|null
+ */
+ protected function getFilterSchemaAssetsExpression()
+ {
+ return $this->_conn->getConfiguration()->getFilterSchemaAssetsExpression();
+ }
+
+ /**
+ * Lists the tables for this connection.
+ *
+ * @return Table[]
+ */
+ public function listTables()
+ {
+ $tableNames = $this->listTableNames();
+
+ $tables = [];
+ foreach ($tableNames as $tableName) {
+ $tables[] = $this->listTableDetails($tableName);
+ }
+
+ return $tables;
+ }
+
+ /**
+ * @param string $tableName
+ *
+ * @return Table
+ */
+ public function listTableDetails($tableName)
+ {
+ $columns = $this->listTableColumns($tableName);
+ $foreignKeys = [];
+ if ($this->_platform->supportsForeignKeyConstraints()) {
+ $foreignKeys = $this->listTableForeignKeys($tableName);
+ }
+ $indexes = $this->listTableIndexes($tableName);
+
+ return new Table($tableName, $columns, $indexes, $foreignKeys, false, []);
+ }
+
+ /**
+ * Lists the views this connection has.
+ *
+ * @return View[]
+ */
+ public function listViews()
+ {
+ $database = $this->_conn->getDatabase();
+ $sql = $this->_platform->getListViewsSQL($database);
+ $views = $this->_conn->fetchAll($sql);
+
+ return $this->_getPortableViewsList($views);
+ }
+
+ /**
+ * Lists the foreign keys for the given table.
+ *
+ * @param string $table The name of the table.
+ * @param string|null $database
+ *
+ * @return ForeignKeyConstraint[]
+ */
+ public function listTableForeignKeys($table, $database = null)
+ {
+ if ($database === null) {
+ $database = $this->_conn->getDatabase();
+ }
+ $sql = $this->_platform->getListTableForeignKeysSQL($table, $database);
+ $tableForeignKeys = $this->_conn->fetchAll($sql);
+
+ return $this->_getPortableTableForeignKeysList($tableForeignKeys);
+ }
+
+ /* drop*() Methods */
+
+ /**
+ * Drops a database.
+ *
+ * NOTE: You can not drop the database this SchemaManager is currently connected to.
+ *
+ * @param string $database The name of the database to drop.
+ *
+ * @return void
+ */
+ public function dropDatabase($database)
+ {
+ $this->_execSql($this->_platform->getDropDatabaseSQL($database));
+ }
+
+ /**
+ * Drops the given table.
+ *
+ * @param string $tableName The name of the table to drop.
+ *
+ * @return void
+ */
+ public function dropTable($tableName)
+ {
+ $this->_execSql($this->_platform->getDropTableSQL($tableName));
+ }
+
+ /**
+ * Drops the index from the given table.
+ *
+ * @param Index|string $index The name of the index.
+ * @param Table|string $table The name of the table.
+ *
+ * @return void
+ */
+ public function dropIndex($index, $table)
+ {
+ if ($index instanceof Index) {
+ $index = $index->getQuotedName($this->_platform);
+ }
+
+ $this->_execSql($this->_platform->getDropIndexSQL($index, $table));
+ }
+
+ /**
+ * Drops the constraint from the given table.
+ *
+ * @param Table|string $table The name of the table.
+ *
+ * @return void
+ */
+ public function dropConstraint(Constraint $constraint, $table)
+ {
+ $this->_execSql($this->_platform->getDropConstraintSQL($constraint, $table));
+ }
+
+ /**
+ * Drops a foreign key from a table.
+ *
+ * @param ForeignKeyConstraint|string $foreignKey The name of the foreign key.
+ * @param Table|string $table The name of the table with the foreign key.
+ *
+ * @return void
+ */
+ public function dropForeignKey($foreignKey, $table)
+ {
+ $this->_execSql($this->_platform->getDropForeignKeySQL($foreignKey, $table));
+ }
+
+ /**
+ * Drops a sequence with a given name.
+ *
+ * @param string $name The name of the sequence to drop.
+ *
+ * @return void
+ */
+ public function dropSequence($name)
+ {
+ $this->_execSql($this->_platform->getDropSequenceSQL($name));
+ }
+
+ /**
+ * Drops a view.
+ *
+ * @param string $name The name of the view.
+ *
+ * @return void
+ */
+ public function dropView($name)
+ {
+ $this->_execSql($this->_platform->getDropViewSQL($name));
+ }
+
+ /* create*() Methods */
+
+ /**
+ * Creates a new database.
+ *
+ * @param string $database The name of the database to create.
+ *
+ * @return void
+ */
+ public function createDatabase($database)
+ {
+ $this->_execSql($this->_platform->getCreateDatabaseSQL($database));
+ }
+
+ /**
+ * Creates a new table.
+ *
+ * @return void
+ */
+ public function createTable(Table $table)
+ {
+ $createFlags = AbstractPlatform::CREATE_INDEXES|AbstractPlatform::CREATE_FOREIGNKEYS;
+ $this->_execSql($this->_platform->getCreateTableSQL($table, $createFlags));
+ }
+
+ /**
+ * Creates a new sequence.
+ *
+ * @param Sequence $sequence
+ *
+ * @return void
+ *
+ * @throws ConnectionException If something fails at database level.
+ */
+ public function createSequence($sequence)
+ {
+ $this->_execSql($this->_platform->getCreateSequenceSQL($sequence));
+ }
+
+ /**
+ * Creates a constraint on a table.
+ *
+ * @param Table|string $table
+ *
+ * @return void
+ */
+ public function createConstraint(Constraint $constraint, $table)
+ {
+ $this->_execSql($this->_platform->getCreateConstraintSQL($constraint, $table));
+ }
+
+ /**
+ * Creates a new index on a table.
+ *
+ * @param Table|string $table The name of the table on which the index is to be created.
+ *
+ * @return void
+ */
+ public function createIndex(Index $index, $table)
+ {
+ $this->_execSql($this->_platform->getCreateIndexSQL($index, $table));
+ }
+
+ /**
+ * Creates a new foreign key.
+ *
+ * @param ForeignKeyConstraint $foreignKey The ForeignKey instance.
+ * @param Table|string $table The name of the table on which the foreign key is to be created.
+ *
+ * @return void
+ */
+ public function createForeignKey(ForeignKeyConstraint $foreignKey, $table)
+ {
+ $this->_execSql($this->_platform->getCreateForeignKeySQL($foreignKey, $table));
+ }
+
+ /**
+ * Creates a new view.
+ *
+ * @return void
+ */
+ public function createView(View $view)
+ {
+ $this->_execSql($this->_platform->getCreateViewSQL($view->getQuotedName($this->_platform), $view->getSql()));
+ }
+
+ /* dropAndCreate*() Methods */
+
+ /**
+ * Drops and creates a constraint.
+ *
+ * @see dropConstraint()
+ * @see createConstraint()
+ *
+ * @param Table|string $table
+ *
+ * @return void
+ */
+ public function dropAndCreateConstraint(Constraint $constraint, $table)
+ {
+ $this->tryMethod('dropConstraint', $constraint, $table);
+ $this->createConstraint($constraint, $table);
+ }
+
+ /**
+ * Drops and creates a new index on a table.
+ *
+ * @param Table|string $table The name of the table on which the index is to be created.
+ *
+ * @return void
+ */
+ public function dropAndCreateIndex(Index $index, $table)
+ {
+ $this->tryMethod('dropIndex', $index->getQuotedName($this->_platform), $table);
+ $this->createIndex($index, $table);
+ }
+
+ /**
+ * Drops and creates a new foreign key.
+ *
+ * @param ForeignKeyConstraint $foreignKey An associative array that defines properties of the foreign key to be created.
+ * @param Table|string $table The name of the table on which the foreign key is to be created.
+ *
+ * @return void
+ */
+ public function dropAndCreateForeignKey(ForeignKeyConstraint $foreignKey, $table)
+ {
+ $this->tryMethod('dropForeignKey', $foreignKey, $table);
+ $this->createForeignKey($foreignKey, $table);
+ }
+
+ /**
+ * Drops and create a new sequence.
+ *
+ * @return void
+ *
+ * @throws ConnectionException If something fails at database level.
+ */
+ public function dropAndCreateSequence(Sequence $sequence)
+ {
+ $this->tryMethod('dropSequence', $sequence->getQuotedName($this->_platform));
+ $this->createSequence($sequence);
+ }
+
+ /**
+ * Drops and creates a new table.
+ *
+ * @return void
+ */
+ public function dropAndCreateTable(Table $table)
+ {
+ $this->tryMethod('dropTable', $table->getQuotedName($this->_platform));
+ $this->createTable($table);
+ }
+
+ /**
+ * Drops and creates a new database.
+ *
+ * @param string $database The name of the database to create.
+ *
+ * @return void
+ */
+ public function dropAndCreateDatabase($database)
+ {
+ $this->tryMethod('dropDatabase', $database);
+ $this->createDatabase($database);
+ }
+
+ /**
+ * Drops and creates a new view.
+ *
+ * @return void
+ */
+ public function dropAndCreateView(View $view)
+ {
+ $this->tryMethod('dropView', $view->getQuotedName($this->_platform));
+ $this->createView($view);
+ }
+
+ /* alterTable() Methods */
+
+ /**
+ * Alters an existing tables schema.
+ *
+ * @return void
+ */
+ public function alterTable(TableDiff $tableDiff)
+ {
+ $queries = $this->_platform->getAlterTableSQL($tableDiff);
+ if (! is_array($queries) || ! count($queries)) {
+ return;
+ }
+
+ foreach ($queries as $ddlQuery) {
+ $this->_execSql($ddlQuery);
+ }
+ }
+
+ /**
+ * Renames a given table to another name.
+ *
+ * @param string $name The current name of the table.
+ * @param string $newName The new name of the table.
+ *
+ * @return void
+ */
+ public function renameTable($name, $newName)
+ {
+ $tableDiff = new TableDiff($name);
+ $tableDiff->newName = $newName;
+ $this->alterTable($tableDiff);
+ }
+
+ /**
+ * Methods for filtering return values of list*() methods to convert
+ * the native DBMS data definition to a portable Doctrine definition
+ */
+
+ /**
+ * @param mixed[] $databases
+ *
+ * @return string[]
+ */
+ protected function _getPortableDatabasesList($databases)
+ {
+ $list = [];
+ foreach ($databases as $value) {
+ $value = $this->_getPortableDatabaseDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * Converts a list of namespace names from the native DBMS data definition to a portable Doctrine definition.
+ *
+ * @param mixed[][] $namespaces The list of namespace names in the native DBMS data definition.
+ *
+ * @return string[]
+ */
+ protected function getPortableNamespacesList(array $namespaces)
+ {
+ $namespacesList = [];
+
+ foreach ($namespaces as $namespace) {
+ $namespacesList[] = $this->getPortableNamespaceDefinition($namespace);
+ }
+
+ return $namespacesList;
+ }
+
+ /**
+ * @param mixed $database
+ *
+ * @return mixed
+ */
+ protected function _getPortableDatabaseDefinition($database)
+ {
+ return $database;
+ }
+
+ /**
+ * Converts a namespace definition from the native DBMS data definition to a portable Doctrine definition.
+ *
+ * @param mixed[] $namespace The native DBMS namespace definition.
+ *
+ * @return mixed
+ */
+ protected function getPortableNamespaceDefinition(array $namespace)
+ {
+ return $namespace;
+ }
+
+ /**
+ * @param mixed[][] $functions
+ *
+ * @return mixed[][]
+ */
+ protected function _getPortableFunctionsList($functions)
+ {
+ $list = [];
+ foreach ($functions as $value) {
+ $value = $this->_getPortableFunctionDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed[] $function
+ *
+ * @return mixed
+ */
+ protected function _getPortableFunctionDefinition($function)
+ {
+ return $function;
+ }
+
+ /**
+ * @param mixed[][] $triggers
+ *
+ * @return mixed[][]
+ */
+ protected function _getPortableTriggersList($triggers)
+ {
+ $list = [];
+ foreach ($triggers as $value) {
+ $value = $this->_getPortableTriggerDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed[] $trigger
+ *
+ * @return mixed
+ */
+ protected function _getPortableTriggerDefinition($trigger)
+ {
+ return $trigger;
+ }
+
+ /**
+ * @param mixed[][] $sequences
+ *
+ * @return Sequence[]
+ */
+ protected function _getPortableSequencesList($sequences)
+ {
+ $list = [];
+ foreach ($sequences as $value) {
+ $value = $this->_getPortableSequenceDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed[] $sequence
+ *
+ * @return Sequence
+ *
+ * @throws DBALException
+ */
+ protected function _getPortableSequenceDefinition($sequence)
+ {
+ throw DBALException::notSupported('Sequences');
+ }
+
+ /**
+ * Independent of the database the keys of the column list result are lowercased.
+ *
+ * The name of the created column instance however is kept in its case.
+ *
+ * @param string $table The name of the table.
+ * @param string $database
+ * @param mixed[][] $tableColumns
+ *
+ * @return Column[]
+ */
+ protected function _getPortableTableColumnList($table, $database, $tableColumns)
+ {
+ $eventManager = $this->_platform->getEventManager();
+
+ $list = [];
+ foreach ($tableColumns as $tableColumn) {
+ $column = null;
+ $defaultPrevented = false;
+
+ if ($eventManager !== null && $eventManager->hasListeners(Events::onSchemaColumnDefinition)) {
+ $eventArgs = new SchemaColumnDefinitionEventArgs($tableColumn, $table, $database, $this->_conn);
+ $eventManager->dispatchEvent(Events::onSchemaColumnDefinition, $eventArgs);
+
+ $defaultPrevented = $eventArgs->isDefaultPrevented();
+ $column = $eventArgs->getColumn();
+ }
+
+ if (! $defaultPrevented) {
+ $column = $this->_getPortableTableColumnDefinition($tableColumn);
+ }
+
+ if (! $column) {
+ continue;
+ }
+
+ $name = strtolower($column->getQuotedName($this->_platform));
+ $list[$name] = $column;
+ }
+
+ return $list;
+ }
+
+ /**
+ * Gets Table Column Definition.
+ *
+ * @param mixed[] $tableColumn
+ *
+ * @return Column
+ */
+ abstract protected function _getPortableTableColumnDefinition($tableColumn);
+
+ /**
+ * Aggregates and groups the index results according to the required data result.
+ *
+ * @param mixed[][] $tableIndexRows
+ * @param string|null $tableName
+ *
+ * @return Index[]
+ */
+ protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
+ {
+ $result = [];
+ foreach ($tableIndexRows as $tableIndex) {
+ $indexName = $keyName = $tableIndex['key_name'];
+ if ($tableIndex['primary']) {
+ $keyName = 'primary';
+ }
+ $keyName = strtolower($keyName);
+
+ if (! isset($result[$keyName])) {
+ $options = [
+ 'lengths' => [],
+ ];
+
+ if (isset($tableIndex['where'])) {
+ $options['where'] = $tableIndex['where'];
+ }
+
+ $result[$keyName] = [
+ 'name' => $indexName,
+ 'columns' => [],
+ 'unique' => $tableIndex['non_unique'] ? false : true,
+ 'primary' => $tableIndex['primary'],
+ 'flags' => $tableIndex['flags'] ?? [],
+ 'options' => $options,
+ ];
+ }
+
+ $result[$keyName]['columns'][] = $tableIndex['column_name'];
+ $result[$keyName]['options']['lengths'][] = $tableIndex['length'] ?? null;
+ }
+
+ $eventManager = $this->_platform->getEventManager();
+
+ $indexes = [];
+ foreach ($result as $indexKey => $data) {
+ $index = null;
+ $defaultPrevented = false;
+
+ if ($eventManager !== null && $eventManager->hasListeners(Events::onSchemaIndexDefinition)) {
+ $eventArgs = new SchemaIndexDefinitionEventArgs($data, $tableName, $this->_conn);
+ $eventManager->dispatchEvent(Events::onSchemaIndexDefinition, $eventArgs);
+
+ $defaultPrevented = $eventArgs->isDefaultPrevented();
+ $index = $eventArgs->getIndex();
+ }
+
+ if (! $defaultPrevented) {
+ $index = new Index($data['name'], $data['columns'], $data['unique'], $data['primary'], $data['flags'], $data['options']);
+ }
+
+ if (! $index) {
+ continue;
+ }
+
+ $indexes[$indexKey] = $index;
+ }
+
+ return $indexes;
+ }
+
+ /**
+ * @param mixed[][] $tables
+ *
+ * @return string[]
+ */
+ protected function _getPortableTablesList($tables)
+ {
+ $list = [];
+ foreach ($tables as $value) {
+ $value = $this->_getPortableTableDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed $table
+ *
+ * @return string
+ */
+ protected function _getPortableTableDefinition($table)
+ {
+ return $table;
+ }
+
+ /**
+ * @param mixed[][] $users
+ *
+ * @return string[][]
+ */
+ protected function _getPortableUsersList($users)
+ {
+ $list = [];
+ foreach ($users as $value) {
+ $value = $this->_getPortableUserDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed[] $user
+ *
+ * @return mixed[]
+ */
+ protected function _getPortableUserDefinition($user)
+ {
+ return $user;
+ }
+
+ /**
+ * @param mixed[][] $views
+ *
+ * @return View[]
+ */
+ protected function _getPortableViewsList($views)
+ {
+ $list = [];
+ foreach ($views as $value) {
+ $view = $this->_getPortableViewDefinition($value);
+
+ if (! $view) {
+ continue;
+ }
+
+ $viewName = strtolower($view->getQuotedName($this->_platform));
+ $list[$viewName] = $view;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed[] $view
+ *
+ * @return View|false
+ */
+ protected function _getPortableViewDefinition($view)
+ {
+ return false;
+ }
+
+ /**
+ * @param mixed[][] $tableForeignKeys
+ *
+ * @return ForeignKeyConstraint[]
+ */
+ protected function _getPortableTableForeignKeysList($tableForeignKeys)
+ {
+ $list = [];
+ foreach ($tableForeignKeys as $value) {
+ $value = $this->_getPortableTableForeignKeyDefinition($value);
+
+ if (! $value) {
+ continue;
+ }
+
+ $list[] = $value;
+ }
+
+ return $list;
+ }
+
+ /**
+ * @param mixed $tableForeignKey
+ *
+ * @return ForeignKeyConstraint
+ */
+ protected function _getPortableTableForeignKeyDefinition($tableForeignKey)
+ {
+ return $tableForeignKey;
+ }
+
+ /**
+ * @param string[]|string $sql
+ *
+ * @return void
+ */
+ protected function _execSql($sql)
+ {
+ foreach ((array) $sql as $query) {
+ $this->_conn->executeUpdate($query);
+ }
+ }
+
+ /**
+ * Creates a schema instance for the current database.
+ *
+ * @return Schema
+ */
+ public function createSchema()
+ {
+ $namespaces = [];
+
+ if ($this->_platform->supportsSchemas()) {
+ $namespaces = $this->listNamespaceNames();
+ }
+
+ $sequences = [];
+
+ if ($this->_platform->supportsSequences()) {
+ $sequences = $this->listSequences();
+ }
+
+ $tables = $this->listTables();
+
+ return new Schema($tables, $sequences, $this->createSchemaConfig(), $namespaces);
+ }
+
+ /**
+ * Creates the configuration for this schema.
+ *
+ * @return SchemaConfig
+ */
+ public function createSchemaConfig()
+ {
+ $schemaConfig = new SchemaConfig();
+ $schemaConfig->setMaxIdentifierLength($this->_platform->getMaxIdentifierLength());
+
+ $searchPaths = $this->getSchemaSearchPaths();
+ if (isset($searchPaths[0])) {
+ $schemaConfig->setName($searchPaths[0]);
+ }
+
+ $params = $this->_conn->getParams();
+ if (! isset($params['defaultTableOptions'])) {
+ $params['defaultTableOptions'] = [];
+ }
+ if (! isset($params['defaultTableOptions']['charset']) && isset($params['charset'])) {
+ $params['defaultTableOptions']['charset'] = $params['charset'];
+ }
+ $schemaConfig->setDefaultTableOptions($params['defaultTableOptions']);
+
+ return $schemaConfig;
+ }
+
+ /**
+ * The search path for namespaces in the currently connected database.
+ *
+ * The first entry is usually the default namespace in the Schema. All
+ * further namespaces contain tables/sequences which can also be addressed
+ * with a short, not full-qualified name.
+ *
+ * For databases that don't support subschema/namespaces this method
+ * returns the name of the currently connected database.
+ *
+ * @return string[]
+ */
+ public function getSchemaSearchPaths()
+ {
+ return [$this->_conn->getDatabase()];
+ }
+
+ /**
+ * Given a table comment this method tries to extract a typehint for Doctrine Type, or returns
+ * the type given as default.
+ *
+ * @param string $comment
+ * @param string $currentType
+ *
+ * @return string
+ */
+ public function extractDoctrineTypeFromComment($comment, $currentType)
+ {
+ if (preg_match('(\(DC2Type:(((?!\)).)+)\))', $comment, $match)) {
+ $currentType = $match[1];
+ }
+
+ return $currentType;
+ }
+
+ /**
+ * @param string $comment
+ * @param string $type
+ *
+ * @return string
+ */
+ public function removeDoctrineTypeFromComment($comment, $type)
+ {
+ return str_replace('(DC2Type:' . $type . ')', '', $comment);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php
new file mode 100644
index 000000000..aef471e06
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Column.php
@@ -0,0 +1,451 @@
+_setName($columnName);
+ $this->setType($type);
+ $this->setOptions($options);
+ }
+
+ /**
+ * @param mixed[] $options
+ *
+ * @return Column
+ */
+ public function setOptions(array $options)
+ {
+ foreach ($options as $name => $value) {
+ $method = 'set' . $name;
+ if (! method_exists($this, $method)) {
+ // next major: throw an exception
+ @trigger_error(sprintf(
+ 'The "%s" column option is not supported,' .
+ ' setting it is deprecated and will cause an error in Doctrine 3.0',
+ $name
+ ), E_USER_DEPRECATED);
+
+ continue;
+ }
+ $this->$method($value);
+ }
+
+ return $this;
+ }
+
+ /**
+ * @return Column
+ */
+ public function setType(Type $type)
+ {
+ $this->_type = $type;
+
+ return $this;
+ }
+
+ /**
+ * @param int|null $length
+ *
+ * @return Column
+ */
+ public function setLength($length)
+ {
+ if ($length !== null) {
+ $this->_length = (int) $length;
+ } else {
+ $this->_length = null;
+ }
+
+ return $this;
+ }
+
+ /**
+ * @param int $precision
+ *
+ * @return Column
+ */
+ public function setPrecision($precision)
+ {
+ if (! is_numeric($precision)) {
+ $precision = 10; // defaults to 10 when no valid precision is given.
+ }
+
+ $this->_precision = (int) $precision;
+
+ return $this;
+ }
+
+ /**
+ * @param int $scale
+ *
+ * @return Column
+ */
+ public function setScale($scale)
+ {
+ if (! is_numeric($scale)) {
+ $scale = 0;
+ }
+
+ $this->_scale = (int) $scale;
+
+ return $this;
+ }
+
+ /**
+ * @param bool $unsigned
+ *
+ * @return Column
+ */
+ public function setUnsigned($unsigned)
+ {
+ $this->_unsigned = (bool) $unsigned;
+
+ return $this;
+ }
+
+ /**
+ * @param bool $fixed
+ *
+ * @return Column
+ */
+ public function setFixed($fixed)
+ {
+ $this->_fixed = (bool) $fixed;
+
+ return $this;
+ }
+
+ /**
+ * @param bool $notnull
+ *
+ * @return Column
+ */
+ public function setNotnull($notnull)
+ {
+ $this->_notnull = (bool) $notnull;
+
+ return $this;
+ }
+
+ /**
+ * @param mixed $default
+ *
+ * @return Column
+ */
+ public function setDefault($default)
+ {
+ $this->_default = $default;
+
+ return $this;
+ }
+
+ /**
+ * @param mixed[] $platformOptions
+ *
+ * @return Column
+ */
+ public function setPlatformOptions(array $platformOptions)
+ {
+ $this->_platformOptions = $platformOptions;
+
+ return $this;
+ }
+
+ /**
+ * @param string $name
+ * @param mixed $value
+ *
+ * @return Column
+ */
+ public function setPlatformOption($name, $value)
+ {
+ $this->_platformOptions[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * @param string $value
+ *
+ * @return Column
+ */
+ public function setColumnDefinition($value)
+ {
+ $this->_columnDefinition = $value;
+
+ return $this;
+ }
+
+ /**
+ * @return Type
+ */
+ public function getType()
+ {
+ return $this->_type;
+ }
+
+ /**
+ * @return int|null
+ */
+ public function getLength()
+ {
+ return $this->_length;
+ }
+
+ /**
+ * @return int
+ */
+ public function getPrecision()
+ {
+ return $this->_precision;
+ }
+
+ /**
+ * @return int
+ */
+ public function getScale()
+ {
+ return $this->_scale;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getUnsigned()
+ {
+ return $this->_unsigned;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getFixed()
+ {
+ return $this->_fixed;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getNotnull()
+ {
+ return $this->_notnull;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getDefault()
+ {
+ return $this->_default;
+ }
+
+ /**
+ * @return mixed[]
+ */
+ public function getPlatformOptions()
+ {
+ return $this->_platformOptions;
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return bool
+ */
+ public function hasPlatformOption($name)
+ {
+ return isset($this->_platformOptions[$name]);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return mixed
+ */
+ public function getPlatformOption($name)
+ {
+ return $this->_platformOptions[$name];
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getColumnDefinition()
+ {
+ return $this->_columnDefinition;
+ }
+
+ /**
+ * @return bool
+ */
+ public function getAutoincrement()
+ {
+ return $this->_autoincrement;
+ }
+
+ /**
+ * @param bool $flag
+ *
+ * @return Column
+ */
+ public function setAutoincrement($flag)
+ {
+ $this->_autoincrement = $flag;
+
+ return $this;
+ }
+
+ /**
+ * @param string $comment
+ *
+ * @return Column
+ */
+ public function setComment($comment)
+ {
+ $this->_comment = $comment;
+
+ return $this;
+ }
+
+ /**
+ * @return string|null
+ */
+ public function getComment()
+ {
+ return $this->_comment;
+ }
+
+ /**
+ * @param string $name
+ * @param mixed $value
+ *
+ * @return Column
+ */
+ public function setCustomSchemaOption($name, $value)
+ {
+ $this->_customSchemaOptions[$name] = $value;
+
+ return $this;
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return bool
+ */
+ public function hasCustomSchemaOption($name)
+ {
+ return isset($this->_customSchemaOptions[$name]);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return mixed
+ */
+ public function getCustomSchemaOption($name)
+ {
+ return $this->_customSchemaOptions[$name];
+ }
+
+ /**
+ * @param mixed[] $customSchemaOptions
+ *
+ * @return Column
+ */
+ public function setCustomSchemaOptions(array $customSchemaOptions)
+ {
+ $this->_customSchemaOptions = $customSchemaOptions;
+
+ return $this;
+ }
+
+ /**
+ * @return mixed[]
+ */
+ public function getCustomSchemaOptions()
+ {
+ return $this->_customSchemaOptions;
+ }
+
+ /**
+ * @return mixed[]
+ */
+ public function toArray()
+ {
+ return array_merge([
+ 'name' => $this->_name,
+ 'type' => $this->_type,
+ 'default' => $this->_default,
+ 'notnull' => $this->_notnull,
+ 'length' => $this->_length,
+ 'precision' => $this->_precision,
+ 'scale' => $this->_scale,
+ 'fixed' => $this->_fixed,
+ 'unsigned' => $this->_unsigned,
+ 'autoincrement' => $this->_autoincrement,
+ 'columnDefinition' => $this->_columnDefinition,
+ 'comment' => $this->_comment,
+ ], $this->_platformOptions, $this->_customSchemaOptions);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php
new file mode 100644
index 000000000..cb6459210
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ColumnDiff.php
@@ -0,0 +1,55 @@
+oldColumnName = $oldColumnName;
+ $this->column = $column;
+ $this->changedProperties = $changedProperties;
+ $this->fromColumn = $fromColumn;
+ }
+
+ /**
+ * @param string $propertyName
+ *
+ * @return bool
+ */
+ public function hasChanged($propertyName)
+ {
+ return in_array($propertyName, $this->changedProperties);
+ }
+
+ /**
+ * @return Identifier
+ */
+ public function getOldColumnName()
+ {
+ $quote = $this->fromColumn && $this->fromColumn->isQuoted();
+
+ return new Identifier($this->oldColumnName, $quote);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php
new file mode 100644
index 000000000..1d8a7275d
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Comparator.php
@@ -0,0 +1,524 @@
+compare($fromSchema, $toSchema);
+ }
+
+ /**
+ * Returns a SchemaDiff object containing the differences between the schemas $fromSchema and $toSchema.
+ *
+ * The returned differences are returned in such a way that they contain the
+ * operations to change the schema stored in $fromSchema to the schema that is
+ * stored in $toSchema.
+ *
+ * @return SchemaDiff
+ */
+ public function compare(Schema $fromSchema, Schema $toSchema)
+ {
+ $diff = new SchemaDiff();
+ $diff->fromSchema = $fromSchema;
+
+ $foreignKeysToTable = [];
+
+ foreach ($toSchema->getNamespaces() as $namespace) {
+ if ($fromSchema->hasNamespace($namespace)) {
+ continue;
+ }
+
+ $diff->newNamespaces[$namespace] = $namespace;
+ }
+
+ foreach ($fromSchema->getNamespaces() as $namespace) {
+ if ($toSchema->hasNamespace($namespace)) {
+ continue;
+ }
+
+ $diff->removedNamespaces[$namespace] = $namespace;
+ }
+
+ foreach ($toSchema->getTables() as $table) {
+ $tableName = $table->getShortestName($toSchema->getName());
+ if (! $fromSchema->hasTable($tableName)) {
+ $diff->newTables[$tableName] = $toSchema->getTable($tableName);
+ } else {
+ $tableDifferences = $this->diffTable($fromSchema->getTable($tableName), $toSchema->getTable($tableName));
+ if ($tableDifferences !== false) {
+ $diff->changedTables[$tableName] = $tableDifferences;
+ }
+ }
+ }
+
+ /* Check if there are tables removed */
+ foreach ($fromSchema->getTables() as $table) {
+ $tableName = $table->getShortestName($fromSchema->getName());
+
+ $table = $fromSchema->getTable($tableName);
+ if (! $toSchema->hasTable($tableName)) {
+ $diff->removedTables[$tableName] = $table;
+ }
+
+ // also remember all foreign keys that point to a specific table
+ foreach ($table->getForeignKeys() as $foreignKey) {
+ $foreignTable = strtolower($foreignKey->getForeignTableName());
+ if (! isset($foreignKeysToTable[$foreignTable])) {
+ $foreignKeysToTable[$foreignTable] = [];
+ }
+ $foreignKeysToTable[$foreignTable][] = $foreignKey;
+ }
+ }
+
+ foreach ($diff->removedTables as $tableName => $table) {
+ if (! isset($foreignKeysToTable[$tableName])) {
+ continue;
+ }
+
+ $diff->orphanedForeignKeys = array_merge($diff->orphanedForeignKeys, $foreignKeysToTable[$tableName]);
+
+ // deleting duplicated foreign keys present on both on the orphanedForeignKey
+ // and the removedForeignKeys from changedTables
+ foreach ($foreignKeysToTable[$tableName] as $foreignKey) {
+ // strtolower the table name to make if compatible with getShortestName
+ $localTableName = strtolower($foreignKey->getLocalTableName());
+ if (! isset($diff->changedTables[$localTableName])) {
+ continue;
+ }
+
+ foreach ($diff->changedTables[$localTableName]->removedForeignKeys as $key => $removedForeignKey) {
+ // We check if the key is from the removed table if not we skip.
+ if ($tableName !== strtolower($removedForeignKey->getForeignTableName())) {
+ continue;
+ }
+ unset($diff->changedTables[$localTableName]->removedForeignKeys[$key]);
+ }
+ }
+ }
+
+ foreach ($toSchema->getSequences() as $sequence) {
+ $sequenceName = $sequence->getShortestName($toSchema->getName());
+ if (! $fromSchema->hasSequence($sequenceName)) {
+ if (! $this->isAutoIncrementSequenceInSchema($fromSchema, $sequence)) {
+ $diff->newSequences[] = $sequence;
+ }
+ } else {
+ if ($this->diffSequence($sequence, $fromSchema->getSequence($sequenceName))) {
+ $diff->changedSequences[] = $toSchema->getSequence($sequenceName);
+ }
+ }
+ }
+
+ foreach ($fromSchema->getSequences() as $sequence) {
+ if ($this->isAutoIncrementSequenceInSchema($toSchema, $sequence)) {
+ continue;
+ }
+
+ $sequenceName = $sequence->getShortestName($fromSchema->getName());
+
+ if ($toSchema->hasSequence($sequenceName)) {
+ continue;
+ }
+
+ $diff->removedSequences[] = $sequence;
+ }
+
+ return $diff;
+ }
+
+ /**
+ * @param Schema $schema
+ * @param Sequence $sequence
+ *
+ * @return bool
+ */
+ private function isAutoIncrementSequenceInSchema($schema, $sequence)
+ {
+ foreach ($schema->getTables() as $table) {
+ if ($sequence->isAutoIncrementsFor($table)) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * @return bool
+ */
+ public function diffSequence(Sequence $sequence1, Sequence $sequence2)
+ {
+ if ($sequence1->getAllocationSize() !== $sequence2->getAllocationSize()) {
+ return true;
+ }
+
+ return $sequence1->getInitialValue() !== $sequence2->getInitialValue();
+ }
+
+ /**
+ * Returns the difference between the tables $table1 and $table2.
+ *
+ * If there are no differences this method returns the boolean false.
+ *
+ * @return TableDiff|false
+ */
+ public function diffTable(Table $table1, Table $table2)
+ {
+ $changes = 0;
+ $tableDifferences = new TableDiff($table1->getName());
+ $tableDifferences->fromTable = $table1;
+
+ $table1Columns = $table1->getColumns();
+ $table2Columns = $table2->getColumns();
+
+ /* See if all the fields in table 1 exist in table 2 */
+ foreach ($table2Columns as $columnName => $column) {
+ if ($table1->hasColumn($columnName)) {
+ continue;
+ }
+
+ $tableDifferences->addedColumns[$columnName] = $column;
+ $changes++;
+ }
+ /* See if there are any removed fields in table 2 */
+ foreach ($table1Columns as $columnName => $column) {
+ // See if column is removed in table 2.
+ if (! $table2->hasColumn($columnName)) {
+ $tableDifferences->removedColumns[$columnName] = $column;
+ $changes++;
+ continue;
+ }
+
+ // See if column has changed properties in table 2.
+ $changedProperties = $this->diffColumn($column, $table2->getColumn($columnName));
+
+ if (empty($changedProperties)) {
+ continue;
+ }
+
+ $columnDiff = new ColumnDiff($column->getName(), $table2->getColumn($columnName), $changedProperties);
+ $columnDiff->fromColumn = $column;
+ $tableDifferences->changedColumns[$column->getName()] = $columnDiff;
+ $changes++;
+ }
+
+ $this->detectColumnRenamings($tableDifferences);
+
+ $table1Indexes = $table1->getIndexes();
+ $table2Indexes = $table2->getIndexes();
+
+ /* See if all the indexes in table 1 exist in table 2 */
+ foreach ($table2Indexes as $indexName => $index) {
+ if (($index->isPrimary() && $table1->hasPrimaryKey()) || $table1->hasIndex($indexName)) {
+ continue;
+ }
+
+ $tableDifferences->addedIndexes[$indexName] = $index;
+ $changes++;
+ }
+ /* See if there are any removed indexes in table 2 */
+ foreach ($table1Indexes as $indexName => $index) {
+ // See if index is removed in table 2.
+ if (($index->isPrimary() && ! $table2->hasPrimaryKey()) ||
+ ! $index->isPrimary() && ! $table2->hasIndex($indexName)
+ ) {
+ $tableDifferences->removedIndexes[$indexName] = $index;
+ $changes++;
+ continue;
+ }
+
+ // See if index has changed in table 2.
+ $table2Index = $index->isPrimary() ? $table2->getPrimaryKey() : $table2->getIndex($indexName);
+
+ if (! $this->diffIndex($index, $table2Index)) {
+ continue;
+ }
+
+ $tableDifferences->changedIndexes[$indexName] = $table2Index;
+ $changes++;
+ }
+
+ $this->detectIndexRenamings($tableDifferences);
+
+ $fromFkeys = $table1->getForeignKeys();
+ $toFkeys = $table2->getForeignKeys();
+
+ foreach ($fromFkeys as $key1 => $constraint1) {
+ foreach ($toFkeys as $key2 => $constraint2) {
+ if ($this->diffForeignKey($constraint1, $constraint2) === false) {
+ unset($fromFkeys[$key1], $toFkeys[$key2]);
+ } else {
+ if (strtolower($constraint1->getName()) === strtolower($constraint2->getName())) {
+ $tableDifferences->changedForeignKeys[] = $constraint2;
+ $changes++;
+ unset($fromFkeys[$key1], $toFkeys[$key2]);
+ }
+ }
+ }
+ }
+
+ foreach ($fromFkeys as $constraint1) {
+ $tableDifferences->removedForeignKeys[] = $constraint1;
+ $changes++;
+ }
+
+ foreach ($toFkeys as $constraint2) {
+ $tableDifferences->addedForeignKeys[] = $constraint2;
+ $changes++;
+ }
+
+ return $changes ? $tableDifferences : false;
+ }
+
+ /**
+ * Try to find columns that only changed their name, rename operations maybe cheaper than add/drop
+ * however ambiguities between different possibilities should not lead to renaming at all.
+ *
+ * @return void
+ */
+ private function detectColumnRenamings(TableDiff $tableDifferences)
+ {
+ $renameCandidates = [];
+ foreach ($tableDifferences->addedColumns as $addedColumnName => $addedColumn) {
+ foreach ($tableDifferences->removedColumns as $removedColumn) {
+ if (count($this->diffColumn($addedColumn, $removedColumn)) !== 0) {
+ continue;
+ }
+
+ $renameCandidates[$addedColumn->getName()][] = [$removedColumn, $addedColumn, $addedColumnName];
+ }
+ }
+
+ foreach ($renameCandidates as $candidateColumns) {
+ if (count($candidateColumns) !== 1) {
+ continue;
+ }
+
+ [$removedColumn, $addedColumn] = $candidateColumns[0];
+ $removedColumnName = strtolower($removedColumn->getName());
+ $addedColumnName = strtolower($addedColumn->getName());
+
+ if (isset($tableDifferences->renamedColumns[$removedColumnName])) {
+ continue;
+ }
+
+ $tableDifferences->renamedColumns[$removedColumnName] = $addedColumn;
+ unset(
+ $tableDifferences->addedColumns[$addedColumnName],
+ $tableDifferences->removedColumns[$removedColumnName]
+ );
+ }
+ }
+
+ /**
+ * Try to find indexes that only changed their name, rename operations maybe cheaper than add/drop
+ * however ambiguities between different possibilities should not lead to renaming at all.
+ *
+ * @return void
+ */
+ private function detectIndexRenamings(TableDiff $tableDifferences)
+ {
+ $renameCandidates = [];
+
+ // Gather possible rename candidates by comparing each added and removed index based on semantics.
+ foreach ($tableDifferences->addedIndexes as $addedIndexName => $addedIndex) {
+ foreach ($tableDifferences->removedIndexes as $removedIndex) {
+ if ($this->diffIndex($addedIndex, $removedIndex)) {
+ continue;
+ }
+
+ $renameCandidates[$addedIndex->getName()][] = [$removedIndex, $addedIndex, $addedIndexName];
+ }
+ }
+
+ foreach ($renameCandidates as $candidateIndexes) {
+ // If the current rename candidate contains exactly one semantically equal index,
+ // we can safely rename it.
+ // Otherwise it is unclear if a rename action is really intended,
+ // therefore we let those ambiguous indexes be added/dropped.
+ if (count($candidateIndexes) !== 1) {
+ continue;
+ }
+
+ [$removedIndex, $addedIndex] = $candidateIndexes[0];
+
+ $removedIndexName = strtolower($removedIndex->getName());
+ $addedIndexName = strtolower($addedIndex->getName());
+
+ if (isset($tableDifferences->renamedIndexes[$removedIndexName])) {
+ continue;
+ }
+
+ $tableDifferences->renamedIndexes[$removedIndexName] = $addedIndex;
+ unset(
+ $tableDifferences->addedIndexes[$addedIndexName],
+ $tableDifferences->removedIndexes[$removedIndexName]
+ );
+ }
+ }
+
+ /**
+ * @return bool
+ */
+ public function diffForeignKey(ForeignKeyConstraint $key1, ForeignKeyConstraint $key2)
+ {
+ if (array_map('strtolower', $key1->getUnquotedLocalColumns()) !== array_map('strtolower', $key2->getUnquotedLocalColumns())) {
+ return true;
+ }
+
+ if (array_map('strtolower', $key1->getUnquotedForeignColumns()) !== array_map('strtolower', $key2->getUnquotedForeignColumns())) {
+ return true;
+ }
+
+ if ($key1->getUnqualifiedForeignTableName() !== $key2->getUnqualifiedForeignTableName()) {
+ return true;
+ }
+
+ if ($key1->onUpdate() !== $key2->onUpdate()) {
+ return true;
+ }
+
+ return $key1->onDelete() !== $key2->onDelete();
+ }
+
+ /**
+ * Returns the difference between the fields $field1 and $field2.
+ *
+ * If there are differences this method returns $field2, otherwise the
+ * boolean false.
+ *
+ * @return string[]
+ */
+ public function diffColumn(Column $column1, Column $column2)
+ {
+ $properties1 = $column1->toArray();
+ $properties2 = $column2->toArray();
+
+ $changedProperties = [];
+
+ foreach (['type', 'notnull', 'unsigned', 'autoincrement'] as $property) {
+ if ($properties1[$property] === $properties2[$property]) {
+ continue;
+ }
+
+ $changedProperties[] = $property;
+ }
+
+ // This is a very nasty hack to make comparator work with the legacy json_array type, which should be killed in v3
+ if ($this->isALegacyJsonComparison($properties1['type'], $properties2['type'])) {
+ array_shift($changedProperties);
+
+ $changedProperties[] = 'comment';
+ }
+
+ // Null values need to be checked additionally as they tell whether to create or drop a default value.
+ // null != 0, null != false, null != '' etc. This affects platform's table alteration SQL generation.
+ if (($properties1['default'] === null) !== ($properties2['default'] === null)
+ || $properties1['default'] != $properties2['default']) {
+ $changedProperties[] = 'default';
+ }
+
+ if (($properties1['type'] instanceof Types\StringType && ! $properties1['type'] instanceof Types\GuidType) ||
+ $properties1['type'] instanceof Types\BinaryType
+ ) {
+ // check if value of length is set at all, default value assumed otherwise.
+ $length1 = $properties1['length'] ?: 255;
+ $length2 = $properties2['length'] ?: 255;
+ if ($length1 !== $length2) {
+ $changedProperties[] = 'length';
+ }
+
+ if ($properties1['fixed'] !== $properties2['fixed']) {
+ $changedProperties[] = 'fixed';
+ }
+ } elseif ($properties1['type'] instanceof Types\DecimalType) {
+ if (($properties1['precision'] ?: 10) !== ($properties2['precision'] ?: 10)) {
+ $changedProperties[] = 'precision';
+ }
+ if ($properties1['scale'] !== $properties2['scale']) {
+ $changedProperties[] = 'scale';
+ }
+ }
+
+ // A null value and an empty string are actually equal for a comment so they should not trigger a change.
+ if ($properties1['comment'] !== $properties2['comment'] &&
+ ! ($properties1['comment'] === null && $properties2['comment'] === '') &&
+ ! ($properties2['comment'] === null && $properties1['comment'] === '')
+ ) {
+ $changedProperties[] = 'comment';
+ }
+
+ $customOptions1 = $column1->getCustomSchemaOptions();
+ $customOptions2 = $column2->getCustomSchemaOptions();
+
+ foreach (array_merge(array_keys($customOptions1), array_keys($customOptions2)) as $key) {
+ if (! array_key_exists($key, $properties1) || ! array_key_exists($key, $properties2)) {
+ $changedProperties[] = $key;
+ } elseif ($properties1[$key] !== $properties2[$key]) {
+ $changedProperties[] = $key;
+ }
+ }
+
+ $platformOptions1 = $column1->getPlatformOptions();
+ $platformOptions2 = $column2->getPlatformOptions();
+
+ foreach (array_keys(array_intersect_key($platformOptions1, $platformOptions2)) as $key) {
+ if ($properties1[$key] === $properties2[$key]) {
+ continue;
+ }
+
+ $changedProperties[] = $key;
+ }
+
+ return array_unique($changedProperties);
+ }
+
+ /**
+ * TODO: kill with fire on v3.0
+ *
+ * @deprecated
+ */
+ private function isALegacyJsonComparison(Types\Type $one, Types\Type $other) : bool
+ {
+ if (! $one instanceof Types\JsonType || ! $other instanceof Types\JsonType) {
+ return false;
+ }
+
+ return ( ! $one instanceof Types\JsonArrayType && $other instanceof Types\JsonArrayType)
+ || ( ! $other instanceof Types\JsonArrayType && $one instanceof Types\JsonArrayType);
+ }
+
+ /**
+ * Finds the difference between the indexes $index1 and $index2.
+ *
+ * Compares $index1 with $index2 and returns $index2 if there are any
+ * differences or false in case there are no differences.
+ *
+ * @return bool
+ */
+ public function diffIndex(Index $index1, Index $index2)
+ {
+ return ! ($index1->isFullfilledBy($index2) && $index2->isFullfilledBy($index1));
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php
new file mode 100644
index 000000000..65e239ec1
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Constraint.php
@@ -0,0 +1,43 @@
+_platform->getListTablesSQL();
+ $sql .= ' AND CREATOR = UPPER(' . $this->_conn->quote($this->_conn->getUsername()) . ')';
+
+ $tables = $this->_conn->fetchAll($sql);
+
+ return $this->filterAssetNames($this->_getPortableTablesList($tables));
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableColumnDefinition($tableColumn)
+ {
+ $tableColumn = array_change_key_case($tableColumn, CASE_LOWER);
+
+ $length = null;
+ $fixed = null;
+ $unsigned = false;
+ $scale = false;
+ $precision = false;
+
+ $default = null;
+
+ if ($tableColumn['default'] !== null && $tableColumn['default'] !== 'NULL') {
+ $default = trim($tableColumn['default'], "'");
+ }
+
+ $type = $this->_platform->getDoctrineTypeMapping($tableColumn['typename']);
+
+ if (isset($tableColumn['comment'])) {
+ $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type);
+ $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type);
+ }
+
+ switch (strtolower($tableColumn['typename'])) {
+ case 'varchar':
+ $length = $tableColumn['length'];
+ $fixed = false;
+ break;
+ case 'character':
+ $length = $tableColumn['length'];
+ $fixed = true;
+ break;
+ case 'clob':
+ $length = $tableColumn['length'];
+ break;
+ case 'decimal':
+ case 'double':
+ case 'real':
+ $scale = $tableColumn['scale'];
+ $precision = $tableColumn['length'];
+ break;
+ }
+
+ $options = [
+ 'length' => $length,
+ 'unsigned' => (bool) $unsigned,
+ 'fixed' => (bool) $fixed,
+ 'default' => $default,
+ 'autoincrement' => (bool) $tableColumn['autoincrement'],
+ 'notnull' => (bool) ($tableColumn['nulls'] === 'N'),
+ 'scale' => null,
+ 'precision' => null,
+ 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== ''
+ ? $tableColumn['comment']
+ : null,
+ 'platformOptions' => [],
+ ];
+
+ if ($scale !== null && $precision !== null) {
+ $options['scale'] = $scale;
+ $options['precision'] = $precision;
+ }
+
+ return new Column($tableColumn['colname'], Type::getType($type), $options);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTablesList($tables)
+ {
+ $tableNames = [];
+ foreach ($tables as $tableRow) {
+ $tableRow = array_change_key_case($tableRow, CASE_LOWER);
+ $tableNames[] = $tableRow['name'];
+ }
+
+ return $tableNames;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableIndexesList($tableIndexRows, $tableName = null)
+ {
+ foreach ($tableIndexRows as &$tableIndexRow) {
+ $tableIndexRow = array_change_key_case($tableIndexRow, CASE_LOWER);
+ $tableIndexRow['primary'] = (bool) $tableIndexRow['primary'];
+ }
+
+ return parent::_getPortableTableIndexesList($tableIndexRows, $tableName);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableForeignKeyDefinition($tableForeignKey)
+ {
+ return new ForeignKeyConstraint(
+ $tableForeignKey['local_columns'],
+ $tableForeignKey['foreign_table'],
+ $tableForeignKey['foreign_columns'],
+ $tableForeignKey['name'],
+ $tableForeignKey['options']
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableForeignKeysList($tableForeignKeys)
+ {
+ $foreignKeys = [];
+
+ foreach ($tableForeignKeys as $tableForeignKey) {
+ $tableForeignKey = array_change_key_case($tableForeignKey, CASE_LOWER);
+
+ if (! isset($foreignKeys[$tableForeignKey['index_name']])) {
+ $foreignKeys[$tableForeignKey['index_name']] = [
+ 'local_columns' => [$tableForeignKey['local_column']],
+ 'foreign_table' => $tableForeignKey['foreign_table'],
+ 'foreign_columns' => [$tableForeignKey['foreign_column']],
+ 'name' => $tableForeignKey['index_name'],
+ 'options' => [
+ 'onUpdate' => $tableForeignKey['on_update'],
+ 'onDelete' => $tableForeignKey['on_delete'],
+ ],
+ ];
+ } else {
+ $foreignKeys[$tableForeignKey['index_name']]['local_columns'][] = $tableForeignKey['local_column'];
+ $foreignKeys[$tableForeignKey['index_name']]['foreign_columns'][] = $tableForeignKey['foreign_column'];
+ }
+ }
+
+ return parent::_getPortableTableForeignKeysList($foreignKeys);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableForeignKeyRuleDef($def)
+ {
+ if ($def === 'C') {
+ return 'CASCADE';
+ } elseif ($def === 'N') {
+ return 'SET NULL';
+ }
+
+ return null;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableViewDefinition($view)
+ {
+ $view = array_change_key_case($view, CASE_LOWER);
+ // sadly this still segfaults on PDO_IBM, see http://pecl.php.net/bugs/bug.php?id=17199
+ //$view['text'] = (is_resource($view['text']) ? stream_get_contents($view['text']) : $view['text']);
+ if (! is_resource($view['text'])) {
+ $pos = strpos($view['text'], ' AS ');
+ $sql = substr($view['text'], $pos+4);
+ } else {
+ $sql = '';
+ }
+
+ return new View($view['name'], $sql);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
new file mode 100644
index 000000000..c334db279
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/DrizzleSchemaManager.php
@@ -0,0 +1,103 @@
+_platform->getDoctrineTypeMapping($dbType);
+ $type = $this->extractDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
+ $tableColumn['COLUMN_COMMENT'] = $this->removeDoctrineTypeFromComment($tableColumn['COLUMN_COMMENT'], $type);
+
+ $options = [
+ 'notnull' => ! (bool) $tableColumn['IS_NULLABLE'],
+ 'length' => (int) $tableColumn['CHARACTER_MAXIMUM_LENGTH'],
+ 'default' => $tableColumn['COLUMN_DEFAULT'] ?? null,
+ 'autoincrement' => (bool) $tableColumn['IS_AUTO_INCREMENT'],
+ 'scale' => (int) $tableColumn['NUMERIC_SCALE'],
+ 'precision' => (int) $tableColumn['NUMERIC_PRECISION'],
+ 'comment' => isset($tableColumn['COLUMN_COMMENT']) && $tableColumn['COLUMN_COMMENT'] !== ''
+ ? $tableColumn['COLUMN_COMMENT']
+ : null,
+ ];
+
+ $column = new Column($tableColumn['COLUMN_NAME'], Type::getType($type), $options);
+
+ if (! empty($tableColumn['COLLATION_NAME'])) {
+ $column->setPlatformOption('collation', $tableColumn['COLLATION_NAME']);
+ }
+
+ return $column;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableDatabaseDefinition($database)
+ {
+ return $database['SCHEMA_NAME'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableDefinition($table)
+ {
+ return $table['TABLE_NAME'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function _getPortableTableForeignKeyDefinition($tableForeignKey)
+ {
+ $columns = [];
+ foreach (explode(',', $tableForeignKey['CONSTRAINT_COLUMNS']) as $value) {
+ $columns[] = trim($value, ' `');
+ }
+
+ $refColumns = [];
+ foreach (explode(',', $tableForeignKey['REFERENCED_TABLE_COLUMNS']) as $value) {
+ $refColumns[] = trim($value, ' `');
+ }
+
+ return new ForeignKeyConstraint(
+ $columns,
+ $tableForeignKey['REFERENCED_TABLE_NAME'],
+ $refColumns,
+ $tableForeignKey['CONSTRAINT_NAME'],
+ [
+ 'onUpdate' => $tableForeignKey['UPDATE_RULE'],
+ 'onDelete' => $tableForeignKey['DELETE_RULE'],
+ ]
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
+ {
+ $indexes = [];
+ foreach ($tableIndexes as $k) {
+ $k['primary'] = (bool) $k['primary'];
+ $indexes[] = $k;
+ }
+
+ return parent::_getPortableTableIndexesList($indexes, $tableName);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
new file mode 100644
index 000000000..31850d7f2
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/ForeignKeyConstraint.php
@@ -0,0 +1,377 @@
+ Identifier)
+ *
+ * @var Identifier[]
+ */
+ protected $_localColumnNames;
+
+ /**
+ * Table or asset identifier instance of the referenced table name the foreign key constraint is associated with.
+ *
+ * @var Table|Identifier
+ */
+ protected $_foreignTableName;
+
+ /**
+ * Asset identifier instances of the referenced table column names the foreign key constraint is associated with.
+ * array($columnName => Identifier)
+ *
+ * @var Identifier[]
+ */
+ protected $_foreignColumnNames;
+
+ /**
+ * Options associated with the foreign key constraint.
+ *
+ * @var mixed[]
+ */
+ protected $_options;
+
+ /**
+ * Initializes the foreign key constraint.
+ *
+ * @param string[] $localColumnNames Names of the referencing table columns.
+ * @param Table|string $foreignTableName Referenced table.
+ * @param string[] $foreignColumnNames Names of the referenced table columns.
+ * @param string|null $name Name of the foreign key constraint.
+ * @param mixed[] $options Options associated with the foreign key constraint.
+ */
+ public function __construct(array $localColumnNames, $foreignTableName, array $foreignColumnNames, $name = null, array $options = [])
+ {
+ $this->_setName($name);
+ $identifierConstructorCallback = static function ($column) {
+ return new Identifier($column);
+ };
+ $this->_localColumnNames = $localColumnNames
+ ? array_combine($localColumnNames, array_map($identifierConstructorCallback, $localColumnNames))
+ : [];
+
+ if ($foreignTableName instanceof Table) {
+ $this->_foreignTableName = $foreignTableName;
+ } else {
+ $this->_foreignTableName = new Identifier($foreignTableName);
+ }
+
+ $this->_foreignColumnNames = $foreignColumnNames
+ ? array_combine($foreignColumnNames, array_map($identifierConstructorCallback, $foreignColumnNames))
+ : [];
+ $this->_options = $options;
+ }
+
+ /**
+ * Returns the name of the referencing table
+ * the foreign key constraint is associated with.
+ *
+ * @return string
+ */
+ public function getLocalTableName()
+ {
+ return $this->_localTable->getName();
+ }
+
+ /**
+ * Sets the Table instance of the referencing table
+ * the foreign key constraint is associated with.
+ *
+ * @param Table $table Instance of the referencing table.
+ *
+ * @return void
+ */
+ public function setLocalTable(Table $table)
+ {
+ $this->_localTable = $table;
+ }
+
+ /**
+ * @return Table
+ */
+ public function getLocalTable()
+ {
+ return $this->_localTable;
+ }
+
+ /**
+ * Returns the names of the referencing table columns
+ * the foreign key constraint is associated with.
+ *
+ * @return string[]
+ */
+ public function getLocalColumns()
+ {
+ return array_keys($this->_localColumnNames);
+ }
+
+ /**
+ * Returns the quoted representation of the referencing table column names
+ * the foreign key constraint is associated with.
+ *
+ * But only if they were defined with one or the referencing table column name
+ * is a keyword reserved by the platform.
+ * Otherwise the plain unquoted value as inserted is returned.
+ *
+ * @param AbstractPlatform $platform The platform to use for quotation.
+ *
+ * @return string[]
+ */
+ public function getQuotedLocalColumns(AbstractPlatform $platform)
+ {
+ $columns = [];
+
+ foreach ($this->_localColumnNames as $column) {
+ $columns[] = $column->getQuotedName($platform);
+ }
+
+ return $columns;
+ }
+
+ /**
+ * Returns unquoted representation of local table column names for comparison with other FK
+ *
+ * @return string[]
+ */
+ public function getUnquotedLocalColumns()
+ {
+ return array_map([$this, 'trimQuotes'], $this->getLocalColumns());
+ }
+
+ /**
+ * Returns unquoted representation of foreign table column names for comparison with other FK
+ *
+ * @return string[]
+ */
+ public function getUnquotedForeignColumns()
+ {
+ return array_map([$this, 'trimQuotes'], $this->getForeignColumns());
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @see getLocalColumns
+ */
+ public function getColumns()
+ {
+ return $this->getLocalColumns();
+ }
+
+ /**
+ * Returns the quoted representation of the referencing table column names
+ * the foreign key constraint is associated with.
+ *
+ * But only if they were defined with one or the referencing table column name
+ * is a keyword reserved by the platform.
+ * Otherwise the plain unquoted value as inserted is returned.
+ *
+ * @see getQuotedLocalColumns
+ *
+ * @param AbstractPlatform $platform The platform to use for quotation.
+ *
+ * @return string[]
+ */
+ public function getQuotedColumns(AbstractPlatform $platform)
+ {
+ return $this->getQuotedLocalColumns($platform);
+ }
+
+ /**
+ * Returns the name of the referenced table
+ * the foreign key constraint is associated with.
+ *
+ * @return string
+ */
+ public function getForeignTableName()
+ {
+ return $this->_foreignTableName->getName();
+ }
+
+ /**
+ * Returns the non-schema qualified foreign table name.
+ *
+ * @return string
+ */
+ public function getUnqualifiedForeignTableName()
+ {
+ $parts = explode('.', $this->_foreignTableName->getName());
+
+ return strtolower(end($parts));
+ }
+
+ /**
+ * Returns the quoted representation of the referenced table name
+ * the foreign key constraint is associated with.
+ *
+ * But only if it was defined with one or the referenced table name
+ * is a keyword reserved by the platform.
+ * Otherwise the plain unquoted value as inserted is returned.
+ *
+ * @param AbstractPlatform $platform The platform to use for quotation.
+ *
+ * @return string
+ */
+ public function getQuotedForeignTableName(AbstractPlatform $platform)
+ {
+ return $this->_foreignTableName->getQuotedName($platform);
+ }
+
+ /**
+ * Returns the names of the referenced table columns
+ * the foreign key constraint is associated with.
+ *
+ * @return string[]
+ */
+ public function getForeignColumns()
+ {
+ return array_keys($this->_foreignColumnNames);
+ }
+
+ /**
+ * Returns the quoted representation of the referenced table column names
+ * the foreign key constraint is associated with.
+ *
+ * But only if they were defined with one or the referenced table column name
+ * is a keyword reserved by the platform.
+ * Otherwise the plain unquoted value as inserted is returned.
+ *
+ * @param AbstractPlatform $platform The platform to use for quotation.
+ *
+ * @return string[]
+ */
+ public function getQuotedForeignColumns(AbstractPlatform $platform)
+ {
+ $columns = [];
+
+ foreach ($this->_foreignColumnNames as $column) {
+ $columns[] = $column->getQuotedName($platform);
+ }
+
+ return $columns;
+ }
+
+ /**
+ * Returns whether or not a given option
+ * is associated with the foreign key constraint.
+ *
+ * @param string $name Name of the option to check.
+ *
+ * @return bool
+ */
+ public function hasOption($name)
+ {
+ return isset($this->_options[$name]);
+ }
+
+ /**
+ * Returns an option associated with the foreign key constraint.
+ *
+ * @param string $name Name of the option the foreign key constraint is associated with.
+ *
+ * @return mixed
+ */
+ public function getOption($name)
+ {
+ return $this->_options[$name];
+ }
+
+ /**
+ * Returns the options associated with the foreign key constraint.
+ *
+ * @return mixed[]
+ */
+ public function getOptions()
+ {
+ return $this->_options;
+ }
+
+ /**
+ * Returns the referential action for UPDATE operations
+ * on the referenced table the foreign key constraint is associated with.
+ *
+ * @return string|null
+ */
+ public function onUpdate()
+ {
+ return $this->onEvent('onUpdate');
+ }
+
+ /**
+ * Returns the referential action for DELETE operations
+ * on the referenced table the foreign key constraint is associated with.
+ *
+ * @return string|null
+ */
+ public function onDelete()
+ {
+ return $this->onEvent('onDelete');
+ }
+
+ /**
+ * Returns the referential action for a given database operation
+ * on the referenced table the foreign key constraint is associated with.
+ *
+ * @param string $event Name of the database operation/event to return the referential action for.
+ *
+ * @return string|null
+ */
+ private function onEvent($event)
+ {
+ if (isset($this->_options[$event])) {
+ $onEvent = strtoupper($this->_options[$event]);
+
+ if (! in_array($onEvent, ['NO ACTION', 'RESTRICT'])) {
+ return $onEvent;
+ }
+ }
+
+ return false;
+ }
+
+ /**
+ * Checks whether this foreign key constraint intersects the given index columns.
+ *
+ * Returns `true` if at least one of this foreign key's local columns
+ * matches one of the given index's columns, `false` otherwise.
+ *
+ * @param Index $index The index to be checked against.
+ *
+ * @return bool
+ */
+ public function intersectsIndexColumns(Index $index)
+ {
+ foreach ($index->getColumns() as $indexColumn) {
+ foreach ($this->_localColumnNames as $localColumn) {
+ if (strtolower($indexColumn) === strtolower($localColumn->getName())) {
+ return true;
+ }
+ }
+ }
+
+ return false;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php
new file mode 100644
index 000000000..f34465e9e
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Identifier.php
@@ -0,0 +1,27 @@
+_setName($identifier);
+
+ if (! $quote || $this->_quoted) {
+ return;
+ }
+
+ $this->_setName('"' . $this->getName() . '"');
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php
new file mode 100644
index 000000000..91ffd4724
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/Index.php
@@ -0,0 +1,357 @@
+ Identifier)
+ *
+ * @var Identifier[]
+ */
+ protected $_columns = [];
+
+ /** @var bool */
+ protected $_isUnique = false;
+
+ /** @var bool */
+ protected $_isPrimary = false;
+
+ /**
+ * Platform specific flags for indexes.
+ * array($flagName => true)
+ *
+ * @var true[]
+ */
+ protected $_flags = [];
+
+ /**
+ * Platform specific options
+ *
+ * @todo $_flags should eventually be refactored into options
+ * @var mixed[]
+ */
+ private $options = [];
+
+ /**
+ * @param string $indexName
+ * @param string[] $columns
+ * @param bool $isUnique
+ * @param bool $isPrimary
+ * @param string[] $flags
+ * @param mixed[] $options
+ */
+ public function __construct($indexName, array $columns, $isUnique = false, $isPrimary = false, array $flags = [], array $options = [])
+ {
+ $isUnique = $isUnique || $isPrimary;
+
+ $this->_setName($indexName);
+ $this->_isUnique = $isUnique;
+ $this->_isPrimary = $isPrimary;
+ $this->options = $options;
+
+ foreach ($columns as $column) {
+ $this->_addColumn($column);
+ }
+ foreach ($flags as $flag) {
+ $this->addFlag($flag);
+ }
+ }
+
+ /**
+ * @param string $column
+ *
+ * @return void
+ *
+ * @throws InvalidArgumentException
+ */
+ protected function _addColumn($column)
+ {
+ if (! is_string($column)) {
+ throw new InvalidArgumentException('Expecting a string as Index Column');
+ }
+
+ $this->_columns[$column] = new Identifier($column);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getColumns()
+ {
+ return array_keys($this->_columns);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function getQuotedColumns(AbstractPlatform $platform)
+ {
+ $subParts = $platform->supportsColumnLengthIndexes() && $this->hasOption('lengths')
+ ? $this->getOption('lengths') : [];
+
+ $columns = [];
+
+ foreach ($this->_columns as $column) {
+ $length = array_shift($subParts);
+
+ $quotedColumn = $column->getQuotedName($platform);
+
+ if ($length !== null) {
+ $quotedColumn .= '(' . $length . ')';
+ }
+
+ $columns[] = $quotedColumn;
+ }
+
+ return $columns;
+ }
+
+ /**
+ * @return string[]
+ */
+ public function getUnquotedColumns()
+ {
+ return array_map([$this, 'trimQuotes'], $this->getColumns());
+ }
+
+ /**
+ * Is the index neither unique nor primary key?
+ *
+ * @return bool
+ */
+ public function isSimpleIndex()
+ {
+ return ! $this->_isPrimary && ! $this->_isUnique;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isUnique()
+ {
+ return $this->_isUnique;
+ }
+
+ /**
+ * @return bool
+ */
+ public function isPrimary()
+ {
+ return $this->_isPrimary;
+ }
+
+ /**
+ * @param string $columnName
+ * @param int $pos
+ *
+ * @return bool
+ */
+ public function hasColumnAtPosition($columnName, $pos = 0)
+ {
+ $columnName = $this->trimQuotes(strtolower($columnName));
+ $indexColumns = array_map('strtolower', $this->getUnquotedColumns());
+
+ return array_search($columnName, $indexColumns) === $pos;
+ }
+
+ /**
+ * Checks if this index exactly spans the given column names in the correct order.
+ *
+ * @param string[] $columnNames
+ *
+ * @return bool
+ */
+ public function spansColumns(array $columnNames)
+ {
+ $columns = $this->getColumns();
+ $numberOfColumns = count($columns);
+ $sameColumns = true;
+
+ for ($i = 0; $i < $numberOfColumns; $i++) {
+ if (isset($columnNames[$i]) && $this->trimQuotes(strtolower($columns[$i])) === $this->trimQuotes(strtolower($columnNames[$i]))) {
+ continue;
+ }
+
+ $sameColumns = false;
+ }
+
+ return $sameColumns;
+ }
+
+ /**
+ * Checks if the other index already fulfills all the indexing and constraint needs of the current one.
+ *
+ * @return bool
+ */
+ public function isFullfilledBy(Index $other)
+ {
+ // allow the other index to be equally large only. It being larger is an option
+ // but it creates a problem with scenarios of the kind PRIMARY KEY(foo,bar) UNIQUE(foo)
+ if (count($other->getColumns()) !== count($this->getColumns())) {
+ return false;
+ }
+
+ // Check if columns are the same, and even in the same order
+ $sameColumns = $this->spansColumns($other->getColumns());
+
+ if ($sameColumns) {
+ if (! $this->samePartialIndex($other)) {
+ return false;
+ }
+
+ if (! $this->hasSameColumnLengths($other)) {
+ return false;
+ }
+
+ if (! $this->isUnique() && ! $this->isPrimary()) {
+ // this is a special case: If the current key is neither primary or unique, any unique or
+ // primary key will always have the same effect for the index and there cannot be any constraint
+ // overlaps. This means a primary or unique index can always fulfill the requirements of just an
+ // index that has no constraints.
+ return true;
+ }
+
+ if ($other->isPrimary() !== $this->isPrimary()) {
+ return false;
+ }
+
+ return $other->isUnique() === $this->isUnique();
+ }
+
+ return false;
+ }
+
+ /**
+ * Detects if the other index is a non-unique, non primary index that can be overwritten by this one.
+ *
+ * @return bool
+ */
+ public function overrules(Index $other)
+ {
+ if ($other->isPrimary()) {
+ return false;
+ } elseif ($this->isSimpleIndex() && $other->isUnique()) {
+ return false;
+ }
+
+ return $this->spansColumns($other->getColumns()) && ($this->isPrimary() || $this->isUnique()) && $this->samePartialIndex($other);
+ }
+
+ /**
+ * Returns platform specific flags for indexes.
+ *
+ * @return string[]
+ */
+ public function getFlags()
+ {
+ return array_keys($this->_flags);
+ }
+
+ /**
+ * Adds Flag for an index that translates to platform specific handling.
+ *
+ * @param string $flag
+ *
+ * @return Index
+ *
+ * @example $index->addFlag('CLUSTERED')
+ */
+ public function addFlag($flag)
+ {
+ $this->_flags[strtolower($flag)] = true;
+
+ return $this;
+ }
+
+ /**
+ * Does this index have a specific flag?
+ *
+ * @param string $flag
+ *
+ * @return bool
+ */
+ public function hasFlag($flag)
+ {
+ return isset($this->_flags[strtolower($flag)]);
+ }
+
+ /**
+ * Removes a flag.
+ *
+ * @param string $flag
+ *
+ * @return void
+ */
+ public function removeFlag($flag)
+ {
+ unset($this->_flags[strtolower($flag)]);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return bool
+ */
+ public function hasOption($name)
+ {
+ return isset($this->options[strtolower($name)]);
+ }
+
+ /**
+ * @param string $name
+ *
+ * @return mixed
+ */
+ public function getOption($name)
+ {
+ return $this->options[strtolower($name)];
+ }
+
+ /**
+ * @return mixed[]
+ */
+ public function getOptions()
+ {
+ return $this->options;
+ }
+
+ /**
+ * Return whether the two indexes have the same partial index
+ *
+ * @return bool
+ */
+ private function samePartialIndex(Index $other)
+ {
+ if ($this->hasOption('where') && $other->hasOption('where') && $this->getOption('where') === $other->getOption('where')) {
+ return true;
+ }
+
+ return ! $this->hasOption('where') && ! $other->hasOption('where');
+ }
+
+ /**
+ * Returns whether the index has the same column lengths as the other
+ */
+ private function hasSameColumnLengths(self $other) : bool
+ {
+ $filter = static function (?int $length) : bool {
+ return $length !== null;
+ };
+
+ return array_filter($this->options['lengths'] ?? [], $filter)
+ === array_filter($other->options['lengths'] ?? [], $filter);
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
new file mode 100644
index 000000000..7bcd5533e
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/MySqlSchemaManager.php
@@ -0,0 +1,331 @@
+ $user['User'],
+ 'password' => $user['Password'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
+ {
+ foreach ($tableIndexes as $k => $v) {
+ $v = array_change_key_case($v, CASE_LOWER);
+ if ($v['key_name'] === 'PRIMARY') {
+ $v['primary'] = true;
+ } else {
+ $v['primary'] = false;
+ }
+ if (strpos($v['index_type'], 'FULLTEXT') !== false) {
+ $v['flags'] = ['FULLTEXT'];
+ } elseif (strpos($v['index_type'], 'SPATIAL') !== false) {
+ $v['flags'] = ['SPATIAL'];
+ }
+ $v['length'] = $v['sub_part'] ?? null;
+
+ $tableIndexes[$k] = $v;
+ }
+
+ return parent::_getPortableTableIndexesList($tableIndexes, $tableName);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableSequenceDefinition($sequence)
+ {
+ return end($sequence);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableDatabaseDefinition($database)
+ {
+ return $database['Database'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableColumnDefinition($tableColumn)
+ {
+ $tableColumn = array_change_key_case($tableColumn, CASE_LOWER);
+
+ $dbType = strtolower($tableColumn['type']);
+ $dbType = strtok($dbType, '(), ');
+ $length = $tableColumn['length'] ?? strtok('(), ');
+
+ $fixed = null;
+
+ if (! isset($tableColumn['name'])) {
+ $tableColumn['name'] = '';
+ }
+
+ $scale = null;
+ $precision = null;
+
+ $type = $this->_platform->getDoctrineTypeMapping($dbType);
+
+ // In cases where not connected to a database DESCRIBE $table does not return 'Comment'
+ if (isset($tableColumn['comment'])) {
+ $type = $this->extractDoctrineTypeFromComment($tableColumn['comment'], $type);
+ $tableColumn['comment'] = $this->removeDoctrineTypeFromComment($tableColumn['comment'], $type);
+ }
+
+ switch ($dbType) {
+ case 'char':
+ case 'binary':
+ $fixed = true;
+ break;
+ case 'float':
+ case 'double':
+ case 'real':
+ case 'numeric':
+ case 'decimal':
+ if (preg_match('([A-Za-z]+\(([0-9]+)\,([0-9]+)\))', $tableColumn['type'], $match)) {
+ $precision = $match[1];
+ $scale = $match[2];
+ $length = null;
+ }
+ break;
+ case 'tinytext':
+ $length = MySqlPlatform::LENGTH_LIMIT_TINYTEXT;
+ break;
+ case 'text':
+ $length = MySqlPlatform::LENGTH_LIMIT_TEXT;
+ break;
+ case 'mediumtext':
+ $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMTEXT;
+ break;
+ case 'tinyblob':
+ $length = MySqlPlatform::LENGTH_LIMIT_TINYBLOB;
+ break;
+ case 'blob':
+ $length = MySqlPlatform::LENGTH_LIMIT_BLOB;
+ break;
+ case 'mediumblob':
+ $length = MySqlPlatform::LENGTH_LIMIT_MEDIUMBLOB;
+ break;
+ case 'tinyint':
+ case 'smallint':
+ case 'mediumint':
+ case 'int':
+ case 'integer':
+ case 'bigint':
+ case 'year':
+ $length = null;
+ break;
+ }
+
+ if ($this->_platform instanceof MariaDb1027Platform) {
+ $columnDefault = $this->getMariaDb1027ColumnDefault($this->_platform, $tableColumn['default']);
+ } else {
+ $columnDefault = $tableColumn['default'];
+ }
+
+ $options = [
+ 'length' => $length !== null ? (int) $length : null,
+ 'unsigned' => strpos($tableColumn['type'], 'unsigned') !== false,
+ 'fixed' => (bool) $fixed,
+ 'default' => $columnDefault,
+ 'notnull' => $tableColumn['null'] !== 'YES',
+ 'scale' => null,
+ 'precision' => null,
+ 'autoincrement' => strpos($tableColumn['extra'], 'auto_increment') !== false,
+ 'comment' => isset($tableColumn['comment']) && $tableColumn['comment'] !== ''
+ ? $tableColumn['comment']
+ : null,
+ ];
+
+ if ($scale !== null && $precision !== null) {
+ $options['scale'] = (int) $scale;
+ $options['precision'] = (int) $precision;
+ }
+
+ $column = new Column($tableColumn['field'], Type::getType($type), $options);
+
+ if (isset($tableColumn['collation'])) {
+ $column->setPlatformOption('collation', $tableColumn['collation']);
+ }
+
+ return $column;
+ }
+
+ /**
+ * Return Doctrine/Mysql-compatible column default values for MariaDB 10.2.7+ servers.
+ *
+ * - Since MariaDb 10.2.7 column defaults stored in information_schema are now quoted
+ * to distinguish them from expressions (see MDEV-10134).
+ * - CURRENT_TIMESTAMP, CURRENT_TIME, CURRENT_DATE are stored in information_schema
+ * as current_timestamp(), currdate(), currtime()
+ * - Quoted 'NULL' is not enforced by Maria, it is technically possible to have
+ * null in some circumstances (see https://jira.mariadb.org/browse/MDEV-14053)
+ * - \' is always stored as '' in information_schema (normalized)
+ *
+ * @link https://mariadb.com/kb/en/library/information-schema-columns-table/
+ * @link https://jira.mariadb.org/browse/MDEV-13132
+ *
+ * @param string|null $columnDefault default value as stored in information_schema for MariaDB >= 10.2.7
+ */
+ private function getMariaDb1027ColumnDefault(MariaDb1027Platform $platform, ?string $columnDefault) : ?string
+ {
+ if ($columnDefault === 'NULL' || $columnDefault === null) {
+ return null;
+ }
+ if ($columnDefault[0] === "'") {
+ return stripslashes(
+ str_replace(
+ "''",
+ "'",
+ preg_replace('/^\'(.*)\'$/', '$1', $columnDefault)
+ )
+ );
+ }
+ switch ($columnDefault) {
+ case 'current_timestamp()':
+ return $platform->getCurrentTimestampSQL();
+ case 'curdate()':
+ return $platform->getCurrentDateSQL();
+ case 'curtime()':
+ return $platform->getCurrentTimeSQL();
+ }
+ return $columnDefault;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableForeignKeysList($tableForeignKeys)
+ {
+ $list = [];
+ foreach ($tableForeignKeys as $value) {
+ $value = array_change_key_case($value, CASE_LOWER);
+ if (! isset($list[$value['constraint_name']])) {
+ if (! isset($value['delete_rule']) || $value['delete_rule'] === 'RESTRICT') {
+ $value['delete_rule'] = null;
+ }
+ if (! isset($value['update_rule']) || $value['update_rule'] === 'RESTRICT') {
+ $value['update_rule'] = null;
+ }
+
+ $list[$value['constraint_name']] = [
+ 'name' => $value['constraint_name'],
+ 'local' => [],
+ 'foreign' => [],
+ 'foreignTable' => $value['referenced_table_name'],
+ 'onDelete' => $value['delete_rule'],
+ 'onUpdate' => $value['update_rule'],
+ ];
+ }
+ $list[$value['constraint_name']]['local'][] = $value['column_name'];
+ $list[$value['constraint_name']]['foreign'][] = $value['referenced_column_name'];
+ }
+
+ $result = [];
+ foreach ($list as $constraint) {
+ $result[] = new ForeignKeyConstraint(
+ array_values($constraint['local']),
+ $constraint['foreignTable'],
+ array_values($constraint['foreign']),
+ $constraint['name'],
+ [
+ 'onDelete' => $constraint['onDelete'],
+ 'onUpdate' => $constraint['onUpdate'],
+ ]
+ );
+ }
+
+ return $result;
+ }
+
+ public function listTableDetails($tableName)
+ {
+ $table = parent::listTableDetails($tableName);
+
+ /** @var MySqlPlatform $platform */
+ $platform = $this->_platform;
+ $sql = $platform->getListTableMetadataSQL($tableName);
+
+ $tableOptions = $this->_conn->fetchAssoc($sql);
+
+ $table->addOption('engine', $tableOptions['ENGINE']);
+ if ($tableOptions['TABLE_COLLATION'] !== null) {
+ $table->addOption('collation', $tableOptions['TABLE_COLLATION']);
+ }
+ if ($tableOptions['AUTO_INCREMENT'] !== null) {
+ $table->addOption('autoincrement', $tableOptions['AUTO_INCREMENT']);
+ }
+ $table->addOption('comment', $tableOptions['TABLE_COMMENT']);
+ $table->addOption('create_options', $this->parseCreateOptions($tableOptions['CREATE_OPTIONS']));
+
+ return $table;
+ }
+
+ /**
+ * @return string[]|true[]
+ */
+ private function parseCreateOptions(?string $string) : array
+ {
+ $options = [];
+
+ if ($string === null || $string === '') {
+ return $options;
+ }
+
+ foreach (explode(' ', $string) as $pair) {
+ $parts = explode('=', $pair, 2);
+
+ $options[$parts[0]] = $parts[1] ?? true;
+ }
+
+ return $options;
+ }
+}
diff --git a/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
new file mode 100644
index 000000000..250ec2a26
--- /dev/null
+++ b/app/vendor/doctrine/dbal/lib/Doctrine/DBAL/Schema/OracleSchemaManager.php
@@ -0,0 +1,383 @@
+getPrevious();
+
+ if (! $exception instanceof DriverException) {
+ throw $exception;
+ }
+
+ // If we have a error code 1940 (ORA-01940), the drop database operation failed
+ // because of active connections on the database.
+ // To force dropping the database, we first have to close all active connections
+ // on that database and issue the drop database operation again.
+ if ($exception->getErrorCode() !== 1940) {
+ throw $exception;
+ }
+
+ $this->killUserSessions($database);
+
+ parent::dropDatabase($database);
+ }
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableViewDefinition($view)
+ {
+ $view = array_change_key_case($view, CASE_LOWER);
+
+ return new View($this->getQuotedIdentifierName($view['view_name']), $view['text']);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableUserDefinition($user)
+ {
+ $user = array_change_key_case($user, CASE_LOWER);
+
+ return [
+ 'user' => $user['username'],
+ ];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableDefinition($table)
+ {
+ $table = array_change_key_case($table, CASE_LOWER);
+
+ return $this->getQuotedIdentifierName($table['table_name']);
+ }
+
+ /**
+ * {@inheritdoc}
+ *
+ * @link http://ezcomponents.org/docs/api/trunk/DatabaseSchema/ezcDbSchemaPgsqlReader.html
+ */
+ protected function _getPortableTableIndexesList($tableIndexes, $tableName = null)
+ {
+ $indexBuffer = [];
+ foreach ($tableIndexes as $tableIndex) {
+ $tableIndex = array_change_key_case($tableIndex, CASE_LOWER);
+
+ $keyName = strtolower($tableIndex['name']);
+ $buffer = [];
+
+ if (strtolower($tableIndex['is_primary']) === 'p') {
+ $keyName = 'primary';
+ $buffer['primary'] = true;
+ $buffer['non_unique'] = false;
+ } else {
+ $buffer['primary'] = false;
+ $buffer['non_unique'] = ! $tableIndex['is_unique'];
+ }
+ $buffer['key_name'] = $keyName;
+ $buffer['column_name'] = $this->getQuotedIdentifierName($tableIndex['column_name']);
+ $indexBuffer[] = $buffer;
+ }
+
+ return parent::_getPortableTableIndexesList($indexBuffer, $tableName);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableColumnDefinition($tableColumn)
+ {
+ $tableColumn = array_change_key_case($tableColumn, CASE_LOWER);
+
+ $dbType = strtolower($tableColumn['data_type']);
+ if (strpos($dbType, 'timestamp(') === 0) {
+ if (strpos($dbType, 'with time zone')) {
+ $dbType = 'timestamptz';
+ } else {
+ $dbType = 'timestamp';
+ }
+ }
+
+ $unsigned = $fixed = $precision = $scale = $length = null;
+
+ if (! isset($tableColumn['column_name'])) {
+ $tableColumn['column_name'] = '';
+ }
+
+ // Default values returned from database sometimes have trailing spaces.
+ $tableColumn['data_default'] = trim($tableColumn['data_default']);
+
+ if ($tableColumn['data_default'] === '' || $tableColumn['data_default'] === 'NULL') {
+ $tableColumn['data_default'] = null;
+ }
+
+ if ($tableColumn['data_default'] !== null) {
+ // Default values returned from database are enclosed in single quotes.
+ $tableColumn['data_default'] = trim($tableColumn['data_default'], "'");
+ }
+
+ if ($tableColumn['data_precision'] !== null) {
+ $precision = (int) $tableColumn['data_precision'];
+ }
+
+ if ($tableColumn['data_scale'] !== null) {
+ $scale = (int) $tableColumn['data_scale'];
+ }
+
+ $type = $this->_platform->getDoctrineTypeMapping($dbType);
+ $type = $this->extractDoctrineTypeFromComment($tableColumn['comments'], $type);
+ $tableColumn['comments'] = $this->removeDoctrineTypeFromComment($tableColumn['comments'], $type);
+
+ switch ($dbType) {
+ case 'number':
+ if ($precision === 20 && $scale === 0) {
+ $type = 'bigint';
+ } elseif ($precision === 5 && $scale === 0) {
+ $type = 'smallint';
+ } elseif ($precision === 1 && $scale === 0) {
+ $type = 'boolean';
+ } elseif ($scale > 0) {
+ $type = 'decimal';
+ }
+
+ break;
+ case 'varchar':
+ case 'varchar2':
+ case 'nvarchar2':
+ $length = $tableColumn['char_length'];
+ $fixed = false;
+ break;
+ case 'char':
+ case 'nchar':
+ $length = $tableColumn['char_length'];
+ $fixed = true;
+ break;
+ }
+
+ $options = [
+ 'notnull' => (bool) ($tableColumn['nullable'] === 'N'),
+ 'fixed' => (bool) $fixed,
+ 'unsigned' => (bool) $unsigned,
+ 'default' => $tableColumn['data_default'],
+ 'length' => $length,
+ 'precision' => $precision,
+ 'scale' => $scale,
+ 'comment' => isset($tableColumn['comments']) && $tableColumn['comments'] !== ''
+ ? $tableColumn['comments']
+ : null,
+ ];
+
+ return new Column($this->getQuotedIdentifierName($tableColumn['column_name']), Type::getType($type), $options);
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableTableForeignKeysList($tableForeignKeys)
+ {
+ $list = [];
+ foreach ($tableForeignKeys as $value) {
+ $value = array_change_key_case($value, CASE_LOWER);
+ if (! isset($list[$value['constraint_name']])) {
+ if ($value['delete_rule'] === 'NO ACTION') {
+ $value['delete_rule'] = null;
+ }
+
+ $list[$value['constraint_name']] = [
+ 'name' => $this->getQuotedIdentifierName($value['constraint_name']),
+ 'local' => [],
+ 'foreign' => [],
+ 'foreignTable' => $value['references_table'],
+ 'onDelete' => $value['delete_rule'],
+ ];
+ }
+
+ $localColumn = $this->getQuotedIdentifierName($value['local_column']);
+ $foreignColumn = $this->getQuotedIdentifierName($value['foreign_column']);
+
+ $list[$value['constraint_name']]['local'][$value['position']] = $localColumn;
+ $list[$value['constraint_name']]['foreign'][$value['position']] = $foreignColumn;
+ }
+
+ $result = [];
+ foreach ($list as $constraint) {
+ $result[] = new ForeignKeyConstraint(
+ array_values($constraint['local']),
+ $this->getQuotedIdentifierName($constraint['foreignTable']),
+ array_values($constraint['foreign']),
+ $this->getQuotedIdentifierName($constraint['name']),
+ ['onDelete' => $constraint['onDelete']]
+ );
+ }
+
+ return $result;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableSequenceDefinition($sequence)
+ {
+ $sequence = array_change_key_case($sequence, CASE_LOWER);
+
+ return new Sequence(
+ $this->getQuotedIdentifierName($sequence['sequence_name']),
+ (int) $sequence['increment_by'],
+ (int) $sequence['min_value']
+ );
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableFunctionDefinition($function)
+ {
+ $function = array_change_key_case($function, CASE_LOWER);
+
+ return $function['name'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ protected function _getPortableDatabaseDefinition($database)
+ {
+ $database = array_change_key_case($database, CASE_LOWER);
+
+ return $database['username'];
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function createDatabase($database = null)
+ {
+ if ($database === null) {
+ $database = $this->_conn->getDatabase();
+ }
+
+ $params = $this->_conn->getParams();
+ $username = $database;
+ $password = $params['password'];
+
+ $query = 'CREATE USER ' . $username . ' IDENTIFIED BY ' . $password;
+ $this->_conn->executeUpdate($query);
+
+ $query = 'GRANT DBA TO ' . $username;
+ $this->_conn->executeUpdate($query);
+ }
+
+ /**
+ * @param string $table
+ *
+ * @return bool
+ */
+ public function dropAutoincrement($table)
+ {
+ assert($this->_platform instanceof OraclePlatform);
+
+ $sql = $this->_platform->getDropAutoincrementSql($table);
+ foreach ($sql as $query) {
+ $this->_conn->executeUpdate($query);
+ }
+
+ return true;
+ }
+
+ /**
+ * {@inheritdoc}
+ */
+ public function dropTable($name)
+ {
+ $this->tryMethod('dropAutoincrement', $name);
+
+ parent::dropTable($name);
+ }
+
+ /**
+ * Returns the quoted representation of the given identifier name.
+ *
+ * Quotes non-uppercase identifiers explicitly to preserve case
+ * and thus make references to the particular identifier work.
+ *
+ * @param string $identifier The identifier to quote.
+ *
+ * @return string The quoted identifier.
+ */
+ private function getQuotedIdentifierName($identifier)
+ {
+ if (preg_match('/[a-z]/', $identifier)) {
+ return $this->_platform->quoteIdentifier($identifier);
+ }
+
+ return $identifier;
+ }
+
+ /**
+ * Kills sessions connected with the given user.
+ *
+ * This is useful to force DROP USER operations which could fail because of active user sessions.
+ *
+ * @param string $user The name of the user to kill sessions for.
+ *
+ * @return void
+ */
+ private function killUserSessions($user)
+ {
+ $sql = <<| ' . $table->getName() . ' | ||
| '; + $label .= '' . $columnLabel . ''; + $label .= ' | ' . strtolower($column->getType()) . ' | '; + $label .= ''; + if ($table->hasPrimaryKey() && in_array($column->getName(), $table->getPrimaryKey()->getColumns())) { + $label .= "\xe2\x9c\xb7"; + } + $label .= ' |
printFormatPreserving($newStmts, $oldStmts, $oldTokens);
+ $this->assertSame(canonicalize($expected), canonicalize($newCode), $name);
+ }
+
+ public function provideTestFormatPreservingPrint() {
+ return $this->getTests(__DIR__ . '/../code/formatPreservation', 'test', 3);
+ }
+
+ /**
+ * @dataProvider provideTestRoundTripPrint
+ * @covers \PhpParser\PrettyPrinter\Standard
+ */
+ public function testRoundTripPrint($name, $code, $expected, $modeLine) {
+ /**
+ * This test makes sure that the format-preserving pretty printer round-trips for all
+ * the pretty printer tests (i.e. returns the input if no changes occurred).
+ */
+
+ list($version) = $this->parseModeLine($modeLine);
+
+ $lexer = new Lexer\Emulative([
+ 'usedAttributes' => [
+ 'comments',
+ 'startLine', 'endLine',
+ 'startTokenPos', 'endTokenPos',
+ ],
+ ]);
+
+ $parserClass = $version === 'php5' ? Parser\Php5::class : Parser\Php7::class;
+ /** @var Parser $parser */
+ $parser = new $parserClass($lexer);
+
+ $traverser = new NodeTraverser();
+ $traverser->addVisitor(new NodeVisitor\CloningVisitor());
+
+ $printer = new PrettyPrinter\Standard();
+
+ try {
+ $oldStmts = $parser->parse($code);
+ } catch (Error $e) {
+ // Can't do a format-preserving print on a file with errors
+ return;
+ }
+
+ $oldTokens = $lexer->getTokens();
+
+ $newStmts = $traverser->traverse($oldStmts);
+
+ $newCode = $printer->printFormatPreserving($newStmts, $oldStmts, $oldTokens);
+ $this->assertSame(canonicalize($code), canonicalize($newCode), $name);
+ }
+
+ public function provideTestRoundTripPrint() {
+ return array_merge(
+ $this->getTests(__DIR__ . '/../code/prettyPrinter', 'test'),
+ $this->getTests(__DIR__ . '/../code/parser', 'test')
+ );
+ }
}
diff --git a/app/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php b/app/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php
deleted file mode 100644
index e1186f4d5..000000000
--- a/app/vendor/nikic/php-parser/test/PhpParser/Serializer/XMLTest.php
+++ /dev/null
@@ -1,172 +0,0 @@
-
- */
- public function testSerialize() {
- $code = <<
-
-
-
-
- 4
-
-
-
- // comment
-
- /** doc comment */
-
-
-
- 6
-
-
-
-
-
- functionName
-
-
-
-
-
- 4
-
-
- 4
-
-
-
-
-
-
-
-
-
-
-
- a
-
-
-
-
- 4
-
-
- 4
-
-
- 10
-
-
- 0
-
-
-
-
-
-
- 4
-
-
- 4
-
-
-
-
-
-
-
-
-
-
-
- b
-
-
-
-
- 4
-
-
- 4
-
-
- 1
-
-
-
-
-
-
-
-
-
-
-
-
-
- 5
-
-
- 5
-
-
-
-
-
- 5
-
-
- 5
-
-
- 1
-
-
- Foo
-
-
-
-
-
-
-
-
-
-
-XML;
-
- $parser = new PhpParser\Parser\Php7(new PhpParser\Lexer);
- $serializer = new XML;
-
- $code = str_replace("\r\n", "\n", $code);
- $stmts = $parser->parse($code);
- $this->assertXmlStringEqualsXmlString($xml, $serializer->serialize($stmts));
- }
-
- /**
- * @expectedException \InvalidArgumentException
- * @expectedExceptionMessage Unexpected node type
- */
- public function testError() {
- $serializer = new XML;
- $serializer->serialize(array(new \stdClass));
- }
-}
diff --git a/app/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php b/app/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php
deleted file mode 100644
index 3bc86dbed..000000000
--- a/app/vendor/nikic/php-parser/test/PhpParser/Unserializer/XMLTest.php
+++ /dev/null
@@ -1,150 +0,0 @@
-
-
-
-
- 1
-
-
-
- // comment
-
- /** doc comment */
-
-
-
- Test
-
-
-
-XML;
-
- $unserializer = new XML;
- $this->assertEquals(
- new Scalar\String_('Test', array(
- 'startLine' => 1,
- 'comments' => array(
- new Comment('// comment' . "\n", 2),
- new Comment\Doc('/** doc comment */', 3),
- ),
- )),
- $unserializer->unserialize($xml)
- );
- }
-
- public function testEmptyNode() {
- $xml = <<
-
-
-
-XML;
-
- $unserializer = new XML;
-
- $this->assertEquals(
- new Scalar\MagicConst\Class_,
- $unserializer->unserialize($xml)
- );
- }
-
- public function testScalars() {
- $xml = <<
-
-
-
-
- test
-
-
- 1
- 1
- 1.5
-
-
-
-
-
-XML;
- $result = array(
- array(), array(),
- 'test', '', '',
- 1,
- 1, 1.5,
- true, false, null
- );
-
- $unserializer = new XML;
- $this->assertEquals($result, $unserializer->unserialize($xml));
- }
-
- /**
- * @expectedException \DomainException
- * @expectedExceptionMessage AST root element not found
- */
- public function testWrongRootElementError() {
- $xml = <<
-
-XML;
-
- $unserializer = new XML;
- $unserializer->unserialize($xml);
- }
-
- /**
- * @dataProvider provideTestErrors
- */
- public function testErrors($xml, $errorMsg) {
- $this->setExpectedException('DomainException', $errorMsg);
-
- $xml = <<
-
- $xml
-
-XML;
-
- $unserializer = new XML;
- $unserializer->unserialize($xml);
- }
-
- public function provideTestErrors() {
- return array(
- array('test ', '"true" scalar must be empty'),
- array('test ', '"false" scalar must be empty'),
- array('test ', '"null" scalar must be empty'),
- array('bar ', 'Unknown scalar type "foo"'),
- array('x ', '"x" is not a valid int'),
- array('x ', '"x" is not a valid float'),
- array('', 'Expected node or scalar'),
- array('test ', 'Unexpected node of type "foo:bar"'),
- array(
- 'test ',
- 'Expected sub node or attribute, got node of type "foo:bar"'
- ),
- array(
- ' ',
- 'Expected node or scalar'
- ),
- array(
- ' ',
- 'Unknown node type "Foo"'
- ),
- );
- }
-}
diff --git a/app/vendor/nikic/php-parser/test/bootstrap.php b/app/vendor/nikic/php-parser/test/bootstrap.php
index 9526b648b..0bfa9d0ad 100644
--- a/app/vendor/nikic/php-parser/test/bootstrap.php
+++ b/app/vendor/nikic/php-parser/test/bootstrap.php
@@ -18,3 +18,14 @@ function canonicalize($str) {
}, $lines);
return implode("\n", $lines);
}
+
+function filesInDir($directory, $fileExtension) {
+ $directory = realpath($directory);
+ $it = new \RecursiveDirectoryIterator($directory);
+ $it = new \RecursiveIteratorIterator($it, \RecursiveIteratorIterator::LEAVES_ONLY);
+ $it = new \RegexIterator($it, '(\.' . preg_quote($fileExtension) . '$)');
+ foreach ($it as $file) {
+ $fileName = $file->getPathname();
+ yield $fileName => file_get_contents($fileName);
+ }
+}
diff --git a/app/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test b/app/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test
new file mode 100644
index 000000000..7551059f7
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/formatPreservation/anonClasses.test
@@ -0,0 +1,16 @@
+Anonymous classes
+-----
+expr;
+$new->class->extends = null;
+$new->args[] = new Expr\Variable('y');
+-----
+exprs[0]->left->right->value = 42;
+-----
+name = new Node\Identifier('bar');
+-----
+byRef = true;
+-----
+byRef = true;
+-----
+stmts[0];
+$stmts[0]->stmts[0] = $stmts[1];
+$stmts[1] = $tmp;
+-----
+stmts[0];
+$stmts[1]->stmts[0] = $stmts[2];
+$stmts[2] = $tmp;
+// Same test, but also removing first statement, triggering fallback
+array_splice($stmts, 0, 1, []);
+-----
+exprs[0] = new Expr\ConstFetch(new Node\Name('C'));
+-----
+exprs[0]->parts[0] = new Expr\Variable('bar');
+$stmts[1]->exprs[0]->parts[0] = new Expr\Variable('bar');
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('c'));
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('c'));
+-----
+setAttribute('comments', []);
+-----
+getComments();
+$comments[] = new Comment("// foo");
+$stmts[1]->setAttribute('comments', $comments);
+-----
+stmts[0];
+$method->setAttribute('comments', [new Comment\Doc("/**\n *\n */")]);
+-----
+expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+// The parens here are "correct", because add is left assoc
+$stmts[1]->expr->right = new Expr\BinaryOp\Plus(new Expr\Variable('b'), new Expr\Variable('c'));
+// No parens necessary
+$stmts[2]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+// Parens for RHS not strictly necessary due to assign speciality
+$stmts[3]->expr->cond = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[3]->expr->if = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[3]->expr->else = new Expr\Assign(new Expr\Variable('a'), new Expr\Variable('b'));
+// Already has parens
+$stmts[4]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[5]->expr->left = new Expr\BinaryOp\Plus(new Expr\Variable('a'), new Expr\Variable('b'));
+-----
+ bar;
+$foo -> bar;
+$foo -> bar;
+$foo -> bar;
+$foo -> bar;
+self :: $foo;
+self :: $foo;
+-----
+$stmts[0]->expr->name = new Expr\Variable('a');
+$stmts[1]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[2]->expr->var = new Expr\Variable('bar');
+$stmts[3]->expr->var = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[4]->expr->name = new Node\Identifier('foo');
+// In this case the braces are not strictly necessary. However, on PHP 5 they may be required
+// depending on where the property fetch node itself occurs.
+$stmts[5]->expr->name = new Expr\Variable('bar');
+$stmts[6]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+$stmts[7]->expr->name = new Node\VarLikeIdentifier('bar');
+$stmts[8]->expr->name = new Expr\BinaryOp\Concat(new Expr\Variable('a'), new Expr\Variable('b'));
+-----
+ bar;
+($a . $b) -> bar;
+$foo -> foo;
+$foo -> {$bar};
+$foo -> {$a . $b};
+self :: $bar;
+self :: ${$a . $b};
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test b/app/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test
new file mode 100644
index 000000000..7494e5359
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/formatPreservation/inlineHtml.test
@@ -0,0 +1,54 @@
+Handling of inline HTML
+-----
+FoosetAttribute('origNode', null);
+-----
+FooBarstmts[2] = $stmts[0]->stmts[1];
+-----
+BarBarstmts[1] = $stmts[0]->stmts[2];
+-----
+returnType = new Node\Name('Foo');
+$stmts[0]->params[0]->type = new Node\Identifier('int');
+$stmts[0]->params[1]->type = new Node\Identifier('array');
+$stmts[0]->params[1]->default = new Expr\ConstFetch(new Node\Name('null'));
+$stmts[1]->expr->dim = new Expr\Variable('a');
+$stmts[2]->expr->items[0]->key = new Scalar\String_('X');
+$stmts[3]->expr->returnType = new Node\Name('Bar');
+$stmts[4]->expr->if = new Expr\Variable('z');
+$stmts[5]->expr->key = new Expr\Variable('k');
+$stmts[6]->expr->value = new Expr\Variable('v');
+$stmts[7]->num = new Scalar\LNumber(2);
+$stmts[8]->num = new Scalar\LNumber(2);
+$stmts[9]->expr = new Expr\Variable('x');
+$stmts[10]->extends = new Node\Name\FullyQualified('Bar');
+$stmts[10]->stmts[0]->returnType = new Node\Name('Y');
+$stmts[10]->stmts[1]->props[0]->default = new Scalar\DNumber(42.0);
+$stmts[11]->keyVar = new Expr\Variable('z');
+$stmts[12]->vars[0]->default = new Scalar\String_('abc');
+$stmts[13]->finally = new Stmt\Finally_([]);
+$stmts[14]->else = new Stmt\Else_([]);
+-----
+ $value
+];
+
+function
+() : Bar
+{};
+
+$x
+? $z
+:
+$y;
+
+yield
+$k => $v ;
+yield $v ;
+
+break 2
+;
+continue 2
+;
+return $x
+;
+
+class
+X extends \Bar
+{
+ public
+ function y() : Y
+ {}
+
+ private
+ $x = 42.0
+ ;
+}
+
+foreach (
+ $x
+ as
+ $z => $y
+) {}
+
+static
+$var = 'abc'
+;
+
+try {
+} catch (X
+$y) {
+} finally {
+}
+
+if ($cond) { // Foo
+} elseif ($cond2) { // Bar
+} else {
+}
+-----
+name = new Node\Name('Foo');
+-----
+stmts[] = new Stmt\Expression(new Expr\Variable('baz'));
+-----
+params[] = new Node\Param(new Expr\Variable('param2'));
+-----
+catches[0]->types[] = new Node\Name('Bar');
+-----
+params, new Node\Param(new Expr\Variable('param0')));
+-----
+params[] = new Node\Param(new Expr\Variable('param0'));
+/* Insertion into empty list not handled yet */
+-----
+elseifs[] = new Stmt\ElseIf_(new Expr\Variable('cond3'), []);
+-----
+catches[] = new Stmt\Catch_([new Node\Name('Bar')], new Expr\Variable('bar'), []);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+$stmts[] = $node;
+-----
+setAttribute('comments', [new Comment('// Test'), new Comment('// Test 2')]);
+$stmts[0]->stmts[] = $node;
+-----
+name->parts[0] = 'Xyz';
+-----
+stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+$stmts[0]->stmts[1]->setAttribute('comments', [new Comment('// Bar foo')]);
+-----
+setAttribute('comments', [new Comment('// Test')]);
+array_unshift($stmts[0]->stmts, $node);
+$stmts[0]->stmts[1]->setAttribute('comments', []);
+-----
+stmts,
+ new Stmt\Expression(new Expr\Variable('a')),
+ new Stmt\Expression(new Expr\Variable('b')));
+-----
+stmts = [
+ new Stmt\Expression(new Expr\Variable('a')),
+ new Stmt\Expression(new Expr\Variable('b')),
+];
+-----
+expr->expr->items, new Expr\ArrayItem(new Scalar\LNumber(42)));
+$stmts[0]->expr->expr->items[] = new Expr\ArrayItem(new Scalar\LNumber(24));
+-----
+expr->expr->items[] = new Expr\ArrayItem(new Scalar\LNumber(24));
+-----
+foo = new Foo;
+$this->foo->a()
+ ->b();
+-----
+$outerCall = $stmts[1]->expr;
+$innerCall = $outerCall->var;
+$var = $innerCall->var;
+$stmts[1]->expr = $innerCall;
+$stmts[2] = new Stmt\Expression(new Expr\MethodCall($var, $outerCall->name));
+-----
+foo = new Foo;
+$this->foo->a();
+$this->foo->b();
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test b/app/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test
new file mode 100644
index 000000000..0ac423901
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/formatPreservation/listRemoval.test
@@ -0,0 +1,41 @@
+Removing from list nodes
+-----
+params);
+-----
+params);
+$stmts[0]->params[] = new Node\Param(new Expr\Variable('x'));
+$stmts[0]->params[] = new Node\Param(new Expr\Variable('y'));
+-----
+flags = Stmt\Class_::MODIFIER_ABSTRACT;
+$stmts[1]->flags = 0;
+$stmts[1]->stmts[0]->flags = Stmt\Class_::MODIFIER_PRIVATE;
+$stmts[1]->stmts[1]->flags = Stmt\Class_::MODIFIER_PROTECTED;
+$stmts[1]->stmts[2]->flags |= Stmt\Class_::MODIFIER_FINAL;
+-----
+ [new Comment('//Some comment here')]]);
+-----
+ $b
+, $c => $d];
+
+yield
+$foo
+=>
+$bar;
+yield
+$bar;
+
+break
+2
+;
+continue
+2
+;
+
+foreach(
+ $array
+as
+ $key
+ =>
+ $value
+) {}
+
+if
+($x)
+{
+}
+
+else {}
+
+return
+$val
+;
+static
+ $x
+ =
+ $y
+;
+
+try {} catch
+ (X $y)
+ {}
+finally
+{}
+-----
+$stmts[0]->returnType = null;
+$stmts[0]->params[0]->default = null;
+$stmts[0]->params[1]->type = null;
+$stmts[1]->expr->returnType = null;
+$stmts[2]->extends = null;
+$stmts[2]->stmts[0]->returnType = null;
+$stmts[2]->stmts[1]->props[0]->default = null;
+$stmts[2]->stmts[2]->adaptations[0]->newName = null;
+$stmts[3]->expr->dim = null;
+$stmts[4]->expr->expr = null;
+$stmts[5]->expr->if = null;
+$stmts[6]->expr->items[1]->key = null;
+$stmts[7]->expr->key = null;
+$stmts[8]->expr->value = null;
+$stmts[9]->num = null;
+$stmts[10]->num = null;
+$stmts[11]->keyVar = null;
+$stmts[12]->else = null;
+$stmts[13]->expr = null;
+$stmts[14]->vars[0]->default = null;
+$stmts[15]->finally = null;
+-----
+ $b
+, $d];
+
+yield
+$bar;
+yield;
+
+break;
+continue;
+
+foreach(
+ $array
+as
+ $value
+) {}
+
+if
+($x)
+{
+}
+
+return;
+static
+ $x
+;
+
+try {} catch
+ (X $y)
+ {}
+-----
+name = null;
+-----
+
!!positions
Syntax error, unexpected ';', expecting T_STRING or T_VARIABLE or '{' or '$' from 3:1 to 3:1
array(
- 0: Expr_PropertyFetch[2:1 - 2:6](
- var: Expr_Variable[2:1 - 2:4](
- name: foo
- )
- name: Expr_Error[3:1 - 2:6](
+ 0: Stmt_Expression[2:1 - 3:1](
+ expr: Expr_PropertyFetch[2:1 - 2:6](
+ var: Expr_Variable[2:1 - 2:4](
+ name: foo
+ )
+ name: Expr_Error[3:1 - 2:6](
+ )
)
)
)
@@ -267,16 +307,20 @@ Syntax error, unexpected '}', expecting T_STRING or T_VARIABLE or '{' or '$' fro
array(
0: Stmt_Function[2:1 - 4:1](
byRef: false
- name: foo
+ name: Identifier[2:10 - 2:12](
+ name: foo
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_PropertyFetch[3:5 - 3:10](
- var: Expr_Variable[3:5 - 3:8](
- name: bar
- )
- name: Expr_Error[4:1 - 3:10](
+ 0: Stmt_Expression[3:5 - 3:10](
+ expr: Expr_PropertyFetch[3:5 - 3:10](
+ var: Expr_Variable[3:5 - 3:8](
+ name: bar
+ )
+ name: Expr_Error[4:1 - 3:10](
+ )
)
)
)
@@ -288,13 +332,15 @@ new T
-----
Syntax error, unexpected EOF from 2:6 to 2:6
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: T
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: T
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
)
@@ -305,10 +351,12 @@ new
!!php7,positions
Syntax error, unexpected EOF from 2:4 to 2:4
array(
- 0: Expr_New[2:1 - 2:3](
- class: Expr_Error[2:4 - 2:3](
- )
- args: array(
+ 0: Stmt_Expression[2:1 - 2:3](
+ expr: Expr_New[2:1 - 2:3](
+ class: Expr_Error[2:4 - 2:3](
+ )
+ args: array(
+ )
)
)
)
@@ -319,11 +367,13 @@ $foo instanceof
!!php7
Syntax error, unexpected EOF from 2:16 to 2:16
array(
- 0: Expr_Instanceof(
- expr: Expr_Variable(
- name: foo
- )
- class: Expr_Error(
+ 0: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: foo
+ )
+ class: Expr_Error(
+ )
)
)
)
@@ -334,8 +384,10 @@ $
!!php7
Syntax error, unexpected EOF, expecting T_VARIABLE or '{' or '$' from 2:2 to 2:2
array(
- 0: Expr_Variable(
- name: Expr_Error(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_Error(
+ )
)
)
)
@@ -346,13 +398,15 @@ Foo::$
!!php7
Syntax error, unexpected EOF, expecting T_VARIABLE or '{' or '$' from 2:7 to 2:7
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: Foo
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Expr_Error(
)
- )
- name: Expr_Error(
)
)
)
@@ -363,13 +417,15 @@ Foo::
!!php7
Syntax error, unexpected EOF from 2:6 to 2:6
array(
- 0: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Foo
+ 0: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Expr_Error(
)
- )
- name: Expr_Error(
)
)
)
@@ -415,7 +471,7 @@ array(
0: A
)
)
- alias: A
+ alias: null
)
)
)
@@ -429,7 +485,7 @@ array(
0: a
)
)
- alias: a
+ alias: null
)
)
)
@@ -448,14 +504,16 @@ array(
0: B
)
)
- alias: B
+ alias: null
)
)
)
3: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 1
)
@@ -506,7 +564,9 @@ array(
)
)
13: Stmt_Goto(
- name: label
+ name: Identifier(
+ name: label
+ )
)
)
)
@@ -553,11 +613,8 @@ A trailing comma is not allowed here from 11:25 to 11:25
A trailing comma is not allowed here from 13:17 to 13:17
A trailing comma is not allowed here from 14:14 to 14:14
A trailing comma is not allowed here from 16:22 to 16:22
-A trailing comma is not allowed here from 18:9 to 18:9
-A trailing comma is not allowed here from 19:9 to 19:9
A trailing comma is not allowed here from 21:13 to 21:13
A trailing comma is not allowed here from 23:16 to 23:16
-A trailing comma is not allowed here from 24:7 to 24:7
A trailing comma is not allowed here from 25:10 to 25:10
A trailing comma is not allowed here from 26:10 to 26:10
A trailing comma is not allowed here from 27:8 to 27:8
@@ -582,7 +639,7 @@ array(
0: B
)
)
- alias: B
+ alias: null
)
)
)
@@ -601,7 +658,7 @@ array(
0: b
)
)
- alias: b
+ alias: null
)
)
)
@@ -615,14 +672,16 @@ array(
0: A
)
)
- alias: A
+ alias: null
)
)
)
3: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 42
)
@@ -631,7 +690,9 @@ array(
)
4: Stmt_Class(
flags: 0
- name: X
+ name: Identifier(
+ name: X
+ )
extends: null
implements: array(
0: Name(
@@ -667,7 +728,9 @@ array(
0: A
)
)
- method: b
+ method: Identifier(
+ name: b
+ )
insteadof: array(
0: Name(
parts: array(
@@ -682,7 +745,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 42
)
@@ -693,7 +758,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: x
+ name: VarLikeIdentifier(
+ name: x
+ )
default: null
)
)
@@ -701,7 +768,9 @@ array(
)
)
5: Stmt_Interface(
- name: I
+ name: Identifier(
+ name: I
+ )
extends: array(
0: Name(
parts: array(
@@ -719,17 +788,21 @@ array(
)
)
)
- 7: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
- name: x
+ 7: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: x
+ )
)
)
)
8: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: a
+ key: Identifier(
+ name: a
+ )
value: Scalar_LNumber(
value: 42
)
@@ -739,13 +812,17 @@ array(
)
9: Stmt_Function(
byRef: false
- name: foo
+ name: Identifier(
+ name: foo
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -753,19 +830,21 @@ array(
stmts: array(
)
)
- 10: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
+ 10: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
@@ -779,7 +858,9 @@ array(
12: Stmt_Static(
vars: array(
0: Stmt_StaticVar(
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -810,56 +891,485 @@ array(
stmts: array(
)
)
- 15: Expr_Closure(
- static: false
+ 15: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
+ )
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ )
+ )
+ returnType: null
+ stmts: array(
+ )
+ )
+ )
+)
+-----
+value $oopsAnotherValue->get()
+];
+$array = [
+ $value $oopsAnotherValue
+];
+$array = [
+ 'key' => $value $oopsAnotherValue
+];
-----
-!!php7,positions
-Syntax error, unexpected ')' from 3:10 to 3:10
+!!php7
+Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 3:18 to 3:34
+Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 6:12 to 6:28
+Syntax error, unexpected T_VARIABLE, expecting ',' or ')' or ']' from 9:21 to 9:37
array(
- 0: Expr_FuncCall[3:1 - 3:10](
- name: Name[3:1 - 3:3](
- parts: array(
- 0: foo
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: array
+ )
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: this
+ )
+ name: Identifier(
+ name: value
+ )
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_MethodCall(
+ var: Expr_Variable(
+ name: oopsAnotherValue
+ )
+ name: Identifier(
+ name: get
+ )
+ args: array(
+ )
+ )
+ byRef: false
+ )
+ )
)
)
- args: array(
- 0: Arg[3:5 - 3:9](
- value: Expr_ClassConstFetch[3:5 - 3:9](
- class: Name[3:5 - 3:7](
- parts: array(
- 0: Bar
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: array
+ )
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: value
)
+ byRef: false
)
- name: Expr_Error[3:10 - 3:9](
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: oopsAnotherValue
+ )
+ byRef: false
+ )
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: array
+ )
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: key
+ )
+ value: Expr_Variable(
+ name: value
+ )
+ byRef: false
+ )
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: oopsAnotherValue
+ )
+ byRef: false
)
)
- byRef: false
- unpack: false
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test b/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test
index 28baf2664..510a93f8a 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDef.test
@@ -14,128 +14,147 @@ array('a', &$b, 'c' => 'd', 'e' => &$f);
['a' => 'b'];
-----
array(
- 0: Expr_Array(
- items: array(
+ 0: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ )
)
)
- 1: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 1: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 2: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 2: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 3: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
+ 3: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: b
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 4: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: a
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
- )
- byRef: true
- )
- 2: Expr_ArrayItem(
- key: Scalar_String(
- value: c
+ 4: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
+ byRef: false
)
- value: Scalar_String(
- value: d
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: true
)
- byRef: false
- )
- 3: Expr_ArrayItem(
- key: Scalar_String(
- value: e
+ 2: Expr_ArrayItem(
+ key: Scalar_String(
+ value: c
+ )
+ value: Scalar_String(
+ value: d
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: f
+ 3: Expr_ArrayItem(
+ key: Scalar_String(
+ value: e
+ )
+ value: Expr_Variable(
+ name: f
+ )
+ byRef: true
)
- byRef: true
)
)
)
- 5: Expr_Array(
- items: array(
+ 5: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ )
+ comments: array(
+ 0: // short array syntax
+ )
)
comments: array(
0: // short array syntax
)
)
- 6: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 6: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
)
- 7: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Scalar_String(
- value: b
+ 7: Stmt_Expression(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- byRef: false
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test b/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
index 4ca76b216..7865e6ffb 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/arrayDestructuring.test
@@ -9,136 +9,144 @@ Array destructuring
-----
!!php7
array(
- 0: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: c
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: d
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: d
+ )
+ byRef: false
)
- byRef: false
)
)
)
)
- 1: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 2: null
- 3: null
- 4: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 2: null
+ 3: null
+ 4: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
+ 5: null
)
- 5: null
)
- )
- expr: Expr_Variable(
- name: foo
+ expr: Expr_Variable(
+ name: foo
+ )
)
)
- 2: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: bar
+ expr: Expr_Variable(
+ name: bar
+ )
)
)
- 3: Expr_Assign(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Expr_Variable(
- name: b
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: Scalar_String(
- value: b
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- value: Expr_Variable(
- name: a
+ 1: Expr_ArrayItem(
+ key: Scalar_String(
+ value: b
+ )
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: baz
+ expr: Expr_Variable(
+ name: baz
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/assign.test b/app/vendor/nikic/php-parser/test/code/parser/expr/assign.test
index 1d6b187ad..33335f89d 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/assign.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/assign.test
@@ -36,266 +36,328 @@ $a++;
$a--;
-----
array(
- 0: Expr_Assign(
- var: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // simple assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // simple assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // simple assign
)
)
- 1: Expr_AssignOp_BitwiseAnd(
- var: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseAnd(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // combined assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // combined assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // combined assign
)
)
- 2: Expr_AssignOp_BitwiseOr(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
- )
- )
- 3: Expr_AssignOp_BitwiseXor(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 2: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseOr(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 4: Expr_AssignOp_Concat(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 3: Stmt_Expression(
+ expr: Expr_AssignOp_BitwiseXor(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 5: Expr_AssignOp_Div(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 4: Stmt_Expression(
+ expr: Expr_AssignOp_Concat(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 6: Expr_AssignOp_Minus(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 5: Stmt_Expression(
+ expr: Expr_AssignOp_Div(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 7: Expr_AssignOp_Mod(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 6: Stmt_Expression(
+ expr: Expr_AssignOp_Minus(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 8: Expr_AssignOp_Mul(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 7: Stmt_Expression(
+ expr: Expr_AssignOp_Mod(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 9: Expr_AssignOp_Plus(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 8: Stmt_Expression(
+ expr: Expr_AssignOp_Mul(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 10: Expr_AssignOp_ShiftLeft(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 9: Stmt_Expression(
+ expr: Expr_AssignOp_Plus(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 11: Expr_AssignOp_ShiftRight(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 10: Stmt_Expression(
+ expr: Expr_AssignOp_ShiftLeft(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 12: Expr_AssignOp_Pow(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_Variable(
- name: b
+ 11: Stmt_Expression(
+ expr: Expr_AssignOp_ShiftRight(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 13: Expr_Assign(
- var: Expr_Variable(
- name: a
- comments: array(
- 0: // chained assign
+ 12: Stmt_Expression(
+ expr: Expr_AssignOp_Pow(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
)
)
- expr: Expr_AssignOp_Mul(
+ )
+ 13: Stmt_Expression(
+ expr: Expr_Assign(
var: Expr_Variable(
- name: b
+ name: a
+ comments: array(
+ 0: // chained assign
+ )
)
- expr: Expr_AssignOp_Pow(
+ expr: Expr_AssignOp_Mul(
var: Expr_Variable(
- name: c
+ name: b
)
- expr: Expr_Variable(
- name: d
+ expr: Expr_AssignOp_Pow(
+ var: Expr_Variable(
+ name: c
+ )
+ expr: Expr_Variable(
+ name: d
+ )
)
)
+ comments: array(
+ 0: // chained assign
+ )
)
comments: array(
0: // chained assign
)
)
- 14: Expr_AssignRef(
- var: Expr_Variable(
- name: a
+ 14: Stmt_Expression(
+ expr: Expr_AssignRef(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // by ref assign
+ )
+ )
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // by ref assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // by ref assign
)
)
- 15: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 15: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
+ )
+ comments: array(
+ 0: // list() assign
)
)
+ expr: Expr_Variable(
+ name: b
+ )
comments: array(
0: // list() assign
)
)
- expr: Expr_Variable(
- name: b
- )
comments: array(
0: // list() assign
)
)
- 16: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 16: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: null
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: b
+ 1: null
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: c
+ expr: Expr_Variable(
+ name: c
+ )
)
)
- 17: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: a
+ 17: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Expr_List(
- items: array(
- 0: null
- 1: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: c
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_List(
+ items: array(
+ 0: null
+ 1: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: d
+ 2: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: d
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: e
+ expr: Expr_Variable(
+ name: e
+ )
)
)
- 18: Expr_PreInc(
- var: Expr_Variable(
- name: a
+ 18: Stmt_Expression(
+ expr: Expr_PreInc(
+ var: Expr_Variable(
+ name: a
+ )
+ comments: array(
+ 0: // inc/dec
+ )
)
comments: array(
0: // inc/dec
)
)
- 19: Expr_PostInc(
- var: Expr_Variable(
- name: a
+ 19: Stmt_Expression(
+ expr: Expr_PostInc(
+ var: Expr_Variable(
+ name: a
+ )
)
)
- 20: Expr_PreDec(
- var: Expr_Variable(
- name: a
+ 20: Stmt_Expression(
+ expr: Expr_PreDec(
+ var: Expr_Variable(
+ name: a
+ )
)
)
- 21: Expr_PostDec(
- var: Expr_Variable(
- name: a
+ 21: Stmt_Expression(
+ expr: Expr_PostDec(
+ var: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test b/app/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
index 10e1317f0..a66d943a4 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/assignNewByRef.test
@@ -5,17 +5,19 @@ $a =& new B;
-----
!!php5
array(
- 0: Expr_AssignRef(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_New(
- class: Name(
- parts: array(
- 0: B
- )
+ 0: Stmt_Expression(
+ expr: Expr_AssignRef(
+ var: Expr_Variable(
+ name: a
)
- args: array(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ args: array(
+ )
)
)
)
@@ -27,13 +29,15 @@ $a =& new B;
!!php7
Syntax error, unexpected T_NEW from 2:7 to 2:9
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: B
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: B
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/cast.test b/app/vendor/nikic/php-parser/test/code/parser/expr/cast.test
index 3c54ba72d..a875bb47f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/cast.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/cast.test
@@ -14,59 +14,81 @@ Casts
(unset) $a;
-----
array(
- 0: Expr_Cast_Array(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Cast_Array(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 1: Expr_Cast_Bool(
- expr: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_Cast_Bool(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 2: Expr_Cast_Bool(
- expr: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Cast_Bool(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 3: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 3: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 4: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 5: Expr_Cast_Double(
- expr: Expr_Variable(
- name: a
+ 5: Stmt_Expression(
+ expr: Expr_Cast_Double(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 6: Expr_Cast_Int(
- expr: Expr_Variable(
- name: a
+ 6: Stmt_Expression(
+ expr: Expr_Cast_Int(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 7: Expr_Cast_Int(
- expr: Expr_Variable(
- name: a
+ 7: Stmt_Expression(
+ expr: Expr_Cast_Int(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 8: Expr_Cast_Object(
- expr: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_Cast_Object(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 9: Expr_Cast_String(
- expr: Expr_Variable(
- name: a
+ 9: Stmt_Expression(
+ expr: Expr_Cast_String(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 10: Expr_Cast_Unset(
- expr: Expr_Variable(
- name: a
+ 10: Stmt_Expression(
+ expr: Expr_Cast_Unset(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/clone.test b/app/vendor/nikic/php-parser/test/code/parser/expr/clone.test
index 640156606..418eb0e65 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/clone.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/clone.test
@@ -5,9 +5,11 @@ Clone
clone $a;
-----
array(
- 0: Expr_Clone(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Clone(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/closure.test b/app/vendor/nikic/php-parser/test/code/parser/expr/closure.test
index f459b602d..c88de78b4 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/closure.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/closure.test
@@ -10,133 +10,167 @@ function($a) : array {};
function() use($a) : \Foo\Bar {};
-----
array(
- 0: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 0: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
)
- )
- uses: array(
- )
- returnType: null
- stmts: array(
- 0: Expr_Variable(
- name: a
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
+ )
)
)
)
- 1: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 1: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
)
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: b
- byRef: false
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ )
+ )
+ returnType: null
+ stmts: array(
)
- )
- returnType: null
- stmts: array(
)
)
- 2: Expr_Closure(
- static: false
- byRef: false
- params: array(
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: a
- byRef: false
+ 2: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
)
- 1: Expr_ClosureUse(
- var: b
- byRef: true
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ )
+ 1: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: b
+ )
+ byRef: true
+ )
+ )
+ returnType: null
+ stmts: array(
)
- )
- returnType: null
- stmts: array(
)
)
- 3: Expr_Closure(
- static: false
- byRef: true
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 3: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: true
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
)
- )
- uses: array(
- )
- returnType: null
- stmts: array(
)
)
- 4: Expr_Closure(
- static: true
- byRef: false
- params: array(
- )
- uses: array(
- )
- returnType: null
- stmts: array(
+ 4: Stmt_Expression(
+ expr: Expr_Closure(
+ static: true
+ byRef: false
+ params: array(
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
+ )
)
)
- 5: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: a
- default: null
+ 5: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: a
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: Identifier(
+ name: array
+ )
+ stmts: array(
)
- )
- uses: array(
- )
- returnType: array
- stmts: array(
)
)
- 6: Expr_Closure(
- static: false
- byRef: false
- params: array(
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: a
- byRef: false
+ 6: Stmt_Expression(
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
)
- )
- returnType: Name_FullyQualified(
- parts: array(
- 0: Foo
- 1: Bar
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ )
+ )
+ returnType: Name_FullyQualified(
+ parts: array(
+ 0: Foo
+ 1: Bar
+ )
+ )
+ stmts: array(
)
- )
- stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/comparison.test b/app/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
index d5b1e3540..011692f06 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/comparison.test
@@ -14,94 +14,116 @@ $a instanceof B;
$a instanceof $b;
-----
array(
- 0: Expr_BinaryOp_Smaller(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 0: Stmt_Expression(
+ expr: Expr_BinaryOp_Smaller(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 1: Expr_BinaryOp_SmallerOrEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_SmallerOrEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 2: Expr_BinaryOp_Greater(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 2: Stmt_Expression(
+ expr: Expr_BinaryOp_Greater(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 3: Expr_BinaryOp_GreaterOrEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_GreaterOrEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 4: Expr_BinaryOp_Equal(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_Equal(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 5: Expr_BinaryOp_Identical(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_Identical(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 6: Expr_BinaryOp_NotEqual(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_NotEqual(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 7: Expr_BinaryOp_NotIdentical(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_NotIdentical(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 8: Expr_BinaryOp_Spaceship(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_Spaceship(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 9: Expr_Instanceof(
- expr: Expr_Variable(
- name: a
- )
- class: Name(
- parts: array(
- 0: B
+ 9: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: a
+ )
+ class: Name(
+ parts: array(
+ 0: B
+ )
)
)
)
- 10: Expr_Instanceof(
- expr: Expr_Variable(
- name: a
- )
- class: Expr_Variable(
- name: b
+ 10: Stmt_Expression(
+ expr: Expr_Instanceof(
+ expr: Expr_Variable(
+ name: a
+ )
+ class: Expr_Variable(
+ name: b
+ )
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test b/app/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
index 3e7a23ef0..d774de71e 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/constant_expr.test
@@ -44,7 +44,9 @@ array(
0: Stmt_Const(
consts: array(
0: Const(
- name: T_1
+ name: Identifier(
+ name: T_1
+ )
value: Expr_BinaryOp_ShiftLeft(
left: Scalar_LNumber(
value: 1
@@ -59,7 +61,9 @@ array(
1: Stmt_Const(
consts: array(
0: Const(
- name: T_2
+ name: Identifier(
+ name: T_2
+ )
value: Expr_BinaryOp_Div(
left: Scalar_LNumber(
value: 1
@@ -74,7 +78,9 @@ array(
2: Stmt_Const(
consts: array(
0: Const(
- name: T_3
+ name: Identifier(
+ name: T_3
+ )
value: Expr_BinaryOp_Plus(
left: Scalar_DNumber(
value: 1.5
@@ -89,7 +95,9 @@ array(
3: Stmt_Const(
consts: array(
0: Const(
- name: T_4
+ name: Identifier(
+ name: T_4
+ )
value: Expr_BinaryOp_Concat(
left: Scalar_String(
value: foo
@@ -104,7 +112,9 @@ array(
4: Stmt_Const(
consts: array(
0: Const(
- name: T_5
+ name: Identifier(
+ name: T_5
+ )
value: Expr_BinaryOp_Mul(
left: Expr_BinaryOp_Plus(
left: Scalar_DNumber(
@@ -124,7 +134,9 @@ array(
5: Stmt_Const(
consts: array(
0: Const(
- name: T_6
+ name: Identifier(
+ name: T_6
+ )
value: Expr_BinaryOp_Concat(
left: Expr_BinaryOp_Concat(
left: Expr_BinaryOp_Concat(
@@ -149,7 +161,9 @@ array(
6: Stmt_Const(
consts: array(
0: Const(
- name: T_7
+ name: Identifier(
+ name: T_7
+ )
value: Scalar_MagicConst_Line(
)
)
@@ -158,7 +172,9 @@ array(
7: Stmt_Const(
consts: array(
0: Const(
- name: T_8
+ name: Identifier(
+ name: T_8
+ )
value: Scalar_String(
value: This is a test string
)
@@ -168,7 +184,9 @@ array(
8: Stmt_Const(
consts: array(
0: Const(
- name: T_9
+ name: Identifier(
+ name: T_9
+ )
value: Expr_BitwiseNot(
expr: Expr_UnaryMinus(
expr: Scalar_LNumber(
@@ -182,7 +200,9 @@ array(
9: Stmt_Const(
consts: array(
0: Const(
- name: T_10
+ name: Identifier(
+ name: T_10
+ )
value: Expr_BinaryOp_Plus(
left: Expr_Ternary(
cond: Expr_UnaryMinus(
@@ -213,7 +233,9 @@ array(
10: Stmt_Const(
consts: array(
0: Const(
- name: T_11
+ name: Identifier(
+ name: T_11
+ )
value: Expr_BinaryOp_BooleanAnd(
left: Scalar_LNumber(
value: 1
@@ -228,7 +250,9 @@ array(
11: Stmt_Const(
consts: array(
0: Const(
- name: T_12
+ name: Identifier(
+ name: T_12
+ )
value: Expr_BinaryOp_LogicalAnd(
left: Scalar_LNumber(
value: 1
@@ -243,7 +267,9 @@ array(
12: Stmt_Const(
consts: array(
0: Const(
- name: T_13
+ name: Identifier(
+ name: T_13
+ )
value: Expr_BinaryOp_BooleanOr(
left: Scalar_LNumber(
value: 0
@@ -258,7 +284,9 @@ array(
13: Stmt_Const(
consts: array(
0: Const(
- name: T_14
+ name: Identifier(
+ name: T_14
+ )
value: Expr_BinaryOp_LogicalOr(
left: Scalar_LNumber(
value: 1
@@ -273,7 +301,9 @@ array(
14: Stmt_Const(
consts: array(
0: Const(
- name: T_15
+ name: Identifier(
+ name: T_15
+ )
value: Expr_BinaryOp_LogicalXor(
left: Scalar_LNumber(
value: 1
@@ -288,7 +318,9 @@ array(
15: Stmt_Const(
consts: array(
0: Const(
- name: T_16
+ name: Identifier(
+ name: T_16
+ )
value: Expr_BinaryOp_LogicalXor(
left: Scalar_LNumber(
value: 1
@@ -303,7 +335,9 @@ array(
16: Stmt_Const(
consts: array(
0: Const(
- name: T_17
+ name: Identifier(
+ name: T_17
+ )
value: Expr_BinaryOp_Smaller(
left: Scalar_LNumber(
value: 1
@@ -318,7 +352,9 @@ array(
17: Stmt_Const(
consts: array(
0: Const(
- name: T_18
+ name: Identifier(
+ name: T_18
+ )
value: Expr_BinaryOp_SmallerOrEqual(
left: Scalar_LNumber(
value: 0
@@ -333,7 +369,9 @@ array(
18: Stmt_Const(
consts: array(
0: Const(
- name: T_19
+ name: Identifier(
+ name: T_19
+ )
value: Expr_BinaryOp_Greater(
left: Scalar_LNumber(
value: 1
@@ -348,7 +386,9 @@ array(
19: Stmt_Const(
consts: array(
0: Const(
- name: T_20
+ name: Identifier(
+ name: T_20
+ )
value: Expr_BinaryOp_GreaterOrEqual(
left: Scalar_LNumber(
value: 1
@@ -363,7 +403,9 @@ array(
20: Stmt_Const(
consts: array(
0: Const(
- name: T_21
+ name: Identifier(
+ name: T_21
+ )
value: Expr_BinaryOp_Identical(
left: Scalar_LNumber(
value: 1
@@ -378,7 +420,9 @@ array(
21: Stmt_Const(
consts: array(
0: Const(
- name: T_22
+ name: Identifier(
+ name: T_22
+ )
value: Expr_BinaryOp_NotIdentical(
left: Scalar_LNumber(
value: 1
@@ -393,7 +437,9 @@ array(
22: Stmt_Const(
consts: array(
0: Const(
- name: T_23
+ name: Identifier(
+ name: T_23
+ )
value: Expr_BinaryOp_NotEqual(
left: Scalar_LNumber(
value: 0
@@ -408,7 +454,9 @@ array(
23: Stmt_Const(
consts: array(
0: Const(
- name: T_24
+ name: Identifier(
+ name: T_24
+ )
value: Expr_BinaryOp_Equal(
left: Scalar_LNumber(
value: 1
@@ -423,7 +471,9 @@ array(
24: Stmt_Const(
consts: array(
0: Const(
- name: T_25
+ name: Identifier(
+ name: T_25
+ )
value: Expr_BinaryOp_Plus(
left: Scalar_LNumber(
value: 1
@@ -443,7 +493,9 @@ array(
25: Stmt_Const(
consts: array(
0: Const(
- name: T_26
+ name: Identifier(
+ name: T_26
+ )
value: Expr_BinaryOp_Plus(
left: Expr_BinaryOp_Plus(
left: Scalar_String(
@@ -463,7 +515,9 @@ array(
26: Stmt_Const(
consts: array(
0: Const(
- name: T_27
+ name: Identifier(
+ name: T_27
+ )
value: Expr_BinaryOp_Pow(
left: Scalar_LNumber(
value: 2
@@ -478,7 +532,9 @@ array(
27: Stmt_Const(
consts: array(
0: Const(
- name: T_28
+ name: Identifier(
+ name: T_28
+ )
value: Expr_ArrayDimFetch(
var: Expr_Array(
items: array(
@@ -515,7 +571,9 @@ array(
28: Stmt_Const(
consts: array(
0: Const(
- name: T_29
+ name: Identifier(
+ name: T_29
+ )
value: Expr_BinaryOp_Minus(
left: Scalar_LNumber(
value: 12
@@ -530,7 +588,9 @@ array(
29: Stmt_Const(
consts: array(
0: Const(
- name: T_30
+ name: Identifier(
+ name: T_30
+ )
value: Expr_BinaryOp_BitwiseXor(
left: Scalar_LNumber(
value: 12
@@ -545,7 +605,9 @@ array(
30: Stmt_Const(
consts: array(
0: Const(
- name: T_31
+ name: Identifier(
+ name: T_31
+ )
value: Expr_BinaryOp_BitwiseAnd(
left: Scalar_LNumber(
value: 12
@@ -560,7 +622,9 @@ array(
31: Stmt_Const(
consts: array(
0: Const(
- name: T_32
+ name: Identifier(
+ name: T_32
+ )
value: Expr_BinaryOp_BitwiseOr(
left: Scalar_LNumber(
value: 12
@@ -575,7 +639,9 @@ array(
32: Stmt_Const(
consts: array(
0: Const(
- name: T_33
+ name: Identifier(
+ name: T_33
+ )
value: Expr_BinaryOp_Mod(
left: Scalar_LNumber(
value: 12
@@ -590,7 +656,9 @@ array(
33: Stmt_Const(
consts: array(
0: Const(
- name: T_34
+ name: Identifier(
+ name: T_34
+ )
value: Expr_BinaryOp_ShiftRight(
left: Scalar_LNumber(
value: 100
@@ -605,7 +673,9 @@ array(
34: Stmt_Const(
consts: array(
0: Const(
- name: T_35
+ name: Identifier(
+ name: T_35
+ )
value: Expr_BooleanNot(
expr: Expr_ConstFetch(
name: Name(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test b/app/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
index ce3fce96a..7f099988a 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/errorSuppress.test
@@ -4,9 +4,11 @@ Error suppression
@$a;
-----
array(
- 0: Expr_ErrorSuppress(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_ErrorSuppress(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/exit.test b/app/vendor/nikic/php-parser/test/code/parser/expr/exit.test
index 8f21e5ba9..c880921f3 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/exit.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/exit.test
@@ -9,26 +9,38 @@ die();
die('Exit!');
-----
array(
- 0: Expr_Exit(
- expr: null
+ 0: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
)
- 1: Expr_Exit(
- expr: null
+ 1: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
)
- 2: Expr_Exit(
- expr: Scalar_String(
- value: Die!
+ 2: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Scalar_String(
+ value: Die!
+ )
)
)
- 3: Expr_Exit(
- expr: null
+ 3: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
)
- 4: Expr_Exit(
- expr: null
+ 4: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: null
+ )
)
- 5: Expr_Exit(
- expr: Scalar_String(
- value: Exit!
+ 5: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Scalar_String(
+ value: Exit!
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
index 6d7352099..24ca03105 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/args.test
@@ -9,90 +9,100 @@ f(&$a);
f($a, ...$b);
-----
array(
- 0: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
- 1: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 2: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
)
- byRef: false
- unpack: false
)
- 1: Arg(
- value: Expr_Variable(
- name: b
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 3: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: true
+ unpack: false
)
- byRef: true
- unpack: false
)
)
)
- 4: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: f
- )
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: f
)
- byRef: false
- unpack: false
)
- 1: Arg(
- value: Expr_Variable(
- name: b
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: true
)
- byRef: false
- unpack: true
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
index 7686d2d96..d00084baf 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constFetch.test
@@ -7,27 +7,37 @@ A::B;
A::class;
-----
array(
- 0: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: A
+ )
)
)
)
- 1: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: B
)
)
- name: B
)
- 2: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 2: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: class
)
)
- name: class
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
index 682f78082..4d14c09ad 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/constantDeref.test
@@ -16,216 +16,238 @@ Foo::BAR[1];
$foo::BAR[2][1][0];
-----
array(
- 0: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: abc
- )
- dim: Scalar_LNumber(
- value: 2
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: abc
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
)
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: abc
+ var: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: abc
+ )
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
dim: Scalar_LNumber(
- value: 2
+ value: 0
)
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
- 2: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- dim: Scalar_LNumber(
- value: 2
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
)
- 3: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
dim: Scalar_LNumber(
- value: 2
+ value: 0
)
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
- 4: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
+ )
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- dim: Scalar_LNumber(
- value: 2
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
)
- 5: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 5: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
+ dim: Scalar_LNumber(
+ value: 2
+ )
)
dim: Scalar_LNumber(
- value: 2
+ value: 0
)
)
dim: Scalar_LNumber(
value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
- 6: Expr_ArrayDimFetch(
- var: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: FOO
+ 6: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: FOO
+ )
)
)
- )
- dim: Scalar_LNumber(
- value: 0
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
)
- 7: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Foo
+ 7: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Identifier(
+ name: BAR
)
)
- name: BAR
- )
- dim: Scalar_LNumber(
- value: 1
+ dim: Scalar_LNumber(
+ value: 1
+ )
)
)
- 8: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Expr_Variable(
- name: foo
+ var: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: BAR
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 2
)
- name: BAR
)
dim: Scalar_LNumber(
- value: 2
+ value: 1
)
)
dim: Scalar_LNumber(
- value: 1
+ value: 0
)
)
- dim: Scalar_LNumber(
- value: 0
- )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
index 62f69e347..4a8265140 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/funcCall.test
@@ -16,115 +16,141 @@ $a->b['c']();
a()['b'];
-----
array(
- 0: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: a
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: a
+ )
+ comments: array(
+ 0: // function name variations
+ )
+ )
+ args: array(
)
comments: array(
0: // function name variations
)
)
- args: array(
- )
comments: array(
0: // function name variations
)
)
- 1: Expr_FuncCall(
- name: Expr_Variable(
- name: a
- )
- args: array(
- )
- )
- 2: Expr_FuncCall(
- name: Expr_Variable(
- name: Scalar_String(
- value: a
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: a
+ )
+ args: array(
)
- )
- args: array(
)
)
- 3: Expr_FuncCall(
- name: Expr_Variable(
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_Variable(
- name: a
+ name: Scalar_String(
+ value: a
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
- 4: Expr_FuncCall(
- name: Expr_Variable(
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_Variable(
name: Expr_Variable(
name: a
)
)
- )
- args: array(
+ args: array(
+ )
)
)
- 5: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
+ )
)
- dim: Scalar_String(
- value: b
+ args: array(
)
)
- args: array(
- )
)
- 6: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 5: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
- dim: Scalar_String(
- value: b
+ args: array(
)
)
- args: array(
- )
)
- 7: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
+ 6: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
- name: b
+ dim: Scalar_String(
+ value: b
+ )
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
+ )
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ args: array(
+ )
)
)
- 8: Expr_ArrayDimFetch(
- var: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: a
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: a
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ args: array(
)
comments: array(
0: // array dereferencing
)
)
- args: array(
+ dim: Scalar_String(
+ value: b
)
comments: array(
0: // array dereferencing
)
)
- dim: Scalar_String(
- value: b
- )
comments: array(
0: // array dereferencing
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
index 5e36ff810..a4b7a7240 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/newDeref.test
@@ -8,48 +8,42 @@ New expression dereferencing
(new A)['b']['c'];
-----
array(
- 0: Expr_PropertyFetch(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- args: array(
- )
- )
- name: b
- )
- 1: Expr_MethodCall(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ args: array(
)
)
- args: array(
+ name: Identifier(
+ name: b
)
)
- name: b
- args: array(
- )
)
- 2: Expr_ArrayDimFetch(
- var: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
)
)
+ name: Identifier(
+ name: b
+ )
args: array(
)
)
- dim: Scalar_String(
- value: b
- )
)
- 3: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_New(
class: Name(
parts: array(
@@ -63,8 +57,26 @@ array(
value: b
)
)
- dim: Scalar_String(
- value: c
+ )
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
+ )
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
index 584461bde..2d1808b05 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/objectAccess.test
@@ -19,123 +19,162 @@ $a->b(){'c'}; // invalid PHP: drop Support?
-----
!!php5
array(
- 0: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // property fetch variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
comments: array(
0: // property fetch variations
)
)
- name: b
comments: array(
0: // property fetch variations
)
)
- 1: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- name: b
)
- dim: Scalar_String(
- value: c
+ )
+ 2: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
+ )
)
)
- 2: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
+ 3: Stmt_Expression(
+ expr: Expr_MethodCall(
var: Expr_Variable(
name: a
+ comments: array(
+ 0: // method call variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
- name: b
- )
- dim: Scalar_String(
- value: c
- )
- )
- 3: Expr_MethodCall(
- var: Expr_Variable(
- name: a
comments: array(
0: // method call variations
)
)
- name: b
- args: array(
- )
comments: array(
0: // method call variations
)
)
- 4: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Scalar_String(
- value: b
- )
- args: array(
- )
- )
- 5: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Expr_Variable(
- name: b
- )
- args: array(
+ 4: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Scalar_String(
+ value: b
+ )
+ args: array(
+ )
)
)
- 6: Expr_MethodCall(
- var: Expr_Variable(
- name: a
- )
- name: Expr_ArrayDimFetch(
+ 5: Stmt_Expression(
+ expr: Expr_MethodCall(
var: Expr_Variable(
+ name: a
+ )
+ name: Expr_Variable(
name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 7: Expr_ArrayDimFetch(
- var: Expr_MethodCall(
+ 6: Stmt_Expression(
+ expr: Expr_MethodCall(
var: Expr_Variable(
name: a
+ )
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: b
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
comments: array(
0: // array dereferencing
)
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
comments: array(
0: // array dereferencing
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
0: // array dereferencing
)
)
- 8: Expr_ArrayDimFetch(
- var: Expr_MethodCall(
- var: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_MethodCall(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
)
- dim: Scalar_String(
- value: c
- )
)
9: Stmt_Nop(
comments: array(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
index ea3f9ef43..133771b75 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/simpleArrayAccess.test
@@ -9,16 +9,8 @@ $a{'b'};
${$a}['b'];
-----
array(
- 0: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
- )
- )
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_Variable(
name: a
)
@@ -26,37 +18,55 @@ array(
value: b
)
)
- dim: Scalar_String(
- value: c
- )
)
- 2: Expr_Assign(
- var: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- dim: null
- )
- expr: Expr_Variable(
- name: b
)
)
- 3: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
- )
- dim: Scalar_String(
- value: b
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: null
+ )
+ expr: Expr_Variable(
+ name: b
+ )
)
)
- 4: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: Expr_Variable(
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Variable(
name: a
)
+ dim: Scalar_String(
+ value: b
+ )
)
- dim: Scalar_String(
- value: b
+ )
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
index b806f7de4..a34a3e4bc 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticCall.test
@@ -20,71 +20,65 @@ $a['b']::c();
-----
!!php5
array(
- 0: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // method name variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
comments: array(
0: // method name variations
)
)
- name: b
- args: array(
- )
comments: array(
0: // method name variations
)
)
- 1: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Scalar_String(
- value: b
- )
- args: array(
- )
- )
- 2: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ name: Scalar_String(
+ value: b
+ )
+ args: array(
)
- )
- name: Expr_Variable(
- name: b
- )
- args: array(
)
)
- 3: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 2: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
+ name: Expr_Variable(
name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 4: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: A
+ 3: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ name: Expr_ArrayDimFetch(
var: Expr_Variable(
name: b
)
@@ -92,82 +86,129 @@ array(
value: c
)
)
- dim: Scalar_String(
- value: d
+ args: array(
)
)
- args: array(
- )
)
- 5: Expr_ArrayDimFetch(
- var: Expr_StaticCall(
+ 4: Stmt_Expression(
+ expr: Expr_StaticCall(
class: Name(
parts: array(
0: A
)
+ )
+ name: Expr_ArrayDimFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: b
+ )
+ dim: Scalar_String(
+ value: c
+ )
+ )
+ dim: Scalar_String(
+ value: d
+ )
+ )
+ args: array(
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // array dereferencing
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
comments: array(
0: // array dereferencing
)
)
- name: b
- args: array(
+ dim: Scalar_String(
+ value: c
)
comments: array(
0: // array dereferencing
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
0: // array dereferencing
)
)
- 6: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: static
+ 6: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: static
+ )
+ comments: array(
+ 0: // class name variations
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
comments: array(
0: // class name variations
)
)
- name: b
- args: array(
- )
comments: array(
0: // class name variations
)
)
- 7: Expr_StaticCall(
- class: Expr_Variable(
- name: a
- )
- name: b
- args: array(
+ 7: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
+ )
)
)
- 8: Expr_StaticCall(
- class: Expr_Variable(
- name: Scalar_String(
- value: a
+ 8: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_Variable(
+ name: Scalar_String(
+ value: a
+ )
+ )
+ name: Identifier(
+ name: b
+ )
+ args: array(
)
- )
- name: b
- args: array(
)
)
- 9: Expr_StaticCall(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 9: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
- dim: Scalar_String(
- value: b
+ name: Identifier(
+ name: c
+ )
+ args: array(
)
- )
- name: c
- args: array(
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
index 3d3cde510..a1de3c8c1 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/fetchAndCall/staticPropertyFetch.test
@@ -14,73 +14,95 @@ A::$b{'c'};
// class name variations can be found in staticCall.test
-----
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // property name variations
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
comments: array(
0: // property name variations
)
)
- name: b
comments: array(
0: // property name variations
)
)
- 1: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- name: Expr_Variable(
- name: b
- )
- )
- 2: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ name: Expr_Variable(
+ name: b
)
)
- name: Scalar_String(
- value: b
- )
)
- 3: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
+ 2: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
+ )
+ name: Scalar_String(
+ value: b
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ comments: array(
+ 0: // array access
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
comments: array(
0: // array access
)
)
- name: b
+ dim: Scalar_String(
+ value: c
+ )
comments: array(
0: // array access
)
)
- dim: Scalar_String(
- value: c
- )
comments: array(
0: // array access
)
)
- 4: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 4: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
- )
- dim: Scalar_String(
- value: c
+ dim: Scalar_String(
+ value: c
+ )
)
)
5: Stmt_Nop(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test b/app/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
index 8870ea5e7..0ab189081 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/includeAndEval.test
@@ -8,33 +8,43 @@ require_once 'A.php';
eval('A');
-----
array(
- 0: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 0: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_INCLUDE (1)
)
- type: TYPE_INCLUDE (1)
)
- 1: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 1: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_INCLUDE_ONCE (2)
)
- type: TYPE_INCLUDE_ONCE (2)
)
- 2: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 2: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_REQUIRE (3)
)
- type: TYPE_REQUIRE (3)
)
- 3: Expr_Include(
- expr: Scalar_String(
- value: A.php
+ 3: Stmt_Expression(
+ expr: Expr_Include(
+ expr: Scalar_String(
+ value: A.php
+ )
+ type: TYPE_REQUIRE_ONCE (4)
)
- type: TYPE_REQURE_ONCE (4)
)
- 4: Expr_Eval(
- expr: Scalar_String(
- value: A
+ 4: Stmt_Expression(
+ expr: Expr_Eval(
+ expr: Scalar_String(
+ value: A
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test b/app/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
index 3a43d0d42..cd074b1a4 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/issetAndEmpty.test
@@ -9,65 +9,75 @@ empty(foo());
empty(array(1, 2, 3));
-----
array(
- 0: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
)
)
)
- 1: Expr_Isset(
- vars: array(
- 0: Expr_Variable(
- name: a
- )
- 1: Expr_Variable(
- name: b
- )
- 2: Expr_Variable(
- name: c
+ 1: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ 2: Expr_Variable(
+ name: c
+ )
)
)
)
- 2: Expr_Empty(
- expr: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 3: Expr_Empty(
- expr: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
+ 3: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
)
- 4: Expr_Empty(
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 4: Stmt_Expression(
+ expr: Expr_Empty(
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 2
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 2
+ )
+ byRef: false
)
- byRef: false
- )
- 2: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 3
+ 2: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 3
+ )
+ byRef: false
)
- byRef: false
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test b/app/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test
new file mode 100644
index 000000000..fd9b1e87c
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/listReferences.test
@@ -0,0 +1,88 @@
+List reference assignments (PHP 7.3)
+-----
+ &$v) = $x;
+[&$v] = $x;
+['k' => &$v] = $x;
+-----
+!!php7
+array(
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: k
+ )
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: k
+ )
+ value: Expr_Variable(
+ name: v
+ )
+ byRef: true
+ )
+ )
+ )
+ expr: Expr_Variable(
+ name: x
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test b/app/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
index 48e9637a6..d0cfbb5ff 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/listWithKeys.test
@@ -7,69 +7,73 @@ list('a' => list($b => $c), 'd' => $e) = $x;
-----
!!php7
array(
- 0: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Expr_Variable(
- name: b
+ 0: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Scalar_String(
- value: b
+ expr: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- byRef: false
)
)
)
)
- 1: Expr_Assign(
- var: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Expr_List(
- items: array(
- 0: Expr_ArrayItem(
- key: Expr_Variable(
- name: b
- )
- value: Expr_Variable(
- name: c
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Expr_List(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Expr_Variable(
+ name: b
+ )
+ value: Expr_Variable(
+ name: c
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: Scalar_String(
- value: d
- )
- value: Expr_Variable(
- name: e
+ 1: Expr_ArrayItem(
+ key: Scalar_String(
+ value: d
+ )
+ value: Expr_Variable(
+ name: e
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- expr: Expr_Variable(
- name: x
+ expr: Expr_Variable(
+ name: x
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/logic.test b/app/vendor/nikic/php-parser/test/code/parser/expr/logic.test
index b3634e91a..6b434565f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/logic.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/logic.test
@@ -21,139 +21,170 @@ $a = $b || $c;
$a = $b or $c;
-----
array(
- 0: Expr_BinaryOp_BooleanAnd(
- left: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // boolean ops
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
comments: array(
0: // boolean ops
)
)
- right: Expr_Variable(
- name: b
- )
comments: array(
0: // boolean ops
)
)
- 1: Expr_BinaryOp_BooleanOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 2: Expr_BooleanNot(
- expr: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanOr(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 3: Expr_BooleanNot(
+ 2: Stmt_Expression(
expr: Expr_BooleanNot(
expr: Expr_Variable(
name: a
)
)
)
- 4: Expr_BinaryOp_LogicalAnd(
- left: Expr_Variable(
- name: a
- comments: array(
- 0: // logical ops
+ 3: Stmt_Expression(
+ expr: Expr_BooleanNot(
+ expr: Expr_BooleanNot(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- right: Expr_Variable(
- name: b
- )
- comments: array(
- 0: // logical ops
- )
- )
- 5: Expr_BinaryOp_LogicalOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
)
- 6: Expr_BinaryOp_LogicalXor(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 7: Expr_BinaryOp_BooleanOr(
- left: Expr_BinaryOp_BooleanAnd(
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalAnd(
left: Expr_Variable(
name: a
comments: array(
- 0: // precedence
+ 0: // logical ops
)
)
right: Expr_Variable(
name: b
)
comments: array(
- 0: // precedence
+ 0: // logical ops
)
)
- right: Expr_BinaryOp_BooleanAnd(
+ comments: array(
+ 0: // logical ops
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
left: Expr_Variable(
- name: c
+ name: a
)
right: Expr_Variable(
- name: d
+ name: b
)
)
- comments: array(
- 0: // precedence
- )
)
- 8: Expr_BinaryOp_BooleanAnd(
- left: Expr_BinaryOp_BooleanAnd(
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalXor(
left: Expr_Variable(
name: a
)
- right: Expr_BinaryOp_BooleanOr(
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanOr(
+ left: Expr_BinaryOp_BooleanAnd(
left: Expr_Variable(
- name: b
+ name: a
+ comments: array(
+ 0: // precedence
+ )
)
right: Expr_Variable(
+ name: b
+ )
+ comments: array(
+ 0: // precedence
+ )
+ )
+ right: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
name: c
)
+ right: Expr_Variable(
+ name: d
+ )
+ )
+ comments: array(
+ 0: // precedence
)
)
- right: Expr_Variable(
- name: d
+ comments: array(
+ 0: // precedence
)
)
- 9: Expr_Assign(
- var: Expr_Variable(
- name: a
- )
- expr: Expr_BinaryOp_BooleanOr(
- left: Expr_Variable(
- name: b
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_BooleanAnd(
+ left: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_BinaryOp_BooleanOr(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
)
right: Expr_Variable(
- name: c
+ name: d
)
)
)
- 10: Expr_BinaryOp_LogicalOr(
- left: Expr_Assign(
+ 9: Stmt_Expression(
+ expr: Expr_Assign(
var: Expr_Variable(
name: a
)
- expr: Expr_Variable(
- name: b
+ expr: Expr_BinaryOp_BooleanOr(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
)
- right: Expr_Variable(
- name: c
+ )
+ 10: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Assign(
+ var: Expr_Variable(
+ name: a
+ )
+ expr: Expr_Variable(
+ name: b
+ )
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/math.test b/app/vendor/nikic/php-parser/test/code/parser/expr/math.test
index 3c00ebc70..8399400c0 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/math.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/math.test
@@ -34,223 +34,280 @@ $a ** $b ** $c;
($a ** $b) ** $c;
-----
array(
- 0: Expr_BitwiseNot(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_BitwiseNot(
+ expr: Expr_Variable(
+ name: a
+ )
+ comments: array(
+ 0: // unary ops
+ )
)
comments: array(
0: // unary ops
)
)
- 1: Expr_UnaryPlus(
- expr: Expr_Variable(
- name: a
+ 1: Stmt_Expression(
+ expr: Expr_UnaryPlus(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 2: Expr_UnaryMinus(
- expr: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_UnaryMinus(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
- 3: Expr_BinaryOp_BitwiseAnd(
- left: Expr_Variable(
- name: a
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseAnd(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // binary ops
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
comments: array(
0: // binary ops
)
)
- right: Expr_Variable(
- name: b
- )
comments: array(
0: // binary ops
)
)
- 4: Expr_BinaryOp_BitwiseOr(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
- )
- )
- 5: Expr_BinaryOp_BitwiseXor(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseOr(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 6: Expr_BinaryOp_Concat(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_BitwiseXor(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 7: Expr_BinaryOp_Div(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 6: Stmt_Expression(
+ expr: Expr_BinaryOp_Concat(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 8: Expr_BinaryOp_Minus(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_Div(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 9: Expr_BinaryOp_Mod(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 8: Stmt_Expression(
+ expr: Expr_BinaryOp_Minus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 10: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 9: Stmt_Expression(
+ expr: Expr_BinaryOp_Mod(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 11: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 10: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 12: Expr_BinaryOp_ShiftLeft(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 11: Stmt_Expression(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 13: Expr_BinaryOp_ShiftRight(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 12: Stmt_Expression(
+ expr: Expr_BinaryOp_ShiftLeft(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 14: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
- )
- right: Expr_Variable(
- name: b
+ 13: Stmt_Expression(
+ expr: Expr_BinaryOp_ShiftRight(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
)
- 15: Expr_BinaryOp_Mul(
- left: Expr_BinaryOp_Mul(
+ 14: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
left: Expr_Variable(
name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 15: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // associativity
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
comments: array(
0: // associativity
)
)
right: Expr_Variable(
- name: b
+ name: c
)
comments: array(
0: // associativity
)
)
- right: Expr_Variable(
- name: c
- )
comments: array(
0: // associativity
)
)
- 16: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: a
- )
- right: Expr_BinaryOp_Mul(
+ 16: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
left: Expr_Variable(
- name: b
+ name: a
)
- right: Expr_Variable(
- name: c
+ right: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
)
)
- 17: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: a
+ 17: Stmt_Expression(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // precedence
+ )
+ )
+ right: Expr_BinaryOp_Mul(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
+ )
comments: array(
0: // precedence
)
)
- right: Expr_BinaryOp_Mul(
- left: Expr_Variable(
- name: b
+ comments: array(
+ 0: // precedence
+ )
+ )
+ 18: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
name: c
)
)
- comments: array(
- 0: // precedence
- )
)
- 18: Expr_BinaryOp_Mul(
- left: Expr_BinaryOp_Plus(
+ 19: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
left: Expr_Variable(
name: a
+ comments: array(
+ 0: // pow is special
+ )
)
- right: Expr_Variable(
- name: b
+ right: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
- )
- right: Expr_Variable(
- name: c
- )
- )
- 19: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
comments: array(
0: // pow is special
)
)
- right: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: b
- )
- right: Expr_Variable(
- name: c
- )
- )
comments: array(
0: // pow is special
)
)
- 20: Expr_BinaryOp_Pow(
- left: Expr_BinaryOp_Pow(
- left: Expr_Variable(
- name: a
+ 20: Stmt_Expression(
+ expr: Expr_BinaryOp_Pow(
+ left: Expr_BinaryOp_Pow(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
- name: b
+ name: c
)
)
- right: Expr_Variable(
- name: c
- )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/new.test b/app/vendor/nikic/php-parser/test/code/parser/expr/new.test
index a132bbb45..2735bfe93 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/new.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/new.test
@@ -19,128 +19,169 @@ new $a->b{'c'}();
(new A);
-----
array(
- 0: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
)
- )
- args: array(
)
)
- 1: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: b
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 2: Expr_New(
- class: Expr_Variable(
- name: a
- )
- args: array(
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_Variable(
+ name: a
+ )
+ args: array(
+ )
+ comments: array(
+ 0: // class name variations
+ )
)
comments: array(
0: // class name variations
)
)
- 3: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
- dim: Scalar_String(
- value: b
+ args: array(
)
)
- args: array(
- )
)
- 4: Expr_New(
- class: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 4: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
- )
- args: array(
+ args: array(
+ )
)
)
- 5: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 5: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ args: array(
+ )
+ comments: array(
+ 0: // DNCR object access
)
- name: b
- )
- args: array(
)
comments: array(
0: // DNCR object access
)
)
- 6: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 6: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_PropertyFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ name: Identifier(
+ name: c
)
- name: b
)
- name: c
- )
- args: array(
+ args: array(
+ )
)
)
- 7: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 7: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 8: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Variable(
- name: a
+ 8: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ name: Identifier(
+ name: b
+ )
+ )
+ dim: Scalar_String(
+ value: c
)
- name: b
)
- dim: Scalar_String(
- value: c
+ args: array(
)
)
- args: array(
- )
)
- 9: Expr_New(
- class: Name(
- parts: array(
- 0: A
+ 9: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ args: array(
)
)
- args: array(
+ comments: array(
+ 0: // test regression introduces by new dereferencing syntax
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test b/app/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
index ca7f4981e..318f9301f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/newWithoutClass.test
@@ -14,10 +14,12 @@ new;
!!php7
Syntax error, unexpected ';' from 2:4 to 2:4
array(
- 0: Expr_New(
- class: Expr_Error(
- )
- args: array(
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_Error(
+ )
+ args: array(
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/print.test b/app/vendor/nikic/php-parser/test/code/parser/expr/print.test
index d07afda09..84ed7775b 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/print.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/print.test
@@ -4,9 +4,11 @@ Print
print $a;
-----
array(
- 0: Expr_Print(
- expr: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Print(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test b/app/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
index 2304fd985..115d9f0a3 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/shellExec.test
@@ -8,38 +8,48 @@ Shell execution
`test \"`;
-----
array(
- 0: Expr_ShellExec(
- parts: array(
+ 0: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ )
)
)
- 1: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test
+ 1: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test
+ )
)
)
)
- 2: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test
- )
- 1: Expr_Variable(
- name: A
+ 2: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test
+ )
+ 1: Expr_Variable(
+ name: A
+ )
)
)
)
- 3: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test `
+ 3: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test `
+ )
)
)
)
- 4: Expr_ShellExec(
- parts: array(
- 0: Scalar_EncapsedStringPart(
- value: test \"
+ 4: Stmt_Expression(
+ expr: Expr_ShellExec(
+ parts: array(
+ 0: Scalar_EncapsedStringPart(
+ value: test \"
+ )
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test b/app/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
index 268935dbd..ea1010caa 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/ternaryAndCoalesce.test
@@ -17,133 +17,158 @@ $a ?? $b ? $c : $d;
$a && $b ?? $c;
-----
array(
- 0: Expr_Ternary(
- cond: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // ternary
+ )
+ )
+ if: Expr_Variable(
+ name: b
+ )
+ else: Expr_Variable(
+ name: c
+ )
comments: array(
0: // ternary
)
)
- if: Expr_Variable(
- name: b
- )
- else: Expr_Variable(
- name: c
- )
comments: array(
0: // ternary
)
)
- 1: Expr_Ternary(
- cond: Expr_Variable(
- name: a
- )
- if: null
- else: Expr_Variable(
- name: c
- )
- )
- 2: Expr_Ternary(
- cond: Expr_Ternary(
+ 1: Stmt_Expression(
+ expr: Expr_Ternary(
cond: Expr_Variable(
name: a
+ )
+ if: null
+ else: Expr_Variable(
+ name: c
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_Ternary(
+ cond: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // precedence
+ )
+ )
+ if: Expr_Variable(
+ name: b
+ )
+ else: Expr_Variable(
+ name: c
+ )
comments: array(
0: // precedence
)
)
if: Expr_Variable(
- name: b
+ name: d
)
else: Expr_Variable(
- name: c
+ name: e
)
comments: array(
0: // precedence
)
)
- if: Expr_Variable(
- name: d
- )
- else: Expr_Variable(
- name: e
- )
comments: array(
0: // precedence
)
)
- 3: Expr_Ternary(
- cond: Expr_Variable(
- name: a
- )
- if: Expr_Variable(
- name: b
- )
- else: Expr_Ternary(
+ 3: Stmt_Expression(
+ expr: Expr_Ternary(
cond: Expr_Variable(
- name: c
+ name: a
)
if: Expr_Variable(
- name: d
+ name: b
)
- else: Expr_Variable(
- name: e
+ else: Expr_Ternary(
+ cond: Expr_Variable(
+ name: c
+ )
+ if: Expr_Variable(
+ name: d
+ )
+ else: Expr_Variable(
+ name: e
+ )
)
)
)
- 4: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: a
+ comments: array(
+ 0: // null coalesce
+ )
+ )
+ right: Expr_Variable(
+ name: b
+ )
comments: array(
0: // null coalesce
)
)
- right: Expr_Variable(
- name: b
- )
comments: array(
0: // null coalesce
)
)
- 5: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
- )
- right: Expr_BinaryOp_Coalesce(
+ 5: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
left: Expr_Variable(
- name: b
+ name: a
)
- right: Expr_Variable(
- name: c
+ right: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: b
+ )
+ right: Expr_Variable(
+ name: c
+ )
)
)
)
- 6: Expr_Ternary(
- cond: Expr_BinaryOp_Coalesce(
- left: Expr_Variable(
- name: a
+ 6: Stmt_Expression(
+ expr: Expr_Ternary(
+ cond: Expr_BinaryOp_Coalesce(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
- right: Expr_Variable(
- name: b
+ if: Expr_Variable(
+ name: c
+ )
+ else: Expr_Variable(
+ name: d
)
- )
- if: Expr_Variable(
- name: c
- )
- else: Expr_Variable(
- name: d
)
)
- 7: Expr_BinaryOp_Coalesce(
- left: Expr_BinaryOp_BooleanAnd(
- left: Expr_Variable(
- name: a
+ 7: Stmt_Expression(
+ expr: Expr_BinaryOp_Coalesce(
+ left: Expr_BinaryOp_BooleanAnd(
+ left: Expr_Variable(
+ name: a
+ )
+ right: Expr_Variable(
+ name: b
+ )
)
right: Expr_Variable(
- name: b
+ name: c
)
)
- right: Expr_Variable(
- name: c
- )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test b/app/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test
new file mode 100644
index 000000000..11092d981
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/trailingCommas.test
@@ -0,0 +1,140 @@
+PHP 7.3 trailing comma additions
+-----
+bar($a, $b, );
+Foo::bar($a, $b, );
+new Foo($a, $b, );
+unset($a, $b, );
+isset($a, $b, );
+-----
+!!php7
+array(
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: bar
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ name: Identifier(
+ name: bar
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
+ )
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 4: Stmt_Unset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_Variable(
+ name: a
+ )
+ 1: Expr_Variable(
+ name: b
+ )
+ )
+ )
+ )
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
index 4cd2e680f..5ae4f958e 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/globalNonSimpleVarError.test
@@ -15,10 +15,12 @@ array(
)
)
)
- 1: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: bar
+ 1: Stmt_Expression(
+ expr: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: bar
+ )
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
index bb3e7fbea..2f36cc7af 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/indirectCall.test
@@ -17,35 +17,8 @@ id(['udef', 'id'])[1]()('var_dump')(5);
-----
!!php7
array(
- 0: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: id
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_String(
- value: var_dump
- )
- byRef: false
- unpack: false
- )
- )
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 1
- )
- byRef: false
- unpack: false
- )
- )
- )
- 1: Expr_FuncCall(
- name: Expr_FuncCall(
+ 0: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Name(
parts: array(
@@ -55,7 +28,7 @@ array(
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -64,26 +37,17 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 1
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 2
- )
- byRef: false
- unpack: false
- )
- )
)
- 2: Expr_FuncCall(
- name: Expr_FuncCall(
+ 1: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Name(
@@ -92,123 +56,180 @@ array(
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 2
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 4
- )
- byRef: false
- unpack: false
- )
- )
)
- 3: Expr_FuncCall(
- name: Expr_FuncCall(
+ 2: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
name: Name(
parts: array(
0: id
)
)
args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: udef
+ )
+ )
+ args: array(
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 4
+ )
+ byRef: false
+ unpack: false
+ )
+ )
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: id
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: udef
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: id
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
+ dim: Scalar_LNumber(
+ value: 1
+ )
)
- dim: Scalar_LNumber(
- value: 1
+ args: array(
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 5
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 5
- )
- byRef: false
- unpack: false
- )
- )
)
- 4: Expr_FuncCall(
- name: Expr_FuncCall(
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: x
- default: null
+ name: Expr_FuncCall(
+ name: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: x
+ )
+ default: null
+ )
+ )
+ uses: array(
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Return(
+ expr: Expr_Variable(
+ name: x
+ )
+ )
)
)
- uses: array(
- )
- returnType: null
- stmts: array(
- 0: Stmt_Return(
- expr: Expr_Variable(
- name: x
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
)
+ byRef: false
+ unpack: false
)
)
)
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -217,72 +238,71 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 8
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 8
- )
- byRef: false
- unpack: false
- )
- )
)
- 5: Expr_FuncCall(
- name: Expr_FuncCall(
+ 5: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_Assign(
- var: Expr_Variable(
- name: f
- )
- expr: Expr_Closure(
- static: false
- byRef: false
- params: array(
- 0: Param(
- type: null
- byRef: false
- variadic: false
- name: x
- default: Expr_ConstFetch(
- name: Name(
- parts: array(
- 0: null
+ name: Expr_FuncCall(
+ name: Expr_Assign(
+ var: Expr_Variable(
+ name: f
+ )
+ expr: Expr_Closure(
+ static: false
+ byRef: false
+ params: array(
+ 0: Param(
+ type: null
+ byRef: false
+ variadic: false
+ var: Expr_Variable(
+ name: x
+ )
+ default: Expr_ConstFetch(
+ name: Name(
+ parts: array(
+ 0: null
+ )
)
)
)
)
- )
- uses: array(
- 0: Expr_ClosureUse(
- var: f
- byRef: true
- )
- )
- returnType: null
- stmts: array(
- 0: Stmt_Return(
- expr: Expr_Ternary(
- cond: Expr_Variable(
- name: x
- )
- if: null
- else: Expr_Variable(
+ uses: array(
+ 0: Expr_ClosureUse(
+ var: Expr_Variable(
name: f
)
+ byRef: true
+ )
+ )
+ returnType: null
+ stmts: array(
+ 0: Stmt_Return(
+ expr: Expr_Ternary(
+ cond: Expr_Variable(
+ name: x
+ )
+ if: null
+ else: Expr_Variable(
+ name: f
+ )
+ )
)
)
)
)
+ args: array(
+ )
)
args: array(
)
@@ -291,58 +311,67 @@ array(
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 9
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 9
- )
- byRef: false
- unpack: false
- )
- )
)
- 6: Expr_FuncCall(
- name: Expr_FuncCall(
+ 6: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Variable(
- name: obj
+ name: Expr_FuncCall(
+ name: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Variable(
+ name: obj
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_String(
- value: id
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
)
- byRef: false
)
)
+ args: array(
+ )
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: id
+ value: Expr_Variable(
+ name: id
)
byRef: false
unpack: false
@@ -351,8 +380,8 @@ array(
)
args: array(
0: Arg(
- value: Expr_Variable(
- name: id
+ value: Scalar_String(
+ value: var_dump
)
byRef: false
unpack: false
@@ -361,38 +390,40 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 10
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 10
- )
- byRef: false
- unpack: false
- )
- )
)
- 7: Expr_FuncCall(
- name: Expr_FuncCall(
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
name: Expr_FuncCall(
- name: Scalar_String(
- value: id
+ name: Expr_FuncCall(
+ name: Scalar_String(
+ value: id
+ )
+ args: array(
+ )
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: id
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
value: Scalar_String(
- value: id
+ value: var_dump
)
byRef: false
unpack: false
@@ -401,81 +432,76 @@ array(
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 12
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 12
- )
- byRef: false
- unpack: false
- )
- )
)
- 8: Expr_FuncCall(
- name: Expr_FuncCall(
+ 8: Stmt_Expression(
+ expr: Expr_FuncCall(
name: Expr_FuncCall(
- name: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: i
+ name: Expr_FuncCall(
+ name: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: i
+ )
+ right: Scalar_String(
+ value: d
+ )
)
- right: Scalar_String(
- value: d
+ args: array(
)
)
args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
)
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 13
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 13
- )
- byRef: false
- unpack: false
- )
- )
)
- 9: Expr_FuncCall(
- name: Expr_FuncCall(
- name: Scalar_String(
- value: \id
+ 9: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_FuncCall(
+ name: Scalar_String(
+ value: \id
+ )
+ args: array(
+ 0: Arg(
+ value: Scalar_String(
+ value: var_dump
+ )
+ byRef: false
+ unpack: false
+ )
+ )
)
args: array(
0: Arg(
- value: Scalar_String(
- value: var_dump
+ value: Scalar_LNumber(
+ value: 14
)
byRef: false
unpack: false
)
)
)
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 14
- )
- byRef: false
- unpack: false
- )
- )
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
index 35bc8ed19..68133a864 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/isset.test
@@ -8,67 +8,77 @@ isset("str"->a);
-----
!!php7
array(
- 0: Expr_Isset(
- vars: array(
- 0: Expr_ArrayDimFetch(
- var: Expr_BinaryOp_Plus(
- left: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 0
+ 0: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_ArrayDimFetch(
+ var: Expr_BinaryOp_Plus(
+ left: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 0
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
)
)
- )
- right: Expr_Array(
- items: array(
+ right: Expr_Array(
+ items: array(
+ )
)
)
- )
- dim: Scalar_LNumber(
- value: 0
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
)
)
)
- 1: Expr_Isset(
- vars: array(
- 0: Expr_PropertyFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Scalar_String(
- value: a
- )
- value: Scalar_String(
- value: b
+ 1: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_PropertyFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Scalar_String(
+ value: a
+ )
+ value: Scalar_String(
+ value: b
+ )
+ byRef: false
)
- byRef: false
)
)
+ name: Identifier(
+ name: a
+ )
)
- name: a
)
)
)
- 2: Expr_Isset(
- vars: array(
- 0: Expr_PropertyFetch(
- var: Scalar_String(
- value: str
+ 2: Stmt_Expression(
+ expr: Expr_Isset(
+ vars: array(
+ 0: Expr_PropertyFetch(
+ var: Scalar_String(
+ value: str
+ )
+ name: Identifier(
+ name: a
+ )
)
- name: a
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
index 2c5ba900e..73b515f08 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/misc.test
@@ -10,100 +10,118 @@ A::A[0][1][2];
-----
!!php7
array(
- 0: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: A
)
)
- name: A
- )
- dim: Scalar_LNumber(
- value: 0
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
)
- 1: Expr_ArrayDimFetch(
- var: Expr_ArrayDimFetch(
+ 1: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
var: Expr_ArrayDimFetch(
- var: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: A
+ var: Expr_ArrayDimFetch(
+ var: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Identifier(
+ name: A
)
)
- name: A
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
dim: Scalar_LNumber(
- value: 0
+ value: 1
)
)
dim: Scalar_LNumber(
- value: 1
+ value: 2
)
)
- dim: Scalar_LNumber(
- value: 2
- )
)
- 2: Expr_MethodCall(
- var: Scalar_String(
- value: string
- )
- name: length
- args: array(
+ 2: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Scalar_String(
+ value: string
+ )
+ name: Identifier(
+ name: length
+ )
+ args: array(
+ )
)
)
- 3: Expr_FuncCall(
- name: Expr_ArrayDimFetch(
- var: Expr_PropertyFetch(
- var: Expr_Clone(
- expr: Expr_Variable(
- name: obj
+ 3: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Expr_ArrayDimFetch(
+ var: Expr_PropertyFetch(
+ var: Expr_Clone(
+ expr: Expr_Variable(
+ name: obj
+ )
+ )
+ name: Identifier(
+ name: b
)
)
- name: b
- )
- dim: Scalar_LNumber(
- value: 0
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
- )
- args: array(
- 0: Arg(
- value: Scalar_LNumber(
- value: 1
+ args: array(
+ 0: Arg(
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 4: Expr_Assign(
- var: Expr_ArrayDimFetch(
- var: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 0
+ 4: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 0
+ )
+ byRef: false
)
- byRef: false
- )
- 1: Expr_ArrayItem(
- key: null
- value: Scalar_LNumber(
- value: 1
+ 1: Expr_ArrayItem(
+ key: null
+ value: Scalar_LNumber(
+ value: 1
+ )
+ byRef: false
)
- byRef: false
)
)
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
- dim: Scalar_LNumber(
- value: 0
+ expr: Scalar_LNumber(
+ value: 1
)
)
- expr: Scalar_LNumber(
- value: 1
- )
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
index e5f92f97a..5e1caf2fc 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/new.test
@@ -11,85 +11,109 @@ new $weird[0]->foo::$className;
-----
!!php7
array(
- 0: Expr_New(
- class: Expr_Variable(
- name: className
- )
- args: array(
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_Variable(
+ name: className
+ )
+ args: array(
+ )
)
)
- 1: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: array
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: array
+ )
+ dim: Scalar_String(
+ value: className
+ )
)
- dim: Scalar_String(
- value: className
+ args: array(
)
)
- args: array(
- )
)
- 2: Expr_New(
- class: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: array
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: array
+ )
+ dim: Scalar_String(
+ value: className
+ )
)
- dim: Scalar_String(
- value: className
+ args: array(
)
)
- args: array(
- )
)
- 3: Expr_New(
- class: Expr_PropertyFetch(
- var: Expr_Variable(
- name: obj
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: obj
+ )
+ name: Identifier(
+ name: className
+ )
+ )
+ args: array(
)
- name: className
- )
- args: array(
)
)
- 4: Expr_New(
- class: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: Test
+ 4: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: VarLikeIdentifier(
+ name: className
)
)
- name: className
- )
- args: array(
+ args: array(
+ )
)
)
- 5: Expr_New(
- class: Expr_StaticPropertyFetch(
- class: Expr_Variable(
- name: test
+ 5: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Expr_Variable(
+ name: test
+ )
+ name: VarLikeIdentifier(
+ name: className
+ )
+ )
+ args: array(
)
- name: className
- )
- args: array(
)
)
- 6: Expr_New(
- class: Expr_StaticPropertyFetch(
- class: Expr_PropertyFetch(
- var: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: weird
+ 6: Stmt_Expression(
+ expr: Expr_New(
+ class: Expr_StaticPropertyFetch(
+ class: Expr_PropertyFetch(
+ var: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: weird
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
)
- dim: Scalar_LNumber(
- value: 0
+ name: Identifier(
+ name: foo
)
)
- name: foo
+ name: VarLikeIdentifier(
+ name: className
+ )
+ )
+ args: array(
)
- name: className
- )
- args: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
index 5fadfc483..bf3547ca7 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/uvs/staticProperty.test
@@ -12,82 +12,112 @@ A::$A::$b;
-----
!!php7
array(
- 0: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 0: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
- )
- 1: Expr_StaticPropertyFetch(
- class: Expr_Variable(
- name: A
- )
- name: b
)
- 2: Expr_StaticPropertyFetch(
- class: Scalar_String(
- value: A
+ 1: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_Variable(
+ name: A
+ )
+ name: VarLikeIdentifier(
+ name: b
+ )
)
- name: b
)
- 3: Expr_StaticPropertyFetch(
- class: Expr_BinaryOp_Concat(
- left: Scalar_String(
+ 2: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Scalar_String(
value: A
)
- right: Scalar_String(
- value:
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
)
- 4: Expr_StaticPropertyFetch(
- class: Expr_ArrayDimFetch(
- var: Scalar_String(
- value: A
+ 3: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: A
+ )
+ right: Scalar_String(
+ value:
+ )
)
- dim: Scalar_LNumber(
- value: 0
+ name: VarLikeIdentifier(
+ name: b
)
)
- name: b
)
- 5: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 4: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_ArrayDimFetch(
+ var: Scalar_String(
+ value: A
+ )
+ dim: Scalar_LNumber(
+ value: 0
+ )
+ )
+ name: VarLikeIdentifier(
+ name: b
)
- )
- name: Expr_Variable(
- name: b
)
)
- 6: Expr_ArrayDimFetch(
- var: Expr_StaticPropertyFetch(
+ 5: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
class: Name(
parts: array(
0: A
)
)
name: Expr_Variable(
- name: c
+ name: b
)
)
- dim: Scalar_LNumber(
- value: 1
+ )
+ 6: Stmt_Expression(
+ expr: Expr_ArrayDimFetch(
+ var: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: Expr_Variable(
+ name: c
+ )
+ )
+ dim: Scalar_LNumber(
+ value: 1
+ )
)
)
- 7: Expr_StaticPropertyFetch(
- class: Expr_StaticPropertyFetch(
- class: Name(
- parts: array(
- 0: A
+ 7: Stmt_Expression(
+ expr: Expr_StaticPropertyFetch(
+ class: Expr_StaticPropertyFetch(
+ class: Name(
+ parts: array(
+ 0: A
+ )
+ )
+ name: VarLikeIdentifier(
+ name: A
)
)
- name: A
+ name: VarLikeIdentifier(
+ name: b
+ )
)
- name: b
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/expr/variable.test b/app/vendor/nikic/php-parser/test/code/parser/expr/variable.test
index 3a709f990..c30326cc5 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/expr/variable.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/expr/variable.test
@@ -11,45 +11,57 @@ $$a['b'];
-----
!!php5
array(
- 0: Expr_Variable(
- name: a
- )
- 1: Expr_Variable(
- name: Scalar_String(
- value: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
)
)
- 2: Expr_Variable(
- name: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: foo
- )
- )
- args: array(
+ 1: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Scalar_String(
+ value: a
)
)
)
- 3: Expr_Variable(
- name: Expr_Variable(
- name: a
+ 2: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: foo
+ )
+ )
+ args: array(
+ )
+ )
)
)
- 4: Expr_Variable(
- name: Expr_Variable(
+ 3: Stmt_Expression(
+ expr: Expr_Variable(
name: Expr_Variable(
name: a
)
)
)
- 5: Expr_Variable(
- name: Expr_ArrayDimFetch(
- var: Expr_Variable(
- name: a
+ 4: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_Variable(
+ name: Expr_Variable(
+ name: a
+ )
)
- dim: Scalar_String(
- value: b
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Variable(
+ name: Expr_ArrayDimFetch(
+ var: Expr_Variable(
+ name: a
+ )
+ dim: Scalar_String(
+ value: b
+ )
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test b/app/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test
new file mode 100644
index 000000000..759e9e545
--- /dev/null
+++ b/app/vendor/nikic/php-parser/test/code/parser/exprStmtMode.test
@@ -0,0 +1,57 @@
+Expression statement mode
+-----
+ float overflows
+ 1: // (all are actually the same number, just in different representations)
+ )
+ )
comments: array(
0: // various integer -> float overflows
1: // (all are actually the same number, just in different representations)
)
)
- 11: Scalar_DNumber(
- value: 1.844674407371E+19
+ 11: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 12: Scalar_DNumber(
- value: 1.844674407371E+19
+ 12: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 13: Scalar_DNumber(
- value: 1.844674407371E+19
+ 13: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
- 14: Scalar_DNumber(
- value: 1.844674407371E+19
+ 14: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: 1.844674407371E+19
+ )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/scalar/int.test b/app/vendor/nikic/php-parser/test/code/parser/scalar/int.test
index 5a212677c..b65858dbb 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/scalar/int.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/scalar/int.test
@@ -13,31 +13,49 @@ Different integer syntaxes
0b111000111000;
-----
array(
- 0: Scalar_LNumber(
- value: 0
- )
- 1: Scalar_LNumber(
- value: 1
- )
- 2: Scalar_LNumber(
- value: @@{ PHP_INT_MAX }@@
- )
- 3: Scalar_DNumber(
- value: @@{ PHP_INT_MAX + 1 }@@
- )
- 4: Scalar_LNumber(
- value: 4095
- )
- 5: Scalar_LNumber(
- value: 4095
- )
- 6: Scalar_LNumber(
- value: 4095
- )
- 7: Scalar_LNumber(
- value: 511
- )
- 8: Scalar_LNumber(
- value: 3640
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 0
+ )
+ )
+ 1: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 1
+ )
+ )
+ 2: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: @@{ PHP_INT_MAX }@@
+ )
+ )
+ 3: Stmt_Expression(
+ expr: Scalar_DNumber(
+ value: @@{ PHP_INT_MAX + 1 }@@
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
+ )
+ 6: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 4095
+ )
+ )
+ 7: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 511
+ )
+ )
+ 8: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 3640
+ )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test b/app/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
index bef3061c8..cd0cbfba0 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/scalar/invalidOctal.test
@@ -6,8 +6,10 @@ Invalid octal literals
!!php7
Invalid numeric literal from 2:1 to 2:4
array(
- 0: Scalar_LNumber(
- value: 0
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 0
+ )
)
)
-----
@@ -16,7 +18,9 @@ array(
-----
!!php5
array(
- 0: Scalar_LNumber(
- value: 7
+ 0: Stmt_Expression(
+ expr: Scalar_LNumber(
+ value: 7
+ )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test b/app/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
index 9b981eb62..520ea1776 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/scalar/magicConst.test
@@ -12,20 +12,36 @@ __NAMESPACE__;
__TRAIT__;
-----
array(
- 0: Scalar_MagicConst_Class(
+ 0: Stmt_Expression(
+ expr: Scalar_MagicConst_Class(
+ )
)
- 1: Scalar_MagicConst_Dir(
+ 1: Stmt_Expression(
+ expr: Scalar_MagicConst_Dir(
+ )
)
- 2: Scalar_MagicConst_File(
+ 2: Stmt_Expression(
+ expr: Scalar_MagicConst_File(
+ )
)
- 3: Scalar_MagicConst_Function(
+ 3: Stmt_Expression(
+ expr: Scalar_MagicConst_Function(
+ )
)
- 4: Scalar_MagicConst_Line(
+ 4: Stmt_Expression(
+ expr: Scalar_MagicConst_Line(
+ )
)
- 5: Scalar_MagicConst_Method(
+ 5: Stmt_Expression(
+ expr: Scalar_MagicConst_Method(
+ )
)
- 6: Scalar_MagicConst_Namespace(
+ 6: Stmt_Expression(
+ expr: Scalar_MagicConst_Namespace(
+ )
)
- 7: Scalar_MagicConst_Trait(
+ 7: Stmt_Expression(
+ expr: Scalar_MagicConst_Trait(
+ )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test b/app/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
index 33a96119a..95d982955 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/scalar/unicodeEscape.test
@@ -8,13 +8,19 @@ Unicode escape sequence
-----
!!php7
array(
- 0: Scalar_String(
- value: @@{"\0"}@@
+ 0: Stmt_Expression(
+ expr: Scalar_String(
+ value: @@{"\0"}@@
+ )
)
- 1: Scalar_String(
- value: Ĕ
+ 1: Stmt_Expression(
+ expr: Scalar_String(
+ value: Ĕ
+ )
)
- 2: Scalar_String(
- value: @@{"\xF0\x9F\x98\x82"}@@
+ 2: Stmt_Expression(
+ expr: Scalar_String(
+ value: @@{"\xF0\x9F\x98\x82"}@@
+ )
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/semiReserved.test b/app/vendor/nikic/php-parser/test/code/parser/semiReserved.test
index 34105300b..7446a875e 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/semiReserved.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/semiReserved.test
@@ -55,7 +55,9 @@ class Foo {
array(
0: Stmt_Class(
flags: 0
- name: Test
+ name: Identifier(
+ name: Test
+ )
extends: null
implements: array(
)
@@ -63,7 +65,9 @@ array(
0: Stmt_ClassMethod(
flags: 0
byRef: false
- name: array
+ name: Identifier(
+ name: array
+ )
params: array(
)
returnType: null
@@ -73,7 +77,9 @@ array(
1: Stmt_ClassMethod(
flags: 0
byRef: false
- name: public
+ name: Identifier(
+ name: public
+ )
params: array(
)
returnType: null
@@ -83,7 +89,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: list
+ name: Identifier(
+ name: list
+ )
params: array(
)
returnType: null
@@ -93,7 +101,9 @@ array(
3: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: protected
+ name: Identifier(
+ name: protected
+ )
params: array(
)
returnType: null
@@ -104,7 +114,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: class
+ name: VarLikeIdentifier(
+ name: class
+ )
default: null
)
)
@@ -113,7 +125,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: private
+ name: VarLikeIdentifier(
+ name: private
+ )
default: null
)
)
@@ -122,13 +136,17 @@ array(
flags: 0
consts: array(
0: Const(
- name: TRAIT
+ name: Identifier(
+ name: TRAIT
+ )
value: Scalar_LNumber(
value: 3
)
)
1: Const(
- name: FINAL
+ name: Identifier(
+ name: FINAL
+ )
value: Scalar_LNumber(
value: 4
)
@@ -139,138 +157,195 @@ array(
flags: 0
consts: array(
0: Const(
- name: __CLASS__
+ name: Identifier(
+ name: __CLASS__
+ )
value: Scalar_LNumber(
value: 1
)
)
1: Const(
- name: __TRAIT__
+ name: Identifier(
+ name: __TRAIT__
+ )
value: Scalar_LNumber(
value: 2
)
)
2: Const(
- name: __FUNCTION__
+ name: Identifier(
+ name: __FUNCTION__
+ )
value: Scalar_LNumber(
value: 3
)
)
3: Const(
- name: __METHOD__
+ name: Identifier(
+ name: __METHOD__
+ )
value: Scalar_LNumber(
value: 4
)
)
4: Const(
- name: __LINE__
+ name: Identifier(
+ name: __LINE__
+ )
value: Scalar_LNumber(
value: 5
)
)
5: Const(
- name: __FILE__
+ name: Identifier(
+ name: __FILE__
+ )
value: Scalar_LNumber(
value: 6
)
)
6: Const(
- name: __DIR__
+ name: Identifier(
+ name: __DIR__
+ )
value: Scalar_LNumber(
value: 7
)
)
7: Const(
- name: __NAMESPACE__
+ name: Identifier(
+ name: __NAMESPACE__
+ )
value: Scalar_LNumber(
value: 8
)
)
)
)
+ 8: Stmt_Nop(
+ comments: array(
+ 0: // __halt_compiler does not work
+ )
+ )
)
)
- 1: Expr_Assign(
- var: Expr_Variable(
- name: t
- )
- expr: Expr_New(
- class: Name(
- parts: array(
- 0: Test
- )
+ 1: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: t
)
- args: array(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ args: array(
+ )
)
)
)
- 2: Expr_MethodCall(
- var: Expr_Variable(
- name: t
- )
- name: array
- args: array(
+ 2: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: array
+ )
+ args: array(
+ )
)
)
- 3: Expr_MethodCall(
- var: Expr_Variable(
- name: t
- )
- name: public
- args: array(
+ 3: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: public
+ )
+ args: array(
+ )
)
)
- 4: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: Test
+ 4: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: list
+ )
+ args: array(
)
- )
- name: list
- args: array(
)
)
- 5: Expr_StaticCall(
- class: Name(
- parts: array(
- 0: Test
+ 5: Stmt_Expression(
+ expr: Expr_StaticCall(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: protected
+ )
+ args: array(
)
- )
- name: protected
- args: array(
)
)
- 6: Expr_PropertyFetch(
- var: Expr_Variable(
- name: t
+ 6: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: class
+ )
)
- name: class
)
- 7: Expr_PropertyFetch(
- var: Expr_Variable(
- name: t
+ 7: Stmt_Expression(
+ expr: Expr_PropertyFetch(
+ var: Expr_Variable(
+ name: t
+ )
+ name: Identifier(
+ name: private
+ )
)
- name: private
)
- 8: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Test
+ 8: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: TRAIT
)
)
- name: TRAIT
)
- 9: Expr_ClassConstFetch(
- class: Name(
- parts: array(
- 0: Test
+ 9: Stmt_Expression(
+ expr: Expr_ClassConstFetch(
+ class: Name(
+ parts: array(
+ 0: Test
+ )
+ )
+ name: Identifier(
+ name: FINAL
)
)
- name: FINAL
)
10: Stmt_Class(
flags: 0
- name: Foo
+ name: Identifier(
+ name: Foo
+ )
extends: null
implements: array(
)
@@ -295,7 +370,9 @@ array(
0: TraitA
)
)
- method: catch
+ method: Identifier(
+ name: catch
+ )
insteadof: array(
0: Name_Relative(
parts: array(
@@ -310,9 +387,13 @@ array(
0: TraitA
)
)
- method: list
+ method: Identifier(
+ name: list
+ )
newModifier: null
- newName: foreach
+ newName: Identifier(
+ name: foreach
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -320,9 +401,13 @@ array(
0: TraitB
)
)
- method: throw
+ method: Identifier(
+ name: throw
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: public
+ newName: Identifier(
+ name: public
+ )
)
3: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -330,15 +415,21 @@ array(
0: TraitB
)
)
- method: self
+ method: Identifier(
+ name: self
+ )
newModifier: MODIFIER_PROTECTED (2)
newName: null
)
4: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: die
+ newName: Identifier(
+ name: die
+ )
)
5: Stmt_TraitUseAdaptation_Alias(
trait: Name_FullyQualified(
@@ -346,9 +437,13 @@ array(
0: TraitC
)
)
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: bye
+ newName: Identifier(
+ name: bye
+ )
)
6: Stmt_TraitUseAdaptation_Alias(
trait: Name_Relative(
@@ -356,9 +451,13 @@ array(
0: TraitC
)
)
- method: exit
+ method: Identifier(
+ name: exit
+ )
newModifier: null
- newName: byebye
+ newName: Identifier(
+ name: byebye
+ )
)
7: Stmt_TraitUseAdaptation_Precedence(
trait: Name(
@@ -366,7 +465,14 @@ array(
0: TraitA
)
)
- method: catch
+ method: Identifier(
+ name: catch
+ comments: array(
+ 0: //
+ 1: /** doc comment */
+ 2: #
+ )
+ )
insteadof: array(
0: Name(
parts: array(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
index ae83dabb9..abf586465 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/blocklessStatement.test
@@ -22,8 +22,10 @@ array(
name: a
)
stmts: array(
- 0: Expr_Variable(
- name: A
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
)
)
elseifs: array(
@@ -32,16 +34,20 @@ array(
name: b
)
stmts: array(
- 0: Expr_Variable(
- name: B
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: B
+ )
)
)
)
)
else: Stmt_Else(
stmts: array(
- 0: Expr_Variable(
- name: C
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: C
+ )
)
)
)
@@ -54,8 +60,10 @@ array(
loop: array(
)
stmts: array(
- 0: Expr_Variable(
- name: foo
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: foo
+ )
)
)
)
@@ -69,8 +77,10 @@ array(
name: b
)
stmts: array(
- 0: Expr_Variable(
- name: AB
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: AB
+ )
)
)
)
@@ -79,33 +89,41 @@ array(
name: a
)
stmts: array(
- 0: Expr_Variable(
- name: A
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
)
)
)
4: Stmt_Do(
- cond: Expr_Variable(
- name: a
- )
stmts: array(
- 0: Expr_Variable(
- name: A
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: A
+ )
)
)
+ cond: Expr_Variable(
+ name: a
+ )
)
5: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: a
+ key: Identifier(
+ name: a
+ )
value: Scalar_String(
value: b
)
)
)
stmts: array(
- 0: Expr_Variable(
- name: C
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: C
+ )
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
index 8c9a99c7a..01a82e519 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/abstract.test
@@ -10,7 +10,9 @@ abstract class A {
array(
0: Stmt_Class(
flags: MODIFIER_ABSTRACT (16)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -18,7 +20,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -28,7 +32,9 @@ array(
1: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_ABSTRACT (17)
byRef: false
- name: b
+ name: Identifier(
+ name: b
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
index 266d94354..a676db68a 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/anonymous.test
@@ -22,123 +22,137 @@ class A {
}
-----
array(
- 0: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: null
- implements: array(
- )
- stmts: array(
- 0: Stmt_ClassMethod(
- flags: MODIFIER_PUBLIC (1)
- byRef: false
- name: test
- params: array(
- )
- returnType: null
- stmts: array(
+ 0: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: null
+ implements: array(
+ )
+ stmts: array(
+ 0: Stmt_ClassMethod(
+ flags: MODIFIER_PUBLIC (1)
+ byRef: false
+ name: Identifier(
+ name: test
+ )
+ params: array(
+ )
+ returnType: null
+ stmts: array(
+ )
)
)
)
- )
- args: array(
+ args: array(
+ )
)
)
- 1: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: Name(
- parts: array(
- 0: A
- )
- )
- implements: array(
- 0: Name(
+ 1: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: Name(
parts: array(
- 0: B
+ 0: A
)
)
- 1: Name(
- parts: array(
- 0: C
+ implements: array(
+ 0: Name(
+ parts: array(
+ 0: B
+ )
)
+ 1: Name(
+ parts: array(
+ 0: C
+ )
+ )
+ )
+ stmts: array(
)
)
- stmts: array(
+ args: array(
)
)
- args: array(
- )
)
- 2: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: null
- implements: array(
- )
- stmts: array(
- 0: Stmt_Property(
- flags: MODIFIER_PUBLIC (1)
- props: array(
- 0: Stmt_PropertyProperty(
- name: foo
- default: null
+ 2: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: null
+ implements: array(
+ )
+ stmts: array(
+ 0: Stmt_Property(
+ flags: MODIFIER_PUBLIC (1)
+ props: array(
+ 0: Stmt_PropertyProperty(
+ name: VarLikeIdentifier(
+ name: foo
+ )
+ default: null
+ )
)
)
)
)
- )
- args: array(
+ args: array(
+ )
)
)
- 3: Expr_New(
- class: Stmt_Class(
- flags: 0
- name: null
- extends: Name(
- parts: array(
- 0: A
+ 3: Stmt_Expression(
+ expr: Expr_New(
+ class: Stmt_Class(
+ flags: 0
+ name: null
+ extends: Name(
+ parts: array(
+ 0: A
+ )
)
- )
- implements: array(
- )
- stmts: array(
- 0: Stmt_TraitUse(
- traits: array(
- 0: Name(
- parts: array(
- 0: T
+ implements: array(
+ )
+ stmts: array(
+ 0: Stmt_TraitUse(
+ traits: array(
+ 0: Name(
+ parts: array(
+ 0: T
+ )
)
)
- )
- adaptations: array(
+ adaptations: array(
+ )
)
)
)
- )
- args: array(
- 0: Arg(
- value: Expr_Variable(
- name: a
+ args: array(
+ 0: Arg(
+ value: Expr_Variable(
+ name: a
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
- )
- 1: Arg(
- value: Expr_Variable(
- name: b
+ 1: Arg(
+ value: Expr_Variable(
+ name: b
+ )
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
4: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -146,7 +160,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
)
returnType: null
@@ -168,7 +184,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
index e18090c79..40a93508b 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/conditional.test
@@ -18,7 +18,9 @@ array(
stmts: array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
index b3604ed6d..a6aa79721 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifierErrors.test
@@ -10,7 +10,9 @@ Cannot use 'static' as constant modifier from 3:5 to 3:10
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -19,7 +21,9 @@ array(
flags: MODIFIER_STATIC (8)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -40,7 +44,9 @@ Cannot use 'abstract' as constant modifier from 3:5 to 3:12
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -49,7 +55,9 @@ array(
flags: MODIFIER_ABSTRACT (16)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -70,7 +78,9 @@ Cannot use 'final' as constant modifier from 3:5 to 3:9
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -79,7 +89,9 @@ array(
flags: MODIFIER_FINAL (32)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
@@ -100,7 +112,9 @@ Multiple access type modifiers are not allowed from 3:12 to 3:17
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -109,7 +123,9 @@ array(
flags: MODIFIER_PUBLIC (1)
consts: array(
0: Const(
- name: X
+ name: Identifier(
+ name: X
+ )
value: Scalar_LNumber(
value: 1
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
index 7129d2846..24d721981 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/constModifiers.test
@@ -13,7 +13,9 @@ class Foo {
array(
0: Stmt_Class(
flags: 0
- name: Foo
+ name: Identifier(
+ name: Foo
+ )
extends: null
implements: array(
)
@@ -22,7 +24,9 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 1
)
@@ -33,7 +37,9 @@ array(
flags: MODIFIER_PUBLIC (1)
consts: array(
0: Const(
- name: B
+ name: Identifier(
+ name: B
+ )
value: Scalar_LNumber(
value: 2
)
@@ -44,7 +50,9 @@ array(
flags: MODIFIER_PROTECTED (2)
consts: array(
0: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_LNumber(
value: 3
)
@@ -55,7 +63,9 @@ array(
flags: MODIFIER_PRIVATE (4)
consts: array(
0: Const(
- name: D
+ name: Identifier(
+ name: D
+ )
value: Scalar_LNumber(
value: 4
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
index 86cc45868..ecb7a5c3d 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/final.test
@@ -7,7 +7,9 @@ final class A {}
array(
0: Stmt_Class(
flags: MODIFIER_FINAL (32)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
index 08452c156..bd43dce9c 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/implicitPublic.test
@@ -15,7 +15,9 @@ abstract class A {
array(
0: Stmt_Class(
flags: MODIFIER_ABSTRACT (16)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -24,7 +26,9 @@ array(
flags: 0
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -33,7 +37,9 @@ array(
flags: MODIFIER_STATIC (8)
props: array(
0: Stmt_PropertyProperty(
- name: b
+ name: VarLikeIdentifier(
+ name: b
+ )
default: null
)
)
@@ -41,7 +47,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT (16)
byRef: false
- name: c
+ name: Identifier(
+ name: c
+ )
params: array(
)
returnType: null
@@ -50,7 +58,9 @@ array(
3: Stmt_ClassMethod(
flags: MODIFIER_FINAL (32)
byRef: false
- name: d
+ name: Identifier(
+ name: d
+ )
params: array(
)
returnType: null
@@ -60,7 +70,9 @@ array(
4: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: e
+ name: Identifier(
+ name: e
+ )
params: array(
)
returnType: null
@@ -70,7 +82,9 @@ array(
5: Stmt_ClassMethod(
flags: MODIFIER_STATIC | MODIFIER_FINAL (40)
byRef: false
- name: f
+ name: Identifier(
+ name: f
+ )
params: array(
)
returnType: null
@@ -80,7 +94,9 @@ array(
6: Stmt_ClassMethod(
flags: 0
byRef: false
- name: g
+ name: Identifier(
+ name: g
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
index d00bdbdc8..7ac15970d 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/interface.test
@@ -8,7 +8,9 @@ interface A extends C, D {
-----
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -25,7 +27,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
index 5a1fd3fc5..cbeb57e11 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/modifier.test
@@ -6,7 +6,9 @@ Multiple access type modifiers are not allowed from 1:24 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -15,7 +17,9 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -30,7 +34,9 @@ Multiple access type modifiers are not allowed from 1:24 to 1:32
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -39,7 +45,9 @@ array(
flags: MODIFIER_PUBLIC | MODIFIER_PROTECTED (3)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -54,7 +62,9 @@ Multiple abstract modifiers are not allowed from 1:26 to 1:33
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -62,7 +72,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT (16)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -78,7 +90,9 @@ Multiple static modifiers are not allowed from 1:24 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -87,7 +101,9 @@ array(
flags: MODIFIER_STATIC (8)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -102,7 +118,9 @@ Multiple final modifiers are not allowed from 1:23 to 1:27
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -110,7 +128,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_FINAL (32)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -127,7 +147,9 @@ Cannot use the final modifier on an abstract class member from 1:26 to 1:30
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -135,7 +157,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT | MODIFIER_FINAL (48)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -152,7 +176,9 @@ Syntax error, unexpected T_FINAL, expecting T_CLASS from 1:16 to 1:20
array(
0: Stmt_Class(
flags: MODIFIER_FINAL (32)
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -172,7 +198,9 @@ Properties cannot be declared abstract from 1:17 to 1:24
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -181,7 +209,9 @@ array(
flags: MODIFIER_ABSTRACT (16)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
@@ -196,7 +226,9 @@ Properties cannot be declared final from 1:17 to 1:21
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -205,11 +237,13 @@ array(
flags: MODIFIER_FINAL (32)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: null
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
index d53330521..40cb2fe27 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/name.test
@@ -6,7 +6,9 @@ Cannot use 'self' as class name as it is reserved from 1:13 to 1:16
array(
0: Stmt_Class(
flags: 0
- name: self
+ name: Identifier(
+ name: self
+ )
extends: null
implements: array(
)
@@ -21,7 +23,9 @@ Cannot use 'PARENT' as class name as it is reserved from 1:13 to 1:18
array(
0: Stmt_Class(
flags: 0
- name: PARENT
+ name: Identifier(
+ name: PARENT
+ )
extends: null
implements: array(
)
@@ -42,7 +46,9 @@ Cannot use 'self' as class name as it is reserved from 1:23 to 1:26
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: self
@@ -61,7 +67,9 @@ Cannot use 'PARENT' as class name as it is reserved from 1:23 to 1:28
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: PARENT
@@ -80,7 +88,9 @@ Cannot use 'static' as class name as it is reserved from 1:23 to 1:28
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: static
@@ -99,7 +109,9 @@ Cannot use 'self' as interface name as it is reserved from 1:26 to 1:29
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -119,7 +131,9 @@ Cannot use 'PARENT' as interface name as it is reserved from 1:26 to 1:31
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -139,7 +153,9 @@ Cannot use 'static' as interface name as it is reserved from 1:26 to 1:31
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
0: Name(
@@ -158,7 +174,9 @@ array(
Cannot use 'self' as class name as it is reserved from 1:17 to 1:20
array(
0: Stmt_Interface(
- name: self
+ name: Identifier(
+ name: self
+ )
extends: array(
)
stmts: array(
@@ -171,7 +189,9 @@ array(
Cannot use 'PARENT' as class name as it is reserved from 1:17 to 1:22
array(
0: Stmt_Interface(
- name: PARENT
+ name: Identifier(
+ name: PARENT
+ )
extends: array(
)
stmts: array(
@@ -190,7 +210,9 @@ array(
Cannot use 'self' as interface name as it is reserved from 1:27 to 1:30
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -208,7 +230,9 @@ array(
Cannot use 'PARENT' as interface name as it is reserved from 1:27 to 1:32
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
@@ -226,7 +250,9 @@ array(
Cannot use 'static' as interface name as it is reserved from 1:27 to 1:32
array(
0: Stmt_Interface(
- name: A
+ name: Identifier(
+ name: A
+ )
extends: array(
0: Name(
parts: array(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
index e459e1752..d6070b889 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/php4Style.test
@@ -11,7 +11,9 @@ class A {
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -20,7 +22,9 @@ array(
flags: 0
props: array(
0: Stmt_PropertyProperty(
- name: foo
+ name: VarLikeIdentifier(
+ name: foo
+ )
default: null
)
)
@@ -28,7 +32,9 @@ array(
1: Stmt_ClassMethod(
flags: 0
byRef: false
- name: bar
+ name: Identifier(
+ name: bar
+ )
params: array(
)
returnType: null
@@ -38,7 +44,9 @@ array(
2: Stmt_ClassMethod(
flags: MODIFIER_ABSTRACT | MODIFIER_STATIC (24)
byRef: false
- name: baz
+ name: Identifier(
+ name: baz
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
index b2f899449..9247eec9f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/simple.test
@@ -19,7 +19,9 @@ class A extends B implements C, D {
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: Name(
parts: array(
0: B
@@ -42,13 +44,17 @@ array(
flags: 0
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
@@ -59,13 +65,17 @@ array(
flags: MODIFIER_PUBLIC (1)
props: array(
0: Stmt_PropertyProperty(
- name: a
+ name: VarLikeIdentifier(
+ name: a
+ )
default: Scalar_String(
value: b
)
)
1: Stmt_PropertyProperty(
- name: c
+ name: VarLikeIdentifier(
+ name: c
+ )
default: Scalar_String(
value: d
)
@@ -76,7 +86,9 @@ array(
flags: MODIFIER_PROTECTED (2)
props: array(
0: Stmt_PropertyProperty(
- name: e
+ name: VarLikeIdentifier(
+ name: e
+ )
default: null
)
)
@@ -85,7 +97,9 @@ array(
flags: MODIFIER_PRIVATE (4)
props: array(
0: Stmt_PropertyProperty(
- name: f
+ name: VarLikeIdentifier(
+ name: f
+ )
default: null
)
)
@@ -93,7 +107,9 @@ array(
4: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -103,13 +119,17 @@ array(
5: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_STATIC (9)
byRef: false
- name: b
+ name: Identifier(
+ name: b
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
)
@@ -120,7 +140,9 @@ array(
6: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC | MODIFIER_FINAL (33)
byRef: false
- name: c
+ name: Identifier(
+ name: c
+ )
params: array(
)
returnType: Name(
@@ -134,7 +156,9 @@ array(
7: Stmt_ClassMethod(
flags: MODIFIER_PROTECTED (2)
byRef: false
- name: d
+ name: Identifier(
+ name: d
+ )
params: array(
)
returnType: null
@@ -144,7 +168,9 @@ array(
8: Stmt_ClassMethod(
flags: MODIFIER_PRIVATE (4)
byRef: false
- name: e
+ name: Identifier(
+ name: e
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
index 225596acb..0540930e4 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/staticMethod.test
@@ -6,7 +6,9 @@ Constructor __construct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -14,7 +16,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __construct
+ name: Identifier(
+ name: __construct
+ )
params: array(
)
returnType: null
@@ -31,7 +35,9 @@ Destructor __destruct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -39,7 +45,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __destruct
+ name: Identifier(
+ name: __destruct
+ )
params: array(
)
returnType: null
@@ -56,7 +64,9 @@ Clone method __clone() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -64,7 +74,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __clone
+ name: Identifier(
+ name: __clone
+ )
params: array(
)
returnType: null
@@ -81,7 +93,9 @@ Constructor __CONSTRUCT() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -89,7 +103,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __CONSTRUCT
+ name: Identifier(
+ name: __CONSTRUCT
+ )
params: array(
)
returnType: null
@@ -106,7 +122,9 @@ Destructor __Destruct() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -114,7 +132,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __Destruct
+ name: Identifier(
+ name: __Destruct
+ )
params: array(
)
returnType: null
@@ -131,7 +151,9 @@ Clone method __cLoNe() cannot be static from 1:17 to 1:22
array(
0: Stmt_Class(
flags: 0
- name: A
+ name: Identifier(
+ name: A
+ )
extends: null
implements: array(
)
@@ -139,7 +161,9 @@ array(
0: Stmt_ClassMethod(
flags: MODIFIER_STATIC (8)
byRef: false
- name: __cLoNe
+ name: Identifier(
+ name: __cLoNe
+ )
params: array(
)
returnType: null
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
index 75c6ec66f..bda3cc56d 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/class/trait.test
@@ -23,12 +23,16 @@ class B {
-----
array(
0: Stmt_Trait(
- name: A
+ name: Identifier(
+ name: A
+ )
stmts: array(
0: Stmt_ClassMethod(
flags: MODIFIER_PUBLIC (1)
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -39,7 +43,9 @@ array(
)
1: Stmt_Class(
flags: 0
- name: B
+ name: Identifier(
+ name: B
+ )
extends: null
implements: array(
)
@@ -66,19 +72,29 @@ array(
adaptations: array(
0: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: a
+ method: Identifier(
+ name: a
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: b
+ newName: Identifier(
+ name: b
+ )
)
1: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: c
+ method: Identifier(
+ name: c
+ )
newModifier: null
- newName: d
+ newName: Identifier(
+ name: d
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: null
- method: e
+ method: Identifier(
+ name: e
+ )
newModifier: MODIFIER_PRIVATE (4)
newName: null
)
@@ -109,7 +125,9 @@ array(
0: E
)
)
- method: a
+ method: Identifier(
+ name: a
+ )
insteadof: array(
0: Name(
parts: array(
@@ -129,9 +147,13 @@ array(
0: E
)
)
- method: b
+ method: Identifier(
+ name: b
+ )
newModifier: MODIFIER_PROTECTED (2)
- newName: c
+ newName: Identifier(
+ name: c
+ )
)
2: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -139,9 +161,13 @@ array(
0: E
)
)
- method: d
+ method: Identifier(
+ name: d
+ )
newModifier: null
- newName: e
+ newName: Identifier(
+ name: e
+ )
)
3: Stmt_TraitUseAdaptation_Alias(
trait: Name(
@@ -149,7 +175,9 @@ array(
0: E
)
)
- method: f
+ method: Identifier(
+ name: f
+ )
newModifier: MODIFIER_PRIVATE (4)
newName: null
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/const.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/const.test
index da21f416f..e6c4db84f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/const.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/const.test
@@ -8,25 +8,33 @@ array(
0: Stmt_Const(
consts: array(
0: Const(
- name: A
+ name: Identifier(
+ name: A
+ )
value: Scalar_LNumber(
value: 0
)
)
1: Const(
- name: B
+ name: Identifier(
+ name: B
+ )
value: Scalar_DNumber(
value: 1
)
)
2: Const(
- name: C
+ name: Identifier(
+ name: C
+ )
value: Scalar_String(
value: A
)
)
3: Const(
- name: D
+ name: Identifier(
+ name: D
+ )
value: Expr_ConstFetch(
name: Name(
parts: array(
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
index 2de1c4f25..d9c9fcf35 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/controlFlow.test
@@ -47,9 +47,13 @@ array(
)
)
7: Stmt_Label(
- name: label
+ name: Identifier(
+ name: label
+ )
)
8: Stmt_Goto(
- name: label
+ name: Identifier(
+ name: label
+ )
)
)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/declare.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
index 93afe67b9..f044d24f9 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/declare.test
@@ -13,7 +13,9 @@ array(
0: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: X
+ key: Identifier(
+ name: X
+ )
value: Scalar_String(
value: Y
)
@@ -24,13 +26,17 @@ array(
1: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: A
+ key: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Stmt_DeclareDeclare(
- key: C
+ key: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
@@ -42,13 +48,17 @@ array(
2: Stmt_Declare(
declares: array(
0: Stmt_DeclareDeclare(
- key: A
+ key: Identifier(
+ name: A
+ )
value: Scalar_String(
value: B
)
)
1: Stmt_DeclareDeclare(
- key: C
+ key: Identifier(
+ name: C
+ )
value: Scalar_String(
value: D
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
index aecced5d6..b90fd019a 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/builtinTypeDeclarations.test
@@ -7,52 +7,80 @@ function test(bool $a, Int $b, FLOAT $c, StRiNg $d, iterable $e, object $f) : vo
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
- type: bool
+ type: Identifier(
+ name: bool
+ )
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
- type: int
+ type: Identifier(
+ name: int
+ )
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
2: Param(
- type: float
+ type: Identifier(
+ name: float
+ )
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
3: Param(
- type: string
+ type: Identifier(
+ name: string
+ )
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: null
)
4: Param(
- type: iterable
+ type: Identifier(
+ name: iterable
+ )
byRef: false
variadic: false
- name: e
+ var: Expr_Variable(
+ name: e
+ )
default: null
)
5: Param(
- type: object
+ type: Identifier(
+ name: object
+ )
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: null
)
)
- returnType: void
+ returnType: Identifier(
+ name: void
+ )
stmts: array(
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
index 1c1669c10..4b276e734 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/byRef.test
@@ -8,13 +8,17 @@ function &a($b) {}
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: true
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -24,13 +28,17 @@ array(
)
1: Stmt_Function(
byRef: true
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -38,4 +46,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
index d9c886ed8..8495aad1f 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/conditional.test
@@ -18,7 +18,9 @@ array(
stmts: array(
0: Stmt_Function(
byRef: false
- name: A
+ name: Identifier(
+ name: A
+ )
params: array(
)
returnType: null
@@ -30,4 +32,4 @@ array(
)
else: null
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
index d77d4f354..6ae96fa65 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/defaultValues.test
@@ -17,13 +17,17 @@ function a(
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: Expr_ConstFetch(
name: Name(
parts: array(
@@ -36,7 +40,9 @@ array(
type: null
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: Scalar_String(
value: foo
)
@@ -45,21 +51,27 @@ array(
type: null
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: Expr_ClassConstFetch(
class: Name(
parts: array(
0: A
)
)
- name: B
+ name: Identifier(
+ name: B
+ )
)
)
3: Param(
type: null
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: Expr_UnaryPlus(
expr: Scalar_LNumber(
value: 1
@@ -70,7 +82,9 @@ array(
type: null
byRef: false
variadic: false
- name: g
+ var: Expr_Variable(
+ name: g
+ )
default: Expr_UnaryMinus(
expr: Scalar_DNumber(
value: 1
@@ -81,7 +95,9 @@ array(
type: null
byRef: false
variadic: false
- name: h
+ var: Expr_Variable(
+ name: h
+ )
default: Expr_Array(
items: array(
)
@@ -91,7 +107,9 @@ array(
type: null
byRef: false
variadic: false
- name: i
+ var: Expr_Variable(
+ name: i
+ )
default: Expr_Array(
items: array(
)
@@ -101,7 +119,9 @@ array(
type: null
byRef: false
variadic: false
- name: j
+ var: Expr_Variable(
+ name: j
+ )
default: Expr_Array(
items: array(
0: Expr_ArrayItem(
@@ -118,7 +138,9 @@ array(
type: null
byRef: false
variadic: false
- name: k
+ var: Expr_Variable(
+ name: k
+ )
default: Expr_Array(
items: array(
0: Expr_ArrayItem(
@@ -145,4 +167,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
index d96df4fae..8bf2d31da 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/nullableTypes.test
@@ -9,7 +9,9 @@ function test(?Foo $bar, ?string $foo) : ?Baz {
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: NullableType(
@@ -21,16 +23,22 @@ array(
)
byRef: false
variadic: false
- name: bar
+ var: Expr_Variable(
+ name: bar
+ )
default: null
)
1: Param(
type: NullableType(
- type: string
+ type: Identifier(
+ name: string
+ )
)
byRef: false
variadic: false
- name: foo
+ var: Expr_Variable(
+ name: foo
+ )
default: null
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
index ca6c3106e..8b71595e7 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/returnTypes.test
@@ -10,7 +10,9 @@ function test4() : Foo\Bar {}
array(
0: Stmt_Function(
byRef: false
- name: test1
+ name: Identifier(
+ name: test1
+ )
params: array(
)
returnType: null
@@ -19,25 +21,35 @@ array(
)
1: Stmt_Function(
byRef: false
- name: test2
+ name: Identifier(
+ name: test2
+ )
params: array(
)
- returnType: array
+ returnType: Identifier(
+ name: array
+ )
stmts: array(
)
)
2: Stmt_Function(
byRef: false
- name: test3
+ name: Identifier(
+ name: test3
+ )
params: array(
)
- returnType: callable
+ returnType: Identifier(
+ name: callable
+ )
stmts: array(
)
)
3: Stmt_Function(
byRef: false
- name: test4
+ name: Identifier(
+ name: test4
+ )
params: array(
)
returnType: Name(
@@ -49,4 +61,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
index f2f35acf4..10a9e0796 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/specialVars.test
@@ -10,7 +10,9 @@ function a() {
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
)
returnType: null
@@ -35,11 +37,15 @@ array(
1: Stmt_Static(
vars: array(
0: Stmt_StaticVar(
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
1: Stmt_StaticVar(
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: Scalar_String(
value: e
)
@@ -48,4 +54,4 @@ array(
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
index 53c462c5a..8327cf32c 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/typeDeclarations.test
@@ -7,27 +7,39 @@ function a($b, array $c, callable $d, E $f) {}
array(
0: Stmt_Function(
byRef: false
- name: a
+ name: Identifier(
+ name: a
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
1: Param(
- type: array
+ type: Identifier(
+ name: array
+ )
byRef: false
variadic: false
- name: c
+ var: Expr_Variable(
+ name: c
+ )
default: null
)
2: Param(
- type: callable
+ type: Identifier(
+ name: callable
+ )
byRef: false
variadic: false
- name: d
+ var: Expr_Variable(
+ name: d
+ )
default: null
)
3: Param(
@@ -38,7 +50,9 @@ array(
)
byRef: false
variadic: false
- name: f
+ var: Expr_Variable(
+ name: f
+ )
default: null
)
)
@@ -46,4 +60,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
index f9d848c7d..afbcf68fb 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadic.test
@@ -9,20 +9,26 @@ function test($a, Type &... $b) {}
array(
0: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
type: null
byRef: false
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -32,20 +38,26 @@ array(
)
1: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
type: null
byRef: true
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -55,13 +67,17 @@ array(
)
2: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
@@ -72,7 +88,9 @@ array(
)
byRef: false
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -82,13 +100,17 @@ array(
)
3: Stmt_Function(
byRef: false
- name: test
+ name: Identifier(
+ name: test
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: false
- name: a
+ var: Expr_Variable(
+ name: a
+ )
default: null
)
1: Param(
@@ -99,7 +121,9 @@ array(
)
byRef: true
variadic: true
- name: b
+ var: Expr_Variable(
+ name: b
+ )
default: null
)
)
@@ -107,4 +131,4 @@ array(
stmts: array(
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
index 0c3714f21..0431f39ac 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/function/variadicDefaultValue.test
@@ -7,13 +7,17 @@ Variadic parameter cannot have a default value from 2:24 to 2:25
array(
0: Stmt_Function(
byRef: false
- name: foo
+ name: Identifier(
+ name: foo
+ )
params: array(
0: Param(
type: null
byRef: false
variadic: true
- name: foo
+ var: Expr_Variable(
+ name: foo
+ )
default: Expr_Array(
items: array(
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
index 8a184aaf6..78ea9c09e 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/basic.test
@@ -34,51 +34,26 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: null
- comments: array(
- 0: // statements
- )
- )
- 1: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: value
- )
- )
- 2: Expr_Yield(
- key: Expr_Variable(
- name: key
- )
- value: Expr_Variable(
- name: value
- )
- )
- 3: Expr_Assign(
- var: Expr_Variable(
- name: data
- comments: array(
- 0: // expressions
- )
- )
+ 0: Stmt_Expression(
expr: Expr_Yield(
key: null
value: null
+ comments: array(
+ 0: // statements
+ )
)
comments: array(
- 0: // expressions
+ 0: // statements
)
)
- 4: Expr_Assign(
- var: Expr_Variable(
- name: data
- )
+ 1: Stmt_Expression(
expr: Expr_Yield(
key: null
value: Expr_Variable(
@@ -86,10 +61,7 @@ array(
)
)
)
- 5: Expr_Assign(
- var: Expr_Variable(
- name: data
- )
+ 2: Stmt_Expression(
expr: Expr_Yield(
key: Expr_Variable(
name: key
@@ -99,6 +71,54 @@ array(
)
)
)
+ 3: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ comments: array(
+ 0: // expressions
+ )
+ )
+ expr: Expr_Yield(
+ key: null
+ value: null
+ )
+ comments: array(
+ 0: // expressions
+ )
+ )
+ comments: array(
+ 0: // expressions
+ )
+ )
+ 4: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ )
+ expr: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: value
+ )
+ )
+ )
+ )
+ 5: Stmt_Expression(
+ expr: Expr_Assign(
+ var: Expr_Variable(
+ name: data
+ )
+ expr: Expr_Yield(
+ key: Expr_Variable(
+ name: key
+ )
+ value: Expr_Variable(
+ name: value
+ )
+ )
+ )
+ )
6: Stmt_If(
cond: Expr_Yield(
key: null
@@ -159,14 +179,14 @@ array(
)
)
9: Stmt_Do(
+ stmts: array(
+ )
cond: Expr_Yield(
key: null
value: Expr_Variable(
name: foo
)
)
- stmts: array(
- )
)
10: Stmt_Switch(
cond: Expr_Yield(
@@ -178,100 +198,119 @@ array(
cases: array(
)
)
- 11: Expr_Exit(
- expr: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ 11: Stmt_Expression(
+ expr: Expr_Exit(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
)
)
- 12: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: func
- )
- comments: array(
- 0: // yield in function calls
+ 12: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: func
+ )
+ comments: array(
+ 0: // yield in function calls
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
+ )
+ comments: array(
+ 0: // yield in function calls
)
)
comments: array(
0: // yield in function calls
)
)
- 13: Expr_MethodCall(
- var: Expr_Variable(
- name: foo
- )
- name: func
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ 13: Stmt_Expression(
+ expr: Expr_MethodCall(
+ var: Expr_Variable(
+ name: foo
+ )
+ name: Identifier(
+ name: func
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 14: Expr_New(
- class: Name(
- parts: array(
- 0: Foo
+ 14: Stmt_Expression(
+ expr: Expr_New(
+ class: Name(
+ parts: array(
+ 0: Foo
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Yield(
- key: null
- value: Expr_Variable(
- name: foo
+ args: array(
+ 0: Arg(
+ value: Expr_Yield(
+ key: null
+ value: Expr_Variable(
+ name: foo
+ )
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 15: Expr_YieldFrom(
- expr: Expr_Variable(
- name: foo
- )
- )
- 16: Expr_BinaryOp_LogicalAnd(
- left: Expr_YieldFrom(
+ 15: Stmt_Expression(
+ expr: Expr_YieldFrom(
expr: Expr_Variable(
name: foo
)
)
- right: Expr_YieldFrom(
- expr: Expr_Variable(
- name: bar
+ )
+ 16: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalAnd(
+ left: Expr_YieldFrom(
+ expr: Expr_Variable(
+ name: foo
+ )
+ )
+ right: Expr_YieldFrom(
+ expr: Expr_Variable(
+ name: bar
+ )
)
)
)
- 17: Expr_YieldFrom(
- expr: Expr_BinaryOp_Plus(
- left: Expr_Variable(
- name: foo
- )
- right: Expr_Variable(
- name: bar
+ 17: Stmt_Expression(
+ expr: Expr_YieldFrom(
+ expr: Expr_BinaryOp_Plus(
+ left: Expr_Variable(
+ name: foo
+ )
+ right: Expr_Variable(
+ name: bar
+ )
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
index ff0d4df08..1f843c314 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldPrecedence.test
@@ -18,213 +18,233 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
- )
- )
- )
- 1: Expr_BinaryOp_LogicalOr(
- left: Expr_Yield(
+ 0: Stmt_Expression(
+ expr: Expr_Yield(
key: null
- value: Scalar_String(
- value: a
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
- right: Expr_Exit(
- expr: null
- )
)
- 2: Expr_Yield(
- key: Scalar_String(
- value: k
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
+ 1: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: a
+ )
)
- right: Scalar_String(
- value: b
+ right: Expr_Exit(
+ expr: null
)
)
)
- 3: Expr_BinaryOp_LogicalOr(
- left: Expr_Yield(
+ 2: Stmt_Expression(
+ expr: Expr_Yield(
key: Scalar_String(
value: k
)
- value: Scalar_String(
- value: a
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
- right: Expr_Exit(
- expr: null
- )
)
- 4: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
+ 3: Stmt_Expression(
+ expr: Expr_BinaryOp_LogicalOr(
+ left: Expr_Yield(
+ key: Scalar_String(
+ value: k
+ )
+ value: Scalar_String(
+ value: a
+ )
+ )
+ right: Expr_Exit(
+ expr: null
)
)
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
+ )
+ 4: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
+ )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k
)
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 5: Expr_Yield(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
+ 5: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
value: Expr_Yield(
key: Scalar_String(
- value: k2
+ value: k1
)
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k2
)
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
)
)
)
- 6: Expr_Yield(
- key: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
- value: Expr_Yield(
- key: null
- value: Scalar_String(
- value: k2
+ 6: Stmt_Expression(
+ expr: Expr_Yield(
+ key: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: k2
+ )
)
)
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
)
- 7: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
+ 7: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: null
- value: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: null
value: Expr_Yield(
key: Scalar_String(
- value: k2
+ value: k1
)
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
+ value: Expr_Yield(
+ key: Scalar_String(
+ value: k2
)
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
)
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
- 8: Expr_FuncCall(
- name: Name(
- parts: array(
- 0: var_dump
+ 8: Stmt_Expression(
+ expr: Expr_FuncCall(
+ name: Name(
+ parts: array(
+ 0: var_dump
+ )
)
- )
- args: array(
- 0: Arg(
- value: Expr_Array(
- items: array(
- 0: Expr_ArrayItem(
- key: Expr_Yield(
- key: Scalar_String(
- value: k1
- )
- value: Expr_Yield(
- key: null
- value: Scalar_String(
- value: k2
+ args: array(
+ 0: Arg(
+ value: Expr_Array(
+ items: array(
+ 0: Expr_ArrayItem(
+ key: Expr_Yield(
+ key: Scalar_String(
+ value: k1
+ )
+ value: Expr_Yield(
+ key: null
+ value: Scalar_String(
+ value: k2
+ )
)
)
- )
- value: Expr_BinaryOp_Concat(
- left: Scalar_String(
- value: a
- )
- right: Scalar_String(
- value: b
+ value: Expr_BinaryOp_Concat(
+ left: Scalar_String(
+ value: a
+ )
+ right: Scalar_String(
+ value: b
+ )
)
+ byRef: false
)
- byRef: false
)
)
+ byRef: false
+ unpack: false
)
- byRef: false
- unpack: false
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
index 13f96602c..6b77d3357 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/generator/yieldUnaryPrecedence.test
@@ -11,38 +11,46 @@ function gen() {
array(
0: Stmt_Function(
byRef: false
- name: gen
+ name: Identifier(
+ name: gen
+ )
params: array(
)
returnType: null
stmts: array(
- 0: Expr_Yield(
- key: null
- value: Expr_UnaryPlus(
- expr: Scalar_LNumber(
- value: 1
+ 0: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_UnaryPlus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
)
)
)
- 1: Expr_Yield(
- key: null
- value: Expr_UnaryMinus(
- expr: Scalar_LNumber(
- value: 1
+ 1: Stmt_Expression(
+ expr: Expr_Yield(
+ key: null
+ value: Expr_UnaryMinus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
)
)
)
- 2: Expr_BinaryOp_Mul(
- left: Expr_Yield(
- key: null
- value: null
- )
- right: Expr_UnaryMinus(
- expr: Scalar_LNumber(
- value: 1
+ 2: Stmt_Expression(
+ expr: Expr_BinaryOp_Mul(
+ left: Expr_Yield(
+ key: null
+ value: null
+ )
+ right: Expr_UnaryMinus(
+ expr: Scalar_LNumber(
+ value: 1
+ )
)
)
)
)
)
-)
+)
\ No newline at end of file
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
index 67133ba74..112946ea7 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompiler.test
@@ -8,8 +8,10 @@ __halt_compiler()
Hallo World!
-----
array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
1: Stmt_HaltCompiler(
remaining: Hallo World!
@@ -22,8 +24,10 @@ $a;
__halt_compiler();Hallo World!
-----
array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
1: Stmt_HaltCompiler(
remaining: Hallo World!
@@ -44,8 +48,10 @@ array(
)
)
stmts: array(
- 0: Expr_Variable(
- name: a
+ 0: Stmt_Expression(
+ expr: Expr_Variable(
+ name: a
+ )
)
)
)
diff --git a/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test b/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
index 597710f2d..381019a9b 100644
--- a/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
+++ b/app/vendor/nikic/php-parser/test/code/parser/stmt/haltCompilerInvalidSyntax.test
@@ -3,4 +3,4 @@ Invalid __halt_compiler() syntax
+Test
+
+Test
+ $code) {
+ if (false !== strpos($code, '@@{')) {
+ // Skip tests with evaluate segments
+ continue;
+ }
+
+ list($name, $tests) = $testParser->parseTest($code, 2);
+ $newTests = [];
+ foreach ($tests as list($modeLine, list($input, $expected))) {
+ $modes = null !== $modeLine ? array_fill_keys(explode(',', $modeLine), true) : [];
+ list($parser5, $parser7) = $codeParsingTest->createParsers($modes);
+ list(, $output) = isset($modes['php5'])
+ ? $codeParsingTest->getParseOutput($parser5, $input, $modes)
+ : $codeParsingTest->getParseOutput($parser7, $input, $modes);
+ $newTests[] = [$modeLine, [$input, $output]];
+ }
+
+ $newCode = $testParser->reconstructTest($name, $newTests);
+ file_put_contents($fileName, $newCode);
+}
diff --git a/app/vendor/nikic/php-parser/test_old/run.php b/app/vendor/nikic/php-parser/test_old/run.php
index bc14d893a..2d7cdaccb 100644
--- a/app/vendor/nikic/php-parser/test_old/run.php
+++ b/app/vendor/nikic/php-parser/test_old/run.php
@@ -110,17 +110,24 @@ function showHelp($error) {
showHelp('Test type must be one of: PHP5, PHP7 or Symfony');
}
-require_once dirname(__FILE__) . '/../lib/PhpParser/Autoloader.php';
-PhpParser\Autoloader::register();
-
-$parserName = 'PhpParser\Parser\\' . $version;
-$parser = new $parserName(new PhpParser\Lexer\Emulative);
+require_once __DIR__ . '/../vendor/autoload.php';
+
+$lexer = new PhpParser\Lexer\Emulative(['usedAttributes' => [
+ 'comments', 'startLine', 'endLine', 'startTokenPos', 'endTokenPos',
+]]);
+$parserName = 'PhpParser\Parser\\' . $version;
+/** @var PhpParser\Parser $parser */
+$parser = new $parserName($lexer);
$prettyPrinter = new PhpParser\PrettyPrinter\Standard;
-$nodeDumper = new PhpParser\NodeDumper;
+$nodeDumper = new PhpParser\NodeDumper;
+
+$cloningTraverser = new PhpParser\NodeTraverser;
+$cloningTraverser->addVisitor(new PhpParser\NodeVisitor\CloningVisitor);
-$parseFail = $ppFail = $compareFail = $count = 0;
+$parseFail = $fpppFail = $ppFail = $compareFail = $count = 0;
-$readTime = $parseTime = $ppTime = $reparseTime = $compareTime = 0;
+$readTime = $parseTime = $cloneTime = 0;
+$fpppTime = $ppTime = $reparseTime = $compareTime = 0;
$totalStartTime = microtime(true);
foreach (new RecursiveIteratorIterator(
@@ -132,10 +139,10 @@ function showHelp($error) {
}
$startTime = microtime(true);
- $code = file_get_contents($file);
+ $origCode = file_get_contents($file);
$readTime += microtime(true) - $startTime;
- if (null === $code = $codeExtractor($file, $code)) {
+ if (null === $origCode = $codeExtractor($file, $origCode)) {
continue;
}
@@ -149,11 +156,30 @@ function showHelp($error) {
try {
$startTime = microtime(true);
- $stmts = $parser->parse($code);
+ $origStmts = $parser->parse($origCode);
$parseTime += microtime(true) - $startTime;
+ $origTokens = $lexer->getTokens();
+
$startTime = microtime(true);
- $code = 'prettyPrint($stmts);
+ $stmts = $cloningTraverser->traverse($origStmts);
+ $cloneTime += microtime(true) - $startTime;
+
+ $startTime = microtime(true);
+ $code = $prettyPrinter->printFormatPreserving($stmts, $origStmts, $origTokens);
+ $fpppTime += microtime(true) - $startTime;
+
+ if ($code !== $origCode) {
+ echo $file, ":\n Result of format-preserving pretty-print differs\n";
+ if ($verbose) {
+ echo "FPPP output:\n=====\n$code\n=====\n\n";
+ }
+
+ ++$fpppFail;
+ }
+
+ $startTime = microtime(true);
+ $code = "prettyPrint($stmts);
$ppTime += microtime(true) - $startTime;
try {
@@ -200,6 +226,9 @@ function showHelp($error) {
if (0 !== $ppFail) {
echo ' ', $ppFail, ' pretty print failures.', "\n";
}
+ if (0 !== $fpppFail) {
+ echo ' ', $fpppFail, ' FPPP failures.', "\n";
+ }
if (0 !== $compareFail) {
echo ' ', $compareFail, ' compare failures.', "\n";
}
@@ -210,6 +239,8 @@ function showHelp($error) {
"\n",
'Reading files took: ', $readTime, "\n",
'Parsing took: ', $parseTime, "\n",
+ 'Cloning took: ', $cloneTime, "\n",
+ 'FPPP took: ', $fpppTime, "\n",
'Pretty printing took: ', $ppTime, "\n",
'Reparsing took: ', $reparseTime, "\n",
'Comparing took: ', $compareTime, "\n",
diff --git a/app/vendor/psy/psysh/.editorconfig b/app/vendor/psy/psysh/.editorconfig
index 779f99a12..fddf9c1c6 100644
--- a/app/vendor/psy/psysh/.editorconfig
+++ b/app/vendor/psy/psysh/.editorconfig
@@ -10,3 +10,6 @@ insert_final_newline = true
[*.md]
trim_trailing_whitespace = false
+
+[Makefile]
+indent_style = tab
diff --git a/app/vendor/psy/psysh/.github/CONTRIBUTING.md b/app/vendor/psy/psysh/.github/CONTRIBUTING.md
new file mode 100644
index 000000000..efb87446c
--- /dev/null
+++ b/app/vendor/psy/psysh/.github/CONTRIBUTING.md
@@ -0,0 +1,9 @@
+## Code style
+
+Please make your code look like the other code in the project.
+
+PsySH follows [PSR-1](http://php-fig.org/psr/psr-1/) and [PSR-2](http://php-fig.org/psr/psr-2/). The easiest way to do make sure you're following the coding standard is to [install `php-cs-fixer`](https://github.com/friendsofphp/php-cs-fixer) and run `php-cs-fixer fix` before committing.
+
+## Branching model
+
+Please branch off and send pull requests to the `develop` branch.
diff --git a/app/vendor/psy/psysh/.gitignore b/app/vendor/psy/psysh/.gitignore
index d4300e2bb..da05f58cb 100644
--- a/app/vendor/psy/psysh/.gitignore
+++ b/app/vendor/psy/psysh/.gitignore
@@ -1,11 +1,9 @@
-build-vendor/
-vendor/
-composer.lock
-composer-compat.json
-composer-compat.lock
-manual/
-dist/
-__pycache__
-.php_cs.cache
-psysh.phar
-psysh-compat.phar
+/build/
+/dist/
+/composer.lock
+/manual/
+/psysh
+/__pycache__
+/.php_cs.cache
+/vendor/
+/vendor-bin/*/vendor/
diff --git a/app/vendor/psy/psysh/.php_cs b/app/vendor/psy/psysh/.php_cs
index 94e2ce165..421c31d2a 100644
--- a/app/vendor/psy/psysh/.php_cs
+++ b/app/vendor/psy/psysh/.php_cs
@@ -10,7 +10,7 @@ $finder = PhpCsFixer\Finder::create()
$header = <<setRules(array(
'@Symfony' => true,
- 'array_syntax' => array('syntax' => 'long'),
+ 'array_syntax' => array('syntax' => 'short'),
'binary_operator_spaces' => false,
'concat_space' => array('spacing' => 'one'),
'header_comment' => array('header' => $header),
diff --git a/app/vendor/psy/psysh/.styleci.yml b/app/vendor/psy/psysh/.styleci.yml
index 27a247ed2..96fc96bf4 100644
--- a/app/vendor/psy/psysh/.styleci.yml
+++ b/app/vendor/psy/psysh/.styleci.yml
@@ -3,7 +3,7 @@ preset: symfony
enabled:
- align_double_arrow
- concat_with_spaces
- - long_array_syntax
+ - short_array_syntax
- ordered_use
- strict
@@ -18,6 +18,8 @@ disabled:
- unalign_double_arrow
- unalign_equals
- yoda_style
+ - property_separation
+ - const_separation
finder:
name:
diff --git a/app/vendor/psy/psysh/.travis.yml b/app/vendor/psy/psysh/.travis.yml
index 20277ef97..3a77512aa 100644
--- a/app/vendor/psy/psysh/.travis.yml
+++ b/app/vendor/psy/psysh/.travis.yml
@@ -4,23 +4,32 @@ sudo: false
matrix:
include:
- - php: 5.3
- dist: precise
- php: 5.4
+ - php: 5.4
+ env: 'COMPOSER_FLAGS="--prefer-lowest --prefer-stable"'
- php: 5.5
- php: 5.6
- php: 7.0
- php: 7.1
+ - php: 7.2
- php: hhvm
dist: trusty
allow_failures:
+ - php: 5.4
+ env: 'COMPOSER_FLAGS="--prefer-lowest --prefer-stable"'
- php: hhvm
+ fast_finish: true
+
+install: travis_retry composer update --no-interaction $COMPOSER_FLAGS
-install: travis_retry composer update --no-interaction
+script:
+ - vendor/bin/phpunit --verbose --coverage-clover=coverage.xml
+ - '[[ $TRAVIS_PHP_VERSION = 7.2* ]] && make build -j 4 || true'
-script: vendor/bin/phpunit --verbose
+after_success:
+ - bash <(curl -s https://codecov.io/bash)
-before_deploy: bin/package -v $TRAVIS_TAG
+before_deploy: make dist -j 4
deploy:
provider: releases
@@ -32,4 +41,4 @@ deploy:
on:
tags: true
repo: bobthecow/psysh
- condition: ($TRAVIS_PHP_VERSION = 5.3* || $TRAVIS_PHP_VERSION = 7.0*)
+ condition: $TRAVIS_PHP_VERSION = 7.2*
diff --git a/app/vendor/psy/psysh/CONTRIBUTING.md b/app/vendor/psy/psysh/CONTRIBUTING.md
deleted file mode 100644
index a5c726ba2..000000000
--- a/app/vendor/psy/psysh/CONTRIBUTING.md
+++ /dev/null
@@ -1,18 +0,0 @@
-## Code style
-
-Please make your code look like the other code in the project. PsySH follows [PSR-1](http://php-fig.org/psr/psr-1/) and [PSR-2](http://php-fig.org/psr/psr-2/). The easiest way to do make sure you're following the coding standard is to run `vendor/bin/php-cs-fixer fix` before committing.
-
-## Branching model
-
-Please branch off and send pull requests to the `develop` branch.
-
-## Building the manual
-
-```sh
-svn co https://svn.php.net/repository/phpdoc/en/trunk/reference/ php_manual
-bin/build_manual phpdoc_manual ~/.local/share/psysh/php_manual.sqlite
-```
-
-To build the manual for another language, switch out `en` above for `de`, `es`, or any of the other languages listed in the docs.
-
-[Partial or outdated documentation is available for other languages](http://www.php.net/manual/help-translate.php) but these translations are outdated, so their content may be completely wrong or insecure!
diff --git a/app/vendor/psy/psysh/LICENSE b/app/vendor/psy/psysh/LICENSE
index fdd27fb73..2c6a45137 100644
--- a/app/vendor/psy/psysh/LICENSE
+++ b/app/vendor/psy/psysh/LICENSE
@@ -1,6 +1,6 @@
The MIT License (MIT)
-Copyright (c) 2012-2017 Justin Hileman
+Copyright (c) 2012-2018 Justin Hileman
Permission is hereby granted, free of charge, to any person obtaining a copy
of this software and associated documentation files (the "Software"), to deal
diff --git a/app/vendor/psy/psysh/Makefile b/app/vendor/psy/psysh/Makefile
new file mode 100644
index 000000000..a1fdb42ed
--- /dev/null
+++ b/app/vendor/psy/psysh/Makefile
@@ -0,0 +1,95 @@
+PSYSH_SRC = bin src box.json.dist composer.json build/stub
+PSYSH_SRC_FILES = $(shell find src -type f -name "*.php")
+VERSION = $(shell git describe --tag --always --dirty=-dev)
+
+COMPOSER_OPTS = --no-interaction --no-progress --verbose
+COMPOSER_REQUIRE_OPTS = $(COMPOSER_OPTS) --no-update
+COMPOSER_UPDATE_OPTS = $(COMPOSER_OPTS) --prefer-stable --no-dev --classmap-authoritative --prefer-dist
+
+
+# Commands
+
+.PHONY: help clean build dist
+.DEFAULT_GOAL := help
+
+help:
+ @echo "\033[33mUsage:\033[0m\n make TARGET\n\n\033[33mTargets:\033[0m"
+ @grep -E '^[a-zA-Z0-9_-]+:.*?## .*$$' $(MAKEFILE_LIST) | sort | awk 'BEGIN {FS = ":.*?## "}; {printf " \033[32m%-7s\033[0m %s\n", $$1, $$2}'
+
+clean: ## Clean all created artifacts
+ rm -rf build/*
+ rm -rf dist/*
+ rm -rf vendor-bin/*/vendor/
+
+build: ## Compile PHARs
+build: build/psysh/psysh build/psysh-compat/psysh build/psysh-php54/psysh build/psysh-php54-compat/psysh
+
+dist: ## Build tarballs for distribution
+dist: dist/psysh-$(VERSION).tar.gz dist/psysh-$(VERSION)-compat.tar.gz dist/psysh-$(VERSION)-php54.tar.gz dist/psysh-$(VERSION)-php54-compat.tar.gz
+
+
+# All the composer stuffs
+
+composer.lock: composer.json
+ composer install
+ touch $@
+
+vendor/autoload.php: composer.lock
+ composer install
+ touch $@
+
+vendor/bin/box: vendor/autoload.php
+ composer bin box install
+ touch $@
+
+
+# Lots of PHARs
+
+build/stub: bin/build-stub bin/psysh LICENSE
+ bin/build-stub
+
+build/psysh: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 7.0
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 7.0
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) php:'>=7.0.0'
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-php54: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 5.4
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/psysh-php54-compat: $(PSYSH_SRC) $(PSYSH_SRC_FILES)
+ rm -rf $@ || true
+ mkdir $@
+ cp -R $(PSYSH_SRC) $@/
+ composer config --working-dir $@ platform.php 5.4
+ composer require --working-dir $@ $(COMPOSER_REQUIRE_OPTS) symfony/polyfill-iconv symfony/polyfill-mbstring hoa/console:^2.15
+ composer update --working-dir $@ $(COMPOSER_UPDATE_OPTS)
+
+build/%/psysh: vendor/bin/box build/%
+ vendor/bin/box compile --working-dir $(dir $@)
+
+
+# Dist packages
+
+dist/psysh-$(VERSION).tar.gz: build/psysh/psysh
+ @mkdir -p $(@D)
+ tar -C $(dir $<) -czf $@ $(notdir $<)
+
+dist/psysh-$(VERSION)-%.tar.gz: build/psysh-%/psysh
+ @mkdir -p $(@D)
+ tar -C $(dir $<) -czf $@ $(notdir $<)
diff --git a/app/vendor/psy/psysh/README.md b/app/vendor/psy/psysh/README.md
index 45dd6a3b2..710434caf 100644
--- a/app/vendor/psy/psysh/README.md
+++ b/app/vendor/psy/psysh/README.md
@@ -17,6 +17,7 @@ PsySH is a runtime developer console, interactive debugger and [REPL](https://en
### [💾 Installation](https://github.com/bobthecow/psysh/wiki/Installation)
* [📕 PHP manual installation](https://github.com/bobthecow/psysh/wiki/PHP-manual)
+ *
Windows
### [🖥 Usage](https://github.com/bobthecow/psysh/wiki/Usage)
* [✨ Magic variables](https://github.com/bobthecow/psysh/wiki/Magic-variables)
diff --git a/app/vendor/psy/psysh/bin/build b/app/vendor/psy/psysh/bin/build
deleted file mode 100755
index 79f2192b2..000000000
--- a/app/vendor/psy/psysh/bin/build
+++ /dev/null
@@ -1,13 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-echo "Building phar"
-./bin/build-vendor
-php -d 'phar.readonly=0' ./bin/build-phar
-
-echo "Building compat phar"
-./bin/build-vendor-compat
-php -d 'phar.readonly=0' ./bin/build-phar --compat
diff --git a/app/vendor/psy/psysh/bin/build-manual b/app/vendor/psy/psysh/bin/build-manual
deleted file mode 100755
index ece227817..000000000
--- a/app/vendor/psy/psysh/bin/build-manual
+++ /dev/null
@@ -1,312 +0,0 @@
-#!/usr/bin/env php
-':
- $inTag = false;
- break;
- }
-
- if ($inTag) {
- $tagWidth++;
- }
-
- $i++;
-
- if (!$inTag && ($i - $tagWidth > $width)) {
- $lastSpace = $lastSpace ?: $width;
-
- $return[] = trim(substr($text, 0, $lastSpace));
- $text = substr($text, $lastSpace);
- $len = strlen($text);
-
- $i = $tagWidth = 0;
- }
- } while ($i < $len);
-
- $return[] = trim($text);
-
- return implode("\n", $return);
-}
-
-function extract_paragraphs($element)
-{
- $paragraphs = array();
- foreach ($element->getElementsByTagName('para') as $p) {
- $text = '';
- foreach ($p->childNodes as $child) {
- // @todo figure out if there's something we can do with tables.
- if ($child instanceof DOMElement && $child->tagName === 'table') {
- continue;
- }
-
- // skip references, because ugh.
- if (preg_match('{^\s*&[a-z][a-z\.]+;\s*$}', $child->textContent)) {
- continue;
- }
-
- $text .= $child->ownerDocument->saveXML($child);
- }
-
- if ($text = trim(preg_replace('{\n[ \t]+}', ' ', $text))) {
- $paragraphs[] = $text;
- }
- }
-
- return implode("\n\n", $paragraphs);
-}
-
-function format_doc($doc)
-{
- $chunks = array();
-
- if (!empty($doc['description'])) {
- $chunks[] = 'Description: ';
- $chunks[] = indent_text(htmlwrap(thunk_tags($doc['description']), WRAP_WIDTH - 2));
- $chunks[] = '';
- }
-
- if (!empty($doc['params'])) {
- $chunks[] = 'Param: ';
-
- $typeMax = max(array_map(function ($param) {
- return strlen($param['type']);
- }, $doc['params']));
-
- $max = max(array_map(function ($param) {
- return strlen($param['name']);
- }, $doc['params']));
-
- $template = ' %-' . $typeMax . 's %-' . $max . 's %s';
- $indent = str_repeat(' ', $typeMax + $max + 6);
- $wrapWidth = WRAP_WIDTH - strlen($indent);
-
- foreach ($doc['params'] as $param) {
- $desc = indent_text(htmlwrap(thunk_tags($param['description']), $wrapWidth), $indent, false);
- $chunks[] = sprintf($template, $param['type'], $param['name'], $desc);
- }
- $chunks[] = '';
- }
-
- if (isset($doc['return']) || isset($doc['return_type'])) {
- $chunks[] = 'Return: ';
-
- $type = isset($doc['return_type']) ? $doc['return_type'] : 'unknown';
- $desc = isset($doc['return']) ? $doc['return'] : '';
-
- $indent = str_repeat(' ', strlen($type) + 4);
- $wrapWidth = WRAP_WIDTH - strlen($indent);
-
- if (!empty($desc)) {
- $desc = indent_text(htmlwrap(thunk_tags($doc['return']), $wrapWidth), $indent, false);
- }
-
- $chunks[] = sprintf(' %s %s', $type, $desc);
- $chunks[] = '';
- }
-
- array_pop($chunks); // get rid of the trailing newline
-
- return implode("\n", $chunks);
-}
-
-function thunk_tags($text)
-{
- $tagMap = array(
- 'parameter>' => 'strong>',
- 'function>' => 'strong>',
- 'literal>' => 'return>',
- 'type>' => 'info>',
- 'constant>' => 'info>',
- );
-
- $andBack = array(
- '&' => '&',
- '&true;' => 'true ',
- '&false;' => 'false ',
- '&null;' => 'null ',
- );
-
- return strtr(strip_tags(strtr($text, $tagMap), ''), $andBack);
-}
-
-function indent_text($text, $indent = ' ', $leading = true)
-{
- return ($leading ? $indent : '') . str_replace("\n", "\n" . $indent, $text);
-}
-
-function find_type($xml, $paramName)
-{
- foreach ($xml->getElementsByTagName('methodparam') as $param) {
- if ($type = $param->getElementsByTagName('type')->item(0)) {
- if ($parameter = $param->getElementsByTagName('parameter')->item(0)) {
- if ($paramName === $parameter->textContent) {
- return $type->textContent;
- }
- }
- }
- }
-}
-
-function format_function_doc($xml)
-{
- $doc = array();
- $refsect1s = $xml->getElementsByTagName('refsect1');
- foreach ($refsect1s as $refsect1) {
- $role = $refsect1->getAttribute('role');
- switch ($role) {
- case 'description':
- $doc['description'] = extract_paragraphs($refsect1);
-
- if ($synopsis = $refsect1->getElementsByTagName('methodsynopsis')->item(0)) {
- foreach ($synopsis->childNodes as $node) {
- if ($node instanceof DOMElement && $node->tagName === 'type') {
- $doc['return_type'] = $node->textContent;
- break;
- }
- }
- }
- break;
-
- case 'returnvalues':
- // do nothing.
- $doc['return'] = extract_paragraphs($refsect1);
- break;
-
- case 'parameters':
- $params = array();
- $vars = $refsect1->getElementsByTagName('varlistentry');
- foreach ($vars as $var) {
- if ($name = $var->getElementsByTagName('parameter')->item(0)) {
- $params[] = array(
- 'name' => '$' . $name->textContent,
- 'type' => find_type($xml, $name->textContent),
- 'description' => extract_paragraphs($var),
- );
- }
- }
-
- $doc['params'] = $params;
- break;
- }
- }
-
- // and the purpose
- if ($purpose = $xml->getElementsByTagName('refpurpose')->item(0)) {
- $desc = htmlwrap($purpose->textContent);
- if (isset($doc['description'])) {
- $desc .= "\n\n" . $doc['description'];
- }
-
- $doc['description'] = trim($desc);
- }
-
- $ids = array();
- foreach ($xml->getElementsByTagName('refname') as $ref) {
- $ids[] = $ref->textContent;
- }
-
- return array($ids, format_doc($doc));
-}
-
-function format_class_doc($xml)
-{
- // @todo implement this
- return array(array(), null);
-}
-
-$dir = new RecursiveDirectoryIterator($argv[1]);
-$filter = new RecursiveCallbackFilterIterator($dir, function ($current, $key, $iterator) {
- return $current->getFilename()[0] !== '.' &&
- ($current->isDir() || $current->getExtension() === 'xml') &&
- strpos($current->getFilename(), 'entities.') !== 0 &&
- $current->getFilename() !== 'pdo_4d'; // Temporarily blacklist this one, the docs are weird.
-});
-$iterator = new RecursiveIteratorIterator($filter);
-
-$docs = array();
-foreach ($iterator as $file) {
- $xmlstr = str_replace('&', '&', file_get_contents($file));
-
- $xml = new DOMDocument();
- $xml->preserveWhiteSpace = false;
-
- if (!@$xml->loadXml($xmlstr)) {
- echo "XML Parse Error: $file\n";
- continue;
- }
-
- if ($xml->getElementsByTagName('refentry')->length !== 0) {
- list($ids, $doc) = format_function_doc($xml);
- } elseif ($xml->getElementsByTagName('classref')->length !== 0) {
- list($ids, $doc) = format_class_doc($xml);
- } else {
- $ids = array();
- $doc = null;
- }
-
- foreach ($ids as $id) {
- $docs[$id] = $doc;
- }
-}
-
-if (is_file($argv[2])) {
- unlink($argv[2]);
-}
-
-$db = new PDO('sqlite:' . $argv[2]);
-
-$db->query('CREATE TABLE php_manual (id char(256) PRIMARY KEY, doc TEXT)');
-$cmd = $db->prepare('INSERT INTO php_manual (id, doc) VALUES (?, ?)');
-foreach ($docs as $id => $doc) {
- $cmd->execute(array($id, $doc));
-}
diff --git a/app/vendor/psy/psysh/bin/build-phar b/app/vendor/psy/psysh/bin/build-phar
deleted file mode 100755
index 43db2f6b7..000000000
--- a/app/vendor/psy/psysh/bin/build-phar
+++ /dev/null
@@ -1,38 +0,0 @@
-#!/usr/bin/env php
-compile('psysh-compat.phar');
-} else {
- $compiler->compile();
-}
diff --git a/app/vendor/psy/psysh/bin/build-stub b/app/vendor/psy/psysh/bin/build-stub
new file mode 100755
index 000000000..0d26110ea
--- /dev/null
+++ b/app/vendor/psy/psysh/bin/build-stub
@@ -0,0 +1,22 @@
+#!/usr/bin/env php
+>> \*/}sm', $autoload, $content);
+$content = preg_replace('/\\(c\\) .*?with this source code./sm', $license, $content);
+
+$content .= '__HALT_COMPILER();';
+
+@mkdir(dirname(__DIR__) . '/build');
+
+file_put_contents(dirname(__DIR__) . '/build/stub', $content);
diff --git a/app/vendor/psy/psysh/bin/build-vendor b/app/vendor/psy/psysh/bin/build-vendor
deleted file mode 100755
index f0057d522..000000000
--- a/app/vendor/psy/psysh/bin/build-vendor
+++ /dev/null
@@ -1,10 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-rm -rf build-vendor
-
-COMPOSER_VENDOR_DIR=build-vendor composer update \
- --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
diff --git a/app/vendor/psy/psysh/bin/build-vendor-compat b/app/vendor/psy/psysh/bin/build-vendor-compat
deleted file mode 100755
index a3cedb592..000000000
--- a/app/vendor/psy/psysh/bin/build-vendor-compat
+++ /dev/null
@@ -1,21 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-rm -rf build-vendor
-rm composer*.lock
-
-cp composer.json composer-compat.json
-
-if [[ $(php --version) = PHP\ 5.3* ]]; then
- HOA_VERSION=^1.14
-fi
-
-COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
- composer require symfony/intl hoa/console $HOA_VERSION --no-progress --no-update --no-interaction --verbose
-
-COMPOSER=composer-compat.json COMPOSER_VENDOR_DIR=build-vendor \
- composer update --prefer-stable --no-dev --no-progress --classmap-authoritative --no-interaction --verbose
-
diff --git a/app/vendor/psy/psysh/bin/package b/app/vendor/psy/psysh/bin/package
deleted file mode 100755
index 2bb6e411e..000000000
--- a/app/vendor/psy/psysh/bin/package
+++ /dev/null
@@ -1,55 +0,0 @@
-#!/usr/bin/env bash
-
-set -e
-
-cd "${BASH_SOURCE%/*}/.."
-
-USAGE="usage: bin/package [-v PACKAGE_VERSION]"
-
-while getopts ":v:h" opt; do
- case $opt in
- v)
- PKG_VERSION=$OPTARG
- ;;
- h)
- echo $USAGE >&2
- exit
- ;;
- \?)
- echo "Invalid option: -$OPTARG" >&2
- echo $USAGE >&2
- exit 1
- ;;
- :)
- echo "Option -$OPTARG requires an argument" >&2
- echo $USAGE >&2
- exit 1
- ;;
- esac
-done
-
-if [ -z "$PKG_VERSION" ]; then
- PKG_VERSION=$(git describe --tag --exact-match)
-fi
-
-if [[ $(php --version) = PHP\ 5.3* ]]; then
- PKG_VERSION=${PKG_VERSION}-php53
-fi
-
-echo "Packaging $PKG_VERSION"
-
-mkdir -p dist || exit 1
-
-./bin/build || exit 1
-chmod +x *.phar
-
-echo "Creating tarballs"
-
-# Support BSD tar because OS X :(
-if [[ $(tar --version) = bsdtar* ]]; then
- tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
- tar -s "/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
-else
- tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}.tar.gz psysh.phar
- tar --transform "s/.*/psysh/" -czf dist/psysh-${PKG_VERSION}-compat.tar.gz psysh-compat.phar
-fi
diff --git a/app/vendor/psy/psysh/bin/psysh b/app/vendor/psy/psysh/bin/psysh
index e1d6350c3..7dbd203e7 100755
--- a/app/vendor/psy/psysh/bin/psysh
+++ b/app/vendor/psy/psysh/bin/psysh
@@ -98,6 +98,9 @@ if (!class_exists('Psy\Shell')) {
// If the psysh binary was included directly, assume they just wanted an
// autoloader and bail early.
+//
+// Keep this PHP 5.3 code around for a while in case someone is using a globally
+// installed psysh as a bin launcher for older local versions.
if (version_compare(PHP_VERSION, '5.3.6', '<')) {
$trace = debug_backtrace();
} elseif (version_compare(PHP_VERSION, '5.4.0', '<')) {
diff --git a/app/vendor/psy/psysh/box.json.dist b/app/vendor/psy/psysh/box.json.dist
new file mode 100644
index 000000000..32305a525
--- /dev/null
+++ b/app/vendor/psy/psysh/box.json.dist
@@ -0,0 +1,13 @@
+{
+ "stub": "stub",
+ "output": "psysh",
+ "compactors": [
+ "KevinGH\\Box\\Compactor\\Php"
+ ],
+ "chmod": "0755",
+ "blacklist": [
+ "grammar",
+ "test_old",
+ "Documentation"
+ ]
+}
diff --git a/app/vendor/psy/psysh/composer.json b/app/vendor/psy/psysh/composer.json
index 69c226cb3..7df60cf48 100644
--- a/app/vendor/psy/psysh/composer.json
+++ b/app/vendor/psy/psysh/composer.json
@@ -13,17 +13,19 @@
}
],
"require": {
- "php": ">=5.3.9",
+ "php": ">=5.4.0",
+ "ext-json": "*",
+ "ext-tokenizer": "*",
"symfony/console": "~2.3.10|^2.4.2|~3.0|~4.0",
"symfony/var-dumper": "~2.7|~3.0|~4.0",
- "nikic/php-parser": "~1.3|~2.0|~3.0",
+ "nikic/php-parser": "~1.3|~2.0|~3.0|~4.0",
"dnoegel/php-xdg-base-dir": "0.1",
"jakub-onderka/php-console-highlighter": "0.3.*"
},
"require-dev": {
- "phpunit/phpunit": "^4.8.35|^5.4.3",
- "symfony/finder": "~2.1|~3.0|~4.0",
- "hoa/console": "~3.16|~1.14"
+ "phpunit/phpunit": "~4.8.35|~5.0|~6.0|~7.0",
+ "hoa/console": "~2.15|~3.16",
+ "bamarni/composer-bin-plugin": "^1.2"
},
"suggest": {
"ext-pcntl": "Enabling the PCNTL extension makes PsySH a lot happier :)",
@@ -33,20 +35,20 @@
"hoa/console": "A pure PHP readline implementation. You'll want this if your PHP install doesn't already support readline or libedit."
},
"autoload": {
- "files": ["src/Psy/functions.php"],
+ "files": ["src/functions.php"],
"psr-4": {
- "Psy\\": "src/Psy/"
+ "Psy\\": "src/"
}
},
"autoload-dev": {
"psr-4": {
- "Psy\\Test\\": "test/Psy/Test/"
+ "Psy\\Test\\": "test/"
}
},
"bin": ["bin/psysh"],
"extra": {
"branch-alias": {
- "dev-develop": "0.8.x-dev"
+ "dev-develop": "0.9.x-dev"
}
}
}
diff --git a/app/vendor/psy/psysh/phpunit.xml.dist b/app/vendor/psy/psysh/phpunit.xml.dist
index 78b2b3305..3534fca27 100644
--- a/app/vendor/psy/psysh/phpunit.xml.dist
+++ b/app/vendor/psy/psysh/phpunit.xml.dist
@@ -6,7 +6,7 @@
- ./src/Psy
+ ./src
* array(
- * 'scope' => 'public', // public protected or protected
- * 'scope_specified' => true, // true is scope keyword was found.
- * 'is_abstract' => false, // true if the abstract keyword was found.
- * 'is_final' => false, // true if the final keyword was found.
- * 'is_static' => false, // true if the static keyword was found.
+ * 'scope' => 'public', // public protected or protected
+ * 'scope_specified' => true, // true is scope keyword was found.
+ * 'return_type' => '', // the return type of the method.
+ * 'return_type_token' => integer, // The stack pointer to the start of the return type
+ * // or false if there is no return type.
+ * 'nullable_return_type' => false, // true if the return type is nullable.
+ * 'is_abstract' => false, // true if the abstract keyword was found.
+ * 'is_final' => false, // true if the final keyword was found.
+ * 'is_static' => false, // true if the static keyword was found.
* );
*
*
@@ -1462,12 +1538,59 @@ public function getMethodProperties($stackPtr)
}//end switch
}//end for
+ $returnType = '';
+ $returnTypeToken = false;
+ $nullableReturnType = false;
+
+ if (isset($this->tokens[$stackPtr]['parenthesis_closer']) === true) {
+ $scopeOpener = null;
+ if (isset($this->tokens[$stackPtr]['scope_opener']) === true) {
+ $scopeOpener = $this->tokens[$stackPtr]['scope_opener'];
+ }
+
+ $valid = [
+ T_STRING => T_STRING,
+ T_CALLABLE => T_CALLABLE,
+ T_SELF => T_SELF,
+ T_PARENT => T_PARENT,
+ T_NS_SEPARATOR => T_NS_SEPARATOR,
+ ];
+
+ for ($i = $this->tokens[$stackPtr]['parenthesis_closer']; $i < $this->numTokens; $i++) {
+ if (($scopeOpener === null && $this->tokens[$i]['code'] === T_SEMICOLON)
+ || ($scopeOpener !== null && $i === $scopeOpener)
+ ) {
+ // End of function definition.
+ break;
+ }
+
+ if ($this->tokens[$i]['code'] === T_NULLABLE) {
+ $nullableReturnType = true;
+ }
+
+ if (isset($valid[$this->tokens[$i]['code']]) === true) {
+ if ($returnTypeToken === false) {
+ $returnTypeToken = $i;
+ }
+
+ $returnType .= $this->tokens[$i]['content'];
+ }
+ }
+ }//end if
+
+ if ($returnType !== '' && $nullableReturnType === true) {
+ $returnType = '?'.$returnType;
+ }
+
return [
- 'scope' => $scope,
- 'scope_specified' => $scopeSpecified,
- 'is_abstract' => $isAbstract,
- 'is_final' => $isFinal,
- 'is_static' => $isStatic,
+ 'scope' => $scope,
+ 'scope_specified' => $scopeSpecified,
+ 'return_type' => $returnType,
+ 'return_type_token' => $returnTypeToken,
+ 'nullable_return_type' => $nullableReturnType,
+ 'is_abstract' => $isAbstract,
+ 'is_final' => $isFinal,
+ 'is_static' => $isStatic,
];
}//end getMethodProperties()
@@ -1481,8 +1604,9 @@ public function getMethodProperties($stackPtr)
*
*
* array(
- * 'scope' => 'public', // public protected or protected
- * 'is_static' => false, // true if the static keyword was found.
+ * 'scope' => 'public', // public protected or protected.
+ * 'scope_specified' => false, // true if the scope was explicitly specified.
+ * 'is_static' => false, // true if the static keyword was found.
* );
*
*
@@ -1527,22 +1651,29 @@ public function getMemberProperties($stackPtr)
}
$valid = [
- T_PUBLIC => T_PUBLIC,
- T_PRIVATE => T_PRIVATE,
- T_PROTECTED => T_PROTECTED,
- T_STATIC => T_STATIC,
- T_WHITESPACE => T_WHITESPACE,
- T_COMMENT => T_COMMENT,
- T_DOC_COMMENT => T_DOC_COMMENT,
- T_VARIABLE => T_VARIABLE,
- T_COMMA => T_COMMA,
+ T_PUBLIC => T_PUBLIC,
+ T_PRIVATE => T_PRIVATE,
+ T_PROTECTED => T_PROTECTED,
+ T_STATIC => T_STATIC,
+ T_VAR => T_VAR,
];
+ $valid += Util\Tokens::$emptyTokens;
+
$scope = 'public';
$scopeSpecified = false;
$isStatic = false;
- for ($i = ($stackPtr - 1); $i > 0; $i--) {
+ $startOfStatement = $this->findPrevious(
+ [
+ T_SEMICOLON,
+ T_OPEN_CURLY_BRACKET,
+ T_CLOSE_CURLY_BRACKET,
+ ],
+ ($stackPtr - 1)
+ );
+
+ for ($i = ($startOfStatement + 1); $i < $stackPtr; $i++) {
if (isset($valid[$this->tokens[$i]['code']]) === false) {
break;
}
@@ -1771,12 +1902,14 @@ public function isReference($stackPtr)
* Returns the content of the tokens from the specified start position in
* the token stack for the specified length.
*
- * @param int $start The position to start from in the token stack.
- * @param int $length The length of tokens to traverse from the start pos.
+ * @param int $start The position to start from in the token stack.
+ * @param int $length The length of tokens to traverse from the start pos.
+ * @param int $origContent Whether the original content or the tab replaced
+ * content should be used.
*
* @return string The token contents.
*/
- public function getTokensAsString($start, $length)
+ public function getTokensAsString($start, $length, $origContent=false)
{
$str = '';
$end = ($start + $length);
@@ -1785,7 +1918,13 @@ public function getTokensAsString($start, $length)
}
for ($i = $start; $i < $end; $i++) {
- $str .= $this->tokens[$i]['content'];
+ // If tabs are being converted to spaces by the tokeniser, the
+ // original content should be used instead of the converted content.
+ if ($origContent === true && isset($this->tokens[$i]['orig_content']) === true) {
+ $str .= $this->tokens[$i]['orig_content'];
+ } else {
+ $str .= $this->tokens[$i]['content'];
+ }
}
return $str;
@@ -2061,6 +2200,10 @@ public function findEndOfStatement($start, $ignore=null)
&& ($i === $this->tokens[$i]['scope_opener']
|| $i === $this->tokens[$i]['scope_condition'])
) {
+ if ($i === $start && isset(Util\Tokens::$scopeOpeners[$this->tokens[$i]['code']]) === true) {
+ return $this->tokens[$i]['scope_closer'];
+ }
+
$i = $this->tokens[$i]['scope_closer'];
} else if (isset($this->tokens[$i]['bracket_closer']) === true
&& $i === $this->tokens[$i]['bracket_opener']
@@ -2234,12 +2377,12 @@ public function findExtendedClassName($stackPtr)
return false;
}
- if (isset($this->tokens[$stackPtr]['scope_closer']) === false) {
+ if (isset($this->tokens[$stackPtr]['scope_opener']) === false) {
return false;
}
- $classCloserIndex = $this->tokens[$stackPtr]['scope_closer'];
- $extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classCloserIndex);
+ $classOpenerIndex = $this->tokens[$stackPtr]['scope_opener'];
+ $extendsIndex = $this->findNext(T_EXTENDS, $stackPtr, $classOpenerIndex);
if (false === $extendsIndex) {
return false;
}
@@ -2250,7 +2393,7 @@ public function findExtendedClassName($stackPtr)
T_WHITESPACE,
];
- $end = $this->findNext($find, ($extendsIndex + 1), $classCloserIndex, true);
+ $end = $this->findNext($find, ($extendsIndex + 1), ($classOpenerIndex + 1), true);
$name = $this->getTokensAsString(($extendsIndex + 1), ($end - $extendsIndex - 1));
$name = trim($name);
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Files/FileList.php b/app/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
index 69526c7a6..9e643de79 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Files/FileList.php
@@ -167,7 +167,7 @@ private function getFilterClass()
*
* @return void
*/
- function rewind()
+ public function rewind()
{
reset($this->files);
@@ -179,7 +179,7 @@ function rewind()
*
* @return \PHP_CodeSniffer\Files\File
*/
- function current()
+ public function current()
{
$path = key($this->files);
if ($this->files[$path] === null) {
@@ -196,7 +196,7 @@ function current()
*
* @return void
*/
- function key()
+ public function key()
{
return key($this->files);
@@ -208,7 +208,7 @@ function key()
*
* @return void
*/
- function next()
+ public function next()
{
next($this->files);
@@ -220,7 +220,7 @@ function next()
*
* @return boolean
*/
- function valid()
+ public function valid()
{
if (current($this->files) === false) {
return false;
@@ -236,7 +236,7 @@ function valid()
*
* @return integer
*/
- function count()
+ public function count()
{
return $this->numFiles;
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php b/app/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
index 0df71512f..6e086808d 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Files/LocalFile.php
@@ -48,7 +48,7 @@ public function __construct($path, Ruleset $ruleset, Config $config)
fclose($handle);
if (strpos($firstContent, '@codingStandardsIgnoreFile') !== false
- || strpos(strtolower($firstContent), 'phpcs:ignorefile') !== false
+ || stripos($firstContent, 'phpcs:ignorefile') !== false
) {
// We are ignoring the whole file.
$this->ignored = true;
@@ -69,7 +69,7 @@ public function __construct($path, Ruleset $ruleset, Config $config)
*
* @return void
*/
- function reloadContent()
+ public function reloadContent()
{
$this->setContent(file_get_contents($this->path));
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php b/app/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
index b7a6c2aa2..04cc3919e 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Filters/Filter.php
@@ -204,9 +204,10 @@ protected function shouldIgnorePath($path)
// If the ignore pattern ends with /* then it is ignoring an entire directory.
if (substr($pattern, -2) === '/*') {
// Need to check this pattern for dirs as well as individual file paths.
- $pattern = substr($pattern, 0, -2);
- $this->ignoreDirPatterns[$pattern] = $type;
$this->ignoreFilePatterns[$pattern] = $type;
+
+ $pattern = substr($pattern, 0, -2);
+ $this->ignoreDirPatterns[$pattern] = $type;
} else {
// This is a file-specific pattern, so only need to check this
// for individual file paths.
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php b/app/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
index 1f1745e30..56049768b 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Generators/Generator.php
@@ -14,7 +14,6 @@
use PHP_CodeSniffer\Ruleset;
use PHP_CodeSniffer\Autoload;
-use PHP_CodeSniffer\Util\Common;
abstract class Generator
{
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reporter.php b/app/vendor/squizlabs/php_codesniffer/src/Reporter.php
index b9a64c261..4667a76a9 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reporter.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reporter.php
@@ -99,12 +99,11 @@ public function __construct(Config $config)
$this->config = $config;
foreach ($config->reports as $type => $output) {
- $type = ucfirst($type);
-
if ($output === null) {
$output = $config->reportFile;
}
+ $reportClassName = '';
if (strpos($type, '.') !== false) {
// This is a path to a custom report class.
$filename = realpath($type);
@@ -114,8 +113,32 @@ public function __construct(Config $config)
}
$reportClassName = Autoload::loadFile($filename);
+ } else if (class_exists('PHP_CodeSniffer\Reports\\'.ucfirst($type)) === true) {
+ // PHPCS native report.
+ $reportClassName = 'PHP_CodeSniffer\Reports\\'.ucfirst($type);
+ } else if (class_exists($type) === true) {
+ // FQN of a custom report.
+ $reportClassName = $type;
} else {
- $reportClassName = 'PHP_CodeSniffer\Reports\\'.$type;
+ // OK, so not a FQN, try and find the report using the registered namespaces.
+ $registeredNamespaces = Autoload::getSearchPaths();
+ $trimmedType = ltrim($type, '\\');
+
+ foreach ($registeredNamespaces as $nsPrefix) {
+ if ($nsPrefix === '') {
+ continue;
+ }
+
+ if (class_exists($nsPrefix.'\\'.$trimmedType) === true) {
+ $reportClassName = $nsPrefix.'\\'.$trimmedType;
+ break;
+ }
+ }
+ }//end if
+
+ if ($reportClassName === '') {
+ $error = "ERROR: Class file for report \"$type\" not found".PHP_EOL;
+ throw new DeepExitException($error, 3);
}
$reportClass = new $reportClassName();
@@ -175,7 +198,6 @@ public function printReports()
*/
public function printReport($report)
{
- $report = ucfirst($report);
$reportClass = $this->reports[$report]['class'];
$reportFile = $this->reports[$report]['output'];
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php b/app/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
index 7d55cc70f..ce4b31fc0 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reports/Diff.php
@@ -10,7 +10,6 @@
namespace PHP_CodeSniffer\Reports;
use PHP_CodeSniffer\Files\File;
-use PHP_CodeSniffer\Util;
class Diff implements Report
{
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reports/Full.php b/app/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
index 10bbbe9d7..084bc8aa5 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reports/Full.php
@@ -114,27 +114,40 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
// The maximum amount of space an error message can use.
$maxErrorSpace = ($width - $paddingLength - 1);
- if ($showSources === true) {
- // Account for the chars used to print colors.
- $maxErrorSpace += 8;
- }
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
- $message = $error['message'];
- $message = str_replace("\n", "\n".$paddingLine2, $message);
- if ($showSources === true) {
- $message = "\033[1m".$message."\033[0m".' ('.$error['source'].')';
+ $message = $error['message'];
+ $msgLines = [$message];
+ if (strpos($message, "\n") !== false) {
+ $msgLines = explode("\n", $message);
+ }
+
+ $errorMsg = '';
+ $lastLine = (count($msgLines) - 1);
+ foreach ($msgLines as $k => $msgLine) {
+ if ($k === 0) {
+ if ($showSources === true) {
+ $errorMsg .= "\033[1m";
+ }
+ } else {
+ $errorMsg .= PHP_EOL.$paddingLine2;
+ }
+
+ if ($k === $lastLine && $showSources === true) {
+ $msgLine .= "\033[0m".' ('.$error['source'].')';
+ }
+
+ $errorMsg .= wordwrap(
+ $msgLine,
+ $maxErrorSpace,
+ PHP_EOL.$paddingLine2
+ );
}
// The padding that goes on the front of the line.
- $padding = ($maxLineNumLength - strlen($line));
- $errorMsg = wordwrap(
- $message,
- $maxErrorSpace,
- PHP_EOL.$paddingLine2
- );
+ $padding = ($maxLineNumLength - strlen($line));
echo ' '.str_repeat(' ', $padding).$line.' | ';
if ($error['type'] === 'ERROR') {
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reports/Info.php b/app/vendor/squizlabs/php_codesniffer/src/Reports/Info.php
index b13d9e2bb..85738a5a5 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reports/Info.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reports/Info.php
@@ -101,30 +101,59 @@ public function generate(
echo str_repeat('-', 70).PHP_EOL;
foreach ($metrics as $metric => $values) {
- $winner = '';
- $winnerCount = 0;
- $totalCount = 0;
- foreach ($values as $value => $count) {
- $totalCount += $count;
- if ($count > $winnerCount) {
- $winner = $value;
- $winnerCount = $count;
- }
- }
+ if (count($values) === 1) {
+ $count = reset($values);
+ $value = key($values);
- $winPercent = round(($winnerCount / $totalCount * 100), 2);
- echo "$metric: \033[4m$winner\033[0m [$winnerCount/$totalCount, $winPercent%]".PHP_EOL;
+ echo "$metric: \033[4m$value\033[0m [$count/$count, 100%]".PHP_EOL;
+ } else {
+ $totalCount = 0;
+ $valueWidth = 0;
+ foreach ($values as $value => $count) {
+ $totalCount += $count;
+ $valueWidth = max($valueWidth, strlen($value));
+ }
- asort($values);
- $values = array_reverse($values, true);
- foreach ($values as $value => $count) {
- if ($value === $winner) {
- continue;
+ $countWidth = strlen($totalCount);
+ $nrOfThousandSeps = floor($countWidth / 3);
+ $countWidth += $nrOfThousandSeps;
+
+ // Account for 'total' line.
+ $valueWidth = max(5, $valueWidth);
+
+ echo "$metric:".PHP_EOL;
+
+ ksort($values, SORT_NATURAL);
+ arsort($values);
+
+ $percentPrefixWidth = 0;
+ $percentWidth = 6;
+ foreach ($values as $value => $count) {
+ $percent = round(($count / $totalCount * 100), 2);
+ $percentPrefix = '';
+ if ($percent === 0.00) {
+ $percent = 0.01;
+ $percentPrefix = '<';
+ $percentPrefixWidth = 2;
+ $percentWidth = 4;
+ }
+
+ printf(
+ "\t%-{$valueWidth}s => %{$countWidth}s (%{$percentPrefixWidth}s%{$percentWidth}.2f%%)".PHP_EOL,
+ $value,
+ number_format($count),
+ $percentPrefix,
+ $percent
+ );
}
- $percent = round(($count / $totalCount * 100), 2);
- echo "\t$value => $count ($percent%)".PHP_EOL;
- }
+ echo "\t".str_repeat('-', ($valueWidth + $countWidth + 15)).PHP_EOL;
+ printf(
+ "\t%-{$valueWidth}s => %{$countWidth}s (100.00%%)".PHP_EOL,
+ 'total',
+ number_format($totalCount)
+ );
+ }//end if
echo PHP_EOL;
}//end foreach
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reports/Json.php b/app/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
index 3c41f8e41..8bf269209 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reports/Json.php
@@ -42,28 +42,23 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
foreach ($report['messages'] as $line => $lineErrors) {
foreach ($lineErrors as $column => $colErrors) {
foreach ($colErrors as $error) {
- $error['message'] = str_replace('\\', '\\\\', $error['message']);
- $error['message'] = str_replace('"', '\"', $error['message']);
- $error['message'] = str_replace('/', '\/', $error['message']);
$error['message'] = str_replace("\n", '\n', $error['message']);
$error['message'] = str_replace("\r", '\r', $error['message']);
$error['message'] = str_replace("\t", '\t', $error['message']);
- $fixable = 'false';
+ $fixable = false;
if ($error['fixable'] === true) {
- $fixable = 'true';
+ $fixable = true;
}
- $messages .= '{"message":"'.$error['message'].'",';
- $messages .= '"source":"'.$error['source'].'",';
- $messages .= '"severity":'.$error['severity'].',';
- $messages .= '"type":"'.$error['type'].'",';
- $messages .= '"line":'.$line.',';
- $messages .= '"column":'.$column.',';
- $messages .= '"fixable":'.$fixable;
- $messages .= '},';
- }//end foreach
- }//end foreach
+ $messagesObject = (object) $error;
+ $messagesObject->line = $line;
+ $messagesObject->column = $column;
+ $messagesObject->fixable = $fixable;
+
+ $messages .= json_encode($messagesObject).",";
+ }
+ }
}//end foreach
echo rtrim($messages, ',');
diff --git a/app/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php b/app/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
index 3461d89f3..d3ede61d4 100644
--- a/app/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
+++ b/app/vendor/squizlabs/php_codesniffer/src/Reports/Junit.php
@@ -39,6 +39,7 @@ public function generateFileReport($report, File $phpcsFile, $showSources=false,
$out->startElement('testsuite');
$out->writeAttribute('name', $report['filename']);
+ $out->writeAttribute('errors', 0);
if (count($report['messages']) === 0) {
$out->writeAttribute('tests', 1);
@@ -120,7 +121,7 @@ public function generate(
$failures = ($totalErrors + $totalWarnings);
echo ''.PHP_EOL;
- echo '
+
+
+
+ Int $foo) : STRING {
+}
+ ]]>
+
+
+
+
+
+ (BOOL) $isValid;
+ ]]>
+
+
+
+
+
+
+
+
+
+
+