Skip to content

Instantly share code, notes, and snippets.

View mtovmassian's full-sized avatar

Martin Tovmassian mtovmassian

View GitHub Profile
@mtovmassian
mtovmassian / python_deprecation_helper.py
Last active October 17, 2022 09:54
Python deprecation decorator
def deprecated(arg):
if callable(arg):
return deprecated_auto_message(arg)
else:
return deprecated_user_message(arg)
def deprecated_auto_message(func):
def wrapper(*args, **kwargs):
message = "Function {} is deprecated.".format(func.__name__)
warn_deprecation(message, 3)
@mtovmassian
mtovmassian / php-TestUtils.php
Last active October 17, 2022 09:54
Helpers for PHP unit testing
<?php
namespace Tests;
use PHPUnit\Framework\TestCase;
class TestUtils
{
public static function invokePrivateMethod(object $object, string $methodName): callable
{