Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

Errors when using the global namespace #201

Closed
cmfcmf opened this issue Jun 20, 2014 · 1 comment
Closed

Errors when using the global namespace #201

cmfcmf opened this issue Jun 20, 2014 · 1 comment
Labels

Comments

@cmfcmf
Copy link
Contributor

cmfcmf commented Jun 20, 2014

This file produces erros when running translation:extract:

<?php
/**
 * Copyright Zikula Foundation 2009 - Zikula Application Framework
 *
 * This work is contributed to the Zikula Foundation under one or more
 * Contributor Agreements and licensed to You under the following license:
 *
 * @license GNU/LGPLv3 (or at your option, any later version).
 *
 * Please see the NOTICE file distributed with this source code for further
 * information regarding copyright and licensing.
 */

namespace Zikula\Module\UsersModule {
    use Zikula\Bundle\CoreBundle\Bundle\AbstractCoreModule;

    /**
     * Base module definition for the users module
     */
    class ZikulaUsersModule extends AbstractCoreModule
    {
    }
}

/**
 * BC layer till for <=1.4.0
 */
namespace {
    /**
     * constants for the users module
     *
     * @deprecated since 1.4.0 use Zikula\Module\UsersModule\Constant instead
     */
    class Users_Constant extends Zikula\Module\UsersModule\Constant
    {
    }

    /**
     * authentication method helper
     *
     * @deprecated since 1.4.0 use \Zikula\Module\UsersModule\Helper\AuthenticationMethodHelper instead
     */
    class Users_Helper_AuthenticationMethod extends \Zikula\Module\UsersModule\Helper\AuthenticationMethodHelper
    {
    }

    /**
     * list authentication helpers
     *
     * @deprecated since 1.4.0 use \Zikula\Module\UsersModule\Helper\AuthenticationMethodListHelper instead
     */
    class Users_Helper_AuthenticationMethodList extends \Zikula\Module\UsersModule\Helper\AuthenticationMethodListHelper
    {
    }

    /**
     * hash method helpers
     *
     * @deprecated since 1.4.0 use \Zikula\Module\UsersModule\Helper\HashMethodListHelper instead
     */
    class Users_Helper_HasMethodList extends \Zikula\Module\UsersModule\Helper\HashMethodListHelper
    {
    }
}

The problem are the classes located in Translation/Extractor/File, enterNode function. Example from TranslationContainerExtractor:

if ($node instanceof \PHPParser_Node_Stmt_Namespace) {
            $this->namespace = implode('\\', $node->name->parts);
            $this->useStatements = array();

            return;
        }

$node->name is null when using the global namespace as it is done in the file above. This results in an error with the implode function. Possible fix (also needs to be applied in the other files using the enterNode function):

if ($node instanceof \PHPParser_Node_Stmt_Namespace) {
            $this->namespace = $node->name !== null ? implode('\\', $node->name->parts) : null;
            $this->useStatements = array();

            return;
        }
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

Successfully merging a pull request may close this issue.

2 participants