Skip to content

Instantly share code, notes, and snippets.

View cspray's full-sized avatar

Charles Sprayberry cspray

View GitHub Profile
@cspray
cspray / class-string-rfc.md
Last active May 31, 2022 00:28
RFC: Introduce a class-string type

RFC: Introduce a class-string type

  • Version: 0.3
  • Last Substantial Updates: 2022-05-04
  • Target Version: PHP 8.next

Introduction

There are many scenarios in which userland code might need to pass parameters to a method or assign a value to a property that is intended to represent a class. Currently the only way to type-hint that a provided value represents a fully-qualified class-name (FQCN) is through userland code. This RFC proposes adding a new internal type that would verify provided values are FQCN.

@cspray
cspray / README.md
Last active August 6, 2022 14:45
Amp Injector Overview

Amp Injector Overview

This document details the high-level technical workings of the amphp/injector project. Specifically, this document has 2 primary goals:

  1. Serve as a basis for more thorough documentation in the amphp/injecto repo proper.
  2. Serve as a technical guide for integrating with cspray/annotated-container.

How it Works

Amphp Injector is split into a set of systems to define and construct your container. Composing these systems together allows you to wire an object graph with the following functionalities:

@cspray
cspray / database-test-case.php
Last active April 5, 2023 19:19
PHPUnit DatabaseTest Example
<?php
use PHPUnit\Framework\TestCase;
class DatabaseTest extends TestCase {
private static $dbConnection;
public static function setUpBeforeClass() : void {