@@ -38,9 +38,9 @@ discard block |
||
38 | 38 | */ |
39 | 39 | protected $engine; |
40 | 40 | |
41 | - public function __construct( Engine $engine, ?callable $engine_config = null ) { |
|
41 | + public function __construct(Engine $engine, ?callable $engine_config = null) { |
|
42 | 42 | $this->engine = $engine_config |
43 | - ? $engine_config( $engine ) |
|
43 | + ? $engine_config($engine) |
|
44 | 44 | : $engine; |
45 | 45 | } |
46 | 46 | |
@@ -50,8 +50,8 @@ discard block |
||
50 | 50 | * @param Schema $schema |
51 | 51 | * @return bool |
52 | 52 | */ |
53 | - public function create_table( Schema $schema ): bool { |
|
54 | - return $this->engine->create_table( $schema ); |
|
53 | + public function create_table(Schema $schema): bool { |
|
54 | + return $this->engine->create_table($schema); |
|
55 | 55 | } |
56 | 56 | |
57 | 57 | /** |
@@ -60,8 +60,8 @@ discard block |
||
60 | 60 | * @param Schema $schema |
61 | 61 | * @return bool |
62 | 62 | */ |
63 | - public function drop_table( Schema $schema ): bool { |
|
64 | - return $this->engine->drop_table( $schema ); |
|
63 | + public function drop_table(Schema $schema): bool { |
|
64 | + return $this->engine->drop_table($schema); |
|
65 | 65 | } |
66 | 66 | |
67 | 67 | /** |
@@ -79,8 +79,8 @@ discard block |
||
79 | 79 | */ |
80 | 80 | protected $on_delete = ''; |
81 | 81 | |
82 | - public function __construct( string $column, ?string $key_name = null ) { |
|
83 | - $this->key_name = $key_name ?? 'fk_' . $column; |
|
82 | + public function __construct(string $column, ?string $key_name = null) { |
|
83 | + $this->key_name = $key_name ?? 'fk_'.$column; |
|
84 | 84 | $this->column = $column; |
85 | 85 | } |
86 | 86 | |
@@ -91,7 +91,7 @@ discard block |
||
91 | 91 | * @param string $reference_column |
92 | 92 | * @return self |
93 | 93 | */ |
94 | - public function reference( string $reference_table, string $reference_column ): self { |
|
94 | + public function reference(string $reference_table, string $reference_column): self { |
|
95 | 95 | $this->reference_column = $reference_column; |
96 | 96 | $this->reference_table = $reference_table; |
97 | 97 | return $this; |
@@ -104,7 +104,7 @@ discard block |
||
104 | 104 | * @param string $reference_table |
105 | 105 | * @return self |
106 | 106 | */ |
107 | - public function reference_table( string $reference_table ): self { |
|
107 | + public function reference_table(string $reference_table): self { |
|
108 | 108 | $this->reference_table = $reference_table; |
109 | 109 | return $this; |
110 | 110 | } |
@@ -116,7 +116,7 @@ discard block |
||
116 | 116 | * @param string $reference_column |
117 | 117 | * @return self |
118 | 118 | */ |
119 | - public function reference_column( string $reference_column ): self { |
|
119 | + public function reference_column(string $reference_column): self { |
|
120 | 120 | $this->reference_column = $reference_column; |
121 | 121 | return $this; |
122 | 122 | } |
@@ -128,7 +128,7 @@ discard block |
||
128 | 128 | * @param string $action |
129 | 129 | * @return self |
130 | 130 | */ |
131 | - public function on_update( string $action ): self { |
|
131 | + public function on_update(string $action): self { |
|
132 | 132 | $this->on_update = $action; |
133 | 133 | return $this; |
134 | 134 | } |
@@ -141,7 +141,7 @@ discard block |
||
141 | 141 | * @param string $action |
142 | 142 | * @return self |
143 | 143 | */ |
144 | - public function on_delete( string $action ): self { |
|
144 | + public function on_delete(string $action): self { |
|
145 | 145 | $this->on_delete = $action; |
146 | 146 | return $this; |
147 | 147 | } |
@@ -36,10 +36,10 @@ discard block |
||
36 | 36 | * @param int|null $length |
37 | 37 | * @return Column |
38 | 38 | */ |
39 | - public function varchar( ?int $length = null ): Column { |
|
40 | - $this->type( 'varchar' ); |
|
41 | - if ( null !== $length ) { |
|
42 | - $this->length( $length ); |
|
39 | + public function varchar(?int $length = null): Column { |
|
40 | + $this->type('varchar'); |
|
41 | + if (null !== $length) { |
|
42 | + $this->length($length); |
|
43 | 43 | } |
44 | 44 | return $this; |
45 | 45 | } |
@@ -51,10 +51,10 @@ discard block |
||
51 | 51 | * @param int|null $length |
52 | 52 | * @return Column |
53 | 53 | */ |
54 | - public function text( ?int $length = null ): Column { |
|
55 | - $this->type( 'text' ); |
|
56 | - if ( null !== $length ) { |
|
57 | - $this->length( $length ); |
|
54 | + public function text(?int $length = null): Column { |
|
55 | + $this->type('text'); |
|
56 | + if (null !== $length) { |
|
57 | + $this->length($length); |
|
58 | 58 | } |
59 | 59 | return $this; |
60 | 60 | } |
@@ -66,10 +66,10 @@ discard block |
||
66 | 66 | * @param int|null $length |
67 | 67 | * @return Column |
68 | 68 | */ |
69 | - public function int( ?int $length = null ): Column { |
|
70 | - $this->type( 'int' ); |
|
71 | - if ( null !== $length ) { |
|
72 | - $this->length( $length ); |
|
69 | + public function int(?int $length = null): Column { |
|
70 | + $this->type('int'); |
|
71 | + if (null !== $length) { |
|
72 | + $this->length($length); |
|
73 | 73 | } |
74 | 74 | return $this; |
75 | 75 | } |
@@ -82,13 +82,13 @@ discard block |
||
82 | 82 | * @param int|null $precision |
83 | 83 | * @return Column |
84 | 84 | */ |
85 | - public function float( ?int $length = null, ?int $precision = null ): Column { |
|
86 | - $this->type( 'float' ); |
|
87 | - if ( null !== $length ) { |
|
88 | - $this->length( $length ); |
|
85 | + public function float(?int $length = null, ?int $precision = null): Column { |
|
86 | + $this->type('float'); |
|
87 | + if (null !== $length) { |
|
88 | + $this->length($length); |
|
89 | 89 | } |
90 | - if ( null !== $precision ) { |
|
91 | - $this->precision( $precision ); |
|
90 | + if (null !== $precision) { |
|
91 | + $this->precision($precision); |
|
92 | 92 | } |
93 | 93 | return $this; |
94 | 94 | } |
@@ -101,13 +101,13 @@ discard block |
||
101 | 101 | * @param int|null $precision |
102 | 102 | * @return Column |
103 | 103 | */ |
104 | - public function double( ?int $length = null, ?int $precision = null ): Column { |
|
105 | - $this->type( 'double' ); |
|
106 | - if ( null !== $length ) { |
|
107 | - $this->length( $length ); |
|
104 | + public function double(?int $length = null, ?int $precision = null): Column { |
|
105 | + $this->type('double'); |
|
106 | + if (null !== $length) { |
|
107 | + $this->length($length); |
|
108 | 108 | } |
109 | - if ( null !== $precision ) { |
|
110 | - $this->precision( $precision ); |
|
109 | + if (null !== $precision) { |
|
110 | + $this->precision($precision); |
|
111 | 111 | } |
112 | 112 | return $this; |
113 | 113 | } |
@@ -119,10 +119,10 @@ discard block |
||
119 | 119 | * @param string|null $default |
120 | 120 | * @return Column |
121 | 121 | */ |
122 | - public function datetime( ?string $default = null ): Column { |
|
123 | - $this->type( 'datetime' ); |
|
124 | - if ( null !== $default ) { |
|
125 | - $this->default( $default ); |
|
122 | + public function datetime(?string $default = null): Column { |
|
123 | + $this->type('datetime'); |
|
124 | + if (null !== $default) { |
|
125 | + $this->default($default); |
|
126 | 126 | } |
127 | 127 | return $this; |
128 | 128 | } |
@@ -134,10 +134,10 @@ discard block |
||
134 | 134 | * @param string|null $default |
135 | 135 | * @return Column |
136 | 136 | */ |
137 | - public function timestamp( ?string $default = null ): Column { |
|
138 | - $this->type( 'timestamp' ); |
|
139 | - if ( null !== $default ) { |
|
140 | - $this->default( $default ); |
|
137 | + public function timestamp(?string $default = null): Column { |
|
138 | + $this->type('timestamp'); |
|
139 | + if (null !== $default) { |
|
140 | + $this->default($default); |
|
141 | 141 | } |
142 | 142 | return $this; |
143 | 143 | } |
@@ -149,11 +149,11 @@ discard block |
||
149 | 149 | * @param int|null $length |
150 | 150 | * @return Column |
151 | 151 | */ |
152 | - public function unsigned_int( ?int $length = null ): Column { |
|
153 | - $this->type( 'int' ); |
|
152 | + public function unsigned_int(?int $length = null): Column { |
|
153 | + $this->type('int'); |
|
154 | 154 | $this->unsigned(); |
155 | - if ( null !== $length ) { |
|
156 | - $this->length( $length ); |
|
155 | + if (null !== $length) { |
|
156 | + $this->length($length); |
|
157 | 157 | } |
158 | 158 | return $this; |
159 | 159 | } |
@@ -165,11 +165,11 @@ discard block |
||
165 | 165 | * @param int|null $length |
166 | 166 | * @return Column |
167 | 167 | */ |
168 | - public function unsigned_medium( ?int $length = null ): Column { |
|
169 | - $this->type( 'mediumint' ); |
|
168 | + public function unsigned_medium(?int $length = null): Column { |
|
169 | + $this->type('mediumint'); |
|
170 | 170 | $this->unsigned(); |
171 | - if ( null !== $length ) { |
|
172 | - $this->length( $length ); |
|
171 | + if (null !== $length) { |
|
172 | + $this->length($length); |
|
173 | 173 | } |
174 | 174 | return $this; |
175 | 175 | } |
@@ -180,11 +180,11 @@ discard block |
||
180 | 180 | * @param int|null $length |
181 | 181 | * @return Column |
182 | 182 | */ |
183 | - public function unsigned_big( ?int $length = null ): Column { |
|
184 | - $this->type( 'bigint' ); |
|
183 | + public function unsigned_big(?int $length = null): Column { |
|
184 | + $this->type('bigint'); |
|
185 | 185 | $this->unsigned(); |
186 | - if ( null !== $length ) { |
|
187 | - $this->length( $length ); |
|
186 | + if (null !== $length) { |
|
187 | + $this->length($length); |
|
188 | 188 | } |
189 | 189 | return $this; |
190 | 190 | } |
@@ -196,7 +196,7 @@ discard block |
||
196 | 196 | * @return Column |
197 | 197 | */ |
198 | 198 | public function json(): Column { |
199 | - $this->type( 'json' ); |
|
199 | + $this->type('json'); |
|
200 | 200 | return $this; |
201 | 201 | } |
202 | 202 | } |