Skip to content

Commit 1df832b

Browse files
committed
Move to ThoroughPHP namespace
1 parent 92cf8dd commit 1df832b

10 files changed

+30
-29
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,8 +1,8 @@
11
language: php
22
sudo: false
33
php:
4-
- 7.1
54
- 7.2
5+
- 7.3
66

77
before_install:
88
- composer self-update

LICENSE

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,4 +1,4 @@
1-
Copyright (c) 2018 Vsevolod Vietluzhskykh
1+
Copyright (c) 2018-2019 Vsevolod Vietluzhskykh
22

33
Permission is hereby granted, free of charge, to any person obtaining a copy
44
of this software and associated documentation files (the "Software"), to deal

README.md

Lines changed: 2 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
# Overloaded Function
22

3-
[![Build Status](https://travis-ci.com/Sevavietl/OverloadedFunction.svg?branch=master)](https://travis-ci.com/Sevavietl/OverloadedFunction)
4-
[![Coverage Status](https://coveralls.io/repos/github/Sevavietl/OverloadedFunction/badge.svg)](https://coveralls.io/github/Sevavietl/OverloadedFunction)
3+
[![Build Status](https://travis-ci.com/ThoroughPHP/OverloadedFunction.svg?branch=master)](https://travis-ci.com/ThoroughPHP/OverloadedFunction)
4+
[![Coverage Status](https://coveralls.io/repos/github/ThoroughPHP/OverloadedFunction/badge.svg)](https://coveralls.io/github/ThoroughPHP/OverloadedFunction)
55
[![License: MIT](https://img.shields.io/badge/License-MIT-yellow.svg)](https://opensource.org/licenses/MIT)
66
[![PHPStan](https://img.shields.io/badge/PHPStan-enabled-brightgreen.svg?style=flat)](https://github.com/phpstan/phpstan)
77

composer.json

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,7 @@
11
{
2-
"name": "sevavietl/overloaded-function",
2+
"name": "thorough-php/overloaded-function",
33
"description": "Function overloading wrapper for php.",
4-
"version": "0.0.1",
4+
"version": "1.0",
55
"type": "library",
66
"keywords": [
77
"php",
@@ -16,8 +16,8 @@
1616
}
1717
],
1818
"require": {
19-
"php": ">=7.1",
20-
"sevavietl/type-guard": "^0.1.1"
19+
"php": ">=7.2",
20+
"thorough-php/type-guard": "^1.0"
2121
},
2222
"require-dev": {
2323
"phpunit/phpunit": "^6.3",
@@ -26,12 +26,12 @@
2626
},
2727
"autoload": {
2828
"psr-4": {
29-
"Sevavietl\\OverloadedFunction\\": "src/"
29+
"ThoroughPHP\\OverloadedFunction\\": "src/"
3030
}
3131
},
3232
"autoload-dev": {
3333
"psr-4": {
34-
"Sevavietl\\OverloadedFunction\\Tests\\Unit\\": "tests/unit/"
34+
"ThoroughPHP\\OverloadedFunction\\Tests\\Unit\\": "tests/unit/"
3535
},
3636
"classmap": [
3737
"tests/TestCase.php"

src/FunctionHasNoCasesException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction;
3+
namespace ThoroughPHP\OverloadedFunction;
44

55
final class FunctionHasNoCasesException extends \DomainException
66
{

src/OverloadedFunction.php

Lines changed: 3 additions & 2 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,8 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction;
3+
namespace ThoroughPHP\OverloadedFunction;
44

5+
use ThoroughPHP\TypeGuard\TypeGuard;
56
use TypeGuard\Guard;
67

78
final class OverloadedFunction
@@ -32,7 +33,7 @@ private function prepareCases(array $cases): \SplObjectStorage
3233
private function prepareFunction(\SplObjectStorage $cases): void
3334
{
3435
$this->func = function (...$args) use ($cases) {
35-
/** @var Guard $signature */
36+
/** @var TypeGuard $signature */
3637
foreach ($cases as $signature) {
3738
if ($signature->match($args)) {
3839
return $cases[$signature](...$args);

src/Signature.php

Lines changed: 6 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -1,12 +1,12 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction;
3+
namespace ThoroughPHP\OverloadedFunction;
44

5-
use TypeGuard\Guard;
5+
use ThoroughPHP\TypeGuard\TypeGuard;
66

77
final class Signature
88
{
9-
/** @var Guard[] */
9+
/** @var TypeGuard[] */
1010
private $guards;
1111

1212
public function __construct(string $stringRepresentation)
@@ -18,15 +18,15 @@ private function parseStringRepresentation(string $stringRepresentation): void
1818
{
1919
$paramTypes = array_filter(array_map('trim', explode(',', $stringRepresentation)));
2020

21-
$this->guards = array_map(function (string $paramType): Guard {
22-
return new Guard($paramType);
21+
$this->guards = array_map(function (string $paramType): TypeGuard {
22+
return new TypeGuard($paramType);
2323
}, $paramTypes);
2424
}
2525

2626
public function match(array $params)
2727
{
2828
return array_reduce(
29-
array_map(function (?Guard $guard, $param): bool {
29+
array_map(function (?TypeGuard $guard, $param): bool {
3030
if (null === $guard) {
3131
return false;
3232
}

src/UnknownSignatureException.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -1,6 +1,6 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction;
3+
namespace ThoroughPHP\OverloadedFunction;
44

55
final class UnknownSignatureException extends \BadFunctionCallException
66
{

tests/unit/OverloadedFunctionTest.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -1,10 +1,10 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction\Tests\Unit;
3+
namespace ThoroughPHP\OverloadedFunction\Tests\Unit;
44

5-
use Sevavietl\OverloadedFunction\OverloadedFunction;
6-
use Sevavietl\OverloadedFunction\FunctionHasNoCasesException;
7-
use Sevavietl\OverloadedFunction\UnknownSignatureException;
5+
use ThoroughPHP\OverloadedFunction\OverloadedFunction;
6+
use ThoroughPHP\OverloadedFunction\FunctionHasNoCasesException;
7+
use ThoroughPHP\OverloadedFunction\UnknownSignatureException;
88

99
final class OverloadedFunctionTest extends \TestCase
1010
{

tests/unit/SignatureTest.php

Lines changed: 5 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,11 +1,11 @@
11
<?php
22

3-
namespace Sevavietl\OverloadedFunction\Tests\Unit;
3+
namespace ThoroughPHP\OverloadedFunction\Tests\Unit;
44

5-
use Sevavietl\OverloadedFunction\Signature;
6-
use Sevavietl\OverloadedFunction\Signature\Types\Type;
7-
use Sevavietl\OverloadedFunction\Signature\Types\ArrayType;
8-
use Sevavietl\OverloadedFunction\Signature\Types\OptionalType;
5+
use ThoroughPHP\OverloadedFunction\Signature;
6+
use ThoroughPHP\OverloadedFunction\Signature\Types\Type;
7+
use ThoroughPHP\OverloadedFunction\Signature\Types\ArrayType;
8+
use ThoroughPHP\OverloadedFunction\Signature\Types\OptionalType;
99

1010
final class SignatureTest extends \TestCase
1111
{

0 commit comments

Comments
 (0)