Skip to content

Commit ab587e6

Browse files
committed
style: fix phpcs errors introduced by #416 refactor
- WorktreeContextInjector.php:590 — split the canonical-top-level array declaration across multiple lines per WordPress.Arrays.ArrayDeclaration Spacing.AssociativeArrayFound. - WorktreeContextInjector.php:596 — flip the underscore-position guard to Yoda style (`strlen( $key ) - 1 === $underscore`). - WorktreeContextInjector.php:1557 — flip the handle equality check to Yoda style (the casted lookup is now on the left). No behavior change. All session-attribution smoke tests still pass. Refs #416
1 parent a55614d commit ab587e6

1 file changed

Lines changed: 6 additions & 3 deletions

File tree

inc/Workspace/WorktreeContextInjector.php

Lines changed: 6 additions & 3 deletions
Original file line numberDiff line numberDiff line change
@@ -587,13 +587,16 @@ private static function migrate_legacy_origin_session( array $session ): array {
587587

588588
// legacy migration only: split top-level `<runtime>_<subkey>` keys into
589589
// the runtime-keyed envelope. Skip canonical envelope keys.
590-
$canonical_top_level = array( 'primary_id' => true, 'ids' => true );
590+
$canonical_top_level = array(
591+
'primary_id' => true,
592+
'ids' => true,
593+
);
591594
foreach ( $session as $key => $value ) {
592595
if ( ! is_string( $key ) || isset( $canonical_top_level[ $key ] ) ) {
593596
continue;
594597
}
595598
$underscore = strpos( $key, '_' );
596-
if ( false === $underscore || 0 === $underscore || $underscore === strlen( $key ) - 1 ) {
599+
if ( false === $underscore || 0 === $underscore || strlen( $key ) - 1 === $underscore ) {
597600
continue;
598601
}
599602
$runtime_id = substr( $key, 0, $underscore );
@@ -1554,7 +1557,7 @@ private static function get_inventory_metadata( string $handle ): ?array {
15541557
}
15551558

15561559
foreach ( $repository->list() as $row ) {
1557-
if ( $handle === (string) ( $row['handle'] ?? '' ) && is_array( $row['metadata'] ?? null ) ) {
1560+
if ( (string) ( $row['handle'] ?? '' ) === $handle && is_array( $row['metadata'] ?? null ) ) {
15581561
return (array) $row['metadata'];
15591562
}
15601563
}

0 commit comments

Comments
 (0)