Skip to content

Commit

Permalink
explat: Fix Phan issues (#39443)
Browse files Browse the repository at this point in the history
Add some missing `use` directives and add `WP_Error` to one return
declaration.
  • Loading branch information
anomiex authored and gogdzl committed Oct 25, 2024
1 parent 8e87f72 commit da36bdd
Show file tree
Hide file tree
Showing 3 changed files with 9 additions and 8 deletions.
8 changes: 1 addition & 7 deletions projects/packages/explat/.phan/baseline.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,15 +8,9 @@
* (can be combined with --load-baseline)
*/
return [
// # Issue statistics:
// PhanTypeArraySuspicious : 3 occurrences
// PhanTypeMismatchReturn : 3 occurrences
// PhanUndeclaredTypeParameter : 1 occurrence
// PhanUndeclaredTypeReturnType : 1 occurrence

// This baseline has no suppressions
// Currently, file_suppressions and directory_suppressions are the only supported suppressions
'file_suppressions' => [
'src/class-rest-controller.php' => ['PhanTypeArraySuspicious', 'PhanTypeMismatchReturn', 'PhanUndeclaredTypeParameter', 'PhanUndeclaredTypeReturnType'],
],
// 'directory_suppressions' => ['src/directory_name' => ['PhanIssueName1', 'PhanIssueName2']] can be manually added if needed.
// (directory_suppressions will currently be ignored by subsequent calls to --save-baseline, but may be preserved in future Phan releases)
Expand Down
Original file line number Diff line number Diff line change
@@ -0,0 +1,5 @@
Significance: patch
Type: fixed
Comment: Add missing `use` and one return type to fix Phan issues. No change to functionality.


4 changes: 3 additions & 1 deletion projects/packages/explat/src/class-rest-controller.php
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@
use Automattic\Jetpack\Connection\Client;
use Automattic\Jetpack\Connection\Manager as Jetpack_Connection;
use WP_Error;
use WP_REST_Request;
use WP_REST_Response;
use WP_REST_Server;

/**
Expand Down Expand Up @@ -71,7 +73,7 @@ public function register_rest_routes() {
* Get the assignments for a given experiment and anon_id
*
* @param WP_REST_Request $request The REST request object.
* @return WP_REST_Response
* @return WP_REST_Response|WP_Error
*/
public function get_assignments( $request ) {
$response = null;
Expand Down

0 comments on commit da36bdd

Please sign in to comment.