Skip to content

Commit 835571a

Browse files
committed
Wrap encapsed vars in curly braces
1 parent b3d8313 commit 835571a

29 files changed

+70
-68
lines changed

src/Addons.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -14,15 +14,15 @@ public static function createTable(): void {
1414

1515
$charset_collate = $wpdb->get_charset_collate();
1616

17-
$sql = "CREATE TABLE $table_name (
17+
$sql = "CREATE TABLE {$table_name} (
1818
slug VARCHAR(191) NOT NULL,
1919
type VARCHAR(249) NOT NULL,
2020
name VARCHAR(249) NOT NULL,
2121
docs_url VARCHAR(2083) NOT NULL,
2222
description VARCHAR(249) NOT NULL,
2323
enabled TINYINT(1) UNSIGNED DEFAULT 0 NOT NULL,
2424
PRIMARY KEY (slug)
25-
) $charset_collate;";
25+
) {$charset_collate};";
2626

2727
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2828
dbDelta( $sql );

src/AdminBar.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -246,7 +246,7 @@ public static function listInvalidations( int $max_items = 5 ) {
246246
return $cloudfront->listInvalidations(
247247
[
248248
'DistributionId' => $distribution_id,
249-
'MaxItems' => "$max_items",
249+
'MaxItems' => "{$max_items}",
250250
]
251251
);
252252
} catch ( AwsException $e ) {

src/Controller.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -680,7 +680,7 @@ public static function runHeadless(): void {
680680
WsLog::l( 'Running in headless mode' );
681681
WsLog::l( 'Starting URL detection' );
682682
$detected_count = URLDetector::enqueueURLs();
683-
WsLog::l( "URL detection completed ($detected_count URLs detected)" );
683+
WsLog::l( "URL detection completed ({$detected_count} URLs detected)" );
684684

685685
self::crawl();
686686

src/CrawledFiles.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -11,7 +11,7 @@ public static function createTable(): void {
1111

1212
$charset_collate = $wpdb->get_charset_collate();
1313

14-
$sql = "CREATE TABLE $table_name (
14+
$sql = "CREATE TABLE {$table_name} (
1515
id mediumint(9) NOT NULL AUTO_INCREMENT,
1616
path VARCHAR(2083) NOT NULL,
1717
path_hash CHAR(32) AS ( md5(path) ) PERSISTENT,
@@ -21,15 +21,15 @@ public static function createTable(): void {
2121
redirect_to VARCHAR(2083) NULL,
2222
content_type VARCHAR(255) DEFAULT '' NOT NULL,
2323
PRIMARY KEY (id)
24-
) $charset_collate;";
24+
) {$charset_collate};";
2525

2626
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2727
dbDelta( $sql );
2828

2929
Db::ensureIndex(
3030
$table_name,
3131
'path_hash',
32-
"CREATE UNIQUE INDEX path_hash ON $table_name (path_hash)"
32+
"CREATE UNIQUE INDEX path_hash ON {$table_name} (path_hash)"
3333
);
3434
}
3535

@@ -313,7 +313,7 @@ public static function rmUrlsById( array $ids ): void {
313313
$ids = array_map( 'absint', $ids );
314314
$table_name = self::getTableName();
315315
$placeholders = implode( ',', array_fill( 0, count( $ids ), '%d' ) );
316-
$sql = "DELETE FROM %i WHERE ID IN($placeholders)";
316+
$sql = "DELETE FROM %i WHERE ID IN({$placeholders})";
317317
// phpcs:ignore WordPress.DB.DirectDatabaseQuery
318318
$wpdb->query(
319319
// phpcs:ignore WordPress.DB.PreparedSQL.NotPrepared

src/Crawler.php

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -234,8 +234,8 @@ public function crawlIter( \Iterator $path_iter ): \Iterator {
234234

235235
$site_host = $this->site_uri->getHost();
236236
$site_port = $this->site_uri->getPort();
237-
$site_host = $site_port ? $site_host . ":$site_port" : $site_host;
238-
$site_urls = [ "http://$site_host", "https://$site_host" ];
237+
$site_host = $site_port ? $site_host . ":{$site_port}" : $site_host;
238+
$site_urls = [ "http://{$site_host}", "https://{$site_host}" ];
239239

240240
$in_flight = [];
241241
$start_next = function () use ( &$in_flight, &$path_iter, &$site_urls ): void {

src/Db.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -48,7 +48,7 @@ public static function ensureIndex(
4848
// phpcs:ignore WordPress.DB
4949
$result = $wpdb->query( $create_index_sql );
5050
if ( false === $result ) {
51-
WsLog::l( "Failed to create $index_name index on $table_name." );
51+
WsLog::l( "Failed to create {$index_name} index on {$table_name}." );
5252
}
5353
return $result;
5454
}

src/DeployCache.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -18,29 +18,29 @@ public static function createTable(): void {
1818

1919
$charset_collate = $wpdb->get_charset_collate();
2020

21-
$sql = "CREATE TABLE $table_name (
21+
$sql = "CREATE TABLE {$table_name} (
2222
id mediumint(9) NOT NULL AUTO_INCREMENT,
2323
path VARCHAR(2083) NOT NULL,
2424
path_hash CHAR(32) AS ( md5(path) ) PERSISTENT,
2525
data_hash CHAR(32) NOT NULL,
2626
namespace VARCHAR(128) NOT NULL,
2727
deployed_at datetime DEFAULT NOW() NOT NULL,
2828
PRIMARY KEY (id)
29-
) $charset_collate;";
29+
) {$charset_collate};";
3030

3131
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
3232
dbDelta( $sql );
3333

3434
Db::ensureIndex(
3535
$table_name,
3636
'path_hash_ns_idx',
37-
"CREATE UNIQUE INDEX path_hash_ns_idx ON $table_name (path_hash, namespace)"
37+
"CREATE UNIQUE INDEX path_hash_ns_idx ON {$table_name} (path_hash, namespace)"
3838
);
3939

4040
Db::ensureIndex(
4141
$table_name,
4242
'deployed_at_idx',
43-
"CREATE INDEX deployed_at_idx ON $table_name (deployed_at)"
43+
"CREATE INDEX deployed_at_idx ON {$table_name} (deployed_at)"
4444
);
4545
}
4646

src/DetectPluginAssets.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -44,7 +44,7 @@ public static function detect(
4444
function ( $active_plugin ) {
4545
$dir = explode( '/', $active_plugin )[0];
4646
if ( STATIC_DEPLOY_DEBUG ) {
47-
WsLog::d( "Active plugin dir: $dir" );
47+
WsLog::d( "Active plugin dir: {$dir}" );
4848
}
4949
return $dir;
5050
},

src/DetectedFiles.php

Lines changed: 7 additions & 7 deletions
Original file line numberDiff line numberDiff line change
@@ -13,28 +13,28 @@ public static function createTable(): void {
1313

1414
$charset_collate = $wpdb->get_charset_collate();
1515

16-
$sql = "CREATE TABLE $table_name (
16+
$sql = "CREATE TABLE {$table_name} (
1717
id mediumint(9) NOT NULL AUTO_INCREMENT,
1818
path VARCHAR(2083) NOT NULL,
1919
path_hash CHAR(32) AS ( md5(path) ) PERSISTENT,
2020
filename VARCHAR(2083) DEFAULT '' NOT NULL,
2121
detected_at datetime DEFAULT NOW() NOT NULL,
2222
PRIMARY KEY (id)
23-
) $charset_collate;";
23+
) {$charset_collate};";
2424

2525
require_once ABSPATH . 'wp-admin/includes/upgrade.php';
2626
dbDelta( $sql );
2727

2828
Db::ensureIndex(
2929
$table_name,
3030
'path_hash',
31-
"CREATE UNIQUE INDEX path_hash ON $table_name (path_hash)"
31+
"CREATE UNIQUE INDEX path_hash ON {$table_name} (path_hash)"
3232
);
3333

3434
Db::ensureIndex(
3535
$table_name,
3636
'detected_at',
37-
"CREATE INDEX detected_at ON $table_name (detected_at)"
37+
"CREATE INDEX detected_at ON {$table_name} (detected_at)"
3838
);
3939
}
4040

@@ -186,7 +186,7 @@ public static function withPathsIter( \Iterator $paths ): \Iterator {
186186
if ( $msg ) {
187187
WsLog::w(
188188
'Skipping invalid path found in detected files table:'
189-
. " $row->path ($msg)"
189+
. " $row->path ({$msg})"
190190
);
191191
continue;
192192
}
@@ -239,7 +239,7 @@ public static function getPathsIter(
239239
if ( $msg ) {
240240
WsLog::w(
241241
'Skipping invalid path found in detected files table:'
242-
. " $row->path ($msg)"
242+
. " $row->path ({$msg})"
243243
);
244244
continue;
245245
}
@@ -284,7 +284,7 @@ public static function rmUrlsById( array $ids ): void {
284284
// phpcs:ignore WordPress.DB.PreparedSQLPlaceholders.ReplacementsWrongNumber
285285
$wpdb->prepare(
286286
// phpcs:ignore WordPress.DB.PreparedSQL.InterpolatedNotPrepared
287-
"DELETE FROM %i WHERE ID IN($placeholders)",
287+
"DELETE FROM %i WHERE ID IN({$placeholders})",
288288
$table_name,
289289
...$ids
290290
)

src/DirectDeployer.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -73,7 +73,7 @@ public function deploy(): void {
7373
if ( 0 === $new_ct ) {
7474
break;
7575
}
76-
WsLog::l( "Found $new_ct new URLs during crawling." );
76+
WsLog::l( "Found {$new_ct} new URLs during crawling." );
7777
$detected = DetectedFiles::getPathsIter( $last_now );
7878
$last_now = Db::now();
7979
$added = DetectedFiles::withPathsIter( $detected );

0 commit comments

Comments
 (0)