unset($arr[1]['one'])
$arr[1]['one'] = null;
(NULL, '$val1', '$val2')
$entity->getUlid()->toBase32()
<?php
use From\Somewhere\ExternalHandler;
class MyClass
{
public function _construct(
private readonly ExternalHandler $handler
) {
}
public function testingMethod($arg)
{
$somethingData = $this->handler->doSomething($arg);
if($somethingData === 'something') {
return false;
}
return $somethingData;
}
}
Как обновить фреймворк, если в нем есть несколько пакетов для php старой версии?
composer init --name='gordinskiy/new_package' \
--description='Project description' \
--type='library' \
--author='Dmitriy Gordinskiy' \
--license='MIT' \
--require='php:>=8.2' \
--require='webmozart/assert:^1.11' \
--require-dev='phpunit/phpunit:^10.3' \
--require-dev='vimeo/psalm:^5.11' \
--require-dev='phpstan/phpstan:^1.10'
class PaymentType
{
private const CASH = 1;
private const NON_CASH = 2;
private int $type;
private function __construct(int $type)
{
$this->type = $type;
}
public static function cash(): self
{
return new self(self::CASH);
}
public static function nonCash(): self
{
return new self(self::NON_CASH);
}
public function isCash(): bool
{
return $this->type === self::CASH;
}
public function isNonCash(): bool
{
return $this->type === self::NON_CASH;
}
}