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 | |
class WebsiteContext{} | |
class WrongSendMail | |
{ | |
public function __construct(private WebsiteContext $website) {} | |
public function send(int $emailId) {} |
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 | |
namespace Email; | |
interface EmailAddress { | |
public function isValid(): bool; | |
public function asString(): string; | |
} | |
class ValidEmailAddress implements EmailAddress { |
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 | |
function connect_while(ApiClient $client): string | |
{ | |
$tries = 0; | |
while(true) { | |
$tries++; | |
try { | |
$result = $client->doThing(); |
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 | |
// OPTION A: | |
class MyController | |
{ | |
//constructor, properties etc | |
/** | |
* @Route("/my/path") | |
*/ |
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 | |
// Entity | |
/** | |
* @ORM\Repository(DoctrinePricesRepository::class) | |
*/ | |
class Price { | |
public function __construct( |
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 | |
/** | |
* @param array<string> $in | |
* | |
* @return array<int> | |
*/ | |
function withIntval(array $in): array | |
{ | |
return array_map('intval', $in); | |
} |
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
interface Foo { | |
foo(): void; | |
} | |
// One | |
type FooBag = { | |
one: Foo, | |
two: Foo, | |
three: Foo | |
}; |
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 | |
namespace App\Controller; | |
use Symfony\Component\HttpFoundation\Response; | |
use Symfony\Component\Security\Core\Security; | |
use Twig\Environment; | |
class AccountPageActionV1 | |
{ |
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
function env(string $param): string | |
{ | |
return sprintf('%env(%s)%', $param); | |
} |
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 TraversalTest extends TestCase | |
{ | |
public function testTraversal(): void | |
{ | |
$parser = new TokenParser(new Lexer()); | |
$ast = $parser->parse('/foo|bar{2,}/i'); | |
$traverser = new Traverser([new RemoveQuantifierVisitor()]); |
NewerOlder