[PHP] need help fixing for php 8.4

here the errors:

Deprecated
: League\Flysystem\EventableFilesystem\EventableFilesystem::__construct(): Implicitly marking parameter $emitter as nullable is deprecated, the explicit nullable type must be used instead in
/usr/www/dcu/public_html/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php
on line
30

Deprecated
: League\Flysystem\EventableFilesystem\EventableFilesystem::get(): Implicitly marking parameter $handler as nullable is deprecated, the explicit nullable type must be used instead in
/usr/www/dcu/public_html/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php
on line
98

Deprecated
: Use of "parent" in callables is deprecated in
/usr/www/dcu/public_html/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php
on line
431

--------------------------------------------------

snippet of line 30:

     /**
      * Constructor.
      *
      * @param AdapterInterface $adapter
      * @param mixed $config
      * @param Emitter $emitter
      */
     public function __construct(AdapterInterface $adapter, $config = null, Emit>
     {
         $this->setEmitter($emitter);
         parent::__construct($adapter, $config);
     }
--------------------------------------------------------------------------

snippet og line 98:

     /**
      * Get a file/directory handler.
      *
      * @param string $path
      * @param Handler $handler
      * @param mixed $config
      *
      * @return Handler file or directory handler
      */
     public function get($path, Handler $handler = null, array $config = )
     {
         return $this->delegateMethodCall('get', compact('path', 'handler', 'config'));

     }

--------------------------------------------

snippet of line 431:

     /**
      * Call the underlying filesystem method.
      *
      * @param string $method
      * @param array $arguments
      *
      * @return mixed
      */
     protected function callFilesystemMethod($method, array $arguments)
     {
         $callable = 'parent::'.$method;
         $result = call_user_func_array($callable, array_values($arguments));

         return $result;
     }

-----------------------------------------

thanks for all your help

On 18/04/2025 21:27, admin@orderofdracul.com wrote:

here the errors:

Deprecated
: League\Flysystem\EventableFilesystem\EventableFilesystem::__construct(): Implicitly marking parameter $emitter as nullable is deprecated, the explicit nullable type must be used instead in
/usr/www/dcu/public_html/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php

on line
30

This change is detailed here: PHP: Deprecated Features - Manual

Deprecated
: Use of "parent" in callables is deprecated in
/usr/www/dcu/public_html/src/vendor/league/flysystem-eventable-filesystem/src/EventableFilesystem.php

on line
431

This change is documented here: PHP: Deprecated Features - Manual

See also PHP: rfc:deprecate_partially_supported_callables

In general, the migrating appendices ( PHP: Appendices - Manual ) are a good reference for changes between PHP versions - see in particular the Deprecated Features and Backward Incompatible Changes sections when upgrading existing code.

It looks like the FlySystem Eventable library has been abandoned since FlySystem dropped the plugins functionality some time ago ( Upgrade from 1.x - Flysystem ) . The package is marked abandoned on Packagist and its repository has been archived (with the last changes 11 years ago).

You should look to migrate away from this library. Based on the description of what it did ( flysystem-eventable-filesystem/readme.md at 44b315a8923b9209cedc5b9f6c2b62c9fd5c0977 · thephpleague/flysystem-eventable-filesystem · GitHub ) it should be easy to write a wrapper around FlySystem the performs the same functionality.

For example, instead of adding an event for "before.read", the wrapper would do whatever the event did, then call the FlySystem read method (or whatever the modern equivalent is).

Making this change will make this and future upgrades easier since you'll be able to pull in the latest version of FlySystem, with support for recent PHP versions, rather than manually maintaining an ancient version, which is error prone and won't contain bug and security fixes.