Skip to content

Commit

Permalink
Add InvalidOverride issue
Browse files Browse the repository at this point in the history
  • Loading branch information
edsrzf committed Feb 3, 2024
1 parent 0082207 commit 7414945
Show file tree
Hide file tree
Showing 2 changed files with 33 additions and 0 deletions.
24 changes: 24 additions & 0 deletions docs/running_psalm/issues/InvalidOverride.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,24 @@
# InvalidOverride

Emitted when an `Override` attribute was added to a method that does not override a method from a parent class or implemented interface.

```php
<?php

class A {
function receive()
{
}
}

class B extends A {
#[Override]
function recieve()
{
}
}
```

## Why this is bad

A fatal error will be thrown.
9 changes: 9 additions & 0 deletions src/Psalm/Issue/InvalidOverride.php
Original file line number Diff line number Diff line change
@@ -0,0 +1,9 @@
<?php

namespace Psalm\Issue;

final class InvalidOverride extends CodeIssue
{
public const ERROR_LEVEL = 7;
public const SHORTCODE = 357;
}

0 comments on commit 7414945

Please sign in to comment.