Issues (83)

src/Builder/Traits/TableBuilder.php (1 issue)

Labels
Severity
1
<?php
2
namespace Kir\MySQL\Builder\Traits;
3
4
use Kir\MySQL\Builder\Internal\Types;
5
6
/**
7
 * @phpstan-import-type DBTableNameType from Types
8
 */
9
trait TableBuilder {
10
	use AbstractTableNameBuilder;
11
12
	/** @var array<int, array{alias: string|null, name: DBTableNameType}> */
13
	private $tables = [];
14
15
	/**
16
	 * @param string|null $alias
17
	 * @param DBTableNameType $table
0 ignored issues
show
The type Kir\MySQL\Builder\Traits\DBTableNameType was not found. Maybe you did not declare it correctly or list all dependencies?

The issue could also be caused by a filter entry in the build configuration. If the path has been excluded in your configuration, e.g. excluded_paths: ["lib/*"], you can move it to the dependency path list as follows:

filter:
    dependency_paths: ["lib/*"]

For further information see https://scrutinizer-ci.com/docs/tools/php/php-scrutinizer/#list-dependency-paths

Loading history...
18
	 * @return $this
19
	 */
20
	protected function addTable(?string $alias, $table) {
21
		$this->tables[] = ['alias' => $alias, 'name' => $table];
22
		return $this;
23
	}
24
25
	/**
26
	 * @param string $query
27
	 * @return string
28
	 */
29
	protected function buildTables(string $query): string {
30
		$arr = [];
31
		foreach($this->tables as $table) {
32
			$arr[] = "\t".$this->buildTableName($table['alias'], $table['name']);
33
		}
34
		if(count($arr)) {
35
			$query .= implode(",\n", $arr)."\n";
36
		}
37
		return $query;
38
	}
39
40
	/**
41
	 * @return array<int, array{alias: string|null, name: DBTableNameType}>
42
	 */
43
	protected function getTables(): array {
44
		return $this->tables;
45
	}
46
}
47