phingofficial/phing

Uncaught Error: Call to undefined method ReflectionUnionType::isBuiltin()

mimmi20 opened this issue · 0 comments

Describe the bug

PHP Fatal error:  Uncaught Error: Call to undefined method ReflectionUnionType::isBuiltin() in /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/IntrospectionHelper.php:657
Stack trace:
#0 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/IntrospectionHelper.php(343): IntrospectionHelper->getClassNameFromParameter()
#1 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/parser/ProjectConfigurator.php(279): IntrospectionHelper->setAttribute()
#2 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/RuntimeConfigurable.php(172): ProjectConfigurator::configure()
#3 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/Task.php(268): RuntimeConfigurable->maybeConfigure()
#4 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/UnknownElement.php(77): Task->maybeConfigure()
#5 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/Task.php(282): UnknownElement->maybeConfigure()
#6 /var/lib/jenkins/workspace/Kontoservice_updates/build/vendor/phing/phing/classes/phing/tasks/system/SequentialTask.php(58): Task->perform()

Steps To Reproduce
The called Task is

<target name="sql-check"
            description="Testet die DB-Deploy Skripte auf syntaktische Korrektheit"
            if="dbdeploy.path,db.sql-check.server">
        <fail unless="dbdeploy.path">DB-Deploy path is not set! Define dbdeploy.path</fail>
        <fail unless="db.server.${db.sql-check.server}.deploypath">Couldn't find the db deploy path for database ${key}!</fail>

        <if>
            <and>
                <isset property="project.has.db"/>
                <isset property="use.sql.check"/>
                <istrue value="${project.has.db}"/>
                <istrue value="${use.sql.check}"/>
            </and>
            <then>
                <taskdef classname="\GeldLib\Deployment\Task\SqlCheckTask" name="sql-check"/>

                <sql-check username="${db.server.${db.sql-check.server}.username}"
                           password="${db.server.${db.sql-check.server}.password}"
                           host="${db.server.${db.sql-check.server}.host}"
                           port="${db.server.${db.sql-check.server}.port}"
                           name="${db.server.${db.sql-check.server}.chkname}"
                           dir="${destination}/${dbdeploy.path}/${db.server.${db.sql-check.server}.deploypath}"
                           useCache="${sql-check.useCache}"
                           completeRollback="${sql-check.completeRollback}"
                           checkreturn="${sql-check.checkreturn}"/>
            </then>
            <else>
                <echo level="warning">"sql-check" not activated, skipping</echo>
            </else>
        </if>
    </target>

The used Task is

<?php
/**
 * This file is part of the geldlib/deployment package.
 *
 * Deployment Lib for Projects of the JDC Geld.de GmbH
 *
 * Copyright (c) 2016-2022, JDC Geld.de GmbH
 * Copyright (c) 2011-2016, Geld.de GmbH
 */

declare(strict_types = 1);

namespace GeldLib\Deployment\Task;

use BuildException;
use GeldLib\Deployment\DbDeploy\Command\Helper\DbDeploy;
use GeldLib\Deployment\DbDeploy\Database;
use PDOException;
use RuntimeException;
use StringHelper;
use Symfony\Component\Console\Exception\InvalidArgumentException;
use Symfony\Component\Console\Output\ConsoleOutput;
use Task;

/**
 * SqlCheck Task
 * http://dbdeploy.com/
 */
class SqlCheckTask extends Task
{
    /**
     * Verzeichnis der DbDeploy-Scripte
     */
    private string $dir;

    /**
     * Datenbank-Host
     */
    private string $host;

    /**
     * Datenbank-Port
     */
    private int $port;

    /**
     * Datenbank-Name
     */
    private string $name;

    /**
     * Database Username
     */
    private string $username;

    /**
     * Database Password
     */
    private string $password;

    private bool $completeRollback = false;

    private bool $useCache = true;

    /**
     * Angabe, ob der Rückgabecode auf Erfolg geprüft wird
     */
    private bool $checkreturn = false;

    /**
     * (non-PHPdoc)
     *
     * @see \Task::main()
     *
     * @throws BuildException
     * @throws RuntimeException
     * @throws InvalidArgumentException
     * @throws PDOException
     */
    public function main(): void
    {
        try {
            $db = new Database($this->host, $this->port, $this->username, $this->password);
            $dbDeployHelper = new DbDeploy($db, new ConsoleOutput());

            $success = $dbDeployHelper->checkScripts($this->name, $this->dir, $this->useCache, true, $this->completeRollback);
        } catch (\Throwable $e) {
            throw new BuildException('sql-check fehlgeschlagen', $e);
        }

        if ($this->checkreturn && !$success) {
            throw new BuildException('sql-check fehlgeschlagen');
        }
    }

    /**
     * Setzt Pfad
     *
     * @throws void
     */
    public function setDir(string $dir): void
    {
        $this->dir = $dir;
    }

    /** @throws void */
    public function setHost(string $host): void
    {
        $this->host = $host;
    }

    /** @throws void */
    public function setName(string $name): void
    {
        $this->name = $name;
    }

    /** @throws void */
    public function setPort(string $port): void
    {
        $this->port = (int) $port;
    }

    /**
     * Setzt Db-Username
     *
     * @throws void
     */
    public function setUsername(string $username): void
    {
        $this->username = $username;
    }

    /**
     * Setzt Db-Password
     *
     * @throws void
     */
    public function setPassword(string $password): void
    {
        $this->password = $password;
    }

    /** @throws void */
    public function setCompleteRollback(bool | string $completeRollback): void
    {
        if ('1' === $completeRollback || 1 === $completeRollback) {
            $this->completeRollback = true;

            return;
        }

        $this->completeRollback = StringHelper::booleanValue($completeRollback);
    }

    /** @throws void */
    public function setUseCache(bool | string $useCache): void
    {
        if ('1' === $useCache || 1 === $useCache) {
            $this->useCache = true;

            return;
        }

        $this->useCache = StringHelper::booleanValue($useCache);
    }

    /**
     * konfiguriert den Task so, dass der Task den erfolgreichen Abschluss des ausgeführen Befehls sicherstellt
     *
     * @throws void
     */
    public function setCheckreturn(bool $checkreturn): void
    {
        $this->checkreturn = $checkreturn;
    }
}

Expected behavior
no error

Screenshots / terminal output
image

Additional context
PHP: 8.1.8
Phing: 2.17.4