Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Improving phpDoc #3635

Merged
merged 1 commit into from
Sep 22, 2023
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
5 changes: 2 additions & 3 deletions includes/classes/Indexable.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,7 +12,6 @@

use ElasticPress\Elasticsearch as Elasticsearch;
use ElasticPress\SyncManager as SyncManager;
use ElasticPress\QueryIntegration as QueryIntegration;

if ( ! defined( 'ABSPATH' ) ) {
exit; // Exit if accessed directly.
Expand Down Expand Up @@ -49,7 +48,7 @@ abstract class Indexable {
* Instance of QueryIntegration. This should handle integrating with a default
* WP query.
*
* @var QueryIntegration
* @var object
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

None of the core features extends this class. So this object here is incorrect.

One gets this error while extending the class.

Property ElasticPress\Indexable::$query_integration (ElasticPress\QueryIntegration) does not accept Project\QueryIntegration. 
```

* @since 3.0
*/
public $query_integration;
Expand Down Expand Up @@ -1149,7 +1148,7 @@ abstract public function prepare_document( $object_id );
* process across indexables.
*
* @param array $args Array to query DB against.
* @return boolean
* @return array
*/
abstract public function query_db( $args );

Expand Down
2 changes: 1 addition & 1 deletion includes/classes/Indexables.php
Original file line number Diff line number Diff line change
Expand Up @@ -152,7 +152,7 @@ public function get_all( $global = null, $slug_only = false, $status = 'active'
/**
* Return singleton instance of class
*
* @return object
* @return self
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Intellisense tools will make better use of this with self. Currently, one gets this:

Call to an undefined method object::get().       

*/
public static function factory() {
static $instance = false;
Expand Down
11 changes: 6 additions & 5 deletions includes/classes/SyncManager.php
Original file line number Diff line number Diff line change
Expand Up @@ -69,8 +69,9 @@ public function __construct( $indexable_slug ) {
/**
* Add an object to the sync queue.
*
* @param id $object_id object ID to sync
* @since 3.1.2
* @since 3.1.2
*
* @param int $object_id Object ID to sync.
Copy link
Contributor Author

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Fixes this error:

Parameter #1 $object_id of method ElasticPress\SyncManager::add_to_queue() expects ElasticPress\id, int given.  

* @return boolean
*/
public function add_to_queue( $object_id ) {
Expand All @@ -95,8 +96,9 @@ public function add_to_queue( $object_id ) {
/**
* Remove an object from the sync queue.
*
* @param id $object_id object ID to remove from the queue
* @since 3.5
* @since 3.5
*
* @param int $object_id Object ID to remove from the queue.
* @return boolean
*/
public function remove_from_queue( $object_id ) {
Expand Down Expand Up @@ -147,7 +149,6 @@ public function index_sync_queue_on_redirect( $location ) {
return $location;
}


/**
* Sync objects in queue.
*
Expand Down
Loading