-
-
Notifications
You must be signed in to change notification settings - Fork 163
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
Added DNF type support #505
base: master
Are you sure you want to change the base?
Added DNF type support #505
Conversation
A new inspection was created. |
$pointcuts = array_slice($args, 1); | ||
} | ||
|
||
if (count(array_filter($pointcuts, static fn ($pointcut) => $pointcut instanceof Pointcut)) !== count($pointcuts)) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before opening parenthesis of function call prohibited
@@ -0,0 +1,14 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
readonly class Node | ||
{ | ||
public function __construct( | ||
public NodeType $type, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 4 spaces, found 8
{ | ||
public function __construct( | ||
public NodeType $type, | ||
public ?string $identifier = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 4 spaces, found 8
public function __construct( | ||
public NodeType $type, | ||
public ?string $identifier = null, | ||
public ?Node $left = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 4 spaces, found 8
public NodeType $type, | ||
public ?string $identifier = null, | ||
public ?Node $left = null, | ||
public ?Node $right = null, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 4 spaces, found 8
@@ -0,0 +1,10 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
enum NodeType | ||
{ | ||
case IDENTIFIER; | ||
case AND; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
{ | ||
case IDENTIFIER; | ||
case AND; | ||
case OR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
@@ -0,0 +1,13 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
case IDENTIFIER; | ||
case LPAREN; | ||
case RPAREN; | ||
case AND; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
case LPAREN; | ||
case RPAREN; | ||
case AND; | ||
case OR; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
@@ -0,0 +1,74 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
@@ -0,0 +1,74 @@ | |||
<?php | |||
|
|||
namespace Go\Aop\Pointcut\DNF\Parser; |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be one blank line after the namespace declaration
* @param \ArrayIterator<\PhpToken> $tokens | ||
*/ | ||
public function __construct( | ||
private readonly \ArrayIterator $tokens |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 4 spaces, found 8
|
||
private function getToken(string $val): Token | ||
{ | ||
return match ($val) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before opening parenthesis of function call prohibited
chr(26) => Token::EOF, | ||
'(' => Token::LPAREN, | ||
')' => Token::RPAREN, | ||
'|' => Token::OR, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
'(' => Token::LPAREN, | ||
')' => Token::RPAREN, | ||
'|' => Token::OR, | ||
'&' => Token::AND, |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
')' => Token::RPAREN, | ||
'|' => Token::OR, | ||
'&' => Token::AND, | ||
default => Token::IDENTIFIER |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 8 spaces, found 12
@@ -0,0 +1,21 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
* @return array{0: Token, 1: string|null} | ||
*/ | ||
public function peek(int $i): array; | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 newline at end of file; 0 found
@@ -0,0 +1,113 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
TokenCollection $tokens, | ||
int $bindingPower, | ||
bool $insideParenthesis = false | ||
): ?Node { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
There must be a single space between the closing parenthesis and the opening brace of a multi-line function declaration; found 0 spaces
): ?Node { | ||
[$token, $val] = $tokens->next(); | ||
switch ($token) { | ||
case Token::LPAREN: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
CASE statements must be defined using a colon
while (true) { | ||
[$token] = $tokens->peek(0); | ||
|
||
if ($token === Token::OR && $insideParenthesis) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
} | ||
|
||
switch ($token) { | ||
case Token::OR: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
|
||
switch ($token) { | ||
case Token::OR: | ||
case Token::AND: |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
|
||
private function operatorNode(Token $type, Node $left, ?Node $right): Node | ||
{ | ||
return match ($type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before opening parenthesis of function call prohibited
private function operatorNode(Token $type, Node $left, ?Node $right): Node | ||
{ | ||
return match ($type) { | ||
Token::OR => new Node(NodeType::OR, left: $left, right: $right), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
{ | ||
return match ($type) { | ||
Token::OR => new Node(NodeType::OR, left: $left, right: $right), | ||
Token::AND => new Node(NodeType::AND, left: $left, right: $right), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
return match ($type) { | ||
Token::OR => new Node(NodeType::OR, left: $left, right: $right), | ||
Token::AND => new Node(NodeType::AND, left: $left, right: $right), | ||
default => throw new Exception('invalid op') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 8 spaces, found 12
*/ | ||
private function getBindingPower(Token $type): array | ||
{ | ||
return match ($type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before opening parenthesis of function call prohibited
private function getBindingPower(Token $type): array | ||
{ | ||
return match ($type) { | ||
Token::OR => [1, 2], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
{ | ||
return match ($type) { | ||
Token::OR => [1, 2], | ||
Token::AND => [3, 4], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
return match ($type) { | ||
Token::OR => [1, 2], | ||
Token::AND => [3, 4], | ||
default => throw new Exception('Invalid operator') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 8 spaces, found 12
}; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Expected 1 newline at end of file; 0 found
- The closing brace for the class must go on the next line after the body
@@ -0,0 +1,8 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
interface TokenizerParserInterface | ||
{ | ||
public function parse(string $input); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 newline at end of file; 0 found
@@ -0,0 +1,44 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
|| $val->implementsInterface($tree->identifier); | ||
} | ||
|
||
if ($tree?->type === NodeType::AND) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
return match ($type) { | ||
Token::OR => new Node(NodeType::OR, left: $left, right: $right), | ||
Token::AND => new Node(NodeType::AND, left: $left, right: $right), | ||
default => throw new Exception('invalid op') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 8 spaces, found 12
*/ | ||
private function getBindingPower(Token $type): array | ||
{ | ||
return match ($type) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space before opening parenthesis of function call prohibited
private function getBindingPower(Token $type): array | ||
{ | ||
return match ($type) { | ||
Token::OR => [1, 2], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
{ | ||
return match ($type) { | ||
Token::OR => [1, 2], | ||
Token::AND => [3, 4], |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
return match ($type) { | ||
Token::OR => [1, 2], | ||
Token::AND => [3, 4], | ||
default => throw new Exception('Invalid operator') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Line indented incorrectly; expected 8 spaces, found 12
}; | ||
} | ||
|
||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Expected 1 newline at end of file; 0 found
- The closing brace for the class must go on the next line after the body
@@ -0,0 +1,8 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
interface TokenizerParserInterface | ||
{ | ||
public function parse(string $input); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 newline at end of file; 0 found
@@ -0,0 +1,44 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
|| $val->implementsInterface($tree->identifier); | ||
} | ||
|
||
if ($tree?->type === NodeType::AND) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected and
but found AND
return $this->verifyTree($tree->left, $val) && $this->verifyTree($tree->right, $val); | ||
} | ||
|
||
if ($tree->type === NodeType::OR) { |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
PHP keywords must be lowercase; expected or
but found OR
|
||
return $parentClasses; | ||
} | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 newline at end of file; 0 found
@@ -0,0 +1,11 @@ | |||
<?php |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
End of line character is invalid; expected \n
but found \r\n
interface SemanticAnalyzerInterface | ||
{ | ||
public function verifyTree(Node $tree, \ReflectionClass|ReflectionFileNamespace $val); | ||
} |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Expected 1 newline at end of file; 0 found
->call(fn($parentClassName) => new ClassInheritancePointcut($parentClassName)) | ||
->call(static function (...$args) { | ||
return array_map( | ||
static fn (string $class) => new ClassInheritancePointcut($class), |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
- Line indented incorrectly; expected 16 spaces, found 20
- Space before opening parenthesis of function call prohibited
@@ -301,6 +305,12 @@ function () { | |||
->call($stringConverter) | |||
->is('namespacePattern', 'nsSeparator', '**') | |||
->call($stringConverter) | |||
->is('namespacePattern', '&', 'namespacePattern') | |||
->call($stringConverter) | |||
->is('(' , 'namespacePattern', '&', 'namespacePattern', ')') |
There was a problem hiding this comment.
Choose a reason for hiding this comment
The reason will be displayed to describe this comment to others. Learn more.
Space found before comma in function call
@lisachenko I would suggest disabling nitpick, seems pretty outdated, most of these comments are wrong |
TODO: