yajra / laravel-datatables

jQuery DataTables API for Laravel
https://yajrabox.com/docs/laravel-datatables
MIT License
4.75k stars 859 forks source link

ReadOnly is a reserved word in PHP 8.1 #2889

Closed nettsite closed 1 year ago

nettsite commented 1 year ago

Summary of problem or feature request

readonly is a reserved keyword in PHP 8.1. Any existing classes or other symbols that use the name readonly (case insensitive) will result in a syntax error in PHP 8.1.

It is not possible to port the readonly functionality to older PHP versions.

Code snippet of problem

<?php

namespace Yajra\DataTables\Html\Editor\Fields;

class ReadOnly extends Field
{
    protected $type = 'readonly';
}

System details

I have fixed this by changing "ReadOnly" to "ReadOnlyProp", which works for me, but I haven't done any testing.

Arne1303 commented 1 year ago

You need to update the DataTable Html package, the ReadOnly class has already been renamed into ReadOnlyField.

nettsite commented 1 year ago

Thanks! I thought I was up to date, as I ran composer update, but it seems that doesn't do it.

 composer update yajra/laravel-datatables-html
Loading composer repositories with package information
Updating dependencies
Nothing to modify in lock file
Installing dependencies from lock file (including require-dev)
Nothing to install, update or remove
nettsite commented 1 year ago

I have now removed yajra-datatables altogether, and required it, and there is still the ReadOnly class.

Arne1303 commented 1 year ago

Sounds like you got a package installed which requires a specific version of the html package. You can use composers depends command to find out which package is blocking the upgrade, you then need to upgrade the blocking package:

https://getcomposer.org/doc/03-cli.md#depends-why

nettsite commented 1 year ago

I am giving up for now, my workaround work for me. I am sure after a few weeks or months other packages which may be causing the issue will catch up.

Thanks for your help!

yajra commented 1 year ago

@nettsite Have you tried using the all-in-one installer?

composer require yajra/laravel-datatables:^9.0
nettsite commented 1 year ago

I have tried that, I have even deleted the composer.lock file and the vendor directory and did a full install. The only way I can get yajra/laravel-datatables to install is

composer require yajra/laravel-datatables:*
github-actions[bot] commented 1 year ago

This issue is stale because it has been open for 30 days with no activity. Remove stale label or comment or this will be closed in 7 days.

github-actions[bot] commented 1 year ago

This issue was closed because it has been inactive for 7 days since being marked as stale.