Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension


Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
1 change: 1 addition & 0 deletions .github/workflows/ci.yml
Original file line number Diff line number Diff line change
Expand Up @@ -98,3 +98,4 @@ jobs:
phpunit: ${{ matrix.config.phpunit }}
coverage: ${{ matrix.config.coverage }}
codecov-token: ${{ secrets.CODECOV_TOKEN }}
timeout-minutes: 15
6 changes: 5 additions & 1 deletion .github/workflows/core-tests.yml
Original file line number Diff line number Diff line change
Expand Up @@ -64,7 +64,7 @@ jobs:
echo "GITHUB_EVENT_NAME=pull_request" >> "wordpress/.env"

- name: Set up Node.js
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version-file: 'wordpress/.nvmrc'
cache: npm
Expand Down Expand Up @@ -111,16 +111,20 @@ jobs:
--verbose -c phpunit.xml.dist
--filter "^\(?!.*test_wp_generate_attachment_metadata_png_thumbnail_smaller_than_original\).*\$"
working-directory: wordpress
timeout-minutes: 15

- name: Run AJAX tests
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group ajax
working-directory: wordpress
timeout-minutes: 15

- name: Run ms-files tests as a multisite install
run: node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c tests/phpunit/multisite.xml --group ms-files
working-directory: wordpress
timeout-minutes: 15

- name: Run external HTTP tests
run: |
node ./tools/local-env/scripts/docker.js run php ./vendor/bin/phpunit --verbose -c phpunit.xml.dist --group external-http
working-directory: wordpress
timeout-minutes: 15
2 changes: 1 addition & 1 deletion .github/workflows/dependency-review.yml
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,7 @@ jobs:
name: Review Dependencies
steps:
- name: Harden Runner
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: block
allowed-endpoints: >
Expand Down
8 changes: 4 additions & 4 deletions .github/workflows/e2e.yml
Original file line number Diff line number Diff line change
Expand Up @@ -38,7 +38,7 @@ jobs:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: block
allowed-endpoints:
Expand Down Expand Up @@ -88,7 +88,7 @@ jobs:
uses: ./.github/actions/prepare-source

- name: Setup Node
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version: 'lts/*'
cache: npm
Expand Down Expand Up @@ -140,15 +140,15 @@ jobs:
contents: read
steps:
- name: Harden Runner
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit

- name: Check out repository code
uses: actions/checkout@v6.0.2

- name: Setup Node
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version: 'lts/*'
cache: npm
Expand Down
4 changes: 2 additions & 2 deletions .github/workflows/lint.yml
Original file line number Diff line number Diff line change
Expand Up @@ -37,7 +37,7 @@ jobs:
fail-fast: 'true'

- name: Setup Node
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version: 'lts/*'
cache: npm
Expand All @@ -58,7 +58,7 @@ jobs:
uses: actions/checkout@v6.0.2

- name: Setup Node
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version: 'lts/*'
cache: npm
Expand Down
1 change: 1 addition & 0 deletions .github/workflows/parsely.yml
Original file line number Diff line number Diff line change
Expand Up @@ -59,3 +59,4 @@ jobs:
with:
wordpress: ${{ matrix.config.wp }}
php: ${{ matrix.config.php }}
timeout-minutes: 15
2 changes: 1 addition & 1 deletion .github/workflows/release-prod.yml
Original file line number Diff line number Diff line change
Expand Up @@ -19,7 +19,7 @@ jobs:
id: ${{ steps.id-generator.outputs.id }}
steps:
- name: Harden Runner
uses: step-security/harden-runner@f808768d1510423e83855289c910610ca9b43176 # v2.17.0
uses: step-security/harden-runner@8d3c67de8e2fe68ef647c8db1e6a09f647780f40 # v2.19.0
with:
egress-policy: audit

Expand Down
2 changes: 1 addition & 1 deletion .github/workflows/search-dev-tools.yml
Original file line number Diff line number Diff line change
Expand Up @@ -27,7 +27,7 @@ jobs:
token: ${{ secrets.WPCOM_VIP_BOT_TOKEN }}

- name: Setup Node
uses: actions/setup-node@v6.3.0
uses: actions/setup-node@v6.4.0
with:
node-version: 'lts/*'
cache: npm
Expand Down
12 changes: 6 additions & 6 deletions __tests__/e2e/package-lock.json

Some generated files are not rendered by default. Learn more about how customized files appear on GitHub.

2 changes: 1 addition & 1 deletion query-monitor/assets/build/query-monitor.css

Large diffs are not rendered by default.

60 changes: 29 additions & 31 deletions query-monitor/assets/build/query-monitor.js

Large diffs are not rendered by default.

57 changes: 57 additions & 0 deletions query-monitor/classes/ArrayAccess.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,57 @@
<?php declare(strict_types = 1);
/**
* Array access trait for data transfer objects.
*
* Provides backwards compatibility for third party code that accesses
* QM data objects using array syntax.
*/

