From ed89fb53227fffd0a0fcf9ec6b29e30a7282de53 Mon Sep 17 00:00:00 2001 From: Turbo Date: Fri, 7 Jun 2019 09:00:41 +0700 Subject: [PATCH 1/2] feat(rule): space before and after operator --- src/CrazyFactory/ruleset.xml | 5 +++++ 1 file changed, 5 insertions(+) diff --git a/src/CrazyFactory/ruleset.xml b/src/CrazyFactory/ruleset.xml index 1a72f1b..fddb729 100644 --- a/src/CrazyFactory/ruleset.xml +++ b/src/CrazyFactory/ruleset.xml @@ -41,6 +41,11 @@ + + + + + From c89be66c35d4e107f64c7c6ae83dd7a4523394ef Mon Sep 17 00:00:00 2001 From: March Kasama Kaewsainguan Date: Mon, 3 Apr 2023 17:40:46 +0700 Subject: [PATCH 2/2] feat(php82): to suuport PHP82 found an isue that the repo https://github.com/squizlabs/PHP_CodeSniffer Doesn't upgrade and support PHP8 + higher phpunit version. so we used to have a unittest that extend from libs which need to be removed. --- .travis.yml | 18 +- composer.json | 44 ++-- docker-compose.yml | 52 ++++ docker-project.json | 33 +++ docker/docker-compose.dev.yml | 52 ++++ docker/php/Dockerfile | 69 ++++++ docker/php/php-fpm-ini.ini | 23 ++ docker/php/www.conf | 13 + ecs.php | 30 +++ phpunit.xml | 8 - .../Classes/UnusedUseStatementUnitTest.inc | 24 -- .../Classes/UnusedUseStatementUnitTest.php | 41 --- .../ControlSignatureUnitTest.inc | 213 ---------------- .../ControlSignatureUnitTest.inc.fixed | 234 ------------------ .../ControlSignatureUnitTest.php | 74 ------ .../BlankLineBeforeReturnUnitTest.inc | 69 ------ .../BlankLineBeforeReturnUnitTest.inc.fixed | 71 ------ .../BlankLineBeforeReturnUnitTest.php | 37 --- .../UseInAlphabeticalOrderUnitTest.1.inc | 9 - ...UseInAlphabeticalOrderUnitTest.1.inc.fixed | 9 - .../UseInAlphabeticalOrderUnitTest.2.inc | 3 - .../UseInAlphabeticalOrderUnitTest.php | 47 ---- tests/AllSniffs.php | 87 ------- tests/bootstrap.php | 49 ---- 24 files changed, 301 insertions(+), 1008 deletions(-) create mode 100644 docker-compose.yml create mode 100644 docker-project.json create mode 100644 docker/docker-compose.dev.yml create mode 100644 docker/php/Dockerfile create mode 100644 docker/php/php-fpm-ini.ini create mode 100644 docker/php/www.conf create mode 100644 ecs.php delete mode 100644 phpunit.xml delete mode 100644 src/CrazyFactory/Tests/Classes/UnusedUseStatementUnitTest.inc delete mode 100644 src/CrazyFactory/Tests/Classes/UnusedUseStatementUnitTest.php delete mode 100644 src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.inc delete mode 100644 src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.inc.fixed delete mode 100644 src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.php delete mode 100644 src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.inc delete mode 100644 src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.inc.fixed delete mode 100644 src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.php delete mode 100644 src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.1.inc delete mode 100644 src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.1.inc.fixed delete mode 100644 src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.2.inc delete mode 100644 src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.php delete mode 100644 tests/AllSniffs.php delete mode 100644 tests/bootstrap.php diff --git a/.travis.yml b/.travis.yml index 3638a69..3e0eb06 100644 --- a/.travis.yml +++ b/.travis.yml @@ -2,30 +2,24 @@ language: php matrix: include: - - php: 7.0 - - php: 7.1 - - php: nightly + - dist: focal + php: 8.2 + env: LIBONIG_INSTALL=1 fast_finish: true - allow_failures: - - php: nightly - - php: 7.0 - -before_script: +before_install: + - if [ -n "$LIBONIG_INSTALL" ]; then sudo apt-get install libonig5; fi - travis_retry composer self-update - travis_retry composer update --prefer-dist -script: - - vendor/bin/phpunit --testsuite=sniff_tests - deploy: provider: script script: scripts/deploy.sh skip_cleanup: false on: tags: true - condition: "$TRAVIS_PHP_VERSION = 7.1" + condition: "$TRAVIS_PHP_VERSION = 8.2" cache: directories: diff --git a/composer.json b/composer.json index f7e1e1a..73e0f24 100644 --- a/composer.json +++ b/composer.json @@ -1,25 +1,27 @@ { - "name": "crazyfactory/sniffs", - "description": "Crazy Factory default code styles to be used with Squizlabs' code sniffer.", - "license": "proprietary", - "require": { - "symplify/easy-coding-standard": "^2.2.0" - }, - "require-dev": { - "phpunit/phpunit": "~4.0" - }, - "autoload": { - "psr-4": { - "CrazyFactory\\Sniffs\\": "src/CrazyFactory/Sniffs/" - } - }, - "config": { - "optimize-autoloader": true, - "preferred-install": { - "*": "dist" - } + "name": "crazyfactory/sniffs", + "description": "Crazy Factory default code styles to be used with Squizlabs' code sniffer.", + "license": "proprietary", + "require": { + "PHP": "^8.2", + "symplify/easy-coding-standard": "^11.3" + }, + "require-dev": { + "squizlabs/php_codesniffer": "^3.7", + "phpunit/phpunit": "^10.0" + }, + "autoload": { + "psr-4": { + "CrazyFactory\\Sniffs\\": "src/CrazyFactory/Sniffs/" + } + }, + "config": { + "optimize-autoloader": true, + "preferred-install": { + "*": "dist" }, - "scripts": { - "test": "phpunit -c phpunit.xml" + "platform": { + "php": "8.2.3" } + } } diff --git a/docker-compose.yml b/docker-compose.yml new file mode 100644 index 0000000..d0619cf --- /dev/null +++ b/docker-compose.yml @@ -0,0 +1,52 @@ +version: '3.4' + +services: + php-sniff-php-fpm: + container_name: php-sniff-php-fpm + build: + context: ./ + dockerfile: ./docker/php/Dockerfile + target: debugging + ports: + - "30112:80" + volumes: + - ./:/var/www/project + environment: + IN_DOCKER: 1 + + PHP_INI_UPLOAD_MAX_FILESIZE: 100M + PHP_INI_POST_MAX_SIZE: 108M + PHP_INI_MAX_FILE_UPLOADS: 200 + INI_EXPOSE_PHP: 0 + + INI_MAX_EXECUTION_TIME: 0 + INI_MEMORY_LIMIT: 2G + + INI_ERROR_LOG: .debug/php-errors.log + INI_LOG_ERRORS: 1 + INI_DISPLAY_ERRORS: "E_ALL & ~E_DEPRECATED & ~E_NOTICE" + INI_DISPLAY_STARTUP_ERRORS: 1 + INI_ERROR_REPORTING: 1 + INI_HTML_ERRORS: 0 + + # https://xdebug.org/docs/all_settings#mode + # INI_XDEBUG_MODE=off,debug,profile,trace - EG - Enables step debugger, profiling and tracing + INI_XDEBUG_MODE: "debug" + INI_XDEBUG_HOST: host.docker.internal + INI_XDEBUG_PORT: 9000 + INI_IDEKEY: PHPSTORM + INI_XDEBUG_OUTPUT_DIR: "/var/www/project/.debug" + INI_XDEBUG_DISCOVER_CLIENT_HOST: 1 + INI_XDEBUG_CLI_COLOR: 1 + INI_XDEBUG_START_WITH_REQUEST: 1 + + INI_XDEBUG_LOG: "/var/www/project/.debug/remote.log" + INI_XDEBUG_LOG_LEVEL: 7 + + INI_XDEBUG_TRACE_FORMAT: 0 + INI_XDEBUG_TRACE_OUTPUT_NAME: "trace.%t-%s" + + INI_XDEBUG_PROFILER_APPEND: 0 + INI_XDEBUG_PROFILER_OUTPUT_NAME: "cachegrind.out.%t-%s" + + PHP_IDE_CONFIG: "serverName=php-sniff-php-fpm" diff --git a/docker-project.json b/docker-project.json new file mode 100644 index 0000000..ad62261 --- /dev/null +++ b/docker-project.json @@ -0,0 +1,33 @@ +{ + "file": "./docker-compose.yml", + "service": "php-sniff-php-fpm", + "command": "composer %args%", + "actions": { + "install": { + "command": "composer %action% %args%", + "user": "www-data" + }, + "update": { + "command": "composer %action% %args%", + "user": "www-data" + }, + "php": { + "command": "php %args%", + "user": "www-data" + }, + "bash": { + "user": "www-data" + }, + "bash:root": { + "command": ["bash"], + "user": "root" + }, + "start:dev": { + "service": "@host", + "command": [ + "docker-compose build", + "docker-compose up -d" + ] + } + } +} diff --git a/docker/docker-compose.dev.yml b/docker/docker-compose.dev.yml new file mode 100644 index 0000000..b0ef1e3 --- /dev/null +++ b/docker/docker-compose.dev.yml @@ -0,0 +1,52 @@ +version: '3.4' + +services: + php-sniff-php-fpm: + container_name: php-sniff-php-fpm + build: + context: ./ + dockerfile: ./docker/php/Dockerfile + target: image-ci-testing + ports: + - "30112:80" + volumes: + - ./:/var/www/project + environment: + IN_DOCKER: 1 + + PHP_INI_UPLOAD_MAX_FILESIZE: 100M + PHP_INI_POST_MAX_SIZE: 108M + PHP_INI_MAX_FILE_UPLOADS: 200 + INI_EXPOSE_PHP: 0 + + INI_MAX_EXECUTION_TIME: 0 + INI_MEMORY_LIMIT: 2G + + INI_ERROR_LOG: .debug/php-errors.log + INI_LOG_ERRORS: 1 + INI_DISPLAY_ERRORS: "E_ALL & ~E_DEPRECATED & ~E_NOTICE" + INI_DISPLAY_STARTUP_ERRORS: 1 + INI_ERROR_REPORTING: 1 + INI_HTML_ERRORS: 0 + + # https://xdebug.org/docs/all_settings#mode + # INI_XDEBUG_MODE=off,debug,profile,trace - EG - Enables step debugger, profiling and tracing + INI_XDEBUG_MODE: "debug" + INI_XDEBUG_HOST: host.docker.internal + INI_XDEBUG_PORT: 9000 + INI_IDEKEY: PHPSTORM + INI_XDEBUG_OUTPUT_DIR: "/var/www/project/.debug" + INI_XDEBUG_DISCOVER_CLIENT_HOST: 1 + INI_XDEBUG_CLI_COLOR: 1 + INI_XDEBUG_START_WITH_REQUEST: 1 + + INI_XDEBUG_LOG: "/var/www/project/.debug/remote.log" + INI_XDEBUG_LOG_LEVEL: 7 + + INI_XDEBUG_TRACE_FORMAT: 0 + INI_XDEBUG_TRACE_OUTPUT_NAME: "trace.%t-%s" + + INI_XDEBUG_PROFILER_APPEND: 0 + INI_XDEBUG_PROFILER_OUTPUT_NAME: "cachegrind.out.%t-%s" + + PHP_IDE_CONFIG: "serverName=php-sniff-php-fpm" diff --git a/docker/php/Dockerfile b/docker/php/Dockerfile new file mode 100644 index 0000000..38b2c30 --- /dev/null +++ b/docker/php/Dockerfile @@ -0,0 +1,69 @@ +# For why we separate so many docker layers by performing multiple RUN and COPY, please see +# https://docs.docker.com/develop/develop-images/dockerfile_best-practices/ +# https://www.ginkgobioworks.com/2020/05/18/optimizing-your-dockerfile/ + +FROM base-php-fpm:php82 as base + +COPY ./docker/php/www.conf /usr/local/etc/php-fpm.d/www.conf +RUN chmod 644 /usr/local/etc/php-fpm.d/www.conf + +FROM base as composer-install + +COPY --chown=www-data:www-data ./composer.json /var/www/project/composer.json +COPY --chown=www-data:www-data ./composer.lock /var/www/project/composer.lock + +USER www-data +RUN COMPOSER_MEMORY_LIMIT=-1 composer install +USER root + +FROM base as copy-volume + +COPY --chown=www-data:www-data ./ /var/www/project + + +FROM base as env-file + +RUN mkdir -p shop-env-config +RUN touch shop-env-config/.env + +RUN chown www-data:www-data /var/www/project/shop-env-config/.env + + +# ---------------- Debug ----------------- # + +FROM base as debugging + +RUN install-php-extensions xdebug + +# debug settings +RUN mkdir -m 777 -p .debug +RUN chown www-data:www-data .debug + +# Travis should have the same ini setup as live prod +COPY ./docker/php/php-fpm-ini.ini /usr/local/etc/php/conf.d/999-overrides.ini + +COPY --from=composer-install /var/www/project . +COPY --from=env-file /var/www/project . +COPY --from=copy-volume /var/www/project . + +# Bind mount location +VOLUME ["/var/www/project"] + +CMD php-fpm + + +# ---------------- CI ----------------- # + +FROM base as image-ci-testing + +# Travis should have the same ini setup as live prod +COPY ./docker/php/php-fpm-ini.ini /usr/local/etc/php/conf.d/999-overrides.ini + +COPY --from=composer-install /var/www/project . +COPY --from=env-file /var/www/project . +COPY --from=copy-volume /var/www/project . + +# Bind mount location +VOLUME ["/var/www/project"] + +CMD php-fpm diff --git a/docker/php/php-fpm-ini.ini b/docker/php/php-fpm-ini.ini new file mode 100644 index 0000000..65cbbda --- /dev/null +++ b/docker/php/php-fpm-ini.ini @@ -0,0 +1,23 @@ +memory_limit = -1 + +[xdebug] + +xdebug.mode=${INI_XDEBUG_MODE} +xdebug.client_host=${INI_XDEBUG_HOST} +xdebug.client_port=${INI_XDEBUG_PORT} +xdebug.idekey=${INI_IDEKEY} +xdebug.output_dir=${INI_XDEBUG_OUTPUT_DIR} +xdebug.discover_client_host = ${INI_XDEBUG_DISCOVER_CLIENT_HOST} +xdebug.cli_color = ${INI_XDEBUG_CLI_COLOR} +xdebug.start_with_request = ${INI_XDEBUG_START_WITH_REQUEST} + +xdebug.log = ${INI_XDEBUG_LOG} +xdebug.log_level = ${INI_XDEBUG_LOG_LEVEL} + +xdebug.trace_format = ${INI_XDEBUG_TRACE_FORMAT} +xdebug.trace_output_name = ${INI_XDEBUG_TRACE_OUTPUT_NAME} + +xdebug.profiler_append = ${INI_XDEBUG_PROFILER_APPEND} +xdebug.profiler_output_name = ${INI_XDEBUG_PROFILER_OUTPUT_NAME} + + diff --git a/docker/php/www.conf b/docker/php/www.conf new file mode 100644 index 0000000..94e799c --- /dev/null +++ b/docker/php/www.conf @@ -0,0 +1,13 @@ +[www] + +user = www-data +group = www-data + +pm = static +pm.max_children = 75 +pm.max_requests = 250 +pm.status_path = /status + +ping.path = /ping + +access.format = "%m %r %d %C %M %s %q" diff --git a/ecs.php b/ecs.php new file mode 100644 index 0000000..7310d04 --- /dev/null +++ b/ecs.php @@ -0,0 +1,30 @@ +paths([ + __DIR__ . '/src', + __DIR__ . '/tests', + ]); + + // this way you add a single rule + $ecsConfig->rules([ + NoUnusedImportsFixer::class, + ]); + + // this way you can add sets - group of rules + $ecsConfig->sets([ + // run and fix, one by one + // SetList::SPACES, + // SetList::ARRAY, + // SetList::DOCBLOCK, + // SetList::NAMESPACES, + // SetList::COMMENTS, + // SetList::PSR_12, + ]); +}; diff --git a/phpunit.xml b/phpunit.xml deleted file mode 100644 index 34cad17..0000000 --- a/phpunit.xml +++ /dev/null @@ -1,8 +0,0 @@ - - - - - tests/AllSniffs.php - - - diff --git a/src/CrazyFactory/Tests/Classes/UnusedUseStatementUnitTest.inc b/src/CrazyFactory/Tests/Classes/UnusedUseStatementUnitTest.inc deleted file mode 100644 index 19ab286..0000000 --- a/src/CrazyFactory/Tests/Classes/UnusedUseStatementUnitTest.inc +++ /dev/null @@ -1,24 +0,0 @@ - - */ - protected function getErrorList() - { - return []; - } - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array(int => int) - */ - protected function getWarningList() - { - return [ - 3 => 1, - 4 => 0, - 5 => 0, - 6 => 0, - 7 => 0, - 8 => 0 - ]; - } -} diff --git a/src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.inc b/src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.inc deleted file mode 100644 index 0cb0d3b..0000000 --- a/src/CrazyFactory/Tests/ControlStructures/ControlSignatureUnitTest.inc +++ /dev/null @@ -1,213 +0,0 @@ - 0); - -do -{ - echo $i; -} while ($i > 0); - -do -{ - echo $i; -} -while ($i > 0); - -do { echo $i; } while ($i > 0); - -do{ - echo $i; -}while($i > 0); - -while ($i < 1) { - echo $i; -} - -while($i < 1){ - echo $i; -} - -while ($i < 1) { echo $i; } - -for ($i = 1; $i < 1; $i++) { - echo $i; -} - -for($i = 1; $i < 1; $i++){ - echo $i; -} - -for ($i = 1; $i < 1; $i++) { echo $i; } - -if ($i == 0) { - $i = 1; -} - -if($i == 0){ - $i = 1; -} - -if ($i == 0) { $i = 1; } - -if ($i == 0) { - $i = 1; -} else { - $i = 0; -} - -if ($i == 0) { - $i = 1; -}else{ - $i = 0; -} - -if ($i == 0) { $i = 1; } else { $i = 0; } - -if ($i == 0) { - $i = 1; -} else if ($i == 2) { - $i = 0; -} - -if ($i == 0) { - $i = 1; -}else if($i == 2){ - $i = 0; -} - -if ($i == 0) { $i = 1; } else if ($i == 2) { $i = 0; } - -if ($i == 0) { // comments are allowed - $i = 1; -} - -if ($i == 0) {// comments are allowed - $i = 1; -} - -if ($i == 0) { /* comments are allowed*/ - $i = 1; -} - -if ($i == 0) -{ // this is ok - $i = 1; -} - -if ($i == 0) /* this is ok */ { -} - -try { - $code = 'this'; -} catch (Exception $e) { - // Caught! -} - -try { $code = 'this'; } catch (Exception $e) { - // Caught! -} - -do { echo $i; -} while ($i > 0); - -if ($i === 0) { - - $i = 1 -} - -if ($a) { - -} -elseif ($b) { -} - -foreach ($items as $item) { - echo $item; -} - -foreach($items as $item){ - echo $item; -} - -if ($a && $b) // && $c) -{ -} - -if ($a == 5) : - echo "a equals 5"; - echo "..."; -elseif ($a == 6) : - echo "a equals 6"; - echo "!!!"; -else : - echo "a is neither 5 nor 6"; -endif; - -try { - // try body -} -catch (FirstExceptionType $e) { - // catch body -} -catch (OtherExceptionType $e) { - // catch body -} - -switch($foo) { - - case 'bar': - break; - -} - -if ($foo) : -endif; - -?> - -getRow()): ?> -

- - - -
- -
- - - - - - - hello - - - - hello - - - 0); - -do { - echo $i; -} -while ($i > 0); - -do { - echo $i; -} -while ($i > 0); - -do { -echo $i; } -while ($i > 0); - -do { - echo $i; -} -while ($i > 0); - -while ($i < 1) { - echo $i; -} - -while ($i < 1) { - echo $i; -} - -while ($i < 1) { -echo $i; } - -for ($i = 1; $i < 1; $i++) { - echo $i; -} - -for ($i = 1; $i < 1; $i++) { - echo $i; -} - -for ($i = 1; $i < 1; $i++) { -echo $i; } - -if ($i == 0) { - $i = 1; -} - -if ($i == 0) { - $i = 1; -} - -if ($i == 0) { -$i = 1; } - -if ($i == 0) { - $i = 1; -} -else { - $i = 0; -} - -if ($i == 0) { - $i = 1; -} -else { - $i = 0; -} - -if ($i == 0) { -$i = 1; } -else { -$i = 0; } - -if ($i == 0) { - $i = 1; -} -else if ($i == 2) { - $i = 0; -} - -if ($i == 0) { - $i = 1; -} -else if ($i == 2) { - $i = 0; -} - -if ($i == 0) { -$i = 1; } -else if ($i == 2) { -$i = 0; } - -if ($i == 0) { // comments are allowed - $i = 1; -} - -if ($i == 0) {// comments are allowed - $i = 1; -} - -if ($i == 0) { /* comments are allowed*/ - $i = 1; -} - -if ($i == 0) { // this is ok - $i = 1; -} - -if ($i == 0) { /* this is ok */ -} - -try { - $code = 'this'; -} -catch (Exception $e) { - // Caught! -} - -try { -$code = 'this'; } -catch (Exception $e) { - // Caught! -} - -do { -echo $i; -} -while ($i > 0); - -if ($i === 0) { - - $i = 1 -} - -if ($a) { - -} -elseif ($b) { -} - -foreach ($items as $item) { - echo $item; -} - -foreach ($items as $item) { - echo $item; -} - -if ($a && $b) { // && $c) -} - -if ($a == 5) : - echo "a equals 5"; - echo "..."; -elseif ($a == 6) : - echo "a equals 6"; - echo "!!!"; -else : - echo "a is neither 5 nor 6"; -endif; - -try { - // try body -} -catch (FirstExceptionType $e) { - // catch body -} -catch (OtherExceptionType $e) { - // catch body -} - -switch ($foo) { - - case 'bar': - break; - -} - -if ($foo) : -endif; - -?> - -getRow()) : ?> -

- - - -
- -
- - - - - - - hello - - - - hello - - - - */ - public function getErrorList($testFile = '') - { - return [ - 5 => 1, - 7 => 1, - 10 => 1, - 12 => 1, - 18 => 2, - 20 => 1, - 22 => 2, - 28 => 2, - 32 => 1, - 38 => 2, - 42 => 1, - 48 => 2, - 52 => 1, - 56 => 1, - 62 => 2, - 66 => 3, - 70 => 1, - 76 => 4, - 80 => 3, - 94 => 1, - 99 => 1, - 104 => 1, - 108 => 2, - 112 => 1, - 113 => 1, - 130 => 2, - 134 => 1, - 158 => 1, - 165 => 1, - 170 => 2, - 185 => 1, - 190 => 2, - 191 => 2, - 195 => 1, - 208 => 1 - ]; - }//end getErrorList() - - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array - */ - public function getWarningList() - { - return []; - }//end getWarningList() -}//end class diff --git a/src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.inc b/src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.inc deleted file mode 100644 index 44db32b..0000000 --- a/src/CrazyFactory/Tests/Formatting/BlankLineBeforeReturnUnitTest.inc +++ /dev/null @@ -1,69 +0,0 @@ - - */ - protected function getErrorList() - { - return [ - 10 => 1, - 44 => 1 - ]; - } - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array(int => int) - */ - protected function getWarningList() - { - return []; - } -} diff --git a/src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.1.inc b/src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.1.inc deleted file mode 100644 index 1f8ff86..0000000 --- a/src/CrazyFactory/Tests/Formatting/UseInAlphabeticalOrderUnitTest.1.inc +++ /dev/null @@ -1,9 +0,0 @@ - - */ - protected function getErrorList($testFile = '') - { - switch ($testFile) { - case 'UseInAlphabeticalOrderUnitTest.1.inc': - return [ - 2 => 7 - ]; - break; - case 'UseInAlphabeticalOrderUnitTest.2.inc': - return [ - 3 => 1 - ]; - break; - default: - return []; - } - } - - /** - * Returns the lines where warnings should occur. - * - * The key of the array should represent the line number and the value - * should represent the number of warnings that should occur on that line. - * - * @return array(int => int) - */ - protected function getWarningList() - { - return []; - } -} diff --git a/tests/AllSniffs.php b/tests/AllSniffs.php deleted file mode 100644 index d885c90..0000000 --- a/tests/AllSniffs.php +++ /dev/null @@ -1,87 +0,0 @@ -getFilename(), 0, 1) === '.') { - continue; - } - - // Tests must have the extension 'php'. - $parts = explode('.', $file); - $ext = array_pop($parts); - if ($ext !== 'php') { - continue; - } - - $className = Autoload::loadFile($file->getPathname()); - $GLOBALS['PHP_CODESNIFFER_STANDARD_DIRS'][$className] = $standardDir; - $GLOBALS['PHP_CODESNIFFER_TEST_DIRS'][$className] = $testsDir; - $suite->addTestSuite($className); - } - }//end foreach - }//end foreach - - return $suite; - - } -} \ No newline at end of file diff --git a/tests/bootstrap.php b/tests/bootstrap.php deleted file mode 100644 index fbf0e81..0000000 --- a/tests/bootstrap.php +++ /dev/null @@ -1,49 +0,0 @@ -