diff --git a/.github/workflows/php.yml b/.github/workflows/php.yml
index d521c32..f2520ef 100644
--- a/.github/workflows/php.yml
+++ b/.github/workflows/php.yml
@@ -17,7 +17,7 @@ jobs:
strategy:
fail-fast: false
matrix:
- php: ['8.1', '8.5']
+ php: ['8.1', '8.2', '8.3', '8.4', '8.5']
steps:
- name: Checkout
uses: actions/checkout@v7
@@ -31,11 +31,11 @@ jobs:
github-token: ${{ secrets.GITHUB_TOKEN }}
coverage: none
- - name: Validate Composer manifest and lock
+ - name: Validate Composer manifest
run: composer validate --no-check-publish --no-interaction
- - name: Install locked dependencies
- run: composer install --prefer-dist --no-interaction --no-progress --no-scripts
+ - name: Resolve and install dependencies
+ run: composer update --prefer-dist --no-interaction --no-progress --no-scripts
- name: Check PHP syntax
run: find . -path './vendor' -prune -o -path './.git' -prune -o -name '*.php' -type f -print0 | xargs -0 -n1 php -l
@@ -48,3 +48,6 @@ jobs:
else
echo 'No test script is declared for this package.'
fi
+
+ - name: Audit dependencies
+ run: composer audit --abandoned=report
diff --git a/CHANGELOG.md b/CHANGELOG.md
index 1da62ac..106627f 100644
--- a/CHANGELOG.md
+++ b/CHANGELOG.md
@@ -5,42 +5,20 @@ All notable changes to this project will be documented in this file.
The format is based on [Keep a Changelog](https://keepachangelog.com/en/1.0.0/),
and this project adheres to [Semantic Versioning](https://semver.org/spec/v2.0.0.html).
-## [1.0.0] - 2025-01-XX - LTS Release
+## [Unreleased]
-### Added
-- Initial LTS release
-- Full documentation
-- Core Engine functionality
-- Container-based dependency injection
-- Configuration management system
-- Request/Response handling
-- Exception handling system
-- Autoload system
-- Bootstrap system
-- Plugin system
-- Context management
+This development version migrates the Engine source to Localzet Server 7.1. It has not been published as a stable release.
### Changed
-- Removed deprecated `#[\AllowDynamicProperties]` from Request and Response classes
-- Improved type safety with strict types
-- Enhanced error handling
+- Requires `localzet/server:^7.1`; the latest published `v8.1.11` package still requires Server 4.
+- Upgrades the logging contract to Monolog 3.
+- Server-owned global `response()`, `json()`, and `redirect()` helpers now keep the Server 7 contract. Use `triangle_response()`, `triangle_json()`, and `triangle_redirect()` for the Engine behavior.
+- Fiber-backed request context is isolated by the active Fiber across Server 7 event loops.
### Fixed
-- Fixed version conflicts in composer.json
-- Improved URI safety checks
-- Enhanced input validation
+- Prevented Composer autoload from redeclaring Server 7 global helpers.
+- Kept Engine JSON responses encoded as strings when Server 7 is loaded first.
+- Removed implicit nullable parameter deprecations reported by PHP 8.5.
### Security
-- Enhanced input validation
-- Improved URI safety checks
-- Better exception handling in production mode
-
----
-
-## [Unreleased]
-
-### Planned
-- Performance optimizations
-- Additional helper functions
-- Enhanced plugin system
-
+- Strip CR and LF from redirect locations created by `triangle_redirect()`.
diff --git a/README.md b/README.md
index a520d9d..724c172 100644
--- a/README.md
+++ b/README.md
@@ -1,21 +1,89 @@
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
-
+# Triangle Engine
+
+Triangle Engine is the HTTP and application runtime layer used by Triangle Framework projects. It provides request and response objects, configuration and execution context, application bootstrap helpers, and adapters around Localzet Server.
+
+This development source requires **PHP 8.1 or newer** and **Localzet Server compatible with `^7.1`**. It is not a standalone web server: the network listener, event loop, protocol handling, and process lifecycle belong to Localzet Server.
+
+## Requirements
+
+- PHP `^8.1`, `ext-intl`, and `ext-json`.
+- `localzet/server:^7.1`.
+- Monolog `^3.0` and PSR Container `^1.0` or `^2.0`.
+- Symfony Cache and Translation `~6.4.0`.
+
+The latest published package is `v8.1.11` and requires `localzet/server:^4`. This development source targets Server 7.1. The two versions are not interchangeable:
+
+| Engine version | Server requirement | Status |
+| --- | --- | --- |
+| `v8.1.11` | `^4` | Published on Packagist |
+| Development source | `^7.1` | Server 7 migration; not yet a compatible stable release |
+
+Do not install the published `v8.1.11` into an application that uses Server 7.1. Inspect the selected packages before upgrading:
+
+```sh
+composer show triangle/engine
+composer show localzet/server
+```
+
+For the current development source, configure the repository and install its development branch only in a development environment:
+
+```sh
+composer config repositories.triangle-engine vcs https://github.com/Triangle-org/Engine
+composer require triangle/engine:dev-main@dev
+```
+
+When the compatible major release is published, use its stable version constraint for production.
+
+## Main components
+
+- `Triangle\Engine\Config` loads and reads application configuration.
+- `Triangle\Engine\Context` stores values for the active Fiber or coroutine; call `Context::destroy()` when a request or task finishes.
+- `Triangle\Engine\Request` and `Triangle\Engine\Response` adapt Localzet Server HTTP messages for Triangle applications.
+- `support\App` assembles configured listeners and processes for a Triangle application.
+- `Triangle\Exception` contains the framework exception types and rendering contracts.
+
+Use the application bootstrap already provided by your Triangle project. Engine does not create a listener or choose a deployment topology on its own.
+
+## Compatibility with Server 7.1
+
+Server 7 defines global `response()`, `json()`, and `redirect()` helpers. Their names overlap with older Engine helpers but their return values and behavior differ. Engine now exposes explicit names for its own behavior:
+
+| Helper | Engine behavior | With Server 7.1 loaded |
+| --- | --- | --- |
+| `triangle_response()` | Engine response envelope and content negotiation | Use this to retain Engine behavior |
+| `triangle_json()` | Encodes a PHP value as a JSON string | Use this when a string is needed |
+| `triangle_redirect()` | Returns `Triangle\Engine\Response` and strips CR/LF from the location | Use this when Engine's response type is required |
+| `responseJson()` / `responseBlob()` | Build an Engine response | Keep using these helpers |
+
+The unprefixed names resolve to Server's helpers when Server is loaded first. This source guards its optional legacy declarations so Composer autoload does not redeclare those functions. Update direct application calls to `response()`, `json()`, or `redirect()` when they relied on Engine-specific semantics.
+
+### Migrating Engine 8 helper calls
+
+| Engine 8 call | Engine 9 replacement | Return contract |
+| --- | --- | --- |
+| `json($data)` | `triangle_json($data)` | JSON string |
+| `response($data, $status)` | `triangle_response($data, $status)` | Engine response envelope and content negotiation |
+| `redirect($url, $status)` | `triangle_redirect($url, $status)` | `Triangle\Engine\Response` |
+
+If the application needs a JSON HTTP response without the Engine envelope, use `responseJson($data, $status)`. Calls without the `triangle_` prefix now follow the Server 7 contract, so update the call site according to whether it needs a string, an Engine response, or a Server response.
+
+The current `Context` implementation keys storage by the active PHP Fiber regardless of the selected event-loop class. This matters when asynchronous handlers interleave on Server 7's standard event loops.
+
+## Tests
+
+Install the development dependencies and run the declared PHPUnit suite:
+
+```sh
+composer install
+composer test
+```
+
+The suite covers configuration, Fiber context isolation, Server 7 helper interoperability, and a real loopback HTTP request through Server 7 using the Engine request and response classes. It does not replace application-level tests for routing, middleware, storage, or deployment behavior.
+
+## Documentation and support
+
+- [Project source](https://github.com/Triangle-org/Engine)
+- [Report a security issue](SECURITY.md)
+- [Contribution guide](CONTRIBUTING.md)
+
+Copyright © 2016-2026 [Localzet Group](https://www.localzet.com/). All rights reserved.
diff --git a/README.ru.md b/README.ru.md
new file mode 100644
index 0000000..c0ed9ad
--- /dev/null
+++ b/README.ru.md
@@ -0,0 +1,89 @@
+# Triangle Engine
+
+Triangle Engine — слой HTTP и запуска приложений, используемый проектами Triangle Framework. Он предоставляет объекты запроса и ответа, конфигурацию и контекст выполнения, средства запуска приложения и адаптеры для Localzet Server.
+
+Эта версия в разработке требует **PHP 8.1 или новее** и **Localzet Server, совместимый с `^7.1`**. Engine не является самостоятельным веб-сервером: сетевой listener, event loop, протоколы и жизненный цикл процессов обеспечивает Localzet Server.
+
+## Требования
+
+- PHP `^8.1`, расширения `ext-intl` и `ext-json`.
+- `localzet/server:^7.1`.
+- Monolog `^3.0` и PSR Container `^1.0` или `^2.0`.
+- Symfony Cache и Translation `~6.4.0`.
+
+Последняя опубликованная версия пакета — `v8.1.11`; она требует `localzet/server:^4`. В этой версии исходников выполняется переход на Server 7.1. Эти версии нельзя считать взаимозаменяемыми:
+
+| Версия Engine | Требование к Server | Статус |
+| --- | --- | --- |
+| `v8.1.11` | `^4` | Опубликована в Packagist |
+| Исходники в разработке | `^7.1` | Переход на Server 7; совместимый стабильный релиз ещё не выпущен |
+
+Не устанавливайте опубликованную `v8.1.11` в приложение на Server 7.1. Перед обновлением проверьте фактически выбранные версии:
+
+```sh
+composer show triangle/engine
+composer show localzet/server
+```
+
+Для проверки текущих исходников настройте репозиторий и подключите ветку разработки только в окружении разработки:
+
+```sh
+composer config repositories.triangle-engine vcs https://github.com/Triangle-org/Engine
+composer require triangle/engine:dev-main@dev
+```
+
+После публикации совместимого основного релиза используйте его стабильное ограничение версии в production.
+
+## Основные компоненты
+
+- `Triangle\Engine\Config` загружает и читает конфигурацию приложения.
+- `Triangle\Engine\Context` хранит значения для активного Fiber или coroutine; вызывайте `Context::destroy()` при завершении запроса или задачи.
+- `Triangle\Engine\Request` и `Triangle\Engine\Response` адаптируют HTTP-сообщения Localzet Server для приложений Triangle.
+- `support\App` собирает настроенные listeners и процессы приложения Triangle.
+- `Triangle\Exception` содержит типы исключений и контракты их отображения.
+
+Используйте bootstrap, который предоставляет ваш проект Triangle. Engine сам не создаёт listener и не выбирает схему развёртывания.
+
+## Совместимость с Server 7.1
+
+Server 7 определяет глобальные функции `response()`, `json()` и `redirect()`. Их имена пересекаются с прежними помощниками Engine, но значения и поведение отличаются. Для прежней семантики Engine доступны отдельные имена:
+
+| Функция | Поведение Engine | При загрузке Server 7.1 |
+| --- | --- | --- |
+| `triangle_response()` | Обёртка ответа Engine и выбор JSON/HTML | Используйте для сохранения поведения Engine |
+| `triangle_json()` | Кодирует значение PHP в строку JSON | Используйте, когда нужна именно строка |
+| `triangle_redirect()` | Возвращает `Triangle\Engine\Response` и удаляет CR/LF из адреса | Используйте, когда нужен тип ответа Engine |
+| `responseJson()` / `responseBlob()` | Создают ответ Engine | Можно продолжать использовать |
+
+Если Server загружен первым, непомеченные префиксом функции относятся к Server. Исходники Engine защищают необязательные старые объявления от повторного определения при автозагрузке Composer. Если приложение рассчитывало на особенности `response()`, `json()` или `redirect()` из Engine, замените такие вызовы на соответствующие функции с префиксом `triangle_`.
+
+### Переход с функций Engine 8
+
+| Вызов в Engine 8 | Замена в Engine 9 | Тип результата |
+| --- | --- | --- |
+| `json($data)` | `triangle_json($data)` | Строка JSON |
+| `response($data, $status)` | `triangle_response($data, $status)` | Обёртка ответа Engine и выбор JSON/HTML |
+| `redirect($url, $status)` | `triangle_redirect($url, $status)` | `Triangle\Engine\Response` |
+
+Если нужен JSON HTTP-ответ без обёртки Engine, используйте `responseJson($data, $status)`. Вызовы без префикса `triangle_` теперь следуют контракту Server 7. При обновлении выберите функцию по требуемому результату: строка JSON, ответ Engine или ответ Server.
+
+Текущий `Context` выбирает ключ хранения по активному PHP Fiber независимо от выбранного event loop. Это важно, когда асинхронные обработчики Server 7 чередуются в стандартных циклах событий.
+
+## Тесты
+
+Установите зависимости для разработки и запустите объявленный набор PHPUnit:
+
+```sh
+composer install
+composer test
+```
+
+Набор проверяет конфигурацию, изоляцию контекста Fiber, взаимодействие с помощниками Server 7 и реальный HTTP-запрос через loopback-сокет с классами запроса и ответа Engine. Он не заменяет тесты приложения для маршрутизации, middleware, хранилищ и поведения при развёртывании.
+
+## Документация и поддержка
+
+- [Исходный код проекта](https://github.com/Triangle-org/Engine)
+- [Сообщить об уязвимости](SECURITY.md)
+- [Правила участия](CONTRIBUTING.md)
+
+Copyright © 2016-2026 [Localzet Group](https://www.localzet.com/). All rights reserved.
diff --git a/composer.json b/composer.json
index cf745cc..bf9b1a0 100644
--- a/composer.json
+++ b/composer.json
@@ -34,8 +34,8 @@
"php": "^8.1",
"ext-intl": "*",
"ext-json": "*",
- "localzet/server": "^4",
- "monolog/monolog": "^2.0",
+ "localzet/server": "^7.1",
+ "monolog/monolog": "^3.0",
"psr/container": "^1.0|^2.0",
"symfony/translation": "~6.4.0",
"symfony/cache": "~6.4.0"
diff --git a/rector.php b/rector.php
index cdda79e..67229e4 100644
--- a/rector.php
+++ b/rector.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -28,27 +28,18 @@
use Rector\CodeQuality\Rector\ClassMethod\LocallyCalledStaticMethodToNonStaticRector;
use Rector\CodeQuality\Rector\Empty_\SimplifyEmptyCheckOnEmptyArrayRector;
-use Rector\CodeQuality\Rector\If_\ExplicitBoolCompareRector;
-use Rector\CodeQuality\Rector\If_\SimplifyIfElseToTernaryRector;
use Rector\CodingStyle\Rector\Assign\SplitDoubleAssignRector;
-use Rector\CodingStyle\Rector\Encapsed\EncapsedStringsToSprintfRector;
-use Rector\CodingStyle\Rector\Encapsed\WrapEncapsedVariableInCurlyBracesRector;
use Rector\Config\RectorConfig;
use Rector\DeadCode\Rector\Property\RemoveUnusedPrivatePropertyRector;
use Rector\DeadCode\Rector\PropertyProperty\RemoveNullPropertyInitializationRector;
-use Rector\Set\ValueObject\LevelSetList;
use Rector\Set\ValueObject\SetList;
-use Rector\Strict\Rector\Empty_\DisallowedEmptyRuleFixerRector;
return RectorConfig::configure()
->withPaths([
__DIR__ . '/src',
])
- ->withPhpSets(php84: true)
+ ->withPhpSets()
->withSets([
- LevelSetList::UP_TO_PHP_84,
- SetList::PHP_84,
-
SetList::CODE_QUALITY,
SetList::CODING_STYLE,
SetList::DEAD_CODE,
@@ -64,12 +55,7 @@
->withSkip([
RemoveNullPropertyInitializationRector::class,
RemoveUnusedPrivatePropertyRector::class,
- SimplifyIfElseToTernaryRector::class,
- ExplicitBoolCompareRector::class,
SimplifyEmptyCheckOnEmptyArrayRector::class,
- DisallowedEmptyRuleFixerRector::class,
LocallyCalledStaticMethodToNonStaticRector::class,
- EncapsedStringsToSprintfRector::class,
- WrapEncapsedVariableInCurlyBracesRector::class,
SplitDoubleAssignRector::class,
]);
diff --git a/src/Annotation/DisableDefaultRoute.php b/src/Annotation/DisableDefaultRoute.php
index e96d492..2fc595f 100644
--- a/src/Annotation/DisableDefaultRoute.php
+++ b/src/Annotation/DisableDefaultRoute.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Annotation/Middleware.php b/src/Annotation/Middleware.php
index 6c86d52..23b0893 100644
--- a/src/Annotation/Middleware.php
+++ b/src/Annotation/Middleware.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/App.php b/src/App.php
index c3a889a..0bb51bb 100644
--- a/src/App.php
+++ b/src/App.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Autoload.php b/src/Autoload.php
index fe365ec..ac73548 100644
--- a/src/Autoload.php
+++ b/src/Autoload.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/AutoloadInterface.php b/src/AutoloadInterface.php
index 7e27587..91b95db 100644
--- a/src/AutoloadInterface.php
+++ b/src/AutoloadInterface.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Bootstrap.php b/src/Bootstrap.php
index db34d20..2565992 100644
--- a/src/Bootstrap.php
+++ b/src/Bootstrap.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/BootstrapInterface.php b/src/BootstrapInterface.php
index 986efab..8257cf7 100644
--- a/src/BootstrapInterface.php
+++ b/src/BootstrapInterface.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Config.php b/src/Config.php
index c0670a5..58b101c 100644
--- a/src/Config.php
+++ b/src/Config.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -77,7 +77,7 @@ public static function reloadAll(array $excludes = []): void
* Загрузи
* @param string|null $key
*/
- public static function load(string $configPath, array $excludeFile = [], string $key = null): void
+ public static function load(string $configPath, array $excludeFile = [], ?string $key = null): void
{
if (!$configPath) {
return;
@@ -222,7 +222,7 @@ public static function clear(): void
* @param mixed|null $default
* @return array|mixed|void|null
*/
- public static function get(string $key = null, mixed $default = null)
+ public static function get(?string $key = null, mixed $default = null)
{
if ($key === null) {
return static::$config;
diff --git a/src/Container.php b/src/Container.php
index e3ed3e4..73b694c 100644
--- a/src/Container.php
+++ b/src/Container.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Context.php b/src/Context.php
index 261668c..a6983b3 100644
--- a/src/Context.php
+++ b/src/Context.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -29,7 +29,6 @@
use Fiber;
use localzet\Server;
-use localzet\Server\Events\Linux;
use localzet\Server\Events\Swoole;
use localzet\Server\Events\Swow;
use StdClass;
@@ -83,8 +82,11 @@ protected static function getObject(): StdClass|null
*/
protected static function getKey(): object
{
+ if (($fiber = Fiber::getCurrent()) instanceof Fiber) {
+ return $fiber;
+ }
+
return match (Server::$eventLoopClass) {
- Linux::class => Fiber::getCurrent(),
Swoole::class => \Swoole\Coroutine::getContext(),
Swow::class => \Swow\Coroutine::getCurrent(),
default => static::$object,
diff --git a/src/Environment.php b/src/Environment.php
index 6602a66..925012d 100644
--- a/src/Environment.php
+++ b/src/Environment.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/AuthorizationDeniedException.php b/src/Exception/AuthorizationDeniedException.php
index cebcec5..31556ba 100644
--- a/src/Exception/AuthorizationDeniedException.php
+++ b/src/Exception/AuthorizationDeniedException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/BusinessException.php b/src/Exception/BusinessException.php
index 5a55f24..7cc73c1 100644
--- a/src/Exception/BusinessException.php
+++ b/src/Exception/BusinessException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/ExceptionHandler.php b/src/Exception/ExceptionHandler.php
index 7ef3a98..278967d 100644
--- a/src/Exception/ExceptionHandler.php
+++ b/src/Exception/ExceptionHandler.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/ExceptionHandlerInterface.php b/src/Exception/ExceptionHandlerInterface.php
index 01ea08c..1c3d542 100644
--- a/src/Exception/ExceptionHandlerInterface.php
+++ b/src/Exception/ExceptionHandlerInterface.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/ExceptionInterface.php b/src/Exception/ExceptionInterface.php
index fc2a055..51dc0a8 100644
--- a/src/Exception/ExceptionInterface.php
+++ b/src/Exception/ExceptionInterface.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/FileException.php b/src/Exception/FileException.php
index 345e13d..ddb94cf 100644
--- a/src/Exception/FileException.php
+++ b/src/Exception/FileException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/HttpClientFailureException.php b/src/Exception/HttpClientFailureException.php
index 47b91b4..fcc5f0d 100644
--- a/src/Exception/HttpClientFailureException.php
+++ b/src/Exception/HttpClientFailureException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/HttpRequestFailedException.php b/src/Exception/HttpRequestFailedException.php
index afe9e3d..f67c9cb 100644
--- a/src/Exception/HttpRequestFailedException.php
+++ b/src/Exception/HttpRequestFailedException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InputTypeException.php b/src/Exception/InputTypeException.php
index 47d34db..b03215c 100644
--- a/src/Exception/InputTypeException.php
+++ b/src/Exception/InputTypeException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InputValueException.php b/src/Exception/InputValueException.php
index 3371c92..5e6f40e 100644
--- a/src/Exception/InputValueException.php
+++ b/src/Exception/InputValueException.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidAccessException.php b/src/Exception/InvalidAccessException.php
index e449ee0..d0b77b5 100644
--- a/src/Exception/InvalidAccessException.php
+++ b/src/Exception/InvalidAccessException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidAccessTokenException.php b/src/Exception/InvalidAccessTokenException.php
index 799fdb2..fc140cd 100644
--- a/src/Exception/InvalidAccessTokenException.php
+++ b/src/Exception/InvalidAccessTokenException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidAuthorizationCodeException.php b/src/Exception/InvalidAuthorizationCodeException.php
index 11126f9..acc760f 100644
--- a/src/Exception/InvalidAuthorizationCodeException.php
+++ b/src/Exception/InvalidAuthorizationCodeException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidAuthorizationException.php b/src/Exception/InvalidAuthorizationException.php
index 73209b6..e68df92 100644
--- a/src/Exception/InvalidAuthorizationException.php
+++ b/src/Exception/InvalidAuthorizationException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidAuthorizationStateException.php b/src/Exception/InvalidAuthorizationStateException.php
index 1d62221..d6f1ff9 100644
--- a/src/Exception/InvalidAuthorizationStateException.php
+++ b/src/Exception/InvalidAuthorizationStateException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidInputException.php b/src/Exception/InvalidInputException.php
index 9f87a40..26d773d 100644
--- a/src/Exception/InvalidInputException.php
+++ b/src/Exception/InvalidInputException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidOauthTokenException.php b/src/Exception/InvalidOauthTokenException.php
index 0ba42d2..6c2afa3 100644
--- a/src/Exception/InvalidOauthTokenException.php
+++ b/src/Exception/InvalidOauthTokenException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/InvalidTokenException.php b/src/Exception/InvalidTokenException.php
index 1a21747..f3c4020 100644
--- a/src/Exception/InvalidTokenException.php
+++ b/src/Exception/InvalidTokenException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/MissingInputException.php b/src/Exception/MissingInputException.php
index 4a58a63..ea219ac 100644
--- a/src/Exception/MissingInputException.php
+++ b/src/Exception/MissingInputException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/NotFoundException.php b/src/Exception/NotFoundException.php
index c2fbe66..23a1081 100644
--- a/src/Exception/NotFoundException.php
+++ b/src/Exception/NotFoundException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/NotImplementedException.php b/src/Exception/NotImplementedException.php
index ddb01b1..0784ba8 100644
--- a/src/Exception/NotImplementedException.php
+++ b/src/Exception/NotImplementedException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/PageNotFoundException.php b/src/Exception/PageNotFoundException.php
index 6ca73e8..202a078 100644
--- a/src/Exception/PageNotFoundException.php
+++ b/src/Exception/PageNotFoundException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Exception/UnexpectedApiResponseException.php b/src/Exception/UnexpectedApiResponseException.php
index 0b382de..7034a5d 100644
--- a/src/Exception/UnexpectedApiResponseException.php
+++ b/src/Exception/UnexpectedApiResponseException.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/File.php b/src/File.php
index 4fd4fb9..01d04a5 100644
--- a/src/File.php
+++ b/src/File.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Install.php b/src/Install.php
index fb91155..bd57b78 100644
--- a/src/Install.php
+++ b/src/Install.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Install/master b/src/Install/master
index 81d5136..7034355 100644
--- a/src/Install/master
+++ b/src/Install/master
@@ -7,7 +7,7 @@
* @link https://github.com/Triangle-org/Engine Triangle Engine v2+
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2018-2024 Localzet Group
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl AGPL-3.0 license
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/InstallInterface.php b/src/InstallInterface.php
index 8abfa09..673c4cb 100644
--- a/src/InstallInterface.php
+++ b/src/InstallInterface.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Log/MongoDBHandler.php b/src/Log/MongoDBHandler.php
index ebcdf31..49b5702 100644
--- a/src/Log/MongoDBHandler.php
+++ b/src/Log/MongoDBHandler.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -36,6 +36,7 @@
use Monolog\Formatter\MongoDBFormatter;
use Monolog\Handler\AbstractProcessingHandler;
use Monolog\Logger;
+use Monolog\LogRecord;
/**
* Класс MongoDBHandler
@@ -96,17 +97,17 @@ public function __construct($mongodb, string $database, string $collection, int
/**
* Записать лог.
*
- * @param array $record Запись лога.
+ * @param LogRecord $record Запись лога.
*/
- protected function write(array $record): void
+ protected function write(LogRecord $record): void
{
if (isset($this->collection)) {
- $this->collection->insertOne($record['formatted']);
+ $this->collection->insertOne($record->formatted);
}
if (isset($this->manager, $this->namespace)) {
$bulkWrite = new BulkWrite;
- $bulkWrite->insert($record["formatted"]);
+ $bulkWrite->insert($record->formatted);
$this->manager->executeBulkWrite($this->namespace, $bulkWrite);
}
}
diff --git a/src/Path.php b/src/Path.php
index 9f1e742..f8c56ea 100644
--- a/src/Path.php
+++ b/src/Path.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -49,11 +49,11 @@ class Path
* @param string|null $runtimePath
*/
public function __construct(
- string $basePath = null,
- string $configPath = null,
- string $appPath = null,
- string $publicPath = null,
- string $runtimePath = null,
+ ?string $basePath = null,
+ ?string $configPath = null,
+ ?string $appPath = null,
+ ?string $publicPath = null,
+ ?string $runtimePath = null,
)
{
static::$basePath = $basePath ?? Path::basePath();
@@ -116,4 +116,4 @@ public static function runtimePath(string $path = ''): ?string
static::$runtimePath ??= static::runPath('runtime');
return path_combine(static::$runtimePath, $path);
}
-}
\ No newline at end of file
+}
diff --git a/src/Plugin.php b/src/Plugin.php
index 5c8b858..d05250c 100644
--- a/src/Plugin.php
+++ b/src/Plugin.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Request.php b/src/Request.php
index 86fa209..4a9feb5 100644
--- a/src/Request.php
+++ b/src/Request.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Response.php b/src/Response.php
index a7c6cee..56d09e9 100644
--- a/src/Response.php
+++ b/src/Response.php
@@ -5,7 +5,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -66,7 +66,7 @@ public function __construct(
*
* @param Throwable|null $throwable Исключение для установки.
*/
- public function exception(Throwable $throwable = null): ?Throwable
+ public function exception(?Throwable $throwable = null): ?Throwable
{
if ($throwable instanceof Throwable) {
$this->exception = $throwable;
diff --git a/src/Services/Monitor.php b/src/Services/Monitor.php
index e7454f6..f6bff72 100644
--- a/src/Services/Monitor.php
+++ b/src/Services/Monitor.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/App.php b/src/Support/App.php
index 63e8f33..5ecc5bb 100644
--- a/src/Support/App.php
+++ b/src/Support/App.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Cache.php b/src/Support/Cache.php
index 216eab8..027c11d 100644
--- a/src/Support/Cache.php
+++ b/src/Support/Cache.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Collection.php b/src/Support/Collection.php
index 61608a2..073a4c4 100644
--- a/src/Support/Collection.php
+++ b/src/Support/Collection.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Container.php b/src/Support/Container.php
index 5fc5b25..230abbf 100644
--- a/src/Support/Container.php
+++ b/src/Support/Container.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Log.php b/src/Support/Log.php
index 025266c..62db2a8 100644
--- a/src/Support/Log.php
+++ b/src/Support/Log.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Redis.php b/src/Support/Redis.php
index 64e1cf0..35a3dd1 100644
--- a/src/Support/Redis.php
+++ b/src/Support/Redis.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/Support/Translation.php b/src/Support/Translation.php
index 876611d..317d14a 100644
--- a/src/Support/Translation.php
+++ b/src/Support/Translation.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
diff --git a/src/functions.php b/src/functions.php
index e22a28a..7e89348 100644
--- a/src/functions.php
+++ b/src/functions.php
@@ -6,7 +6,7 @@
* @link https://github.com/localzet-archive/FrameX-Public FrameX (v1-2)
*
* @author Ivan Zorin
- * @copyright Copyright (c) 2023-2025 Triangle Framework Team
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
* @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
*
* This program is free software: you can redistribute it and/or modify
@@ -31,8 +31,8 @@
use Triangle\Engine\Config;
use Triangle\Engine\Environment;
use Triangle\Engine\Path;
-use Triangle\Request;
-use Triangle\Response;
+use Triangle\Engine\Request;
+use Triangle\Engine\Response;
$install_path = Composer\InstalledVersions::getRootPackage()['install_path'] ?? null;
define('BASE_PATH', str_starts_with($install_path, 'phar://') ? $install_path : realpath($install_path) ?? dirname(__DIR__));
@@ -46,7 +46,7 @@
* @param string|null $domain
* @param string|null $locale
*/
- function trans(string $id, array $parameters = [], string $domain = null, string $locale = null): string
+ function trans(string $id, array $parameters = [], ?string $domain = null, ?string $locale = null): string
{
$res = Translation::trans($id, $parameters, $domain, $locale);
return $res === '' ? $id : $res;
@@ -58,7 +58,7 @@ function trans(string $id, array $parameters = [], string $domain = null, string
* Locale
* @param string|null $locale
*/
- function locale(string $locale = null): string
+ function locale(?string $locale = null): string
{
if (!$locale) {
return Translation::getLocale();
@@ -71,6 +71,18 @@ function locale(string $locale = null): string
/** FORMATS HELPERS */
+if (!function_exists('triangle_json')) {
+ /**
+ * Encode JSON using the Triangle Engine helper defaults.
+ *
+ * @param mixed $value
+ */
+ function triangle_json($value, int $flags = JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR): false|string
+ {
+ return json_encode($value, $flags);
+ }
+}
+
if (!function_exists('json')) {
/**
* @param $value
@@ -78,7 +90,7 @@ function locale(string $locale = null): string
*/
function json($value, int $flags = JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR): false|string
{
- return json_encode($value, $flags);
+ return triangle_json($value, $flags);
}
}
@@ -90,7 +102,7 @@ function json($value, int $flags = JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON
* @param string|null $key
* @param mixed|null $default
*/
- function config(string $key = null, mixed $default = null, ?string $plugin = null): mixed
+ function config(?string $key = null, mixed $default = null, ?string $plugin = null): mixed
{
return empty($plugin)
? Config::get($key, $default)
@@ -103,7 +115,7 @@ function config(string $key = null, mixed $default = null, ?string $plugin = nul
* @param string|null $key
* * @param mixed|null $default
*/
- function plugin(string $key = null, mixed $default = null): mixed
+ function plugin(?string $key = null, mixed $default = null): mixed
{
return Config::get(
Config::get('app.plugin_alias', 'plugin') . ($key ? ".$key" : ''),
@@ -116,7 +128,7 @@ function plugin(string $key = null, mixed $default = null): mixed
* @param string|null $key
* @param mixed|null $default
*/
- function env(string $key = null, mixed $default = null): mixed
+ function env(?string $key = null, mixed $default = null): mixed
{
return Environment::get($key, $default);
}
@@ -312,11 +324,11 @@ function server(): ?Server
}
}
-if (!function_exists('response')) {
+if (!function_exists('triangle_response')) {
/**
* @throws Throwable
*/
- function response(mixed $data = '', int $status = 200, array $headers = [], bool $raw = false): Response
+ function triangle_response(mixed $data = '', int $status = 200, array $headers = [], bool $raw = false): Response
{
if ($raw) {
$body = $data;
@@ -337,6 +349,16 @@ function response(mixed $data = '', int $status = 200, array $headers = [], bool
}
}
+if (!function_exists('response')) {
+ /**
+ * @throws Throwable
+ */
+ function response(mixed $data = '', int $status = 200, array $headers = [], bool $raw = false): Response
+ {
+ return triangle_response($data, $status, $headers, $raw);
+ }
+}
+
function responseBlob(string $blob, string $type = 'text/plain'): Response
{
@@ -348,17 +370,26 @@ function responseBlob(string $blob, string $type = 'text/plain'): Response
*/
function responseJson($data, int $status = 200, array $headers = [], int $options = JSON_NUMERIC_CHECK | JSON_PRETTY_PRINT | JSON_UNESCAPED_SLASHES | JSON_UNESCAPED_UNICODE | JSON_THROW_ON_ERROR): Response
{
- return new Response($status, ['Content-Type' => 'application/json'] + $headers, json($data, $options));
+ return new Response($status, ['Content-Type' => 'application/json'] + $headers, triangle_json($data, $options));
}
-function redirect(string $location, int $status = 302, array $headers = []): Response
-{
- $response = new Response($status, ['Location' => $location]);
- if (!empty($headers)) {
- $response->withHeaders($headers);
+if (!function_exists('triangle_redirect')) {
+ function triangle_redirect(string $location, int $status = 302, array $headers = []): Response
+ {
+ $response = new Response($status, ['Location' => str_replace(["\r", "\n"], '', $location)]);
+ if (!empty($headers)) {
+ $response->withHeaders($headers);
+ }
+
+ return $response;
}
+}
- return $response;
+if (!function_exists('redirect')) {
+ function redirect(string $location, int $status = 302, array $headers = []): Response
+ {
+ return triangle_redirect($location, $status, $headers);
+ }
}
if (!function_exists('not_found')) {
@@ -367,7 +398,7 @@ function redirect(string $location, int $status = 302, array $headers = []): Res
*/
function not_found(): Response
{
- return response('Ничего не найдено', 404);
+ return triangle_response('Ничего не найдено', 404);
}
}
@@ -383,4 +414,4 @@ function jsonp($data, string $callbackName = 'callback'): Response
return new Response(200, [], "$callbackName($data)");
}
-}
\ No newline at end of file
+}
diff --git a/tests/Integration/Server7HttpIntegrationTest.php b/tests/Integration/Server7HttpIntegrationTest.php
new file mode 100644
index 0000000..8e7a5b0
--- /dev/null
+++ b/tests/Integration/Server7HttpIntegrationTest.php
@@ -0,0 +1,182 @@
+
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+namespace Tests\Integration;
+
+use PHPUnit\Framework\TestCase;
+use RuntimeException;
+
+class Server7HttpIntegrationTest extends TestCase
+{
+ public function testServer7HttpRequestUsesEngineRequestContextAndResponse(): void
+ {
+ if (PHP_OS_FAMILY === 'Windows'
+ || !function_exists('proc_open')
+ || !function_exists('posix_kill')
+ || !function_exists('posix_setpgid')) {
+ self::markTestSkipped('The HTTP integration fixture requires a Unix process supervisor.');
+ }
+
+ $runtimeDirectory = sys_get_temp_dir() . '/triangle-engine-http-' . bin2hex(random_bytes(8));
+ self::assertTrue(mkdir($runtimeDirectory, 0700));
+
+ $process = null;
+
+ try {
+ $port = $this->reservePort();
+ $logFile = $runtimeDirectory . '/server.log';
+ $descriptors = [
+ 0 => ['pipe', 'r'],
+ 1 => ['file', $logFile, 'a'],
+ 2 => ['file', $logFile, 'a'],
+ ];
+
+ $process = proc_open(
+ [PHP_BINARY, __DIR__ . '/../fixtures/server7_http.php', 'start', (string)$port, $runtimeDirectory],
+ $descriptors,
+ $pipes,
+ dirname(__DIR__, 2),
+ );
+
+ self::assertIsResource($process);
+ if (isset($pipes[0]) && is_resource($pipes[0])) {
+ fclose($pipes[0]);
+ }
+
+ $this->waitForServer($port, $process, $logFile);
+
+ $socket = stream_socket_client("tcp://127.0.0.1:$port", $errorCode, $errorMessage, 2);
+ self::assertIsResource($socket, "Could not connect to Server 7: $errorMessage ($errorCode)");
+ stream_set_timeout($socket, 3);
+ fwrite($socket, "GET /?request_id=engine-http HTTP/1.1\r\nHost: localhost\r\nConnection: close\r\n\r\n");
+ $response = stream_get_contents($socket);
+ fclose($socket);
+
+ self::assertIsString($response);
+ self::assertStringStartsWith('HTTP/1.1 200', $response);
+ self::assertStringContainsString("\r\n\r\n", $response);
+
+ [, $body] = explode("\r\n\r\n", $response, 2);
+ self::assertSame(
+ ['request_id' => 'engine-http'],
+ json_decode($body, true, 512, JSON_THROW_ON_ERROR),
+ );
+ } finally {
+ if (is_resource($process)) {
+ $this->stopServer($process, $runtimeDirectory);
+ }
+ $this->removeRuntimeDirectory($runtimeDirectory);
+ }
+ }
+
+ private function reservePort(): int
+ {
+ $socket = stream_socket_server('tcp://127.0.0.1:0', $errorCode, $errorMessage);
+ if (!is_resource($socket)) {
+ throw new RuntimeException("Could not reserve an integration port: $errorMessage ($errorCode)");
+ }
+
+ $address = stream_socket_get_name($socket, false);
+ fclose($socket);
+
+ return (int)substr(strrchr((string)$address, ':'), 1);
+ }
+
+ /** @param resource $process */
+ private function waitForServer(int $port, $process, string $logFile): void
+ {
+ $deadline = microtime(true) + 5;
+ do {
+ $socket = @stream_socket_client("tcp://127.0.0.1:$port", $errorCode, $errorMessage, 0.05);
+ if (is_resource($socket)) {
+ fclose($socket);
+ return;
+ }
+
+ $status = proc_get_status($process);
+ if (!$status['running']) {
+ throw new RuntimeException('Server 7 exited during startup: ' . $this->readLog($logFile));
+ }
+
+ usleep(50_000);
+ } while (microtime(true) < $deadline);
+
+ throw new RuntimeException('Server 7 did not open its HTTP listener: ' . $this->readLog($logFile));
+ }
+
+ /** @param resource $process */
+ private function stopServer($process, string $runtimeDirectory): void
+ {
+ $status = proc_get_status($process);
+ $masterPid = (int)$status['pid'];
+ if ($status['running']) {
+ proc_terminate($process, SIGTERM);
+
+ $deadline = microtime(true) + 5;
+ do {
+ usleep(50_000);
+ $status = proc_get_status($process);
+ } while ($status['running'] && microtime(true) < $deadline);
+ }
+
+ $processGroup = (int)@file_get_contents($runtimeDirectory . '/process-group');
+ $hasWorkers = $this->hasRunningWorker($runtimeDirectory, $masterPid);
+ if ($processGroup === $masterPid && ($status['running'] || $hasWorkers)) {
+ @posix_kill(-$processGroup, SIGKILL);
+ } elseif ($status['running']) {
+ proc_terminate($process, SIGKILL);
+ }
+
+ proc_close($process);
+ }
+
+ private function hasRunningWorker(string $runtimeDirectory, int $masterPid): bool
+ {
+ foreach (glob($runtimeDirectory . '/server.status.d/worker-*.json') ?: [] as $file) {
+ $worker = json_decode((string)file_get_contents($file), true);
+ $workerPid = (int)($worker['pid'] ?? 0);
+
+ if (($worker['master_pid'] ?? null) === $masterPid
+ && $workerPid > 1
+ && @posix_kill($workerPid, 0)
+ && @posix_getpgid($workerPid) === $masterPid) {
+ return true;
+ }
+ }
+
+ return false;
+ }
+
+ private function readLog(string $logFile): string
+ {
+ return is_file($logFile) ? (string)file_get_contents($logFile) : '';
+ }
+
+ private function removeRuntimeDirectory(string $directory): void
+ {
+ foreach (glob($directory . '/*') ?: [] as $file) {
+ @unlink($file);
+ }
+ @rmdir($directory);
+ }
+}
diff --git a/tests/Unit/ConfigTest.php b/tests/Unit/ConfigTest.php
index 82d2c0a..3788ef8 100644
--- a/tests/Unit/ConfigTest.php
+++ b/tests/Unit/ConfigTest.php
@@ -1,5 +1,26 @@
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
namespace Tests\Unit;
use PHPUnit\Framework\TestCase;
diff --git a/tests/Unit/ContextTest.php b/tests/Unit/ContextTest.php
new file mode 100644
index 0000000..93be741
--- /dev/null
+++ b/tests/Unit/ContextTest.php
@@ -0,0 +1,81 @@
+
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+namespace Tests\Unit;
+
+use Fiber;
+use localzet\Server;
+use localzet\Server\Events\Fiber as FiberEventLoop;
+use localzet\Server\Events\Select;
+use PHPUnit\Framework\TestCase;
+use Triangle\Engine\Context;
+
+class ContextTest extends TestCase
+{
+ private ?string $originalEventLoopClass;
+
+ protected function setUp(): void
+ {
+ parent::setUp();
+
+ Context::init();
+ $this->originalEventLoopClass = Server::$eventLoopClass;
+ }
+
+ protected function tearDown(): void
+ {
+ Server::$eventLoopClass = $this->originalEventLoopClass;
+ Context::destroy();
+
+ parent::tearDown();
+ }
+
+ public function testFiberContextRemainsIsolatedAcrossServerEventLoops(): void
+ {
+ foreach ([Select::class, FiberEventLoop::class] as $eventLoopClass) {
+ Server::$eventLoopClass = $eventLoopClass;
+
+ $first = new Fiber(static function (): string {
+ Context::set('requestId', 'first');
+ Fiber::suspend();
+
+ return Context::get('requestId');
+ });
+ $second = new Fiber(static function (): string {
+ Context::set('requestId', 'second');
+ Fiber::suspend();
+
+ return Context::get('requestId');
+ });
+
+ $first->start();
+ $second->start();
+
+ $first->resume();
+ $second->resume();
+
+ self::assertSame('first', $first->getReturn(), $eventLoopClass);
+ self::assertSame('second', $second->getReturn(), $eventLoopClass);
+ }
+ }
+}
diff --git a/tests/Unit/LoggingCompatibilityTest.php b/tests/Unit/LoggingCompatibilityTest.php
new file mode 100644
index 0000000..e8fafc1
--- /dev/null
+++ b/tests/Unit/LoggingCompatibilityTest.php
@@ -0,0 +1,73 @@
+
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+namespace Tests\Unit;
+
+use Monolog\Handler\TestHandler;
+use Monolog\LogRecord;
+use PHPUnit\Framework\TestCase;
+use ReflectionMethod;
+use support\Log;
+use Triangle\Engine\Config;
+use Triangle\Engine\Log\MongoDBHandler;
+
+class LoggingCompatibilityTest extends TestCase
+{
+ protected function tearDown(): void
+ {
+ Config::clear();
+
+ parent::tearDown();
+ }
+
+ public function testSupportLoggerWritesThroughMonologThree(): void
+ {
+ $channel = 'engine-test-' . bin2hex(random_bytes(4));
+ Config::set([
+ 'log' => [
+ $channel => [
+ 'handlers' => [[
+ 'class' => TestHandler::class,
+ 'constructor' => [],
+ 'formatter' => [],
+ ]],
+ ],
+ ],
+ ]);
+
+ $logger = Log::channel($channel);
+ $logger->info('engine logger record');
+
+ $handler = $logger->getHandlers()[0];
+ self::assertInstanceOf(TestHandler::class, $handler);
+ self::assertTrue($handler->hasInfoThatContains('engine logger record'));
+ }
+
+ public function testMongoDbHandlerAcceptsMonologThreeRecords(): void
+ {
+ $method = new ReflectionMethod(MongoDBHandler::class, 'write');
+ $recordType = $method->getParameters()[0]->getType();
+
+ self::assertSame(LogRecord::class, $recordType->getName());
+ }
+}
diff --git a/tests/Unit/Server7HelpersCompatibilityTest.php b/tests/Unit/Server7HelpersCompatibilityTest.php
new file mode 100644
index 0000000..a1a9c83
--- /dev/null
+++ b/tests/Unit/Server7HelpersCompatibilityTest.php
@@ -0,0 +1,92 @@
+
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+namespace Tests\Unit;
+
+use PHPUnit\Framework\TestCase;
+use localzet\Server\Protocols\Http\Response as ServerResponse;
+use Triangle\Engine\Config;
+use Triangle\Engine\Response;
+
+class Server7HelpersCompatibilityTest extends TestCase
+{
+ protected function setUp(): void
+ {
+ Config::clear();
+ parent::setUp();
+ }
+
+ protected function tearDown(): void
+ {
+ Config::clear();
+ parent::tearDown();
+ }
+
+ public function testResponseJsonUsesTheTriangleJsonEncoder(): void
+ {
+ $response = responseJson(['ok' => true], 422, ['X-Trace' => 'trace']);
+
+ self::assertInstanceOf(Response::class, $response);
+ self::assertSame(422, $response->getStatusCode());
+ self::assertSame('trace', $response->getHeaders()['X-Trace']);
+ self::assertSame(['ok' => true], json_decode((string)$response->rawBody(), true, 512, JSON_THROW_ON_ERROR));
+ }
+
+ public function testTriangleJsonKeepsTheEngineStringContract(): void
+ {
+ $encoded = triangle_json(['ok' => true]);
+
+ self::assertIsString($encoded);
+ self::assertSame(['ok' => true], json_decode($encoded, true, 512, JSON_THROW_ON_ERROR));
+ }
+
+ public function testTriangleResponseKeepsTheEngineEnvelope(): void
+ {
+ Config::set(['app' => ['debug' => false, 'http_always_200' => false]]);
+
+ $response = triangle_response(['message' => 'invalid'], 422);
+
+ self::assertInstanceOf(Response::class, $response);
+ self::assertSame(422, $response->getStatusCode());
+ self::assertSame(
+ ['status' => 422, 'data' => ['message' => 'invalid']],
+ json_decode((string)$response->rawBody(), true, 512, JSON_THROW_ON_ERROR),
+ );
+ }
+
+ public function testTriangleRedirectReturnsTheEngineResponseAndStripsLineBreaks(): void
+ {
+ $response = triangle_redirect("/next\r\nX-Injected: value", 302);
+
+ self::assertInstanceOf(Response::class, $response);
+ self::assertSame(302, $response->getStatusCode());
+ self::assertSame('/nextX-Injected: value', $response->getHeaders()['Location']);
+ }
+
+ public function testServerGlobalHelpersKeepTheirServerResponseContract(): void
+ {
+ self::assertInstanceOf(ServerResponse::class, response('body'));
+ self::assertInstanceOf(ServerResponse::class, json(['ok' => true]));
+ self::assertInstanceOf(ServerResponse::class, redirect('/next'));
+ }
+}
diff --git a/tests/fixtures/server7_http.php b/tests/fixtures/server7_http.php
new file mode 100644
index 0000000..51cf64e
--- /dev/null
+++ b/tests/fixtures/server7_http.php
@@ -0,0 +1,65 @@
+
+ * @copyright Copyright © 2016-2026 Localzet Group. All rights reserved.
+ * @license https://www.gnu.org/licenses/agpl-3.0 GNU Affero General Public License v3.0
+ *
+ * This program is free software: you can redistribute it and/or modify
+ * it under the terms of the GNU Affero General Public License as published
+ * by the Free Software Foundation, either version 3 of the License, or
+ * (at your option) any later version.
+ *
+ * This program is distributed in the hope that it will be useful,
+ * but WITHOUT ANY WARRANTY; without even the implied warranty of
+ * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the
+ * GNU Affero General Public License for more details.
+ *
+ * You should have received a copy of the GNU Affero General Public License
+ * along with this program. If not, see .
+ */
+
+use localzet\Server;
+use localzet\Server\Connection\TcpConnection;
+use localzet\Server\Protocols\Http;
+use Triangle\Engine\Context;
+use Triangle\Engine\Request;
+use Triangle\Engine\Response;
+
+$port = (int)($argv[2] ?? 0);
+$runtimeDirectory = (string)($argv[3] ?? '');
+
+if (!function_exists('posix_setpgid') || !posix_setpgid(0, 0) || posix_getpgrp() !== getmypid()) {
+ fwrite(STDERR, "Could not isolate the HTTP integration process group.\n");
+ exit(1);
+}
+
+file_put_contents($runtimeDirectory . '/process-group', (string)posix_getpgrp(), LOCK_EX);
+
+require dirname(__DIR__, 2) . '/vendor/autoload.php';
+
+Server::$pidFile = $runtimeDirectory . '/server.pid';
+Server::$statusFile = $runtimeDirectory . '/server.status';
+Server::$stdoutFile = $runtimeDirectory . '/stdout.log';
+Server::$logFile = $runtimeDirectory . '/server.log';
+
+Http::requestClass(Request::class);
+Context::init();
+
+$server = new Server("http://127.0.0.1:$port");
+$server->count = 1;
+$server->onMessage = static function (TcpConnection $connection, Request $request): void {
+ Context::set('request_id', $request->get('request_id'));
+
+ try {
+ $body = triangle_json(['request_id' => Context::get('request_id')]);
+ $connection->send(new Response(200, ['Connection' => 'close'], $body));
+ $connection->close();
+ } finally {
+ Context::destroy();
+ }
+};
+
+Server::runAll();
diff --git a/tests/phpunit.xml b/tests/phpunit.xml
index c9caf8c..9dddab3 100644
--- a/tests/phpunit.xml
+++ b/tests/phpunit.xml
@@ -11,6 +11,9 @@
Unit
+
+ Integration
+