configuration->getMetadataStorageConfiguration(); foreach ($sql as $query) { if ( $storageConfiguration instanceof TableMetadataStorageConfiguration && stripos($query, $storageConfiguration->getTableName()) !== false ) { continue; } if ($formatted) { $maxLength = $lineLength - 18 - 8; // max - php code length - indentation if (strlen($query) > $maxLength) { $query = $this->formatQuery($query); } } $code[] = sprintf( "\$this->addSql(<<<'SQL'\n%s\nSQL);", preg_replace('/^/m', str_repeat(' ', 4), $query), ); } if (count($code) !== 0 && $checkDbPlatform && $this->configuration->isDatabasePlatformChecked()) { $currentPlatform = '\\' . get_class($this->platform); array_unshift( $code, sprintf( <<<'PHP' $this->abortIf( !$this->connection->getDatabasePlatform() instanceof %s, "Migration can only be executed safely on '%s'." ); PHP , $currentPlatform, $currentPlatform, ), '', ); } return implode("\n", $code); } private function formatQuery(string $query): string { $this->formatter ??= new SqlFormatter(new NullHighlighter()); return $this->formatter->format($query); } }