Skip to content

Do not treat negated constant as a magic number#4

Merged
sidz merged 1 commit intosidz:mainfrom
maks-rafalko:bugfix/unary-minus
Apr 25, 2023
Merged

Do not treat negated constant as a magic number#4
sidz merged 1 commit intosidz:mainfrom
maks-rafalko:bugfix/unary-minus

Conversation

@maks-rafalko
Copy link
Copy Markdown
Contributor

Do not treat negated constant as a magic number

return -self::CONST

is not a magic number.

Additionally, correctly handle UnaryPlus as well as UnaryMinus and add more tests for different combinations of + and - with constants and raw values.

```php
return -self::CONST
```

is not a magic number.

Additionally, correctly handle `UnaryPlus` as well as `UnaryMinus` and add more tests for different combinations of `+` and `-` with constants and raw values.
Copy link
Copy Markdown
Owner

@sidz sidz left a comment

Choose a reason for hiding this comment

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

nice catch. 👍

@sidz sidz merged commit 50c7d97 into sidz:main Apr 25, 2023
@maks-rafalko maks-rafalko deleted the bugfix/unary-minus branch April 25, 2023 13:01
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