Created
May 14, 2019 09:23
-
-
Save lunetics/5a26646f2394cbbc46bbf949a0f0d03f to your computer and use it in GitHub Desktop.
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function Loose(?array $foo) : ?array | |
{ | |
$localScoped = null; | |
if ($foo !== null) { | |
foreach ($foo as $bar) { | |
$localScoped[] = $bar->stuff(); | |
} | |
} | |
return $localScoped; | |
} | |
function LooseCallee(?array $other) : ?array | |
{ | |
$localScoped = null; | |
if ($other !== null) { | |
foreach ($other as $bar) { | |
$localScoped[] = $bar->stuff(); | |
} | |
} | |
return $localScoped; | |
} |
This file contains hidden or bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
function tight(array $foo) : array | |
{ | |
$localScoped = []; | |
foreach ($foo as $bar) { | |
$localScoped[] = $bar->stuff(); | |
} | |
return $localScoped; | |
} | |
function tightCallee(array $resultSet) : array | |
{ | |
$localScoped = []; | |
foreach ($resultSet as $bar) { | |
$localScoped[] = $bar->stuff(); | |
} | |
return $localScoped; | |
} |
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment