Qual: Enable phan on modulebuilder (#30652)

* Allow null for buyer, and force '' for  in printObjectLine(s)

* Allow null for Contact in show_actions_done

* Qual: Enable phan on modulebuilder

# Qual: Enable phan on modulebuilder

Most files of the modulebuilder template can be checked as regular files.
It will help improve the template

* Update baseline (enable modulebuilder notices)

* Add properties that are expected to exist on modules_boxes

* Qual: Ignore false positive (phan)

* Set phpdoc type to include null on formAddObjectLine

* Qual: Fixes for modulebuilder (phan, phpstan, bugs, format)

* Fix phpcs for intracom

* Make ModeleBoxes:showBox() signature match child class's

* Fix *box::showBox() phpdoc types

* Update index.php

---------

Co-authored-by: Laurent Destailleur <eldy@destailleur.fr>
This commit is contained in:
MDW
2024-08-18 18:16:08 +02:00
committed by GitHub
parent 4e2842ca27
commit b0087aaf61
111 changed files with 1266 additions and 1019 deletions

View File

@@ -1,7 +1,6 @@
<?php
/* Copyright (C) 2004-2017 Laurent Destailleur <eldy@users.sourceforge.net>
* Copyright (C) 2024 MDW <mdeweerd@users.noreply.github.com>
* Copyright (C) ---Put here your own copyright and developer email---
* Copyright (C) ---Replace with your own copyright and developer email---
*
* This program is free software: you can redistribute it and/or modify
* it under the terms of the GNU General Public License as published by
@@ -218,26 +217,26 @@ if ($action == 'updateMask') {
$className = $myTmpObjects[$tmpobjectkey]['class'];
$tmpobject = new $className($db);
'@phan-var-force MyObject $tmpobject';
$tmpobject->initAsSpecimen();
// Search template files
$file = '';
$className = '';
$filefound = 0;
$dirmodels = array_merge(array('/'), (array) $conf->modules_parts['models']);
foreach ($dirmodels as $reldir) {
$file = dol_buildpath($reldir."core/modules/mymodule/doc/pdf_".$modele."_".strtolower($tmpobjectkey).".modules.php", 0);
if (file_exists($file)) {
$filefound = 1;
$className = "pdf_".$modele."_".strtolower($tmpobjectkey);
break;
}
}
if ($filefound) {
if ($className !== '') {
require_once $file;
$module = new $className($db);
'@phan-var-force ModelePDFMyObject $module';
'@phan-var-force ModelePDFMyObject $module';
@@ -372,8 +371,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file.'.php';
$module = new $file($db);
'@phan-var-force CommonNumRefGenerator $module';
'@phan-var-force ModeleNumRefMyObject $module';
// Show modules according to features level
if ($module->version == 'development' && getDolGlobalInt('MAIN_FEATURES_LEVEL') < 2) {
@@ -416,6 +414,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
$className = $myTmpObjectArray['class'];
$mytmpinstance = new $className($db);
'@phan-var-force MyObject $mytmpinstance';
$mytmpinstance->initAsSpecimen();
// Info
@@ -498,6 +497,7 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
if (is_dir($dir)) {
$handle = opendir($dir);
if (is_resource($handle)) {
$filelist = array();
while (($file = readdir($handle)) !== false) {
$filelist[] = $file;
}
@@ -512,7 +512,6 @@ foreach ($myTmpObjects as $myTmpObjectKey => $myTmpObjectArray) {
require_once $dir.'/'.$file;
$module = new $className($db);
'@phan-var-force ModelePDFMyObject $module';
$modulequalified = 1;