diff --git a/src/Config/Configuration.php b/src/Config/Configuration.php index 5027ee2b..bbe707a8 100644 --- a/src/Config/Configuration.php +++ b/src/Config/Configuration.php @@ -85,7 +85,7 @@ private function path($path, callable $callback): void * @return $this * @throws SchemaBuilderException */ - public function set($path, $value): self + public function set($path, $value): Configuration { $this->path($path, function (&$scope, $part) use ($value) { $scope[$part] = $value; @@ -100,7 +100,7 @@ public function set($path, $value): self * @return $this * @throws SchemaBuilderException */ - public function unset($path): self + public function unset($path): Configuration { $this->path($path, function (&$scope, $part) { unset($scope[$part]); @@ -113,7 +113,7 @@ public function unset($path): self * @param array $settings * @return $this */ - public function apply(array $settings): self + public function apply(array $settings): Configuration { $this->settings = Priority::mergeArray($settings, $this->settings); diff --git a/src/Controller.php b/src/Controller.php index 8c352c9a..0683eb5e 100644 --- a/src/Controller.php +++ b/src/Controller.php @@ -245,7 +245,7 @@ public function getMergedCorsConfig(): array return array_merge($defaults, $override); } - public function setCorsConfig(array $config): self + public function setCorsConfig(array $config): Controller { $this->corsConfig = array_merge($this->corsConfig, $config); @@ -326,7 +326,7 @@ protected function getRequestOrigin(HTTPRequest $request): ?string protected function handleOptions(HTTPRequest $request): HTTPResponse { $response = HTTPResponse::create(); - $corsConfig = Config::inst()->get(self::class, 'cors'); + $corsConfig = Config::inst()->get(Controller::class, 'cors'); if ($corsConfig['Enabled']) { // CORS config is enabled and the request is an OPTIONS pre-flight. // Process the CORS config and add appropriate headers. @@ -390,7 +390,7 @@ protected function getRequestUser(HTTPRequest $request): ?Member return $member; } - public function setSchemaKey(string $schemaKey): self + public function setSchemaKey(string $schemaKey): Controller { $this->schemaKey = $schemaKey; return $this; @@ -406,7 +406,7 @@ public function getQueryHandler(): QueryHandlerInterface return $this->queryHandler; } - public function setQueryHandler(QueryHandlerInterface $queryHandler): self + public function setQueryHandler(QueryHandlerInterface $queryHandler): Controller { $this->queryHandler = $queryHandler; return $this; diff --git a/src/Dev/Benchmark.php b/src/Dev/Benchmark.php index ef9271a3..a922954d 100644 --- a/src/Dev/Benchmark.php +++ b/src/Dev/Benchmark.php @@ -16,10 +16,10 @@ class Benchmark public static function start(string $id): void { - if (isset(self::$benchmarks[$id])) { + if (isset(Benchmark::$benchmarks[$id])) { throw new \Exception(sprintf('Benchmark ID %s has already started', $id)); } - self::$benchmarks[$id] = microtime(true); + Benchmark::$benchmarks[$id] = microtime(true); } /** @@ -31,7 +31,7 @@ public static function start(string $id): void */ public static function end(string $id, string $message = null, bool $return = true): ?string { - $benchmark = self::$benchmarks[$id] ?? null; + $benchmark = Benchmark::$benchmarks[$id] ?? null; if (!$benchmark) { throw new \Exception(sprintf('Benchmark ID %s was never started', $id)); } @@ -40,7 +40,7 @@ public static function end(string $id, string $message = null, bool $return = tr $ms = $rounded * 1000; $result = $message ? sprintf($message, $ms) : sprintf('[%s]: %sms', $id, $ms); - unset(self::$benchmarks[$id]); + unset(Benchmark::$benchmarks[$id]); if ($return) { return $result; diff --git a/src/Dev/DevelopmentAdmin.php b/src/Dev/DevelopmentAdmin.php index 14ae689b..d1e29cc0 100644 --- a/src/Dev/DevelopmentAdmin.php +++ b/src/Dev/DevelopmentAdmin.php @@ -62,7 +62,7 @@ public function index(HTTPRequest $request) echo '