/**
* @implements \ArrayAccess<string,mixed>
*/
trait QM_ArrayAccess {
/**
* @param mixed $offset
* @param mixed $value
* @return void
*/
#[ReturnTypeWillChange]
final public function offsetSet( $offset, $value ) {
if ( is_string( $offset ) ) {
$this->$offset = $value;
}
}

/**
* @param mixed $offset
* @return bool
*/
#[ReturnTypeWillChange]
final public function offsetExists( $offset ) {
return is_string( $offset ) && isset( $this->$offset );
}

/**
* @param mixed $offset
* @return void
*/
#[ReturnTypeWillChange]
final public function offsetUnset( $offset ) {
if ( is_string( $offset ) ) {
unset( $this->$offset );
}
}

/**
* @param mixed $offset
* @return mixed
*/
#[ReturnTypeWillChange]
final public function &offsetGet( $offset ) {
if ( is_string( $offset ) ) {
return $this->$offset;
}
$null = null;
return $null;
}
}
2 changes: 1 addition & 1 deletion query-monitor/classes/Collector.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,7 +61,7 @@ public function set_up() {}
* @return string
*/
final public function id() {
return $this->id;
return "qm-{$this->id}";
}

/**
Expand Down
8 changes: 4 additions & 4 deletions query-monitor/classes/Collector_Assets.php
Original file line number Diff line number Diff line change
Expand Up @@ -30,9 +30,9 @@
*/
abstract class QM_Collector_Assets extends QM_DataCollector {
/**
* @var array<int, string>
* @var ?array<int, string>
*/
protected $header = array();
protected $header = null;

/**
* @var array<int, string>
Expand Down Expand Up @@ -106,7 +106,7 @@ public function action_head() {
* @return void
*/
public function action_print_footer_scripts() {
if ( empty( $this->header ) ) {
if ( null === $this->header ) {
return;
}

Expand All @@ -129,7 +129,7 @@ public function process() {
$modules = self::get_script_modules();
}

if ( empty( $this->header ) && empty( $this->footer ) && empty( $modules ) ) {
if ( null === $this->header && empty( $this->footer ) && empty( $modules ) ) {
return;
}

Expand Down
48 changes: 2 additions & 46 deletions query-monitor/classes/Data.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,6 +8,8 @@
*/
#[AllowDynamicProperties]
abstract class QM_Data implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @var array<string, mixed>
*/
Expand All @@ -22,50 +24,4 @@ abstract class QM_Data implements \ArrayAccess {
* @var ?array<mixed>
*/
public $concerned_actions = null;

/**
* @param mixed $offset
* @param mixed $value
* @return void
*/
#[ReturnTypeWillChange]
final public function offsetSet( $offset, $value ) {
if ( is_string( $offset ) ) {
$this->$offset = $value;
}
}

/**
* @param mixed $offset
* @return bool
*/
#[ReturnTypeWillChange]
final public function offsetExists( $offset ) {
return is_string( $offset ) && isset( $this->$offset );
}

/**
* @param mixed $offset
* @return void
*/
#[ReturnTypeWillChange]
final public function offsetUnset( $offset ) {
// @TODO might be able to no-op this
if ( is_string( $offset ) ) {
unset( $this->$offset );
}
}

/**
* @param mixed $offset
* @return mixed
*/
#[ReturnTypeWillChange]
final public function &offsetGet( $offset ) {
if ( is_string( $offset ) ) {
return $this->$offset;
}
$null = null;
return $null;
}
}
4 changes: 2 additions & 2 deletions query-monitor/classes/Util.php
Original file line number Diff line number Diff line change
Expand Up @@ -645,15 +645,15 @@ public static function shorten_fqn( $fqn ) {
/**
* Helper function for JSON encoding data and formatting it in a consistent manner.
*
* @deprecated Use json_encode() directly with the appropriate options instead.
* @deprecated Use wp_json_encode() directly with the appropriate options instead.
*
* @param mixed $data The data to be JSON encoded.
* @return string The JSON encoded data.
*/
public static function json_format( $data ) {
$json_options = JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES;

$json = json_encode( $data, $json_options );
$json = wp_json_encode( $data, $json_options );

if ( false === $json ) {
return '';
Expand Down
7 changes: 6 additions & 1 deletion query-monitor/data/block_editor/post_block.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* @package query-monitor
*/

class QM_Data_Post_Block {
/**
* @implements \ArrayAccess<string,mixed>
*/
class QM_Data_Post_Block implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @var string|null
*/
Expand Down
7 changes: 6 additions & 1 deletion query-monitor/data/callback.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* @package query-monitor
*/

class QM_Data_Callback {
/**
* @implements \ArrayAccess<string,mixed>
*/
class QM_Data_Callback implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @var 'function'|'method'|'static_method'|'closure'|'invokable'|'lambda'|'unknown'|'unknown_closure'
*/
Expand Down
7 changes: 6 additions & 1 deletion query-monitor/data/callsite.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* @package query-monitor
*/

class QM_Data_Callsite {
/**
* @implements \ArrayAccess<string,mixed>
*/
class QM_Data_Callsite implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @var string
*/
Expand Down
7 changes: 6 additions & 1 deletion query-monitor/data/frame.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* @package query-monitor
*/

class QM_Data_Stack_Frame {
/**
* @implements \ArrayAccess<string,mixed>
*/
class QM_Data_Stack_Frame implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @var string
*/
Expand Down
7 changes: 6 additions & 1 deletion query-monitor/data/http/http_request.php
Original file line number Diff line number Diff line change
Expand Up @@ -10,7 +10,12 @@
* @package query-monitor
*/

class QM_Data_HTTP_Request {
/**
* @implements \ArrayAccess<string,mixed>
*/
class QM_Data_HTTP_Request implements \ArrayAccess {
use QM_ArrayAccess;

/**
* @phpstan-var array{
* method: string,
Expand Down
Loading
Loading