How do you document model attributes implemented using synchronous accessor methods?
Example - bare model, no documentation:
class Contact
{
protected $phone;
public function getPhone() {| <?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 |
| /// This interface defines an event listener | |
| interface Listener<Event> { | |
| (event: Event): void | |
| } | |
| /// This interface represents a hookable type | |
| interface Hookable<Event> { | |
| /// Attach a handler to this hookable | |
| (handler: Listener<Event>): void | |
| } |
This page provides a full overview of PHP's SessionHandler
life-cycle - this was generated by a set of test-scripts, in order to provide an exact overview of when and
what you can expect will be called in your custom SessionHandler implementation.
Each example is a separate script being run by a client with cookies enabled.
To the left, you can see the function being called in your script, and to the right, you can see the resulting calls being made to a custom session-handler registed using session_set_save_handler().