This "project" is a simple CLI slugger
<?php | |
class TSGen | |
{ | |
public static function fromJSON(string $json, string $interfaceName): string | |
{ | |
try { | |
return self::generateInterface(json_decode($json, true, 512, JSON_THROW_ON_ERROR), $interfaceName); | |
} catch (JsonException $e) { | |
throw new InvalidArgumentException("Error parsing JSON: " . $e->getMessage()); |
I'm kinda proud of this, but it took me way too long to come up with the right solution 😅 I also couldn't find anyone on the internet who wrote something like this, so I'm sharing it in case others find it useful.
This can be used to wrap an $output
in any CLI command, it will intercept all the newlines being printed out and insert the current time at the start of every line.
Easier said than done, because if we just naively insert dates after each newline, then the timestamp of a line would be the time from the previous message, not the current line being printed. So to correct that, we need to keep track of whether the previous write inserted a final newline, and if so prepend a date; and we need to skip adding a date on the last newline of that write.
- removed
EntityChoiceList
- removed
$manager
(2nd) and$class
(3th) arguments ofORMQueryBuilderLoader
- removed passing a query builder closure to
ORMQueryBuilderLoader
- removed
loader
andproperty
options of theDoctrineType
- deprecated interface
Symfony\Component\HttpKernel\Log\LoggerInterface
has been removed
Disclaimer: I assume someone has already suggested this and there are good reasons it hasn't happened!
Inspired by a conversation with @pronskiy after my talk "PHP Generics Today (Almost)" at IPC Munich
Examples:
class Queue #
I had an interesting use-case with a customer for which I provide consulting services: they needed multiple fields to be marked as "optional".
We will take a CRUD-ish example, for the sake of simplicity.
For example, in the following scenario, does a null
$description
mean "remove the description",
<?php | |
namespace Tests\Integration; | |
use Symfony\Bundle\FrameworkBundle\Test\KernelTestCase; | |
use Symfony\Component\Config\FileLocator; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; | |
use Symfony\Component\DependencyInjection\Definition; | |
use Symfony\Component\DependencyInjection\Loader\XmlFileLoader; |
<?php | |
use App\Kernel; | |
require __DIR__.'/vendor/autoload_runtime.php'; | |
use Symfony\Component\Console\Output\StreamOutput; | |
use Symfony\Component\DependencyInjection\Compiler\CompilerPassInterface; | |
use Symfony\Component\DependencyInjection\ContainerBuilder; |
- Version: 0.3
- Last Substantial Updates: 2022-05-04
- Target Version: PHP 8.next
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.
#!/usr/bin/env bash | |
set -eu | |
# A bash script to spin up pimcore demo locally using docker. | |
# The script follows the README instructions for docker. | |
# See: https://github.com/pimcore/demo | |
# Usage: | |
# curl -s https://gist.githubusercontent.com/yariksheptykin/9eaa93910c5ef9360697a507cd01488a/raw/pimcore-demo.sh | bash -s [up|down] <project-name> |