1
0
Fork 0
mirror of https://github.com/archtechx/tenancy.git synced 2025-12-12 15:34:03 +00:00

[1.8.0] Use strict types (#115)

* Use strict types

* Apply fixes from StyleCI

* Fix str_repeat

* Fix false json decode
This commit is contained in:
Samuel Štancl 2019-08-23 18:18:26 +02:00 committed by GitHub
parent 1e51dcb508
commit 2fd3662eb7
No known key found for this signature in database
GPG key ID: 4AEE18F83AFDEB23
60 changed files with 123 additions and 2 deletions

View file

@ -1,6 +1,7 @@
preset: laravel
enabled:
- native_function_invocation
- declare_strict_types
disabled:
- concat_without_spaces
- ternary_operator_spaces

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
return [
'storage_driver' => 'Stancl\Tenancy\StorageDrivers\DatabaseStorageDriver',
'storage' => [

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Illuminate\Support\Facades\Schema;
use Illuminate\Database\Schema\Blueprint;
use Illuminate\Database\Migrations\Migration;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Cache\CacheManager as BaseCacheManager;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Stancl\Tenancy\DatabaseManager;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Commands;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Controllers;
use Illuminate\Routing\Controller;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Stancl\Tenancy\Jobs\QueuedTenantDatabaseCreator;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Exceptions;
class CannotChangeUuidOrDomainException extends \Exception

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Exceptions;
class DatabaseManagerNotRegisteredException extends \Exception

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Exceptions;
class PhpRedisNotInstalledException extends \Exception

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Exceptions;
class TenantCouldNotBeIdentifiedException extends \Exception

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Support\Facades\Facade;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Interfaces;
interface StorageDriver

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Interfaces;
interface TenantDatabaseManager

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Interfaces;
interface UniqueIdentifierGenerator

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Jobs;
use Illuminate\Bus\Queueable;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Jobs;
use Illuminate\Bus\Queueable;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Middleware;
use Closure;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\StorageDrivers;
use Stancl\Tenancy\Tenant;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\StorageDrivers;
use Illuminate\Support\Facades\Redis;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Support\Facades\Facade;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Laravel\Telescope\Telescope;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Database\Eloquent\Model;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\TenantDatabaseManagers;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\TenantDatabaseManagers;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\TenantDatabaseManagers;
use Stancl\Tenancy\Interfaces\TenantDatabaseManager;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Stancl\Tenancy\Interfaces\StorageDriver;
@ -383,7 +385,9 @@ final class TenantManager
protected function jsonDecodeArrayValues(array $array)
{
\array_walk($array, function (&$value, $key) {
$value = \json_decode($value, true);
if ($value) {
$value = \json_decode($value, true);
}
});
return $array;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Illuminate\Support\Facades\Route;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Stancl\Tenancy\CacheManager;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
trait DealsWithMigrations

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Symfony\Component\Console\Input\InputOption;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Traits;
use Illuminate\Support\Collection;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy;
use Stancl\Tenancy\Interfaces\UniqueIdentifierGenerator;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
use Stancl\Tenancy\TenantManager;
if (! \function_exists('tenancy')) {

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
Route::get('/tenancy/assets/{path}', 'Stancl\Tenancy\Controllers\TenantAssetsController@asset')
->where('path', '(.*)')
->name('stancl.tenancy.asset');

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\Redis;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
class CacheManagerTest extends TestCase

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Str;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Stancl\Tenancy\DatabaseManager;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Etc;
use Orchestra\Testbench\Console\Kernel;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Etc;
use Illuminate\Console\Command;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Etc;
use Illuminate\Support\Str;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests\Etc;
use Illuminate\Foundation\Http\Kernel;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Tenant;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use GlobalCache;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Bus\Queueable;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
class ReidentificationTest extends TestCase

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
class TenantAssetTest extends TestCase

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Tenant;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\DB;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Route;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Stancl\Tenancy\Tenant;

View file

@ -1,5 +1,7 @@
<?php
declare(strict_types=1);
namespace Stancl\Tenancy\Tests;
use Illuminate\Support\Facades\Redis;
@ -160,7 +162,7 @@ abstract class TestCase extends \Orchestra\Testbench\TestCase
public function randomString(int $length = 10)
{
return \substr(\str_shuffle(\str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', \ceil($length / \strlen($x)))), 1, $length);
return \substr(\str_shuffle(\str_repeat($x = '0123456789abcdefghijklmnopqrstuvwxyzABCDEFGHIJKLMNOPQRSTUVWXYZ', (int) (\ceil($length / \strlen($x))))), 1, $length);
}
public function isContainerized()