Skip to content

* fix regression of ad5e6eed04aa5af7c6d72b67cc8d1a7f52bfb4eb that not… #147

* fix regression of ad5e6eed04aa5af7c6d72b67cc8d1a7f52bfb4eb that not…

* fix regression of ad5e6eed04aa5af7c6d72b67cc8d1a7f52bfb4eb that not… #147

Triggered via push September 24, 2024 04:44
Status Failure
Total duration 4m 24s
Artifacts 3

be.yml

on: push
Matrix: runs-on
Fit to window
Zoom out
Zoom in

Annotations

41 errors and 75 warnings
runs-on (ubuntu-latest) / php-cs-fixer
Process completed with exit code 8.
runs-on (ubuntu-latest) / phpmd: tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L50
BaseQueryTest.php: The method testReOrderNestedPosts uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (ElseExpression, Clean Code Rules)
runs-on (ubuntu-latest) / phpmd
Process completed with exit code 2.
runs-on (ubuntu-latest) / pint
Process completed with exit code 1.
runs-on (ubuntu-latest) / phpstan
Process completed with exit code 1.
runs-on (ubuntu-latest) / phpcs: phan.php#L7
phan.php: PSR12.Files.FileHeader.IncorrectOrder: The file-level docblock must follow the opening PHP tag in the file header
runs-on (ubuntu-latest) / phpcs: phan.php#L38
phan.php: PSR12.Files.FileHeader.SpacingAfterBlock: Header blocks must be separated by a single blank line
runs-on (ubuntu-latest) / phpcs
Process completed with exit code 1.
runs-on (ubuntu-latest) / phpcs
Process completed with exit code 2.
runs-on (ubuntu-latest) / psalm
Process completed with exit code 2.
runs-on (ubuntu-latest) / phan: app/Eloquent/Model/Post/Post.php#L33
Post.php: PhanTypeMismatchReturnReal: Returning self::MODEL_CLASS_TO_TABLE_NAME_SUFFIX[$this::class] of type null but getTableNameSuffix() is declared to return string
runs-on (ubuntu-latest) / phan: app/Exceptions/Handler.php#L16
Handler.php: PhanUndeclaredMethod: Call to undeclared method \Illuminate\Container\Container::json
runs-on (ubuntu-latest) / phan: app/Helper.php#L94
Helper.php: PhanUndeclaredMethod: Call to undeclared method \Illuminate\Container\Container::json
runs-on (ubuntu-latest) / phan: app/Helper.php#L100
Helper.php: PhanUndeclaredMethod: Call to undeclared method \Illuminate\Container\Container::withHeaders
runs-on (ubuntu-latest) / phan: app/Http/Controllers/PostsQuery.php#L58
PostsQuery.php: PhanParamTooFew: Call with 0 arg(s) to \App\Http\PostsQuery\IndexQuery::__construct(\Barryvdh\Debugbar\LaravelDebugbar $debugbar, \App\Http\PostsQuery\CursorCodec $cursorCodec, int $perPageItems = 50) which requires 2 arg(s) defined at app/Http/PostsQuery/BaseQuery.php:36
runs-on (ubuntu-latest) / phan: app/Http/PostsQuery/BaseQuery.php#L274
BaseQuery.php: PhanNonClassMethodCall: Call to method values on non-class type string
runs-on (ubuntu-latest) / phan: app/Http/PostsQuery/BaseQuery.php#L279
BaseQuery.php: PhanNonClassMethodCall: Call to method filter on non-class type string
runs-on (ubuntu-latest) / phan: app/Http/PostsQuery/BaseQuery.php#L288
BaseQuery.php: PhanNonClassMethodCall: Call to method first on non-class type string
runs-on (ubuntu-latest) / phan: app/Http/PostsQuery/BaseQuery.php#L321
BaseQuery.php: PhanNonClassMethodCall: Call to method map on non-class type string
runs-on (ubuntu-latest) / phan: app/Http/PostsQuery/BaseQuery.php#L327
BaseQuery.php: PhanNonClassMethodCall: Call to method sortBy on non-class type string
runs-on (windows-latest) / psalm
Process completed with exit code 127.
runs-on (windows-latest) / phan
Process completed with exit code 1.
runs-on (windows-latest) / pint
Process completed with exit code 1.
runs-on (windows-latest) / phpcs
Process completed with exit code 1.
runs-on (windows-latest) / phpcs: be/phan.php#L7
phan.php: PSR12.Files.FileHeader.IncorrectOrder: The file-level docblock must follow the opening PHP tag in the file header
runs-on (windows-latest) / phpcs: be/phan.php#L38
phan.php: PSR12.Files.FileHeader.SpacingAfterBlock: Header blocks must be separated by a single blank line
runs-on (windows-latest) / phpcs
Process completed with exit code 1.
runs-on (windows-latest) / phpstan
Process completed with exit code 1.
runs-on (windows-latest) / php-cs-fixer
Process completed with exit code 8.
runs-on (windows-latest) / phpmd: be/tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L50
BaseQueryTest.php: The method testReOrderNestedPosts uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (ElseExpression, Clean Code Rules)
runs-on (windows-latest) / phpmd
Process completed with exit code 2.
runs-on (macos-latest) / php-cs-fixer
Process completed with exit code 8.
runs-on (macos-latest) / phpcs
Process completed with exit code 2.
runs-on (macos-latest) / phpcs: phan.php#L7
phan.php: PSR12.Files.FileHeader.IncorrectOrder: The file-level docblock must follow the opening PHP tag in the file header
runs-on (macos-latest) / phpcs: phan.php#L38
phan.php: PSR12.Files.FileHeader.SpacingAfterBlock: Header blocks must be separated by a single blank line
runs-on (macos-latest) / phpcs
Process completed with exit code 1.
runs-on (macos-latest) / phpmd: tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L50
BaseQueryTest.php: The method testReOrderNestedPosts uses an else expression. Else clauses are basically not necessary and you can simplify the code by not using them. (ElseExpression, Clean Code Rules)
runs-on (macos-latest) / phpmd
Process completed with exit code 2.
runs-on (macos-latest) / phpstan
Process completed with exit code 1.
runs-on (macos-latest) / pint
Process completed with exit code 1.
runs-on (macos-latest) / psalm
Process completed with exit code 2.
runs-on (ubuntu-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (ubuntu-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (ubuntu-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (ubuntu-latest) / phpmd: app/Http/Controllers/PostsQuery.php#L18
PostsQuery.php: The class PostsQuery has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. (CouplingBetweenObjects, Design Rules)
runs-on (ubuntu-latest) / phpmd: app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (ubuntu-latest) / phpmd: app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has an NPath complexity of 400. The configured NPath complexity threshold is 200. (NPathComplexity, Code Size Rules)
runs-on (ubuntu-latest) / phpmd: app/Http/PostsQuery/SearchQuery.php#L53
SearchQuery.php: The method applyQueryParamsOnQuery() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (ubuntu-latest) / phpmd: tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L55
BaseQueryTest.php: The method provideReOrderNestedPostsData() has 168 lines of code. Current threshold is set to 100. Avoid really long methods. (ExcessiveMethodLength, Code Size Rules)
runs-on (ubuntu-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (ubuntu-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (ubuntu-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (ubuntu-latest) / phan: app/Console/Commands/BatchTableSQLGenerator.php#L9
BatchTableSQLGenerator.php: PhanUnreferencedClass: Possibly zero references to class \App\Console\Commands\BatchTableSQLGenerator
runs-on (ubuntu-latest) / phan: app/Console/Commands/BatchTableSQLGenerator.php#L20
BatchTableSQLGenerator.php: PhanUnreferencedPublicMethod: Possibly zero references to public method \App\Console\Commands\BatchTableSQLGenerator::handle()
runs-on (ubuntu-latest) / phan: app/Console/Commands/BatchTableSQLGenerator.php#L46
BatchTableSQLGenerator.php: PhanCoalescingNeverNull: Using non-null (($outputSQL . ' 影响行数:') . $affectedRows) of type string as the left hand side of a null coalescing (??) operation. The right hand side may be unnecessary.
runs-on (ubuntu-latest) / phan: app/Console/Commands/BatchTableSQLGenerator.php#L46
BatchTableSQLGenerator.php: PhanPartialTypeMismatchArgument: Argument 1 ($string) is ((($outputSQL . ' 影响行数:') . $affectedRows) ?? 0) of type 0|string but \App\Console\Commands\BatchTableSQLGenerator::info() takes string (0 is incompatible) defined at vendor/laravel/framework/src/Illuminate/Console/Concerns/InteractsWithIO.php:289
runs-on (ubuntu-latest) / phan: app/Console/Commands/BatchTableSQLGenerator.php#L46
BatchTableSQLGenerator.php: PhanTypeSuspiciousStringExpression: Suspicious type bool of a variable or expression $affectedRows used to build a string. (Expected type to be able to cast to a string)
runs-on (ubuntu-latest) / phan: app/Console/Commands/GenerateBilibiliVote.php#L11
GenerateBilibiliVote.php: PhanUnreferencedClass: Possibly zero references to class \App\Console\Commands\GenerateBilibiliVote
runs-on (ubuntu-latest) / phan: app/Console/Commands/GenerateBilibiliVote.php#L17
GenerateBilibiliVote.php: PhanUnreferencedPublicMethod: Possibly zero references to public method \App\Console\Commands\GenerateBilibiliVote::handle()
runs-on (ubuntu-latest) / phan: app/Console/Commands/GenerateBilibiliVote.php#L28
GenerateBilibiliVote.php: PhanUnreferencedClosure: Possibly zero references to Closure(\Illuminate\Support\Collection $voteReplies)
runs-on (ubuntu-latest) / phan: app/Console/Commands/GenerateBilibiliVote.php#L42
GenerateBilibiliVote.php: PhanCoalescingNeverNullInLoop: Using non-null \Safe\json_encode($voteReply['content']) of type string as the left hand side of a null coalescing (??) operation. The right hand side may be unnecessary. (in a loop body - this is likely a false positive)
runs-on (ubuntu-latest) / phan: app/Console/Kernel.php#L8
Kernel.php: PhanUnreferencedClass: Possibly zero references to class \App\Console\Kernel
runs-on (windows-latest) / pint: be/app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (windows-latest) / pint: be/app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (windows-latest) / pint: be/app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (windows-latest) / php-cs-fixer: app\Http\Controllers\PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (windows-latest) / php-cs-fixer: app\Http\Controllers\PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (windows-latest) / php-cs-fixer: app\Http\Controllers\PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/BaseQuery.php#L281
Escaped Mutant for Mutator "Coalesce": --- Original +++ New @@ @@ // use the topmost value between sorting key or value of orderBy field within its child posts $curAndChildSortingKeys = collect([ // value of orderBy field in the first sorted child post that isMatchQuery after previous sorting - $childPosts->filter(static fn(Collection $p) => ($p['isMatchQuery'] ?? true) === true)->first()[$this->orderByField] ?? null, + $childPosts->filter(static fn(Collection $p) => (true ?? $p['isMatchQuery']) === true)->first()[$this->orderByField] ?? null, // sorting key from the first sorted child posts // not requiring isMatchQuery since a child post without isMatchQuery // might have its own child posts with isMatchQuery
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L33
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ return '0'; } $prefix = match (true) { - \is_int($cursor) && $cursor < 0 => '-', + \is_int($cursor) && $cursor <= 0 => '-', \is_string($cursor) => 'S', default => '', };
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L40
Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ \is_string($cursor) => 'S', default => '', }; - $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor >= 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); + $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor > 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); if ($prefix !== 'S') { // https://en.wikipedia.org/wiki/Base64#URL_applications $value = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($value));
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L75
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * @var string $cursor * @var string $prefix */ - [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 2, null); + [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 3, null); if ($cursor === null) { // no prefix being provided means the value of cursor is a positive int $cursor = $prefix;
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L82
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // keep 0 as is 'S' => $cursor, // string literal is not base64 encoded - default => ((array) unpack(format: 'P', string: str_pad( + default => unpack(format: 'P', string: str_pad( // re-add removed trailing 0x00 or 0xFF base64_decode( // https://en.wikipedia.org/wiki/Base64#URL_applications @@ @@ ), length: 8, pad_string: $prefix === '-' ? "\xff" : "\x00" - )))[1], + ))[1], }; })->chunk(2)->map(static fn(Collection $i) => $i->values()))->mapWithKeys(fn(Collection $cursors, string $postType) => [$postType => $cursors->mapWithKeys(fn(int|string|null $cursor, int $index) => [$index === 0 ? Helper::POST_TYPE_TO_ID[$postType] : $orderByField => $cursor])])->reject(static fn(Collection $cursors) => $cursors->every(static fn(int|string|null $cursor) => $cursor === null))->map(static fn(Collection $cursors) => new Cursor($cursors->toArray())); } }
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L90
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ // https://en.wikipedia.org/wiki/Base64#URL_applications str_replace(['-', '_'], ['+', '/'], $cursor) ), - length: 8, + length: 9, pad_string: $prefix === '-' ? "\xff" : "\x00" )))[1], };
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L28
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { - $this->params->addDefaultValueOnParams(); + $this->params->addDefaultValueOnUniqueParams(); // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all();
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L29
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { $this->params->addDefaultValueOnParams(); - $this->params->addDefaultValueOnUniqueParams(); + // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes);
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L33
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes); - $currentPostTypes = (array) $this->params->getUniqueParamValue('postTypes'); + $currentPostTypes = $this->params->getUniqueParamValue('postTypes'); if (!$shouldSkip40003) { $this->validate40003($currentPostTypes); }
runs-on (ubuntu-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L43
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ } private function validateParamsValue(array $params) : void { - $paramsPossibleValue = ['userGender' => [0, 1, 2], 'userManagerType' => ['NULL', 'manager', 'assist', 'voiceadmin']]; + $paramsPossibleValue = ['userGender' => [-1, 1, 2], 'userManagerType' => ['NULL', 'manager', 'assist', 'voiceadmin']]; $dateRangeValidator = function ($_, string $value) : void { $this->validator->make(explode(',', $value), ['0' => 'date|before_or_equal:1', '1' => 'date|after_or_equal:0'])->validate(); };
runs-on (windows-latest) / phpmd: be/app/Http/Controllers/PostsQuery.php#L18
PostsQuery.php: The class PostsQuery has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. (CouplingBetweenObjects, Design Rules)
runs-on (windows-latest) / phpmd: be/app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (windows-latest) / phpmd: be/app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has an NPath complexity of 400. The configured NPath complexity threshold is 200. (NPathComplexity, Code Size Rules)
runs-on (windows-latest) / phpmd: be/app/Http/PostsQuery/SearchQuery.php#L53
SearchQuery.php: The method applyQueryParamsOnQuery() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (windows-latest) / phpmd: be/tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L55
BaseQueryTest.php: The method provideReOrderNestedPostsData() has 168 lines of code. Current threshold is set to 100. Avoid really long methods. (ExcessiveMethodLength, Code Size Rules)
runs-on (macos-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (macos-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (macos-latest) / php-cs-fixer: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (windows-latest) / phpunit-infection
JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled.
runs-on (windows-latest) / phpunit-infection
JIT is incompatible with third party extensions that override zend_execute_ex(). JIT disabled.
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/BaseQuery.php#L281
Escaped Mutant for Mutator "Coalesce": --- Original +++ New @@ @@ // use the topmost value between sorting key or value of orderBy field within its child posts $curAndChildSortingKeys = collect([ // value of orderBy field in the first sorted child post that isMatchQuery after previous sorting - $childPosts->filter(static fn(Collection $p) => ($p['isMatchQuery'] ?? true) === true)->first()[$this->orderByField] ?? null, + $childPosts->filter(static fn(Collection $p) => (true ?? $p['isMatchQuery']) === true)->first()[$this->orderByField] ?? null, // sorting key from the first sorted child posts // not requiring isMatchQuery since a child post without isMatchQuery // might have its own child posts with isMatchQuery
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L33
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ return '0'; } $prefix = match (true) { - \is_int($cursor) && $cursor < 0 => '-', + \is_int($cursor) && $cursor <= 0 => '-', \is_string($cursor) => 'S', default => '', };
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L40
Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ \is_string($cursor) => 'S', default => '', }; - $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor >= 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); + $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor > 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); if ($prefix !== 'S') { // https://en.wikipedia.org/wiki/Base64#URL_applications $value = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($value));
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L75
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * @var string $cursor * @var string $prefix */ - [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 2, null); + [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 3, null); if ($cursor === null) { // no prefix being provided means the value of cursor is a positive int $cursor = $prefix;
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L82
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // keep 0 as is 'S' => $cursor, // string literal is not base64 encoded - default => ((array) unpack(format: 'P', string: str_pad( + default => unpack(format: 'P', string: str_pad( // re-add removed trailing 0x00 or 0xFF base64_decode( // https://en.wikipedia.org/wiki/Base64#URL_applications @@ @@ ), length: 8, pad_string: $prefix === '-' ? "\xff" : "\x00" - )))[1], + ))[1], }; })->chunk(2)->map(static fn(Collection $i) => $i->values()))->mapWithKeys(fn(Collection $cursors, string $postType) => [$postType => $cursors->mapWithKeys(fn(int|string|null $cursor, int $index) => [$index === 0 ? Helper::POST_TYPE_TO_ID[$postType] : $orderByField => $cursor])])->reject(static fn(Collection $cursors) => $cursors->every(static fn(int|string|null $cursor) => $cursor === null))->map(static fn(Collection $cursors) => new Cursor($cursors->toArray())); } }
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L90
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ // https://en.wikipedia.org/wiki/Base64#URL_applications str_replace(['-', '_'], ['+', '/'], $cursor) ), - length: 8, + length: 9, pad_string: $prefix === '-' ? "\xff" : "\x00" )))[1], };
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L28
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { - $this->params->addDefaultValueOnParams(); + $this->params->addDefaultValueOnUniqueParams(); // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all();
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L29
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { $this->params->addDefaultValueOnParams(); - $this->params->addDefaultValueOnUniqueParams(); + // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes);
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L33
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes); - $currentPostTypes = (array) $this->params->getUniqueParamValue('postTypes'); + $currentPostTypes = $this->params->getUniqueParamValue('postTypes'); if (!$shouldSkip40003) { $this->validate40003($currentPostTypes); }
runs-on (windows-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L43
Escaped Mutant for Mutator "DecrementInteger": --- Original +++ New @@ @@ } private function validateParamsValue(array $params) : void { - $paramsPossibleValue = ['userGender' => [0, 1, 2], 'userManagerType' => ['NULL', 'manager', 'assist', 'voiceadmin']]; + $paramsPossibleValue = ['userGender' => [-1, 1, 2], 'userManagerType' => ['NULL', 'manager', 'assist', 'voiceadmin']]; $dateRangeValidator = function ($_, string $value) : void { $this->validator->make(explode(',', $value), ['0' => 'date|before_or_equal:1', '1' => 'date|after_or_equal:0'])->validate(); };
runs-on (macos-latest) / phpmd: app/Http/Controllers/PostsQuery.php#L18
PostsQuery.php: The class PostsQuery has a coupling between objects value of 13. Consider to reduce the number of dependencies under 13. (CouplingBetweenObjects, Design Rules)
runs-on (macos-latest) / phpmd: app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has a Cyclomatic Complexity of 13. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (macos-latest) / phpmd: app/Http/PostsQuery/IndexQuery.php#L17
IndexQuery.php: The method query() has an NPath complexity of 400. The configured NPath complexity threshold is 200. (NPathComplexity, Code Size Rules)
runs-on (macos-latest) / phpmd: app/Http/PostsQuery/SearchQuery.php#L53
SearchQuery.php: The method applyQueryParamsOnQuery() has a Cyclomatic Complexity of 12. The configured cyclomatic complexity threshold is 10. (CyclomaticComplexity, Code Size Rules)
runs-on (macos-latest) / phpmd: tests/Feature/App/Http/PostsQuery/BaseQueryTest.php#L55
BaseQueryTest.php: The method provideReOrderNestedPostsData() has 168 lines of code. Current threshold is set to 100. Avoid really long methods. (ExcessiveMethodLength, Code Size Rules)
runs-on (macos-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.trailing_comma_in_multiline: Found violation(s) of type: trailing_comma_in_multiline
runs-on (macos-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.braces_position: Found violation(s) of type: braces_position
runs-on (macos-latest) / pint: app/Http/Controllers/PostsQuery.php#L1
PostsQuery.php: PHP-CS-Fixer.single_line_empty_body: Found violation(s) of type: single_line_empty_body
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/BaseQuery.php#L281
Escaped Mutant for Mutator "Coalesce": --- Original +++ New @@ @@ // use the topmost value between sorting key or value of orderBy field within its child posts $curAndChildSortingKeys = collect([ // value of orderBy field in the first sorted child post that isMatchQuery after previous sorting - $childPosts->filter(static fn(Collection $p) => ($p['isMatchQuery'] ?? true) === true)->first()[$this->orderByField] ?? null, + $childPosts->filter(static fn(Collection $p) => (true ?? $p['isMatchQuery']) === true)->first()[$this->orderByField] ?? null, // sorting key from the first sorted child posts // not requiring isMatchQuery since a child post without isMatchQuery // might have its own child posts with isMatchQuery
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L33
Escaped Mutant for Mutator "LessThan": --- Original +++ New @@ @@ return '0'; } $prefix = match (true) { - \is_int($cursor) && $cursor < 0 => '-', + \is_int($cursor) && $cursor <= 0 => '-', \is_string($cursor) => 'S', default => '', };
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L40
Escaped Mutant for Mutator "GreaterThanOrEqualTo": --- Original +++ New @@ @@ \is_string($cursor) => 'S', default => '', }; - $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor >= 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); + $value = \is_int($cursor) ? rtrim(pack('P', $cursor), $cursor > 0 ? "\x00" : "\xff") : ($prefix === 'S' ? $cursor : throw new \RuntimeException('Invalid cursor value')); if ($prefix !== 'S') { // https://en.wikipedia.org/wiki/Base64#URL_applications $value = str_replace(['+', '/', '='], ['-', '_', ''], base64_encode($value));
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L75
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ * @var string $cursor * @var string $prefix */ - [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 2, null); + [$prefix, $cursor] = array_pad(explode(':', $encodedCursor), 3, null); if ($cursor === null) { // no prefix being provided means the value of cursor is a positive int $cursor = $prefix;
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L82
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // keep 0 as is 'S' => $cursor, // string literal is not base64 encoded - default => ((array) unpack(format: 'P', string: str_pad( + default => unpack(format: 'P', string: str_pad( // re-add removed trailing 0x00 or 0xFF base64_decode( // https://en.wikipedia.org/wiki/Base64#URL_applications @@ @@ ), length: 8, pad_string: $prefix === '-' ? "\xff" : "\x00" - )))[1], + ))[1], }; })->chunk(2)->map(static fn(Collection $i) => $i->values()))->mapWithKeys(fn(Collection $cursors, string $postType) => [$postType => $cursors->mapWithKeys(fn(int|string|null $cursor, int $index) => [$index === 0 ? Helper::POST_TYPE_TO_ID[$postType] : $orderByField => $cursor])])->reject(static fn(Collection $cursors) => $cursors->every(static fn(int|string|null $cursor) => $cursor === null))->map(static fn(Collection $cursors) => new Cursor($cursors->toArray())); } }
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/CursorCodec.php#L90
Escaped Mutant for Mutator "IncrementInteger": --- Original +++ New @@ @@ // https://en.wikipedia.org/wiki/Base64#URL_applications str_replace(['-', '_'], ['+', '/'], $cursor) ), - length: 8, + length: 9, pad_string: $prefix === '-' ? "\xff" : "\x00" )))[1], };
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L28
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ } public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { - $this->params->addDefaultValueOnParams(); + $this->params->addDefaultValueOnUniqueParams(); // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all();
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L29
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ public function addDefaultParamsThenValidate(bool $shouldSkip40003) : void { $this->params->addDefaultValueOnParams(); - $this->params->addDefaultValueOnUniqueParams(); + // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes);
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L32
Escaped Mutant for Mutator "MethodCallRemoval": --- Original +++ New @@ @@ $this->params->addDefaultValueOnUniqueParams(); // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); - $this->params->setUniqueParamValue('postTypes', $sortedPostTypes); + $currentPostTypes = (array) $this->params->getUniqueParamValue('postTypes'); if (!$shouldSkip40003) { $this->validate40003($currentPostTypes);
runs-on (macos-latest) / phpunit-infection: be/app/Http/PostsQuery/ParamsValidator.php#L33
Escaped Mutant for Mutator "CastArray": --- Original +++ New @@ @@ // sort here to prevent further sort while validating $sortedPostTypes = collect($this->params->getUniqueParamValue('postTypes'))->sort()->values()->all(); $this->params->setUniqueParamValue('postTypes', $sortedPostTypes); - $currentPostTypes = (array) $this->params->getUniqueParamValue('postTypes'); + $currentPostTypes = $this->params->getUniqueParamValue('postTypes'); if (!$shouldSkip40003) { $this->validate40003($currentPostTypes); }

Artifacts

Produced during runtime
Name Size
coverage-macos-latest Expired
5.56 KB
coverage-ubuntu-latest Expired
5.56 KB
coverage-windows-latest Expired
5.5 KB