src/CodeGeneration/Generator/RelationsGenerator.php
protected function useRelationTraitInClass(string $classPath, string $traitPath): void
    {
        try {
            $class = PhpClass::fromFile($classPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        try {
            $trait = PhpTrait::fromFile($traitPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        $class->addTrait($trait);
        $this->codeHelper->generate($class, $classPath);
    }
protected function useRelationTraitInClass(string $classPath, string $traitPath): void
    {
        try {
            $class = PhpClass::fromFile($classPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        try {
            $trait = PhpTrait::fromFile($traitPath);
        } catch (Error $e) {
            throw new DoctrineStaticMetaException(
                'PHP parsing error when loading class ' . $classPath . ': ' . $e->getMessage(),
                $e->getCode(),
                $e
            );
        }
        $class->addTrait($trait);
        $this->codeHelper->generate($class, $classPath);
    }
protected function useRelationTraitInClass ( string $ classPath , string $ traitPath ) : void { try { $ class = PhpClass :: fromFile ( $ classPath ) ; } catch ( Error $ e ) { throw new DoctrineStaticMetaException ( 'PHP parsing error when loading class ' . $ classPath . ': ' . $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } try { $ trait = PhpTrait :: fromFile ( $ traitPath ) ; } catch ( Error $ e ) { throw new DoctrineStaticMetaException ( 'PHP parsing error when loading class ' . $ classPath . ': ' . $ e -> getMessage ( ) , $ e -> getCode ( ) , $ e ) ; } $ class -> addTrait ( $ trait ) ; $ this -> codeHelper -> generate ( $ class , $ classPath ) ; }
Add the specified trait to the specified class

@param string $classPath
@param string $traitPath

@throws DoctrineStaticMetaException
@SuppressWarnings(PHPMD.StaticAccess)
Add the specified trait to the specified class