Skip to content

Instantly share code, notes, and snippets.

View Aliance's full-sized avatar
👨‍💻

Lesnykh Ilia Aliance

👨‍💻
View GitHub Profile
@Aliance
Aliance / READONLY.MD
Last active July 18, 2024 13:30
Using readonly modifier in PHP with different class types

Using readonly modifier with different class types

More about PHP readonly modifier

The readonly modifier in PHP is intended for declaring class properties whose values cannot be changed after they are initialized in the constructor.

class UserDTO
{
 public function __construct(
@Aliance
Aliance / pr.md
Created February 22, 2023 16:47 — forked from piscisaureus/pr.md
Checkout github pull requests locally

Locate the section for your github remote in the .git/config file. It looks like this:

[remote "origin"]
	fetch = +refs/heads/*:refs/remotes/origin/*
	url = git@github.com:joyent/node.git

Now add the line fetch = +refs/pull/*/head:refs/remotes/origin/pr/* to this section. Obviously, change the github url to match your project's URL. It ends up looking like this:

@Aliance
Aliance / DTO\ItemListDTO.php
Created May 21, 2020 22:25
Add extra information for the list of objects while serializing via JMS
<?php
declare(strict_types=1);
namespace AppBundle\DTO;
use AppBundle\Entity\Item;
use JMS\Serializer\Annotation as JMS;
/**
@Aliance
Aliance / GITHUB_INTEGRATION.md
Last active March 10, 2020 23:17
GitHub integration with Slack

FYI, 8 простых шагов по настройке оповещений из гитхаба в слак:

@Aliance
Aliance / Collapser.md
Last active December 8, 2017 11:23
Collapser markdown for GitHub
<details>
 <summary>Summary Goes Here</summary>
 ...this is hidden, collapsable content...
</details>
Summary Goes Here ...this is hidden, collapsable content...
@Aliance
Aliance / UnitTestCase.php
Created October 29, 2017 19:34
Automatically unset all properties with PHPUnit.
<?php
use PHPUnit\Framework\TestCase;
/**
* Base class for all unit tests.
*/
abstract class UnitTestCase extends TestCase
{
/**