This file contains hidden or 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 App\Form\DataMapper; | |
use Symfony\Component\Form\DataMapperInterface; | |
use Symfony\Component\Form\Exception\UnexpectedTypeException; | |
use Symfony\Component\Form\FormInterface; |
This file contains hidden or 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 RandomImageSource implements ImageSourceInterface | |
{ | |
/** {@inheritDoc} */ | |
public function __invoke(string $imageId, string $imageFormat): ImageInterface | |
{ | |
return new ImmutableImage($imageId, $imageFormat, static function () use ($imageId): string { | |
$randomImageUrl = \sprintf('https://picsum.photos/seed/%s/1000/1000', \sha1($imageId)); | |
$randomImageData = \file_get_contents($randomImageUrl); |
This file contains hidden or 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 UrlGenerateCommand extends Command | |
{ | |
private readonly RouterInterface $router; | |
public function __construct( | |
RouterInterface $router, | |
) { | |
parent::__construct(); |
This file contains hidden or 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 IndexAction | |
{ | |
private const YEAR = 31536000; | |
public function __construct( | |
private readonly ChecksumValidatorInterface $checksumValidator, | |
private readonly SupportedImagesInterface $supportedFormats, | |
private readonly SizeFactoryInterface $sizeFactory, |
This file contains hidden or 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
ARG USER_UID=82 | |
ARG USER_GID=82 | |
# Recreate www-data user with user id matching the host | |
RUN deluser --remove-home www-data && \ | |
addgroup -S -g ${USER_GID} www-data && \ | |
adduser -u ${USER_UID} -D -S -G www-data www-data |
This file contains hidden or 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 App\User\Notification; | |
use App\Notification\EmailNotificationInterface; | |
use App\Notification\NotificationManagerInterface; | |
use App\Events\PostRegistrationEvent; | |
use App\User\Notification\WelcomeGreetingEmailNotificationFactory; |
This file contains hidden or 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 | |
/** @var LRUCacheInterface<User> $cache */ | |
$cache = new LRUCache(50); | |
foreach ($taskRepository->findAll() as $task) { | |
// get the user from cache | |
// phpStorm will correctly resolve the $user as the User class | |
$user = $cache->get($task->getUserId()); | |
This file contains hidden or 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 App\Cache; | |
/** | |
* @template TCacheItem | |
* @template-implements LRUCacheInterface<TCacheItem> | |
*/ |
This file contains hidden or 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 App\Cache; | |
/** | |
* @template TObject | |
*/ | |
interface LRUCacheInterface |
This file contains hidden or 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 App\User\Notification; | |
use App\Notification\EmailNotificationInterface; | |
use App\Notification\NotificationManagerInterface; | |
use App\Events\PostRegistrationEvent; | |
use App\Events\EventSubscriberInterface; |
NewerOlder