Skip to content
New issue

Have a question about this project? Sign up for a free GitHub account to open an issue and contact its maintainers and the community.

By clicking “Sign up for GitHub”, you agree to our terms of service and privacy statement. We’ll occasionally send you account related emails.

Already on GitHub? Sign in to your account

2.0 #23

Merged
merged 12 commits into from
Sep 19, 2023
Prev Previous commit
Appease Stan
andrewdalpino committed Sep 19, 2023

Unverified

This commit is not signed, but one or more authors requires that any commit attributed to them is signed.
commit 354012b43040f770d6c5c2699c6e92f27ee5939d
11 changes: 7 additions & 4 deletions composer.json
Original file line number Diff line number Diff line change
@@ -37,10 +37,10 @@
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.0",
"phpstan/phpstan": "0.12.*",
"phpstan/phpstan": "^1.0",
"phpstan/extension-installer": "^1.0",
"phpstan/phpstan-phpunit": "0.12.*",
"phpunit/phpunit": "8.5.*"
"phpstan/phpstan-phpunit": "^1.0",
"phpunit/phpunit": "^9.0"
},
"autoload": {
"psr-4": {
@@ -69,7 +69,10 @@
},
"config": {
"preferred-install": "dist",
"sort-packages": true
"sort-packages": true,
"allow-plugins": {
"phpstan/extension-installer": true
}
},
"funding": [
{
1 change: 1 addition & 0 deletions phpstan.neon
Original file line number Diff line number Diff line change
@@ -3,3 +3,4 @@ parameters:
paths:
- 'src'
- 'tests'
checkGenericClassInNonGenericObjectType: false
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/Controller.php
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ abstract class Controller
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
abstract public function routes() : array;
}
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/DashboardController.php
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public function __construct(SSEChannel $channel)
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
public function routes() : array
{
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/GraphQLController.php
Original file line number Diff line number Diff line change
@@ -45,7 +45,7 @@ public function __construct(Schema $schema, PromiseAdapter $adapter)
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
public function routes() : array
{
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/ModelController.php
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public function __construct(Model $model)
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
public function routes() : array
{
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/ServerController.php
Original file line number Diff line number Diff line change
@@ -27,7 +27,7 @@ public function __construct(Server $server)
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
public function routes() : array
{
2 changes: 1 addition & 1 deletion src/HTTP/Controllers/StaticAssetsController.php
Original file line number Diff line number Diff line change
@@ -66,7 +66,7 @@ public function __construct(string $basePath, Cache $cache)
/**
* Return the routes this controller handles.
*
* @return array[]
* @return array<mixed>
*/
public function routes() : array
{
4 changes: 2 additions & 2 deletions src/Helpers/JSON.php
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ class JSON
*
* @param mixed $value
* @param int $options
* @param int $depth
* @param positive-int $depth
* @throws \Rubix\Server\Exceptions\JSONException
* @return string
*/
@@ -56,7 +56,7 @@ public static function encode($value, int $options = self::DEFAULT_OPTIONS, int
*
* @param string $data
* @param int $options
* @param int $depth
* @param positive-int $depth
* @throws \Rubix\Server\Exceptions\JSONException
* @return mixed[]
*/
2 changes: 1 addition & 1 deletion src/Listeners/CloseSSEChannels.php
Original file line number Diff line number Diff line change
@@ -24,7 +24,7 @@ public function __construct(array $channels)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Listeners/CloseSocket.php
Original file line number Diff line number Diff line change
@@ -25,7 +25,7 @@ public function __construct(Socket $socket)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Listeners/DashboardEmitter.php
Original file line number Diff line number Diff line change
@@ -28,7 +28,7 @@ public function __construct(SSEChannel $channel)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener|callable>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Listeners/Listener.php
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ interface Listener
/**
* Return the events that this listener subscribes to and their handlers.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener|callable>>
*/
public function events() : array;
}
2 changes: 1 addition & 1 deletion src/Listeners/LogFailures.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ public function __construct(LoggerInterface $logger)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Listeners/RecordHTTPStats.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ public function __construct(HTTPStats $httpStats)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener|callable>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Listeners/StopTimers.php
Original file line number Diff line number Diff line change
@@ -34,7 +34,7 @@ public function __construct(Scheduler $scheduler, array $timers)
/**
* Return the events that this listener subscribes to.
*
* @return array[]
* @return array<array<\Rubix\Server\Listeners\Listener>>
*/
public function events() : array
{
2 changes: 1 addition & 1 deletion src/Models/Model.php
Original file line number Diff line number Diff line change
@@ -77,7 +77,7 @@ public function predict(Dataset $dataset) : array
*
* @param \Rubix\ML\Datasets\Dataset $dataset
* @throws \Rubix\Server\Exceptions\RuntimeException
* @return array[]
* @return array<array<float>>
*/
public function proba(Dataset $dataset) : array
{
4 changes: 2 additions & 2 deletions src/Services/Routes.php
Original file line number Diff line number Diff line change
@@ -26,7 +26,7 @@ class Routes implements ArrayAccess
/**
* The routes and their controllers.
*
* @var array[]
* @var array<array<\Rubix\Server\HTTP\Controllers\Controller>>
*/
protected array $routes;

@@ -70,7 +70,7 @@ public static function collect(array $controllers) : self
}

/**
* @param array[] $routes
* @param array<array<\Rubix\Server\HTTP\Controllers\Controller>> $routes
* @throws \Rubix\Server\Exceptions\InvalidArgumentException
*/
public function __construct(array $routes)
6 changes: 3 additions & 3 deletions src/Services/Subscriptions.php
Original file line number Diff line number Diff line change
@@ -18,14 +18,14 @@ class Subscriptions implements ArrayAccess
/**
* The mapping of events to their handlers.
*
* @var array[]
* @var array<array<\Rubix\Server\Listeners\Listener|callable>>
*/
protected array $subscriptions;

/**
* Subscribe an array of listeners to their events.
*
* @param \Rubix\Server\Listeners\Listener[] $listeners
* @param array<\Rubix\Server\Listeners\Listener|callable> $listeners
* @throws \InvalidArgumentException
* @return self
*/
@@ -50,7 +50,7 @@ public static function subscribe(array $listeners) : self
}

/**
* @param array[] $subscriptions
* @param array<array<\Rubix\Server\Listeners\Listener|callable>> $subscriptions
* @throws \Rubix\Server\Exceptions\InvalidArgumentException
*/
public function __construct(array $subscriptions)