Skip to content

Latest commit

 

History

History
33 lines (25 loc) · 616 Bytes

simplified_null_return.rst

File metadata and controls

33 lines (25 loc) · 616 Bytes

Rule simplified_null_return

A return statement wishing to return void should not return null.

Examples

Example #1

--- Original
+++ New
-<?php return null;
+<?php return;

Example #2

--- Original
+++ New
 <?php
-function foo() { return null; }
+function foo() { return; }
 function bar(): int { return null; }
 function baz(): ?int { return null; }
-function xyz(): void { return null; }
+function xyz(): void { return; }