You can copy the XML below and paste them into your live templates in PHPStorm to start using it :)
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
const plugin = require('tailwindcss/plugin'); | |
let untilBreakpoint = plugin(({ addVariant, config }) => { | |
let screens = config('theme.screens'); | |
for (let screen in screens) { | |
let def = screens[screen]; | |
if (typeof def === 'string') { | |
addVariant(`-${screen}`, `@media (max-width: calc(${def} - 1px))`); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
@servers(['web' => 'user@example.com -p 1234']) | |
@task('deploy', ['on' => 'web']) | |
ls -la | |
@endtask |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
/** | |
* Imagine this is an API call | |
*/ | |
function listPage(int $i): array | |
{ | |
$next = $i >= 9 ? null : $i + 1; | |
return ['cursor' => $next, 'items' => array_fill(0, 5, $i)]; | |
} |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
$ftp = new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Ftp($settings)); | |
$local = new League\Flysystem\Filesystem(new League\Flysystem\Adapter\Local($path)); | |
$local->write($destination, $ftp->read($source)); |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
#set($returnType = ": $TYPE_HINT") | |
## First we check against a blacklist of primitive and other common types used in documentation. | |
#set($nonTypeHintableTypes = ["", "mixed", "number", "void", "object", "real", "double", "resource", "null"]) | |
#foreach($nonTypeHintableType in $nonTypeHintableTypes) | |
#if ($nonTypeHintableType == $TYPE_HINT) | |
#set($returnType = "") | |
#end | |
#end | |
## Make sure the type hint actually looks like a legal php class name(permitting namespaces too) for future proofing reasons. | |
## This is important because PSR-5 is coming soon, and will allow documentation of types with syntax like SplStack<int> |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
declare(strict_types=1); | |
namespace AcmeCompany\Flysystem; | |
use Aws\CommandInterface; | |
use Aws\S3\Exception\S3Exception; | |
use Aws\S3\S3ClientInterface; | |
use Exception; |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
use Aws\S3\S3Client; | |
use League\Flysystem\AwsS3v3\AwsS3Adapter; | |
use League\Flysystem\Filesystem; | |
function get_filesystem() { | |
$client = new S3Client([ | |
'credentials' => [ | |
'key' => getenv('AWS_KET'), |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
interface EventDispatcher | |
{ | |
public function listen(string $event, callable $listener); | |
public function emit(object $event): object; | |
} | |
class ExampleEventDispatcher implements EventDispatcher | |
{ |
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
<?php | |
final class EventDispatcher { | |
private $listeners = []; | |
public function listen(callable $listener) | |
{ | |
$this->listeners[] = $listener; | |
} |
NewerOlder