magento2 – Magento 2 Fatal error: Declaration of IndexerHandler :: isAvailable () problem

I'm having this code:

The IndexerHandler class implements IndexerInterface
{
/ **
* @var IndexRepositoryInterface
* /
private $ indexRepository;

/ **
* @var IndexStructure
* /
private structure of $ index;

/ **
* @var array
* /
private data of $;

/ **
* @var Resource | Resource
* /
Private resource $

/ **
* @var Batch
* /
private lot $

/ **
* @var int
* /
private $ batchSize;

/ **
* @var ScopeProxy
* /
private $ indexScopeResolver;

public function __constructed (
IndexRepositoryInterface $ indexRepository,
IndexStructure $ indexStructure,
ResourceConnection $ resource,
Lot $ lot,
ScopeProxy $ indexScopeResolver,
matrix $ data,
$ batchSize = 100
) {
$ this-> indexRepository = $ indexRepository;
$ this-> indexScopeResolver = $ indexScopeResolver;
$ this-> indexStructure = $ indexStructure;
$ this-> resource = $ resource;
$ this-> batch = $ batch;
$ this-> data = $ data;
$ this-> batchSize = $ batchSize;
}

/ **
* {@inheritdoc}
* /
Public function saveIndex ($ dimensions, documents  Traversable $)
{
$ index = $ this-> indexRepository-> get ($ this-> getIndexName ());
$ instance = $ this-> indexRepository-> getInstance ($ index);

foreach ($ this-> batch-> getItems ($ documents, $ this-> batchSize) as $ docs) {
foreach ($ instance-> getDataMappers (& # 39; mysql2 & # 39;) as $ dataMapper) {
$ docs = $ dataMapper-> map ($ docs, $ dimensions, $ this-> getIndexName ());
}

$ this-> insertDocuments ($ docs, $ dimensions);
}
}

/ **
* {@inheritdoc}
* /
public function deleteIndex ($ dimensions,  $ traversable documents)
{
foreach ($ this-> batch-> getItems ($ documents, $ this-> batchSize) as $ batchDocuments) {
$ this-> resource-> getConnection ()
-> delete ($ this-> getTableName ($ dimensions), ['entity_id in (?)' => $batchDocuments]);
}
}

/ **
* {@inheritdoc}
* /
cleanIndex public function ($ dimensions)
{
$ this-> indexStructure-> delete ($ this-> getIndexName (), $ dimensions);
$ this-> indexStructure-> create ($ this-> getIndexName (), [], $ dimensions);
}

/ **
* {@inheritdoc}
* /
Public function is available ()
{
true returns
}

/ **
* @param Dimension[] $ dimensions
* @return string
* /
Private function getTableName ($ dimensions)
{
returns $ this-> indexScopeResolver-> resolve ($ this-> getIndexName (), $ dimensions);
}

/ **
* @return string
* /
Private function getIndexName ()
{
returns $ this-> data['indexer_id'];
}

/ **
* @param array $ documents
* @param Dimension[] $ dimensions
* @return void
* /
Private function insertDocuments (array $ documents, $ dimensions)
{
$ documents = $ this-> prepareSearchableFields ($ documents);

yes (empty ($ documents)) {
he came back;
}

$ this-> resource-> getConnection () -> insertOnDuplicate (
$ this-> getTableName ($ dimensions),
$ documents,
        ['data_index']
    );
}

/ **
* @param array $ documents
* @return array
* /
private function prepareSearchableFields (array $ documents)
{
$ insertDocuments = [];
foreach ($ documents like $ entityId => $ document) {
foreach ($ document as $ attributeId => $ fieldValue) {
$ insertDocuments[$entityId . '_' . $attributeId] = [
                'entity_id'    => $entityId,
                'attribute_id' => $attributeId,
                'data_index'   => $fieldValue,
            ];
}
}

returns $ insertDocuments;
}
}

With this I get an error when compiling:

Fatal error: the declaration of myfile :: isAvailable () must be compatible
with
Magento Framework Indexer SaveHandler IndexerInterface :: is available ($ dimensions
= Array) in myfile / IndexerHandler.php on line 29

I found in my code that this line:

Public function is available ()
{
true returns
}

It is wrong because the native declaration of magento is not used.

So I change it with:

Public function is available ($ dimensions =[])
{
true returns
}

But there is no luck …
I just made the same mistake but in a different line:

Fatal error: the declaration of myfile :: isAvailable () must be compatible
with
Magento Framework Indexer SaveHandler IndexerInterface :: is available ($ dimensions
= Array) in myfile / IndexerHandler.php on line 26

Any ideas please?