Skip to content

assorted updates #221

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 3 commits into from
Jul 17, 2025
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
4 changes: 2 additions & 2 deletions MO4/Sniffs/Arrays/ArrayDoubleArrowAlignmentSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -96,7 +96,7 @@ public function process(File $phpcsFile, $stackPtr): void
$previous = $tokens[($i - 1)];

// Skip nested arrays.
if (true === \in_array($current['code'], $this->arrayTokens, true)) {
if (\in_array($current['code'], $this->arrayTokens, true)) {
$i = T_ARRAY === $current['code'] ? ($current['parenthesis_closer'] + 1) : ($current['bracket_closer'] + 1);

continue;
Expand Down Expand Up @@ -145,7 +145,7 @@ public function process(File $phpcsFile, $stackPtr): void
$j = ($i - 1);

while (($j >= 0) && ($tokens[$j]['line'] === $current['line'])) {
if (false === \in_array($tokens[$j]['code'], PHP_CodeSniffer_Tokens::$emptyTokens, true)) {
if (!\in_array($tokens[$j]['code'], PHP_CodeSniffer_Tokens::$emptyTokens, true)) {
$hasKeyInLine = true;
}

Expand Down
2 changes: 1 addition & 1 deletion MO4/Sniffs/Formatting/AlphabeticalUseStatementsSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -89,7 +89,7 @@ class AlphabeticalUseStatementsSniff extends UseDeclarationSniff
*/
public function process(File $phpcsFile, $stackPtr): void
{
if (false === \in_array($this->order, self::SUPPORTED_ORDERING_METHODS, true)) {
if (!\in_array($this->order, self::SUPPORTED_ORDERING_METHODS, true)) {
$error = \sprintf(
"'%s' is not a valid order function for %s! Pick one of: %s",
$this->order,
Expand Down
6 changes: 3 additions & 3 deletions MO4/Sniffs/Formatting/UnnecessaryNamespaceUsageSniff.php
Original file line number Diff line number Diff line change
Expand Up @@ -125,7 +125,7 @@ public function process(File $phpcsFile, $stackPtr): void
foreach ($tokens[$nsSep]['comment_tags'] as $tag) {
$content = $tokens[$tag]['content'];

if (false === \array_key_exists($content, $docCommentTags)) {
if (!\array_key_exists($content, $docCommentTags)) {
continue;
}

Expand Down Expand Up @@ -179,7 +179,7 @@ public function process(File $phpcsFile, $stackPtr): void
// phpcs:enable

foreach ($typeTokens as $typeToken) {
if (true === \in_array($typeToken, $useStatements, true)) {
if (\in_array($typeToken, $useStatements, true)) {
continue;
}

Expand Down Expand Up @@ -341,7 +341,7 @@ private function checkShorthandPossible(File $phpcsFile, array $useStatements, s

$fullClassName = $this->getFullyQualifiedClassName($className);

if (true === \array_key_exists($fullClassName, $useStatements)) {
if (\array_key_exists($fullClassName, $useStatements)) {
$replacement = $useStatements[$fullClassName];

$data = [
Expand Down
4 changes: 2 additions & 2 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -32,8 +32,8 @@
"require-dev": {
"ergebnis/composer-normalize": ">=2.19 <2.30",
"phan/phan": "^5.4.2",
"phpstan/phpstan": "^1.0",
"phpstan/phpstan-strict-rules": "^1.0",
"phpstan/phpstan": "^1.12",
"phpstan/phpstan-strict-rules": "^1.6",
"phpunit/phpunit": "^7.5.20 || ^8.5.36 || ^9.6.15",
"psalm/plugin-phpunit": "^0.18",
"vimeo/psalm": "^4.30"
Expand Down
5 changes: 3 additions & 2 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -1,10 +1,11 @@
parameters:
level: max
bootstrapFiles:
- %rootDir%/../../../tests/bootstrap.php
- %rootDir%/../../../tests/static_analysis_bootstrap.php
paths:
- %rootDir%/../../../MO4
- %rootDir%/../../../tests
checkMissingIterableValueType: false
ignoreErrors:
- identifier: missingType.iterableValue
includes:
- vendor/phpstan/phpstan-strict-rules/rules.neon
2 changes: 1 addition & 1 deletion psalm.xml
Original file line number Diff line number Diff line change
Expand Up @@ -4,7 +4,7 @@
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config vendor/vimeo/psalm/config.xsd"
autoloader="tests/bootstrap.php"
autoloader="tests/static_analysis_bootstrap.php"
>
<projectFiles>
<directory name="MO4" />
Expand Down
18 changes: 18 additions & 0 deletions tests/static_analysis_bootstrap.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,18 @@
<?php

/**
* This file is part of the mo4-coding-standard (phpcs standard)
*
* Bootstrap file for PHP_CodeSniffer MO4 Coding Standard unit tests.
*
* @author Xaver Loppenstedt <[email protected]>
*
* @license http://spdx.org/licenses/MIT MIT License
*
* @link https://github.com/mayflower/mo4-coding-standard
*/

declare(strict_types=1);

require_once __DIR__.'/../vendor/squizlabs/php_codesniffer/autoload.php';
require_once __DIR__.'/../vendor/squizlabs/php_codesniffer/src/Util/Tokens.php';