You can have a linear workflow with the array functions.
The following is unreadable:
$output = array_reduce(
array_map(
function($n) { return $n ** 2; }
array_filter($input, function($n) { return $n % 2 == 0; })
),You can have a linear workflow with the array functions.
The following is unreadable:
$output = array_reduce(
array_map(
function($n) { return $n ** 2; }
array_filter($input, function($n) { return $n % 2 == 0; })
),| <?php | |
| // an ultra-simple middleware host that works for middleware callables with any signature. | |
| // the last argument is always the `$next` function, which delegates to the next middleware. | |
| class Host | |
| { | |
| /** | |
| * @var callable[] | |
| */ |
| <?php | |
| namespace Psr\Middleware; | |
| use Psr\Http\Message\RequestInterface; | |
| use Psr\Http\Message\ResponseInterface; | |
| /** | |
| * This interface defines the formal method common to HTTP Middleware components. | |
| */ |
| /** | |
| * Automatically create ordered/unordered lists when detecting content like "* " or "1. " | |
| */ | |
| define(function () { | |
| "use strict"; | |
| return function () { | |
| return function (scribe) { | |
| /** |
| <?php | |
| // anonymous classes are both instances and types. huh? what? | |
| $type = new class { | |
| public function foo() { | |
| echo "YAY"; | |
| } | |
| }; |
| <?php | |
| function kthxbai() { | |
| $result = "hey"; | |
| try { | |
| return $result; | |
| } finally { | |
| $result = "dafuq"; | |
| } |
| <?php | |
| class Container | |
| { | |
| /** @var Closure[] */ | |
| private $factories = []; | |
| /** @var array */ | |
| private $components = []; |
How do you document model attributes implemented using synchronous accessor methods?
Example - bare model, no documentation:
class Contact
{
protected $phone;
public function getPhone() {| /// This interface defines an event listener | |
| interface IListener<Event> { | |
| (event: Event): void | |
| } | |
| /// This interface represents an event hook | |
| interface IHook<Event> { | |
| /// Attach a handler to this hookable | |
| (handler: IListener<Event>): void |