Skip to content

BUG: UnnecessaryNamespaceUsageSniff failing with php-error if no "use" and "namespace" is present #78

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

Closed
SebTM opened this issue May 17, 2018 · 2 comments
Assignees
Labels

Comments

@SebTM
Copy link

SebTM commented May 17, 2018

Example file:

<?php

class Shopware_Controllers_Api_Motif extends Shopware_Controllers_Api_Rest
{
    /**
     * @return void
     */
    public function indexAction(): void
    {
        $this->View()->assign([
            'success' => true,
            'data'    => $this->get('xxx_service')->getList(),
        ]);
    }
}

Result:

1 | ERROR | An error occurred during processing; checking has been aborted. The error message was: strpos(): Empty needle in
| | mayflower/mo4-coding-standard/MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php on line 367

@xalopp xalopp self-assigned this May 17, 2018
@xalopp
Copy link
Contributor

xalopp commented May 17, 2018

Good catch 🦋

@xalopp xalopp added the bug label May 17, 2018
@xalopp
Copy link
Contributor

xalopp commented May 17, 2018

When no use statement exists and type annotations are uses, this bug is triggered.

xalopp added a commit to xalopp/mo4-coding-standard that referenced this issue May 17, 2018
xalopp added a commit to xalopp/mo4-coding-standard that referenced this issue May 17, 2018
xalopp added a commit to xalopp/mo4-coding-standard that referenced this issue May 17, 2018
@xalopp xalopp closed this as completed in 05eae77 May 17, 2018
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment
Labels
Projects
None yet
Development

No branches or pull requests

2 participants