[Bug]: The `toHaveSuspiciousCharacters` method identifies Cyrillic characters as suspicious
Nobody has claimed this yet.
- Dominant language
- PHP
- Stars
- 11.7k
- Forks
- 538
- Avg merge
- 4d 11h
- Merged PRs (30d)
- 8
Description
What Happened
In our project we use annotations to generate the OpenApi file and specify the description using Cyrillic.
When calling the architectural test arch()->preset()->php() it returns an error:
Expecting 'app\Enums\AlertTypeEnum.php' to not include suspicious characters.
at app\Enums\AlertTypeEnum.php:11
at vendor\pestphp\pest-plugin-arch\src\Expectations\Targeted.php:46
at vendor\pestphp\pest-plugin-arch\src\Blueprint.php:137
at vendor\pestphp\pest-plugin-arch\src\Expectations\Targeted.php:43
at vendor\pestphp\pest-plugin-arch\src\SingleArchExpectation.php:162
at vendor\pestphp\pest-plugin-arch\src\SingleArchExpectation.php:146
Enum class:
<?php
declare(strict_types=1);
namespace App\Enums;
use OpenApi\Attributes as OA;
#[OA\Schema(
schema: AlertTypeEnum::class,
description: 'Тип алерта', // this line
type: 'string',
enum: AlertTypeEnum::class,
)]
enum AlertTypeEnum: string
{
case Ok = 'OK';
case Warning = 'WARNING';
case Error = 'ERROR';
}
How to Reproduce
Create any file and add annotation with Cyrillic. For example:
<?php
declare(strict_types=1);
namespace App\Console\Commands;
use Illuminate\Console\Command;
use Symfony\Component\Console\Attribute\AsCommand;
#[AsCommand('test', 'Привет')]
class TestCommand extends Command
{
public function handle(): void {}
}
And now just run the check:
arch()->preset()->php();
Result:
Expecting 'app\Console\Commands\TestCommand.php' to not include suspicious characters.
at app\Console\Commands\TestCommand.php:10
at vendor\pestphp\pest-plugin-arch\src\Expectations\Targeted.php:46
at vendor\pestphp\pest-plugin-arch\src\Blueprint.php:137
at vendor\pestphp\pest-plugin-arch\src\Expectations\Targeted.php:43
at vendor\pestphp\pest-plugin-arch\src\SingleArchExpectation.php:162
at vendor\pestphp\pest-plugin-arch\src\SingleArchExpectation.php:146
Sample Repository
No response
Pest Version
4.0.3
PHP Version
8.4.11
Operation System
Windows
Notes
No response
Contributor guide
First steps
- Read the whole issue, then the project's contributing guide.
- Comment on the issue to say you are picking it up — it saves two people doing the same work.
- Fork the repository and make your change on a branch.
- Open a pull request that references the issue number.
Research direction
Start by locating the toHaveSuspiciousCharacters implementation behind arch()->preset()->php(), using the stack entries in vendor/pestphp/pest-plugin-arch/src/Expectations/Targeted.php and Blueprint.php as entry points. Reproduce the check with the Cyrillic annotation shown in the issue, then verify that Cyrillic descriptions are accepted while genuinely suspicious characters are still rejected.
Written by the indexing model from the issue text.
Assessment
- Tech stack
- php
- Domain
- testing
- Issue type
- Bug
- Difficulty
- 3/5
- Estimated time
- 1-2 days
- Activity status
- Stale
- Clarity
- Clearly specified
- Newbie friendliness
- 45/100