gnanet / mailzu

MailZu-ng compatible PHP 7.2+, PHP-PDO | Based on zedzedtop/mailzu and SF.net/projects/mailzu/ | MailZu is a simple and intuitive web interface to manage Amavisd-new quarantine. Users can view their own quarantine, release/delete messages or request the release of messages. This fork of MailZu is written in PHP and requires Amavisd-new version greater than 2.7.0
GNU General Public License v2.0
14 stars 7 forks source link

Class-dependencies cleanup #14

Closed gnanet closed 3 years ago

gnanet commented 3 years ago

Introduction

During the first tests to upgrade the code to either PHP 7.4 or 7.3 using rector-php, the resulting code seem to contain bugs, because the way rector traversed the code, it found some functions only later than their stub-function variant ( and the stub was intentionally not requiring parameters), and that lead to parameter-removal in some parts of the code.

Proposal

To ensure that a code-upgrade results in smooth working code, the loading-order of classes, and include-order of function-libraries has to be traced, and restructured.

  1. a map of the classes and other includes should be generated.
  2. a dependency graph of the classes should be defined
  3. the resulting inclusion order needs to be applied to the code
gnanet commented 3 years ago

Branch mailzu-ng-php72 contains first steps to solve this

gnanet commented 3 years ago

Moving to composer, as other issues going to be solved by replacing old clases with uptodate composer-packages

gnanet commented 3 years ago

The current manual ordered autoloader needs to switch to composer based one, found this article, and the first, relative simple way seems enough :

https://www.phptutorial.net/php-oop/php-composer-autoload/#shcb-language-6