Duplicate code is one of the most pungent code smells. A rule that is often used is to re-structure code once it is duplicated in three or more places.
Common duplication problems, and corresponding solutions are:
| 1 | <?php  | 
            ||
| 21 | class SendProjectMomentHandler  | 
            ||
| 22 | { | 
            ||
| 23 | use DispatchesJobs;  | 
            ||
| 24 | |||
| 25 | /**  | 
            ||
| 26 | * Handle the project updated moment.  | 
            ||
| 27 | */  | 
            ||
| 28 | public function handle(ProjectEventInterface $event)  | 
            ||
| 40 | |||
| 41 | /**  | 
            ||
| 42 | * Trigger the moment.  | 
            ||
| 43 | *  | 
            ||
| 44 | * @param \Gitamin\Models\Project $project  | 
            ||
| 45 | * @param int $action  | 
            ||
| 46 | */  | 
            ||
| 47 | View Code Duplication | protected function trigger(Project &$project, $action)  | 
            |
| 58 | }  | 
            ||
| 59 | 
If you access a property on an interface, you most likely code against a concrete implementation of the interface.
Available Fixes
Adding an additional type check:
Changing the type hint: