nodespark / des-connector

An abstraction for Elasticsearch connector for Drupal.
Other
9 stars 17 forks source link

Potential issue with magic method __sleep visibility #15

Open miloskroulik opened 5 years ago

miloskroulik commented 5 years ago

When running PHPcompatibility phpcs sniff, following error appears:

FILE: vendor/nodespark/des-connector/src/DESConnector/Elasticsearch/Aggregations/Aggregations.php
----------------------------------------------------------------------------------------------------------------------------------------
FOUND 1 ERROR AFFECTING 1 LINE
----------------------------------------------------------------------------------------------------------------------------------------
 76 | ERROR | Visibility for magic method __sleep must be public. Found: private
----------------------------------------------------------------------------------------------------------------------------------------

It seems that the issue is still present in the current master HEAD. Based on https://github.com/wpengine/phpcompat/issues/83 I believe, that it's probably a false positive. Can you confirm that, please?

ghost commented 4 years ago

According to the PHP documentation, all magic methods must be declared as public: https://www.php.net/manual/en/language.oop5.magic.php

This is not a false positive.

apotek commented 2 years ago

These warnings are showing up on my staging site right now so it looks like this issue is still open.

The magic method nodespark\DESConnector\Elasticsearch\Aggregations\Aggregations::__wakeup() must have public visibility in /app/vendor/nodespark/des-connector/src/DESConnector/Elasticsearch/Aggregations/Aggregations.php on line 68