Skip to content

Conversation

@Lassombria
Copy link
Contributor

No description provided.

@ZhukV
Copy link
Contributor

ZhukV commented Jan 23, 2025

Will be conflict with #21

Please wait to merge #21 and update this merge request.

@ZhukV ZhukV self-assigned this Jan 23, 2025
-
class: \FiveLab\Component\CiRules\PhpStan\MethodCallConsistencyRule
arguments:
- @reflectionProvider
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Use only one parameter, so that the code is the same please use one line for arguments.

use PHP_CodeSniffer\Files\File;
use PHP_CodeSniffer\Sniffs\Sniff;

class CyrillicSniff implements Sniff
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

This sniff should check only ASCII codes, without any cyrillic map, because must only support ASCII printable characters (character code 32-127).

https://www.ascii-code.com/

public function register(): array
{
return [
T_VARIABLE,
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

PHP not allow use special chars on variables, interfaces, classes.

use PHPStan\Analyser\Scope;
use PHPStan\Rules\Rule;

class NamespaceConsistencyRule implements Rule
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

phpstan more checks logic, but not strings, correct names, etc... As result, for this we should add phpcs rule, not phpstan.

__DIR__.'/Resources/cyrillic/wrong.php',
[
//phpcs:ignore
'message' => 'Use cyrillic symbols is forbidden: "Пространство"',
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We can't use cyrillic. For test, please use ord function.

@Lassombria Lassombria changed the base branch from 1.0 to master January 29, 2025 16:25
$className,
$methodReflection->getName()
))
->identifier('methodCallConsistency.error')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

We use methodCall namespace. As result, please set methodCall.consistency

$className,
$methodReflection->getName()
))
->identifier('methodCallConsistency.error')
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

see comment above

public const LINE_AFTER_NOT_ALLOWED = 'LineAfterNotAllowed';
public const LINE_BEFORE_NOT_ALLOWED = 'LineBeforeNotAllowed';
public const MISSED_CONSTANT_TYPE = 'MissedConstantType';
public const NAMESPACE_WRONG = 'NamespaceWrong';
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Please align all constants.

$content = $tokens[$stackPtr]['content'];
$forbiddenSymbols = [];

foreach (mb_str_split($content) as $char) {
Copy link
Contributor

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Should be \ before call function in global namespace. And please check this moment below.

@ZhukV ZhukV merged commit bf46097 into FiveLab:master Jan 31, 2025
5 checks passed
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants