[PHP 7.1] «Cannot use 'Void' as class name as it is reserved» while compiling the Magento 2 PHP code (and my fix)

The previous reports:

How to fix it

Step 1

Find the line:

Replace it with the following one:

<route url="/V1/invoices/:id/voidInvoice" method="POST">

Step 2

Find the line:

Replace it with the following one:

return $this->getUrl('sales/*/voidInvoice', ['invoice_id' => $this->getInvoice()->getId()]);

Step 3

Find the line:

Replace it with the following one:

return $this->getUrl('sales/*/voidInvoice', ['invoice_id' => $this->getInvoice()->getId()]);

Step 4

Find the line:

Replace it with the following one:

return $this->getUrl('sales/*/voidCreditmemo', ['creditmemo_id' => $this->getCreditmemo()->getId()]);

Step 5

Find the line:

Replace it with the following one:

class VoidCreditmemo extends \Magento\Backend\App\Action

Step 6

Find the line:

Replace it with the following one:

class VoidInvoice extends \Magento\Sales\Controller\Adminhtml\Invoice\AbstractInvoice\View

Step 7

Rename the file app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/Void.php to app/code/Magento/Sales/Controller/Adminhtml/Order/Creditmemo/VoidCreditmemo.php

Step 8

Rename the file app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/Void.php to app/code/Magento/Sales/Controller/Adminhtml/Order/Invoice/VoidInvoice.php

See also:

The current Magento 2.2 development branch becomes to support PHP 7.1.
So the fix is not needed anymore.