Skip to content

Namespace conflict with core rules #61

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

Merged
merged 1 commit into from
Mar 19, 2019
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
2 changes: 1 addition & 1 deletion .travis.yml
Original file line number Diff line number Diff line change
Expand Up @@ -7,4 +7,4 @@ php:
install: composer install --no-interaction --prefer-source
script:
- vendor/bin/phpunit
- vendor/bin/phpcs --standard=Magento Magento/ --extensions=php
- vendor/bin/phpcs --standard=Magento2 Magento2/ --extensions=php
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sniffs\Classes;
namespace Magento2\Sniffs\Classes;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Classes;
namespace Magento2\Sniffs\Classes;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -16,7 +16,7 @@ class ObjectInstantiationSniff implements Sniff
/**
* String representation of warning.
*
* phpcs:disable Magento.Files.LineLength.MaxExceeded
* phpcs:disable Magento2.Files.LineLength.MaxExceeded
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\CodeAnalysis;
namespace Magento2\Sniffs\CodeAnalysis;

use PHP_CodeSniffer\Standards\Generic\Sniffs\CodeAnalysis\EmptyStatementSniff;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Exceptions;
namespace Magento2\Sniffs\Exceptions;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Exceptions;
namespace Magento2\Sniffs\Exceptions;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sniffs\Exceptions;
namespace Magento2\Sniffs\Exceptions;

use function array_slice;
use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Files;
namespace Magento2\Sniffs\Files;

use PHP_CodeSniffer\Standards\Generic\Sniffs\Files\LineLengthSniff as FilesLineLengthSniff;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sniffs\Functions;
namespace Magento2\Sniffs\Functions;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Legacy;
namespace Magento2\Sniffs\Legacy;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\NamingConvention;
namespace Magento2\Sniffs\NamingConvention;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\NamingConvention;
namespace Magento2\Sniffs\NamingConvention;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -16,7 +16,7 @@ class DateTimeSniff implements Sniff
/**
* String representation of warning.
*
* phpcs:disable Magento.Files.LineLength.MaxExceeded
* phpcs:disable Magento2.Files.LineLength.MaxExceeded
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Standards\Generic\Sniffs\PHP\ForbiddenFunctionsSniff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -27,7 +27,7 @@ public function register()
public function process(File $phpcsFile, $stackPtr)
{
$phpcsFile->addError(
// phpcs:ignore Magento.Files.LineLength.MaxExceeded
// phpcs:ignore Magento2.Files.LineLength.MaxExceeded
'Final keyword is prohibited in Magento. It decreases extensibility and is not compatible with plugins and proxies.',
$stackPtr,
'FoundFinal'
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\PHP;
namespace Magento2\Sniffs\PHP;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Performance;
namespace Magento2\Sniffs\Performance;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -20,12 +20,12 @@ class EmptyCheckSniff implements Sniff
*/
protected $map = [
'count' => [
// phpcs:ignore Magento.Files.LineLength.MaxExceeded
// phpcs:ignore Magento2.Files.LineLength.MaxExceeded
'message' => 'count(...) function should not be used to check if array is empty. Use empty(...) language construct instead',
'code' => 'FoundCount'
],
'strlen' => [
// phpcs:ignore Magento.Files.LineLength.MaxExceeded
// phpcs:ignore Magento2.Files.LineLength.MaxExceeded
'message' => 'strlen(...) function should not be used to check if string is empty. Consider replace with (... === "") or (... !== "")',
'code' => 'FoundStrlen'
],
Expand Down Expand Up @@ -114,7 +114,7 @@ public function process(File $phpcsFile, $stackPtr)
$phpcsFile->addWarning($message, $stackPtr, $code);
}
} else {
// phpcs:ignore Magento.Files.LineLength.MaxExceeded
// phpcs:ignore Magento2.Files.LineLength.MaxExceeded
if ($phpcsFile->findNext($this->otherComparisonOperators, $functionPosition, $endOfStatementPosition) === false) {
$phpcsFile->addWarning($message, $stackPtr, $code);
}
Expand All @@ -130,7 +130,7 @@ public function process(File $phpcsFile, $stackPtr)
*/
private function findFunctionPosition($index)
{
// phpcs:ignore Magento.Files.LineLength.MaxExceeded
// phpcs:ignore Magento2.Files.LineLength.MaxExceeded
for ($i = $this->tokens[$index]['parenthesis_opener'] + 1; $i < $this->tokens[$index]['parenthesis_closer']; $i++) {
if (array_key_exists($this->tokens[$i]['content'], $this->map)) {
return $i;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\SQL;
namespace Magento2\Sniffs\SQL;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Security;
namespace Magento2\Sniffs\Security;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Security;
namespace Magento2\Sniffs\Security;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -23,7 +23,7 @@ class LanguageConstructSniff implements Sniff
/**
* String representation of backtick error.
*
* phpcs:disable Magento.Files.LineLength.MaxExceeded
* phpcs:disable Magento2.Files.LineLength.MaxExceeded
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Security;
namespace Magento2\Sniffs\Security;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Security;
namespace Magento2\Sniffs\Security;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Strings;
namespace Magento2\Sniffs\Strings;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand All @@ -17,7 +17,7 @@ class ExecutableRegExSniff implements Sniff
/**
* String representation of error.
*
* phpcs:disable Magento.Files.LineLength.MaxExceeded
* phpcs:disable Magento2.Files.LineLength.MaxExceeded
*
* @var string
*/
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Strings;
namespace Magento2\Sniffs\Strings;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Templates;
namespace Magento2\Sniffs\Templates;

use PHP_CodeSniffer\Sniffs\Sniff;
use PHP_CodeSniffer\Files\File;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento, Inc. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Translation;
namespace Magento2\Sniffs\Translation;

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down Expand Up @@ -65,7 +65,7 @@ public function process(File $phpcsFile, $stackPtr)
}

/**
* Checks if first argument of \Magento\Framework\Phrase or translation function is a constant
* Checks if first argument of \Magento2\Framework\Phrase or translation function is a constant
*
* @param File $phpcsFile
* @param int $stackPtr
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Sniffs\Whitespace;
namespace Magento2\Sniffs\Whitespace;

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;
Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,8 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/

namespace Magento\Tests\Classes;
namespace Magento2\Tests\Classes;

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Tests\Classes;
namespace Magento2\Tests\Classes;

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

Expand Down
Original file line number Diff line number Diff line change
Expand Up @@ -3,7 +3,7 @@
* Copyright © Magento. All rights reserved.
* See COPYING.txt for license details.
*/
namespace Magento\Tests\CodeAnalysis;
namespace Magento2\Tests\CodeAnalysis;

use PHP_CodeSniffer\Tests\Standards\AbstractSniffUnitTest;

Expand Down
Loading