View collections.md

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; })
  ),
View middleware-host.php
<?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[]
*/
View MiddlewareDelegateInterface.php
<?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.
*/
View scribe-plugin-smart-lists.js
/**
* Automatically create ordered/unordered lists when detecting content like "* " or "1. "
*/
define(function () {
"use strict";
return function () {
return function (scribe) {
/**
View shared-toolbar.js
define(function () {
"use strict";
var active_scribe = null;
function create_handler_for(button) {
return function (event) {
if (!active_scribe) {
return;
}
View anonymous.php
<?php
// anonymous classes are both instances and types. huh? what?
$type = new class {
public function foo() {
echo "YAY";
}
};
View dafuq.php
<?php
function kthxbai() {
$result = "hey";
try {
return $result;
} finally {
$result = "dafuq";
}
View Container.php
<?php
class Container
{
/** @var Closure[] */
private $factories = [];
/** @var array */
private $components = [];
View blah.md

How do you document model attributes implemented using synchronous accessor methods?

Example - bare model, no documentation:

class Contact
{
    protected $phone;
    
    public function getPhone() {
View hooks.ts
/// 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