Skip to content

Cannot declare class PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff #1042

@Mechstud

Description

@Mechstud

I am using latest released (stable) version of both PHP Codesniffer and PHP Compatibility.

For code sniffer, I have downloaded the phar file to use that, and for PHP Compatibility, I download the .tar.gz file of latest release: 9.3.5

However, on trying to run the sniffer using PHP Compatibility, I am getting the following error:

/home/teamrj# php phpcs.phar -p php-7-4-upgrade --standard=PHPCompatibility-9.3.5/PHPCompatibility
PHP Fatal error:  Cannot declare class PHPCompatibility\Sniffs\FunctionUse\RequiredToOptionalFunctionParametersSniff, because the name is already in use in /home/teamrj/PHPCompatibility-9.3.5/PHPCompatibility/Sniffs/FunctionUse/RequiredToOptionalFunctionParametersSniff.php on line 350
PHP Stack trace:
PHP   1. {main}() /home/teamrj/phpcs.phar:0
PHP   2. PHP_CodeSniffer\Runner->runPHPCS() /home/teamrj/phpcs.phar:6
PHP   3. PHP_CodeSniffer\Runner->init() phar:///home/teamrj/phpcs.phar/src/Runner.php:2
PHP   4. PHP_CodeSniffer\Ruleset->__construct() phar:///home/teamrj/phpcs.phar/src/Runner.php:2
PHP   5. PHP_CodeSniffer\Ruleset->registerSniffs() phar:///home/teamrj/phpcs.phar/src/Ruleset.php:2
PHP   6. PHP_CodeSniffer\Autoload::loadFile() phar:///home/teamrj/phpcs.phar/src/Ruleset.php:2

My CodeSniffer.conf file is as follows:

<?php
 $phpCodeSnifferConfig = array (
  'installed_paths' => 'PHPCompatibility-9.3.5/PHPCompatibility/',
)
?>

Kindly assist.

Metadata

Metadata

Assignees

No one assigned

    Type

    No type

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions