diff --git a/.github/workflows/cs.yml b/.github/workflows/cs.yml index c63eeac..7bc8296 100644 --- a/.github/workflows/cs.yml +++ b/.github/workflows/cs.yml @@ -38,4 +38,4 @@ jobs: run: vendor/bin/phpcs --report-full --report-checkstyle=./checkstyle.xml - name: Show PHPCS results in PR - run: cs2pr ./checkstyle.xml --graceful-warnings + run: cs2pr ./checkstyle.xml diff --git a/.github/workflows/test.yml b/.github/workflows/test.yml index 4be6154..4f4c881 100644 --- a/.github/workflows/test.yml +++ b/.github/workflows/test.yml @@ -40,10 +40,10 @@ jobs: coverage: none tools: cs2pr - # Remove PHPCS as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3. + # Remove the PHPCS standard as it has a minimum PHP requirements of PHP 5.4 and would block install on PHP 5.3. - name: 'Composer: remove PHPCS' if: ${{ matrix.php < 5.4 }} - run: composer remove --dev squizlabs/php_codesniffer --no-update + run: composer remove --dev php-parallel-lint/php-code-style --no-update # Install dependencies and handle caching in one go. # @link https://github.com/marketplace/actions/install-composer-dependencies diff --git a/composer.json b/composer.json index 26ffde8..a9098b0 100644 --- a/composer.json +++ b/composer.json @@ -21,8 +21,7 @@ "phpunit/phpunit": "^4.8.36 || ^5.7.21 || ^6.0 || ^7.0 || ^8.0 || ^9.0", "php-parallel-lint/php-parallel-lint": "^1.0", "php-parallel-lint/php-var-dump-check": "0.*", - "squizlabs/php_codesniffer": "3.*", - "php-parallel-lint/php-code-style": "1.0" + "php-parallel-lint/php-code-style": "^2.0" }, "replace": { "jakub-onderka/php-console-color": "*" diff --git a/example.php b/example.php index 3ac1b2d..5432e32 100644 --- a/example.php +++ b/example.php @@ -1,4 +1,5 @@ - + A coding standard for Jakub Onderka's projects. - ./src/ + + + + . + + + */build/* + */vendor/* @@ -13,6 +25,19 @@ - + + + + + + + + + + diff --git a/src/ConsoleColor.php b/src/ConsoleColor.php index 1f87326..4a9e398 100644 --- a/src/ConsoleColor.php +++ b/src/ConsoleColor.php @@ -1,4 +1,5 @@ themes[$s])) { $sequences = array_merge($sequences, $this->themeSequence($s)); - } else if ($this->isValidStyle($s)) { + } elseif ($this->isValidStyle($s)) { $sequences[] = $this->styleSequence($s); } else { throw new InvalidStyleException($s); @@ -203,6 +204,7 @@ public function removeTheme($name) public function isSupported() { if (DIRECTORY_SEPARATOR === '\\') { + // phpcs:ignore Generic.PHP.NoSilencedErrors,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound if (function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT)) { return true; } elseif (getenv('ANSICON') !== false || getenv('ConEmuANSI') === 'ON') { @@ -210,6 +212,7 @@ public function isSupported() } return false; } else { + // phpcs:ignore Generic.PHP.NoSilencedErrors return function_exists('posix_isatty') && @posix_isatty(STDOUT); } } @@ -222,6 +225,7 @@ public function isSupported() public function are256ColorsSupported() { if (DIRECTORY_SEPARATOR === '\\') { + // phpcs:ignore Generic.PHP.NoSilencedErrors,PHPCompatibility.FunctionUse.NewFunctions.sapi_windows_vt100_supportFound return function_exists('sapi_windows_vt100_support') && @sapi_windows_vt100_support(STDOUT); } else { return strpos(getenv('TERM'), '256color') !== false; diff --git a/src/InvalidStyleException.php b/src/InvalidStyleException.php index c8d71b0..b06501e 100644 --- a/src/InvalidStyleException.php +++ b/src/InvalidStyleException.php @@ -1,4 +1,5 @@