Skip to content

Commit ddc6350

Browse files
authored
Merge pull request #26 from nazg-hack/feature/patch3.27
Feature/patch3.27
2 parents 876d323 + 06da104 commit ddc6350

Some content is hidden

Large Commits have some content hidden by default. Use the searchbox below for content that may be hidden.

46 files changed

+263
-271
lines changed

.travis.yml

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -4,8 +4,8 @@ services:
44
- docker
55
env:
66
matrix:
7-
- HHVM_VERSION=3.25.3
87
- HHVM_VERSION=3.26.0
8+
- HHVM_VERSION=3.27.0
99
- HHVM_VERSION=latest
1010
install:
1111
- docker pull hhvm/hhvm:$HHVM_VERSION

composer.json

Lines changed: 9 additions & 9 deletions
Original file line numberDiff line numberDiff line change
@@ -21,16 +21,16 @@
2121
],
2222
"require": {
2323
"php": ">=7.0",
24-
"hhvm": ">=3.25.0",
24+
"hhvm": ">=3.26.0",
2525
"ext-asio": "*",
2626
"hhvm/hhvm-autoload": "^1.6",
27-
"hhvm/type-assert": "^3.2.1",
27+
"hhvm/type-assert": "^3.2.2",
2828
"hack-psr/psr7-http-message-hhi": "^1.0.0",
29-
"ytake/hh-container": "^0.5.2",
30-
"ytake/hh-config-aggregator": "^0.1.5",
31-
"nazg/heredity": "^0.3.2",
32-
"nazg/hcache": "^0.1.2",
33-
"facebook/hack-router": "^0.13",
29+
"ytake/hh-container": "^1.0.2",
30+
"ytake/hh-config-aggregator": "^0.1.7",
31+
"nazg/heredity": "^0.3.3",
32+
"nazg/hcache": "^0.1.4",
33+
"facebook/hack-router": "^0.14",
3434
"zendframework/zend-diactoros": "^1.7.0",
3535
"monolog/monolog": "^1.23.0",
3636
"libreworks/psr3-log-hhi": "^1.0.1",
@@ -40,8 +40,8 @@
4040
"require-dev": {
4141
"phpunit/phpunit": "^5.7",
4242
"91carriage/phpunit-hhi": "^5.7",
43-
"facebook/fbexpect": "^0.4.0",
44-
"hhvm/hhast": "^1.0.1"
43+
"facebook/fbexpect": "^2.0.0",
44+
"hhvm/hhast": "^1.0.1|>=3.26.0"
4545
},
4646
"autoload": {
4747
"psr-4": {

hhast-lint.json

Lines changed: 7 additions & 5 deletions
Original file line numberDiff line numberDiff line change
@@ -1,7 +1,9 @@
11
{
2-
"roots": [
3-
"src/",
4-
"tests/"
5-
]
2+
"roots": [
3+
"src/",
4+
"tests/"
5+
],
6+
"namespaceAliases": {
7+
"HHAST": "Facebook\\HHAST\\Linters"
68
}
7-
9+
}

src/Cache/CacheConfiguration.php

Lines changed: 8 additions & 6 deletions
Original file line numberDiff line numberDiff line change
@@ -17,13 +17,15 @@
1717
*/
1818
namespace Nazg\Cache;
1919

20-
use Redis;
21-
use Memcached;
22-
use Nazg\Cache\Resolver\{
20+
use type Redis;
21+
use type Memcached;
22+
use type Nazg\Cache\Resolver\{
2323
MemcachedResolver,
2424
RedisResolver
2525
};
2626

27+
use function is_null;
28+
2729
type MemcachedServer = shape(
2830
'host' => string,
2931
'port' => int,
@@ -57,22 +59,22 @@ public function __construct(
5759
) {}
5860

5961
public function getMemcached(): ?Memcached {
60-
if(!\is_null($this->memcachedConfig)) {
62+
if(!is_null($this->memcachedConfig)) {
6163
$resolver = new MemcachedResolver($this->memcachedConfig);
6264
return $resolver->provide();
6365
}
6466
return null;
6567
}
6668

6769
public function getFileSystemDir(): ?string {
68-
if(!\is_null($this->filesystemConfig)) {
70+
if(!is_null($this->filesystemConfig)) {
6971
return Shapes::idx($this->filesystemConfig, 'cacheStoreDir');
7072
}
7173
return null;
7274
}
7375

7476
public function getRedis(): ?Redis {
75-
if(!\is_null($this->redisConfig)) {
77+
if(!is_null($this->redisConfig)) {
7678
$resolver = new RedisResolver($this->redisConfig);
7779
return $resolver->provide();
7880
}

src/Cache/CacheServiceModule.php

Lines changed: 7 additions & 12 deletions
Original file line numberDiff line numberDiff line change
@@ -17,21 +17,16 @@
1717
*/
1818
namespace Nazg\Cache;
1919

20-
use Memcached;
21-
use Redis;
22-
use Nazg\Cache\CacheConfiguration;
23-
use Nazg\HCache\CacheManager;
24-
use Nazg\HCache\CacheProvider;
25-
use Nazg\HCache\Driver\{
26-
MapCache,
20+
use type Nazg\Cache\CacheConfiguration;
21+
use type Nazg\HCache\CacheManager;
22+
use type Nazg\HCache\CacheProvider;
23+
use type Nazg\HCache\Driver\{
2724
FileSystemCache,
28-
ApcCache,
2925
MemcachedCache,
3026
RedisCache,
31-
VoidCache
3227
};
33-
use Ytake\HHContainer\ServiceModule;
34-
use Ytake\HHContainer\FactoryContainer;
28+
use type Ytake\HHContainer\ServiceModule;
29+
use type Ytake\HHContainer\FactoryContainer;
3530

3631
abstract class CacheServiceModule extends ServiceModule {
3732

@@ -66,7 +61,7 @@ abstract protected function cacheConfigure(
6661
): CacheConfiguration;
6762

6863
protected function detectCacheProvider(
69-
?CacheProvider $provider,
64+
?CacheProvider $provider,
7065
CacheConfiguration $cacheConfigure
7166
): CacheProvider {
7267
invariant($provider instanceof CacheProvider, "provider type error");

src/Cache/Resolver/MemcachedResolver.php

Lines changed: 6 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,13 @@
1717
*/
1818
namespace Nazg\Cache\Resolver;
1919

20-
use Memcached;
21-
use Nazg\Cache\MemcachedConfig;
20+
use type Memcached;
21+
use type Nazg\Cache\MemcachedConfig;
22+
23+
use function is_null;
2224

2325
class MemcachedResolver {
24-
26+
2527
const type T = Memcached;
2628

2729
public function __construct(
@@ -32,7 +34,7 @@ public function provide(): this::T {
3234
$config = $this->config;
3335
$m = new Memcached(Shapes::idx($config, 'persistentId'));
3436
$servers = Shapes::idx($config, 'servers');
35-
if(!\is_null($servers)) {
37+
if(!is_null($servers)) {
3638
$m->addServers($servers->toArray());
3739
}
3840
return $m;

src/Cache/Resolver/RedisResolver.php

Lines changed: 4 additions & 4 deletions
Original file line numberDiff line numberDiff line change
@@ -17,11 +17,11 @@
1717
*/
1818
namespace Nazg\Cache\Resolver;
1919

20-
use Redis;
21-
use Nazg\Cache\RedisConfig;
20+
use type Redis;
21+
use type Nazg\Cache\RedisConfig;
2222

2323
class RedisResolver {
24-
24+
2525
const type T = Redis;
2626

2727
public function __construct(
@@ -50,7 +50,7 @@ public function provide(): this::T {
5050
$this->redisConnectOption($redis, $config);
5151
return $redis;
5252
}
53-
53+
5454
protected function redisConnectOption(Redis $redis, RedisConfig $config): void {
5555
$password = Shapes::idx($config, 'password', null);
5656
if (!\is_null($password)) {

src/Foundation/Application.php

Lines changed: 22 additions & 20 deletions
Original file line numberDiff line numberDiff line change
@@ -17,20 +17,22 @@
1717
*/
1818
namespace Nazg\Foundation;
1919

20-
use Facebook\HackRouter\BaseRouter;
21-
use Nazg\Http\HttpMethod;
22-
use Nazg\Heredity\Heredity;
23-
use Nazg\Heredity\{MiddlewareStack, PsrContainerResolver};
24-
use Nazg\Response\Emitter;
25-
use Nazg\RequestHandler\FallbackHandler;
26-
use Nazg\Foundation\Middleware\Dispatcher;
27-
use Nazg\Foundation\Bootstrap\BootstrapRegister;
28-
use Nazg\Foundation\Dependency\DependencyInterface;
29-
use Psr\Http\Server\RequestHandlerInterface;
30-
use Psr\Http\Server\MiddlewareInterface;
31-
use Psr\Http\Message\ServerRequestInterface;
32-
use Psr\Http\Message\ResponseInterface;
33-
use Psr\Container\ContainerInterface;
20+
use type Facebook\HackRouter\BaseRouter;
21+
use type Nazg\Heredity\Heredity;
22+
use type Nazg\Heredity\{MiddlewareStack, PsrContainerResolver};
23+
use type Nazg\Response\Emitter;
24+
use type Nazg\RequestHandler\FallbackHandler;
25+
use type Nazg\Foundation\Middleware\Dispatcher;
26+
use type Nazg\Foundation\Bootstrap\BootstrapRegister;
27+
use type Nazg\Foundation\Dependency\DependencyInterface;
28+
use type Psr\Http\Server\RequestHandlerInterface;
29+
use type Psr\Http\Message\ServerRequestInterface;
30+
use type Psr\Http\Message\ResponseInterface;
31+
use type Psr\Container\ContainerInterface;
32+
33+
use function get_class;
34+
use function is_array;
35+
use function array_key_exists;
3436

3537
class Application {
3638

@@ -52,7 +54,7 @@ public function run(ServerRequestInterface $serverRequest): void {
5254
invariant(
5355
$router instanceof BaseRouter,
5456
"%s class must extend %s",
55-
\get_class($router),
57+
get_class($router),
5658
BaseRouter::class,
5759
);
5860
list($middleware, $attributes) =
@@ -63,7 +65,7 @@ public function run(ServerRequestInterface $serverRequest): void {
6365
}
6466
}
6567
$heredity = $this->middlewareProcessor(
66-
$middleware['middleware'],
68+
$middleware['middleware'],
6769
$container
6870
);
6971
$this->send(
@@ -127,8 +129,8 @@ protected function middleware(): ImmVector<\Nazg\Types\TMiddlewareClass> {
127129
}
128130

129131
private function registerDependencies(mixed $config): void {
130-
if (\is_array($config)) {
131-
if (\array_key_exists(Service::MODULES, $config)) {
132+
if (is_array($config)) {
133+
if (array_key_exists(Service::MODULES, $config)) {
132134
if ($this->dependency instanceof \Nazg\Foundation\Dependency\Dependency) {
133135
$vModule = $config[Service::MODULES];
134136
if ($vModule instanceof ImmVector) {
@@ -140,8 +142,8 @@ private function registerDependencies(mixed $config): void {
140142
}
141143

142144
private function registerMiddlewares(mixed $config): void {
143-
if (\is_array($config)) {
144-
if (\array_key_exists(Service::MIDDLEWARES, $config)) {
145+
if (is_array($config)) {
146+
if (array_key_exists(Service::MIDDLEWARES, $config)) {
145147
if ($config[Service::MIDDLEWARES] instanceof ImmVector) {
146148
$this->im = $config[Service::MIDDLEWARES];
147149
}

src/Foundation/Bootstrap/BootstrapRegister.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,7 @@
1717
*/
1818
namespace Nazg\Foundation\Bootstrap;
1919

20-
use Psr\Container\ContainerInterface;
20+
use type Psr\Container\ContainerInterface;
2121

2222
type Bootstrap = classname<BootstrapRegisterInterface>;
2323

src/Foundation/Bootstrap/BootstrapRegisterInterface.php

Lines changed: 0 additions & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -17,7 +17,6 @@
1717
*/
1818
namespace Nazg\Foundation\Bootstrap;
1919

20-
use Nazg\Exceptions\ExceptionHandleInterface;
2120

2221
interface BootstrapRegisterInterface {
2322

0 commit comments

Comments
 (0)