diff --git a/.github/workflows/main.yml b/.github/workflows/main.yml index a916ae4e..6d55be29 100644 --- a/.github/workflows/main.yml +++ b/.github/workflows/main.yml @@ -10,7 +10,7 @@ jobs: strategy: matrix: - php-versions: ["7.4", "8.0", "8.1", "8.2"] + php-versions: ["8.1", "8.2"] steps: - uses: actions/checkout@v4 diff --git a/composer.json b/composer.json index c68cdbd6..f8fc428c 100644 --- a/composer.json +++ b/composer.json @@ -29,14 +29,14 @@ "support": { "issues": "https://github.com/phalcon/ide-stubs/issues", "source": "https://github.com/phalcon/ide-stubs", - "forum": "https://forum.phalcon.io/" + "discussions": "https://phalcon.io/discussions/" }, "require": { - "php": ">=7.4" + "php": ">=8.1" }, "require-dev": { - "squizlabs/php_codesniffer": "3.*", - "vimeo/psalm": "^3.4" + "squizlabs/php_codesniffer": "^4.0", + "vimeo/psalm": "^6.16" }, "autoload-dev": { "psr-4": { diff --git a/composer.lock b/composer.lock index 139636cf..d27e1e4f 100644 --- a/composer.lock +++ b/composer.lock @@ -4,59 +4,48 @@ "Read more about it at https://getcomposer.org/doc/01-basic-usage.md#installing-dependencies", "This file is @generated automatically" ], - "content-hash": "7d008907c09cfa7e75a685aad7e3dc66", + "content-hash": "a2776c18e3dbda06d363c5de9c78fcdd", "packages": [], "packages-dev": [ { "name": "amphp/amp", - "version": "v2.6.1", + "version": "v3.1.1", "source": { "type": "git", "url": "https://github.com/amphp/amp.git", - "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae" + "reference": "fa0ab33a6f47a82929c38d03ca47ebb71086a93f" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/amp/zipball/c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", - "reference": "c5fc66a78ee38d7ac9195a37bacaf940eb3f65ae", + "url": "https://api.github.com/repos/amphp/amp/zipball/fa0ab33a6f47a82929c38d03ca47ebb71086a93f", + "reference": "fa0ab33a6f47a82929c38d03ca47ebb71086a93f", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1", - "ext-json": "*", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^7 | ^8 | ^9", - "psalm/phar": "^3.11@dev", - "react/promise": "^2" + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.x-dev" - } - }, "autoload": { - "psr-4": { - "Amp\\": "lib" - }, "files": [ - "lib/functions.php", - "lib/Internal/functions.php" - ] + "src/functions.php", + "src/Future/functions.php", + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], "authors": [ - { - "name": "Daniel Lowrey", - "email": "rdlowrey@php.net" - }, { "name": "Aaron Piotrowski", "email": "aaron@trowski.com" @@ -68,10 +57,14 @@ { "name": "Niklas Keller", "email": "me@kelunik.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" } ], "description": "A non-blocking concurrency framework for PHP applications.", - "homepage": "http://amphp.org/amp", + "homepage": "https://amphp.org/amp", "keywords": [ "async", "asynchronous", @@ -84,9 +77,8 @@ "promise" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/amp/issues", - "source": "https://github.com/amphp/amp/tree/v2.6.1" + "source": "https://github.com/amphp/amp/tree/v3.1.1" }, "funding": [ { @@ -94,47 +86,46 @@ "type": "github" } ], - "time": "2021-09-23T18:43:08+00:00" + "time": "2025-08-27T21:42:00+00:00" }, { "name": "amphp/byte-stream", - "version": "v1.8.1", + "version": "v2.1.2", "source": { "type": "git", "url": "https://github.com/amphp/byte-stream.git", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd" + "reference": "55a6bd071aec26fa2a3e002618c20c35e3df1b46" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/amphp/byte-stream/zipball/acbd8002b3536485c997c4e019206b3f10ca15bd", - "reference": "acbd8002b3536485c997c4e019206b3f10ca15bd", + "url": "https://api.github.com/repos/amphp/byte-stream/zipball/55a6bd071aec26fa2a3e002618c20c35e3df1b46", + "reference": "55a6bd071aec26fa2a3e002618c20c35e3df1b46", "shasum": "" }, "require": { - "amphp/amp": "^2", - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/parser": "^1.1", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2.3" }, "require-dev": { - "amphp/php-cs-fixer-config": "dev-master", - "amphp/phpunit-util": "^1.4", - "friendsofphp/php-cs-fixer": "^2.3", - "jetbrains/phpstorm-stubs": "^2019.3", - "phpunit/phpunit": "^6 || ^7 || ^8", - "psalm/phar": "^3.11.4" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.22.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { - "psr-4": { - "Amp\\ByteStream\\": "lib" - }, "files": [ - "lib/functions.php" - ] + "src/functions.php", + "src/Internal/functions.php" + ], + "psr-4": { + "Amp\\ByteStream\\": "src" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -151,7 +142,7 @@ } ], "description": "A stream abstraction to make working with non-blocking I/O simple.", - "homepage": "http://amphp.org/byte-stream", + "homepage": "https://amphp.org/byte-stream", "keywords": [ "amp", "amphp", @@ -161,9 +152,8 @@ "stream" ], "support": { - "irc": "irc://irc.freenode.org/amphp", "issues": "https://github.com/amphp/byte-stream/issues", - "source": "https://github.com/amphp/byte-stream/tree/v1.8.1" + "source": "https://github.com/amphp/byte-stream/tree/v2.1.2" }, "funding": [ { @@ -171,44 +161,39 @@ "type": "github" } ], - "time": "2021-03-30T17:13:30+00:00" + "time": "2025-03-16T17:10:27+00:00" }, { - "name": "composer/package-versions-deprecated", - "version": "1.11.99.4", + "name": "amphp/cache", + "version": "v2.0.1", "source": { "type": "git", - "url": "https://github.com/composer/package-versions-deprecated.git", - "reference": "b174585d1fe49ceed21928a945138948cb394600" + "url": "https://github.com/amphp/cache.git", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/package-versions-deprecated/zipball/b174585d1fe49ceed21928a945138948cb394600", - "reference": "b174585d1fe49ceed21928a945138948cb394600", + "url": "https://api.github.com/repos/amphp/cache/zipball/46912e387e6aa94933b61ea1ead9cf7540b7797c", + "reference": "46912e387e6aa94933b61ea1ead9cf7540b7797c", "shasum": "" }, "require": { - "composer-plugin-api": "^1.1.0 || ^2.0", - "php": "^7 || ^8" - }, - "replace": { - "ocramius/package-versions": "1.11.99" + "amphp/amp": "^3", + "amphp/serialization": "^1", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "composer/composer": "^1.9.3 || ^2.0@dev", - "ext-zip": "^1.13", - "phpunit/phpunit": "^6.5 || ^7" - }, - "type": "composer-plugin", - "extra": { - "class": "PackageVersions\\Installer", - "branch-alias": { - "dev-master": "1.x-dev" - } + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" }, + "type": "library", "autoload": { "psr-4": { - "PackageVersions\\": "src/PackageVersions" + "Amp\\Cache\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -217,65 +202,71 @@ ], "authors": [ { - "name": "Marco Pivetta", - "email": "ocramius@gmail.com" + "name": "Niklas Keller", + "email": "me@kelunik.com" }, { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" } ], - "description": "Composer plugin that provides efficient querying for installed package versions (no runtime IO)", + "description": "A fiber-aware cache API based on Amp and Revolt.", + "homepage": "https://amphp.org/cache", "support": { - "issues": "https://github.com/composer/package-versions-deprecated/issues", - "source": "https://github.com/composer/package-versions-deprecated/tree/1.11.99.4" + "issues": "https://github.com/amphp/cache/issues", + "source": "https://github.com/amphp/cache/tree/v2.0.1" }, "funding": [ { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", + "url": "https://github.com/amphp", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2021-09-13T08:41:34+00:00" + "time": "2024-04-19T03:38:06+00:00" }, { - "name": "composer/semver", - "version": "3.2.5", + "name": "amphp/dns", + "version": "v2.4.0", "source": { "type": "git", - "url": "https://github.com/composer/semver.git", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9" + "url": "https://github.com/amphp/dns.git", + "reference": "78eb3db5fc69bf2fc0cb503c4fcba667bc223c71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/semver/zipball/31f3ea725711245195f62e54ffa402d8ef2fdba9", - "reference": "31f3ea725711245195f62e54ffa402d8ef2fdba9", + "url": "https://api.github.com/repos/amphp/dns/zipball/78eb3db5fc69bf2fc0cb503c4fcba667bc223c71", + "reference": "78eb3db5fc69bf2fc0cb503c4fcba667bc223c71", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/process": "^2", + "daverandom/libdns": "^2.0.2", + "ext-filter": "*", + "ext-json": "*", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "phpstan/phpstan": "^0.12.54", - "symfony/phpunit-bridge": "^4.2 || ^5" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.20" }, "type": "library", - "extra": { - "branch-alias": { - "dev-main": "3.x-dev" - } - }, "autoload": { + "files": [ + "src/functions.php" + ], "psr-4": { - "Composer\\Semver\\": "src" + "Amp\\Dns\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -284,75 +275,91 @@ ], "authors": [ { - "name": "Nils Adermann", - "email": "naderman@naderman.de", - "homepage": "http://www.naderman.de" + "name": "Chris Wright", + "email": "addr@daverandom.com" }, { - "name": "Jordi Boggiano", - "email": "j.boggiano@seld.be", - "homepage": "http://seld.be" + "name": "Daniel Lowrey", + "email": "rdlowrey@php.net" }, { - "name": "Rob Bast", - "email": "rob.bast@gmail.com", - "homepage": "http://robbast.nl" + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" } ], - "description": "Semver library that offers utilities, version constraint parsing and validation.", + "description": "Async DNS resolution for Amp.", + "homepage": "https://github.com/amphp/dns", "keywords": [ - "semantic", - "semver", - "validation", - "versioning" + "amp", + "amphp", + "async", + "client", + "dns", + "resolve" ], "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/semver/issues", - "source": "https://github.com/composer/semver/tree/3.2.5" + "issues": "https://github.com/amphp/dns/issues", + "source": "https://github.com/amphp/dns/tree/v2.4.0" }, "funding": [ { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", + "url": "https://github.com/amphp", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2021-05-24T12:41:47+00:00" + "time": "2025-01-19T15:43:40+00:00" }, { - "name": "composer/xdebug-handler", - "version": "1.4.6", + "name": "amphp/parallel", + "version": "v2.4.0", "source": { "type": "git", - "url": "https://github.com/composer/xdebug-handler.git", - "reference": "f27e06cd9675801df441b3656569b328e04aa37c" + "url": "https://github.com/amphp/parallel.git", + "reference": "37f5b2754fadc229c00f9416bd68fb8d04529a81" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/f27e06cd9675801df441b3656569b328e04aa37c", - "reference": "f27e06cd9675801df441b3656569b328e04aa37c", + "url": "https://api.github.com/repos/amphp/parallel/zipball/37f5b2754fadc229c00f9416bd68fb8d04529a81", + "reference": "37f5b2754fadc229c00f9416bd68fb8d04529a81", "shasum": "" }, "require": { - "php": "^5.3.2 || ^7.0 || ^8.0", - "psr/log": "^1.0" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/cache": "^2", + "amphp/parser": "^1", + "amphp/pipeline": "^1", + "amphp/process": "^2", + "amphp/serialization": "^1", + "amphp/socket": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1" }, "require-dev": { - "phpstan/phpstan": "^0.12.55", - "symfony/phpunit-bridge": "^4.2 || ^5" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" }, "type": "library", "autoload": { + "files": [ + "src/Context/functions.php", + "src/Context/Internal/functions.php", + "src/Ipc/functions.php", + "src/Worker/functions.php" + ], "psr-4": { - "Composer\\XdebugHandler\\": "src" + "Amp\\Parallel\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -361,186 +368,1234 @@ ], "authors": [ { - "name": "John Stevenson", - "email": "john-stevenson@blueyonder.co.uk" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" } ], - "description": "Restarts a process without Xdebug.", + "description": "Parallel processing component for Amp.", + "homepage": "https://github.com/amphp/parallel", "keywords": [ - "Xdebug", - "performance" + "async", + "asynchronous", + "concurrent", + "multi-processing", + "multi-threading" ], "support": { - "irc": "irc://irc.freenode.org/composer", - "issues": "https://github.com/composer/xdebug-handler/issues", - "source": "https://github.com/composer/xdebug-handler/tree/1.4.6" + "issues": "https://github.com/amphp/parallel/issues", + "source": "https://github.com/amphp/parallel/tree/v2.4.0" }, "funding": [ { - "url": "https://packagist.com", - "type": "custom" - }, - { - "url": "https://github.com/composer", + "url": "https://github.com/amphp", "type": "github" - }, - { - "url": "https://tidelift.com/funding/github/packagist/composer/composer", - "type": "tidelift" } ], - "time": "2021-03-25T17:01:18+00:00" + "time": "2026-05-16T16:54:01+00:00" }, { - "name": "dnoegel/php-xdg-base-dir", - "version": "v0.1.1", + "name": "amphp/parser", + "version": "v1.1.1", "source": { "type": "git", - "url": "https://github.com/dnoegel/php-xdg-base-dir.git", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + "url": "https://github.com/amphp/parser.git", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", - "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "url": "https://api.github.com/repos/amphp/parser/zipball/3cf1f8b32a0171d4b1bed93d25617637a77cded7", + "reference": "3cf1f8b32a0171d4b1bed93d25617637a77cded7", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": ">=7.4" }, "require-dev": { - "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "^5.4" }, "type": "library", "autoload": { "psr-4": { - "XdgBaseDir\\": "src/" + "Amp\\Parser\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ "MIT" ], - "description": "implementation of xdg base directory specification for php", + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "A generator parser to make streaming parsers simple.", + "homepage": "https://github.com/amphp/parser", + "keywords": [ + "async", + "non-blocking", + "parser", + "stream" + ], "support": { - "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", - "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + "issues": "https://github.com/amphp/parser/issues", + "source": "https://github.com/amphp/parser/tree/v1.1.1" }, - "time": "2019-12-04T15:06:13+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-03-21T19:16:53+00:00" }, { - "name": "felixfbecker/advanced-json-rpc", - "version": "v3.2.1", + "name": "amphp/pipeline", + "version": "v1.2.4", "source": { "type": "git", - "url": "https://github.com/felixfbecker/php-advanced-json-rpc.git", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447" + "url": "https://github.com/amphp/pipeline.git", + "reference": "a044733e080940d1483f56caff0c412ad6982776" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-advanced-json-rpc/zipball/b5f37dbff9a8ad360ca341f3240dc1c168b45447", - "reference": "b5f37dbff9a8ad360ca341f3240dc1c168b45447", + "url": "https://api.github.com/repos/amphp/pipeline/zipball/a044733e080940d1483f56caff0c412ad6982776", + "reference": "a044733e080940d1483f56caff0c412ad6982776", "shasum": "" }, "require": { - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0 || ^4.0", - "php": "^7.1 || ^8.0", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0" + "amphp/amp": "^3", + "php": ">=8.1", + "revolt/event-loop": "^1" }, "require-dev": { - "phpunit/phpunit": "^7.0 || ^8.0" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" }, "type": "library", "autoload": { "psr-4": { - "AdvancedJsonRpc\\": "lib/" + "Amp\\Pipeline\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "ISC" + "MIT" ], "authors": [ { - "name": "Felix Becker", - "email": "felix.b@outlook.com" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "A more advanced JSONRPC implementation", + "description": "Asynchronous iterators and operators.", + "homepage": "https://amphp.org/pipeline", + "keywords": [ + "amp", + "amphp", + "async", + "io", + "iterator", + "non-blocking" + ], "support": { - "issues": "https://github.com/felixfbecker/php-advanced-json-rpc/issues", - "source": "https://github.com/felixfbecker/php-advanced-json-rpc/tree/v3.2.1" + "issues": "https://github.com/amphp/pipeline/issues", + "source": "https://github.com/amphp/pipeline/tree/v1.2.4" }, - "time": "2021-06-11T22:34:44+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-05-06T05:37:57+00:00" }, { - "name": "felixfbecker/language-server-protocol", - "version": "1.5.1", + "name": "amphp/process", + "version": "v2.1.0", "source": { "type": "git", - "url": "https://github.com/felixfbecker/php-language-server-protocol.git", - "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730" + "url": "https://github.com/amphp/process.git", + "reference": "583959df17d00304ad7b0b32285373f985935643" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/9d846d1f5cf101deee7a61c8ba7caa0a975cd730", - "reference": "9d846d1f5cf101deee7a61c8ba7caa0a975cd730", + "url": "https://api.github.com/repos/amphp/process/zipball/583959df17d00304ad7b0b32285373f985935643", + "reference": "583959df17d00304ad7b0b32285373f985935643", "shasum": "" }, "require": { - "php": ">=7.1" + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/sync": "^2", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" }, "require-dev": { - "phpstan/phpstan": "*", - "squizlabs/php_codesniffer": "^3.1", - "vimeo/psalm": "^4.0" + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" }, "type": "library", - "extra": { - "branch-alias": { - "dev-master": "1.x-dev" - } - }, "autoload": { + "files": [ + "src/functions.php" + ], "psr-4": { - "LanguageServerProtocol\\": "src/" + "Amp\\Process\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "ISC" + "MIT" ], "authors": [ { - "name": "Felix Becker", - "email": "felix.b@outlook.com" + "name": "Bob Weinand", + "email": "bobwei9@hotmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "PHP classes for the Language Server Protocol", - "keywords": [ - "language", - "microsoft", - "php", - "server" - ], + "description": "A fiber-aware process manager based on Amp and Revolt.", + "homepage": "https://amphp.org/process", "support": { - "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", - "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/1.5.1" + "issues": "https://github.com/amphp/process/issues", + "source": "https://github.com/amphp/process/tree/v2.1.0" }, - "time": "2021-02-22T14:02:09+00:00" + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-05-31T15:11:55+00:00" }, { - "name": "netresearch/jsonmapper", - "version": "v3.1.1", + "name": "amphp/serialization", + "version": "v1.1.0", "source": { "type": "git", - "url": "https://github.com/cweiske/jsonmapper.git", - "reference": "ba09f0e456d4f00cef84e012da5715625594407c" + "url": "https://github.com/amphp/serialization.git", + "reference": "fdf2834d78cebb0205fb2672676c1b1eb84371f0" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/ba09f0e456d4f00cef84e012da5715625594407c", - "reference": "ba09f0e456d4f00cef84e012da5715625594407c", + "url": "https://api.github.com/repos/amphp/serialization/zipball/fdf2834d78cebb0205fb2672676c1b1eb84371f0", + "reference": "fdf2834d78cebb0205fb2672676c1b1eb84371f0", + "shasum": "" + }, + "require": { + "php": ">=7.4" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "ext-json": "*", + "ext-zlib": "*", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Serialization\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Serialization tools for IPC and data storage in PHP.", + "homepage": "https://github.com/amphp/serialization", + "keywords": [ + "async", + "asynchronous", + "serialization", + "serialize" + ], + "support": { + "issues": "https://github.com/amphp/serialization/issues", + "source": "https://github.com/amphp/serialization/tree/v1.1.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-04-05T15:59:53+00:00" + }, + { + "name": "amphp/socket", + "version": "v2.4.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/socket.git", + "reference": "dadb63c5d3179fd83803e29dfeac27350e619314" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/socket/zipball/dadb63c5d3179fd83803e29dfeac27350e619314", + "reference": "dadb63c5d3179fd83803e29dfeac27350e619314", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/dns": "^2", + "ext-openssl": "*", + "kelunik/certificate": "^1.1", + "league/uri": "^7", + "league/uri-interfaces": "^7", + "php": ">=8.1", + "revolt/event-loop": "^1" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "amphp/process": "^2", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.1" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php", + "src/Internal/functions.php", + "src/SocketAddress/functions.php" + ], + "psr-4": { + "Amp\\Socket\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Daniel Lowrey", + "email": "rdlowrey@gmail.com" + }, + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Non-blocking socket connection / server implementations based on Amp and Revolt.", + "homepage": "https://github.com/amphp/socket", + "keywords": [ + "amp", + "async", + "encryption", + "non-blocking", + "sockets", + "tcp", + "tls" + ], + "support": { + "issues": "https://github.com/amphp/socket/issues", + "source": "https://github.com/amphp/socket/tree/v2.4.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2026-04-19T15:09:56+00:00" + }, + { + "name": "amphp/sync", + "version": "v2.3.0", + "source": { + "type": "git", + "url": "https://github.com/amphp/sync.git", + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/amphp/sync/zipball/217097b785130d77cfcc58ff583cf26cd1770bf1", + "reference": "217097b785130d77cfcc58ff583cf26cd1770bf1", + "shasum": "" + }, + "require": { + "amphp/amp": "^3", + "amphp/pipeline": "^1", + "amphp/serialization": "^1", + "php": ">=8.1", + "revolt/event-loop": "^1 || ^0.2" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "amphp/phpunit-util": "^3", + "phpunit/phpunit": "^9", + "psalm/phar": "5.23" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "Amp\\Sync\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + }, + { + "name": "Stephen Coakley", + "email": "me@stephencoakley.com" + } + ], + "description": "Non-blocking synchronization primitives for PHP based on Amp and Revolt.", + "homepage": "https://github.com/amphp/sync", + "keywords": [ + "async", + "asynchronous", + "mutex", + "semaphore", + "synchronization" + ], + "support": { + "issues": "https://github.com/amphp/sync/issues", + "source": "https://github.com/amphp/sync/tree/v2.3.0" + }, + "funding": [ + { + "url": "https://github.com/amphp", + "type": "github" + } + ], + "time": "2024-08-03T19:31:26+00:00" + }, + { + "name": "composer/pcre", + "version": "3.3.2", + "source": { + "type": "git", + "url": "https://github.com/composer/pcre.git", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/pcre/zipball/b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "reference": "b2bed4734f0cc156ee1fe9c0da2550420d99a21e", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "conflict": { + "phpstan/phpstan": "<1.11.10" + }, + "require-dev": { + "phpstan/phpstan": "^1.12 || ^2", + "phpstan/phpstan-strict-rules": "^1 || ^2", + "phpunit/phpunit": "^8 || ^9" + }, + "type": "library", + "extra": { + "phpstan": { + "includes": [ + "extension.neon" + ] + }, + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Pcre\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + } + ], + "description": "PCRE wrapping library that offers type-safe preg_* replacements.", + "keywords": [ + "PCRE", + "preg", + "regex", + "regular expression" + ], + "support": { + "issues": "https://github.com/composer/pcre/issues", + "source": "https://github.com/composer/pcre/tree/3.3.2" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-11-12T16:29:46+00:00" + }, + { + "name": "composer/semver", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/composer/semver.git", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/semver/zipball/198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "reference": "198166618906cb2de69b95d7d47e5fa8aa1b2b95", + "shasum": "" + }, + "require": { + "php": "^5.3.2 || ^7.0 || ^8.0" + }, + "require-dev": { + "phpstan/phpstan": "^1.11", + "symfony/phpunit-bridge": "^3 || ^7" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Composer\\Semver\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Nils Adermann", + "email": "naderman@naderman.de", + "homepage": "http://www.naderman.de" + }, + { + "name": "Jordi Boggiano", + "email": "j.boggiano@seld.be", + "homepage": "http://seld.be" + }, + { + "name": "Rob Bast", + "email": "rob.bast@gmail.com", + "homepage": "http://robbast.nl" + } + ], + "description": "Semver library that offers utilities, version constraint parsing and validation.", + "keywords": [ + "semantic", + "semver", + "validation", + "versioning" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/semver/issues", + "source": "https://github.com/composer/semver/tree/3.4.4" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + } + ], + "time": "2025-08-20T19:15:30+00:00" + }, + { + "name": "composer/xdebug-handler", + "version": "3.0.5", + "source": { + "type": "git", + "url": "https://github.com/composer/xdebug-handler.git", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/composer/xdebug-handler/zipball/6c1925561632e83d60a44492e0b344cf48ab85ef", + "reference": "6c1925561632e83d60a44492e0b344cf48ab85ef", + "shasum": "" + }, + "require": { + "composer/pcre": "^1 || ^2 || ^3", + "php": "^7.2.5 || ^8.0", + "psr/log": "^1 || ^2 || ^3" + }, + "require-dev": { + "phpstan/phpstan": "^1.0", + "phpstan/phpstan-strict-rules": "^1.1", + "phpunit/phpunit": "^8.5 || ^9.6 || ^10.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Composer\\XdebugHandler\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "John Stevenson", + "email": "john-stevenson@blueyonder.co.uk" + } + ], + "description": "Restarts a process without Xdebug.", + "keywords": [ + "Xdebug", + "performance" + ], + "support": { + "irc": "ircs://irc.libera.chat:6697/composer", + "issues": "https://github.com/composer/xdebug-handler/issues", + "source": "https://github.com/composer/xdebug-handler/tree/3.0.5" + }, + "funding": [ + { + "url": "https://packagist.com", + "type": "custom" + }, + { + "url": "https://github.com/composer", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/composer/composer", + "type": "tidelift" + } + ], + "time": "2024-05-06T16:37:16+00:00" + }, + { + "name": "danog/advanced-json-rpc", + "version": "v3.2.3", + "source": { + "type": "git", + "url": "https://github.com/danog/php-advanced-json-rpc.git", + "reference": "ae703ea7b4811797a10590b6078de05b3b33dd91" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/danog/php-advanced-json-rpc/zipball/ae703ea7b4811797a10590b6078de05b3b33dd91", + "reference": "ae703ea7b4811797a10590b6078de05b3b33dd91", + "shasum": "" + }, + "require": { + "netresearch/jsonmapper": "^5", + "php": ">=8.1", + "phpdocumentor/reflection-docblock": "^4.3.4 || ^5.0.0 || ^6" + }, + "replace": { + "felixfbecker/php-advanced-json-rpc": "^3" + }, + "require-dev": { + "phpunit/phpunit": "^9" + }, + "type": "library", + "autoload": { + "psr-4": { + "AdvancedJsonRpc\\": "lib/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + }, + { + "name": "Daniil Gentili", + "email": "daniil@daniil.it" + } + ], + "description": "A more advanced JSONRPC implementation", + "support": { + "issues": "https://github.com/danog/php-advanced-json-rpc/issues", + "source": "https://github.com/danog/php-advanced-json-rpc/tree/v3.2.3" + }, + "time": "2026-01-12T21:07:10+00:00" + }, + { + "name": "daverandom/libdns", + "version": "v2.1.0", + "source": { + "type": "git", + "url": "https://github.com/DaveRandom/LibDNS.git", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/DaveRandom/LibDNS/zipball/b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "reference": "b84c94e8fe6b7ee4aecfe121bfe3b6177d303c8a", + "shasum": "" + }, + "require": { + "ext-ctype": "*", + "php": ">=7.1" + }, + "suggest": { + "ext-intl": "Required for IDN support" + }, + "type": "library", + "autoload": { + "files": [ + "src/functions.php" + ], + "psr-4": { + "LibDNS\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "DNS protocol implementation written in pure PHP", + "keywords": [ + "dns" + ], + "support": { + "issues": "https://github.com/DaveRandom/LibDNS/issues", + "source": "https://github.com/DaveRandom/LibDNS/tree/v2.1.0" + }, + "time": "2024-04-12T12:12:48+00:00" + }, + { + "name": "dnoegel/php-xdg-base-dir", + "version": "v0.1.1", + "source": { + "type": "git", + "url": "https://github.com/dnoegel/php-xdg-base-dir.git", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/dnoegel/php-xdg-base-dir/zipball/8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "reference": "8f8a6e48c5ecb0f991c2fdcf5f154a47d85f9ffd", + "shasum": "" + }, + "require": { + "php": ">=5.3.2" + }, + "require-dev": { + "phpunit/phpunit": "~7.0|~6.0|~5.0|~4.8.35" + }, + "type": "library", + "autoload": { + "psr-4": { + "XdgBaseDir\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "implementation of xdg base directory specification for php", + "support": { + "issues": "https://github.com/dnoegel/php-xdg-base-dir/issues", + "source": "https://github.com/dnoegel/php-xdg-base-dir/tree/v0.1.1" + }, + "time": "2019-12-04T15:06:13+00:00" + }, + { + "name": "doctrine/deprecations", + "version": "1.1.6", + "source": { + "type": "git", + "url": "https://github.com/doctrine/deprecations.git", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/doctrine/deprecations/zipball/d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "reference": "d4fe3e6fd9bb9e72557a19674f44d8ac7db4c6ca", + "shasum": "" + }, + "require": { + "php": "^7.1 || ^8.0" + }, + "conflict": { + "phpunit/phpunit": "<=7.5 || >=14" + }, + "require-dev": { + "doctrine/coding-standard": "^9 || ^12 || ^14", + "phpstan/phpstan": "1.4.10 || 2.1.30", + "phpstan/phpstan-phpunit": "^1.0 || ^2", + "phpunit/phpunit": "^7.5 || ^8.5 || ^9.6 || ^10.5 || ^11.5 || ^12.4 || ^13.0", + "psr/log": "^1 || ^2 || ^3" + }, + "suggest": { + "psr/log": "Allows logging deprecations via PSR-3 logger implementation" + }, + "type": "library", + "autoload": { + "psr-4": { + "Doctrine\\Deprecations\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "A small layer on top of trigger_error(E_USER_DEPRECATED) or PSR-3 logging with options to disable all deprecations or selectively for packages.", + "homepage": "https://www.doctrine-project.org/", + "support": { + "issues": "https://github.com/doctrine/deprecations/issues", + "source": "https://github.com/doctrine/deprecations/tree/1.1.6" + }, + "time": "2026-02-07T07:09:04+00:00" + }, + { + "name": "felixfbecker/language-server-protocol", + "version": "v1.5.3", + "source": { + "type": "git", + "url": "https://github.com/felixfbecker/php-language-server-protocol.git", + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/felixfbecker/php-language-server-protocol/zipball/a9e113dbc7d849e35b8776da39edaf4313b7b6c9", + "reference": "a9e113dbc7d849e35b8776da39edaf4313b7b6c9", + "shasum": "" + }, + "require": { + "php": ">=7.1" + }, + "require-dev": { + "phpstan/phpstan": "*", + "squizlabs/php_codesniffer": "^3.1", + "vimeo/psalm": "^4.0" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "LanguageServerProtocol\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "ISC" + ], + "authors": [ + { + "name": "Felix Becker", + "email": "felix.b@outlook.com" + } + ], + "description": "PHP classes for the Language Server Protocol", + "keywords": [ + "language", + "microsoft", + "php", + "server" + ], + "support": { + "issues": "https://github.com/felixfbecker/php-language-server-protocol/issues", + "source": "https://github.com/felixfbecker/php-language-server-protocol/tree/v1.5.3" + }, + "time": "2024-04-30T00:40:11+00:00" + }, + { + "name": "fidry/cpu-core-counter", + "version": "1.3.0", + "source": { + "type": "git", + "url": "https://github.com/theofidry/cpu-core-counter.git", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/theofidry/cpu-core-counter/zipball/db9508f7b1474469d9d3c53b86f817e344732678", + "reference": "db9508f7b1474469d9d3c53b86f817e344732678", + "shasum": "" + }, + "require": { + "php": "^7.2 || ^8.0" + }, + "require-dev": { + "fidry/makefile": "^0.2.0", + "fidry/php-cs-fixer-config": "^1.1.2", + "phpstan/extension-installer": "^1.2.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-deprecation-rules": "^2.0.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^8.5.31 || ^9.5.26", + "webmozarts/strict-phpunit": "^7.5" + }, + "type": "library", + "autoload": { + "psr-4": { + "Fidry\\CpuCoreCounter\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Théo FIDRY", + "email": "theo.fidry@gmail.com" + } + ], + "description": "Tiny utility to get the number of CPU cores.", + "keywords": [ + "CPU", + "core" + ], + "support": { + "issues": "https://github.com/theofidry/cpu-core-counter/issues", + "source": "https://github.com/theofidry/cpu-core-counter/tree/1.3.0" + }, + "funding": [ + { + "url": "https://github.com/theofidry", + "type": "github" + } + ], + "time": "2025-08-14T07:29:31+00:00" + }, + { + "name": "kelunik/certificate", + "version": "v1.1.3", + "source": { + "type": "git", + "url": "https://github.com/kelunik/certificate.git", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/kelunik/certificate/zipball/7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "reference": "7e00d498c264d5eb4f78c69f41c8bd6719c0199e", + "shasum": "" + }, + "require": { + "ext-openssl": "*", + "php": ">=7.0" + }, + "require-dev": { + "amphp/php-cs-fixer-config": "^2", + "phpunit/phpunit": "^6 | 7 | ^8 | ^9" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.x-dev" + } + }, + "autoload": { + "psr-4": { + "Kelunik\\Certificate\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Niklas Keller", + "email": "me@kelunik.com" + } + ], + "description": "Access certificate details and transform between different formats.", + "keywords": [ + "DER", + "certificate", + "certificates", + "openssl", + "pem", + "x509" + ], + "support": { + "issues": "https://github.com/kelunik/certificate/issues", + "source": "https://github.com/kelunik/certificate/tree/v1.1.3" + }, + "time": "2023-02-03T21:26:53+00:00" + }, + { + "name": "league/uri", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri.git", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri/zipball/08cf38e3924d4f56238125547b5720496fac8fd4", + "reference": "08cf38e3924d4f56238125547b5720496fac8fd4", + "shasum": "" + }, + "require": { + "league/uri-interfaces": "^7.8.1", + "php": "^8.1", + "psr/http-factory": "^1" + }, + "conflict": { + "league/uri-schemes": "^1.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-dom": "to convert the URI into an HTML anchor tag", + "ext-fileinfo": "to create Data URI from file contennts", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "ext-uri": "to use the PHP native URI class", + "jeremykendall/php-domain-parser": "to further parse the URI host and resolve its Public Suffix and Top Level Domain", + "league/uri-components": "to provide additional tools to manipulate URI objects components", + "league/uri-polyfill": "to backport the PHP URI extension for older versions of PHP", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "URI manipulation library", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "URN", + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "middleware", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc2141", + "rfc3986", + "rfc3987", + "rfc6570", + "rfc8141", + "uri", + "uri-template", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-15T20:22:25+00:00" + }, + { + "name": "league/uri-interfaces", + "version": "7.8.1", + "source": { + "type": "git", + "url": "https://github.com/thephpleague/uri-interfaces.git", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/thephpleague/uri-interfaces/zipball/85d5c77c5d6d3af6c54db4a78246364908f3c928", + "reference": "85d5c77c5d6d3af6c54db4a78246364908f3c928", + "shasum": "" + }, + "require": { + "ext-filter": "*", + "php": "^8.1", + "psr/http-message": "^1.1 || ^2.0" + }, + "suggest": { + "ext-bcmath": "to improve IPV4 host parsing", + "ext-gmp": "to improve IPV4 host parsing", + "ext-intl": "to handle IDN host with the best performance", + "php-64bit": "to improve IPV4 host parsing", + "rowbot/url": "to handle URLs using the WHATWG URL Living Standard specification", + "symfony/polyfill-intl-idn": "to handle IDN host via the Symfony polyfill if ext-intl is not present" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "7.x-dev" + } + }, + "autoload": { + "psr-4": { + "League\\Uri\\": "" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Ignace Nyamagana Butera", + "email": "nyamsprod@gmail.com", + "homepage": "https://nyamsprod.com" + } + ], + "description": "Common tools for parsing and resolving RFC3987/RFC3986 URI", + "homepage": "https://uri.thephpleague.com", + "keywords": [ + "data-uri", + "file-uri", + "ftp", + "hostname", + "http", + "https", + "parse_str", + "parse_url", + "psr-7", + "query-string", + "querystring", + "rfc3986", + "rfc3987", + "rfc6570", + "uri", + "url", + "ws" + ], + "support": { + "docs": "https://uri.thephpleague.com", + "forum": "https://thephpleague.slack.com", + "issues": "https://github.com/thephpleague/uri-src/issues", + "source": "https://github.com/thephpleague/uri-interfaces/tree/7.8.1" + }, + "funding": [ + { + "url": "https://github.com/sponsors/nyamsprod", + "type": "github" + } + ], + "time": "2026-03-08T20:05:35+00:00" + }, + { + "name": "netresearch/jsonmapper", + "version": "v5.0.1", + "source": { + "type": "git", + "url": "https://github.com/cweiske/jsonmapper.git", + "reference": "980674efdda65913492d29a8fd51c82270dd37bb" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/cweiske/jsonmapper/zipball/980674efdda65913492d29a8fd51c82270dd37bb", + "reference": "980674efdda65913492d29a8fd51c82270dd37bb", "shasum": "" }, "require": { @@ -548,10 +1603,10 @@ "ext-pcre": "*", "ext-reflection": "*", "ext-spl": "*", - "php": ">=5.6" + "php": ">=7.1" }, "require-dev": { - "phpunit/phpunit": "~4.8.35 || ~5.7 || ~6.4 || ~7.0", + "phpunit/phpunit": "~7.5 || ~8.0 || ~9.0 || ~10.0", "squizlabs/php_codesniffer": "~3.5" }, "type": "library", @@ -576,31 +1631,33 @@ "support": { "email": "cweiske@cweiske.de", "issues": "https://github.com/cweiske/jsonmapper/issues", - "source": "https://github.com/cweiske/jsonmapper/tree/v3.1.1" + "source": "https://github.com/cweiske/jsonmapper/tree/v5.0.1" }, - "time": "2020-11-02T19:19:54+00:00" + "time": "2026-02-22T16:28:03+00:00" }, { "name": "nikic/php-parser", - "version": "v4.13.0", + "version": "v5.7.0", "source": { "type": "git", "url": "https://github.com/nikic/PHP-Parser.git", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53" + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/50953a2691a922aa1769461637869a0a2faa3f53", - "reference": "50953a2691a922aa1769461637869a0a2faa3f53", + "url": "https://api.github.com/repos/nikic/PHP-Parser/zipball/dca41cd15c2ac9d055ad70dbfd011130757d1f82", + "reference": "dca41cd15c2ac9d055ad70dbfd011130757d1f82", "shasum": "" }, "require": { + "ext-ctype": "*", + "ext-json": "*", "ext-tokenizer": "*", - "php": ">=7.0" + "php": ">=7.4" }, "require-dev": { "ircmaxell/php-yacc": "^0.0.7", - "phpunit/phpunit": "^6.5 || ^7.0 || ^8.0 || ^9.0" + "phpunit/phpunit": "^9.0" }, "bin": [ "bin/php-parse" @@ -608,7 +1665,7 @@ "type": "library", "extra": { "branch-alias": { - "dev-master": "4.9-dev" + "dev-master": "5.x-dev" } }, "autoload": { @@ -632,89 +1689,259 @@ ], "support": { "issues": "https://github.com/nikic/PHP-Parser/issues", - "source": "https://github.com/nikic/PHP-Parser/tree/v4.13.0" + "source": "https://github.com/nikic/PHP-Parser/tree/v5.7.0" }, - "time": "2021-09-20T12:20:58+00:00" + "time": "2025-12-06T11:56:16+00:00" }, { - "name": "openlss/lib-array2xml", - "version": "1.0.0", + "name": "phpdocumentor/reflection-common", + "version": "2.2.0", "source": { "type": "git", - "url": "https://github.com/nullivex/lib-array2xml.git", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90" + "url": "https://github.com/phpDocumentor/ReflectionCommon.git", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/nullivex/lib-array2xml/zipball/a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", - "reference": "a91f18a8dfc69ffabe5f9b068bc39bb202c81d90", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", "shasum": "" }, "require": { - "php": ">=5.3.2" + "php": "^7.2 || ^8.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-2.x": "2.x-dev" + } + }, "autoload": { - "psr-0": { - "LSS": "" + "psr-4": { + "phpDocumentor\\Reflection\\": "src/" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" + } + ], + "description": "Common reflection classes used by phpdocumentor to reflect the code structure", + "homepage": "http://www.phpdoc.org", + "keywords": [ + "FQSEN", + "phpDocumentor", + "phpdoc", + "reflection", + "static analysis" + ], + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", + "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + }, + "time": "2020-06-27T09:03:43+00:00" + }, + { + "name": "phpdocumentor/reflection-docblock", + "version": "6.0.3", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/7bae67520aa9f5ecc506d646810bd40d9da54582", + "reference": "7bae67520aa9f5ecc506d646810bd40d9da54582", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.1", + "ext-filter": "*", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.2", + "phpdocumentor/type-resolver": "^2.0", + "phpstan/phpdoc-parser": "^2.0", + "webmozart/assert": "^1.9.1 || ^2" + }, + "require-dev": { + "mockery/mockery": "~1.3.5 || ~1.6.0", + "phpstan/extension-installer": "^1.1", + "phpstan/phpstan": "^1.8", + "phpstan/phpstan-mockery": "^1.1", + "phpstan/phpstan-webmozart-assert": "^1.2", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^5.26", + "shipmonk/dead-code-detector": "^0.5.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-master": "5.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" } }, "notification-url": "https://packagist.org/downloads/", "license": [ - "Apache-2.0" + "MIT" ], "authors": [ { - "name": "Bryan Tong", - "email": "bryan@nullivex.com", - "homepage": "https://www.nullivex.com" + "name": "Mike van Riel", + "email": "me@mikevanriel.com" }, { - "name": "Tony Butler", - "email": "spudz76@gmail.com", - "homepage": "https://www.nullivex.com" + "name": "Jaap van Otterdijk", + "email": "opensource@ijaap.nl" } ], - "description": "Array2XML conversion library credit to lalit.org", - "homepage": "https://www.nullivex.com", - "keywords": [ - "array", - "array conversion", - "xml", - "xml conversion" + "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "support": { + "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", + "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/6.0.3" + }, + "time": "2026-03-18T20:49:53+00:00" + }, + { + "name": "phpdocumentor/type-resolver", + "version": "2.0.0", + "source": { + "type": "git", + "url": "https://github.com/phpDocumentor/TypeResolver.git", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/327a05bbee54120d4786a0dc67aad30226ad4cf9", + "reference": "327a05bbee54120d4786a0dc67aad30226ad4cf9", + "shasum": "" + }, + "require": { + "doctrine/deprecations": "^1.0", + "php": "^7.4 || ^8.0", + "phpdocumentor/reflection-common": "^2.0", + "phpstan/phpdoc-parser": "^2.0" + }, + "require-dev": { + "ext-tokenizer": "*", + "phpbench/phpbench": "^1.2", + "phpstan/extension-installer": "^1.4", + "phpstan/phpstan": "^2.1", + "phpstan/phpstan-phpunit": "^2.0", + "phpunit/phpunit": "^9.5", + "psalm/phar": "^4" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-1.x": "1.x-dev", + "dev-2.x": "2.x-dev" + } + }, + "autoload": { + "psr-4": { + "phpDocumentor\\Reflection\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Mike van Riel", + "email": "me@mikevanriel.com" + } ], + "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", "support": { - "issues": "https://github.com/nullivex/lib-array2xml/issues", - "source": "https://github.com/nullivex/lib-array2xml/tree/master" + "issues": "https://github.com/phpDocumentor/TypeResolver/issues", + "source": "https://github.com/phpDocumentor/TypeResolver/tree/2.0.0" }, - "time": "2019-03-29T20:06:56+00:00" + "time": "2026-01-06T21:53:42+00:00" }, { - "name": "phpdocumentor/reflection-common", - "version": "2.2.0", + "name": "phpstan/phpdoc-parser", + "version": "2.3.2", + "source": { + "type": "git", + "url": "https://github.com/phpstan/phpdoc-parser.git", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/phpstan/phpdoc-parser/zipball/a004701b11273a26cd7955a61d67a7f1e525a45a", + "reference": "a004701b11273a26cd7955a61d67a7f1e525a45a", + "shasum": "" + }, + "require": { + "php": "^7.4 || ^8.0" + }, + "require-dev": { + "doctrine/annotations": "^2.0", + "nikic/php-parser": "^5.3.0", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/extension-installer": "^1.0", + "phpstan/phpstan": "^2.0", + "phpstan/phpstan-phpunit": "^2.0", + "phpstan/phpstan-strict-rules": "^2.0", + "phpunit/phpunit": "^9.6", + "symfony/process": "^5.2" + }, + "type": "library", + "autoload": { + "psr-4": { + "PHPStan\\PhpDocParser\\": [ + "src/" + ] + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "description": "PHPDoc parser with support for nullable, intersection and generic types", + "support": { + "issues": "https://github.com/phpstan/phpdoc-parser/issues", + "source": "https://github.com/phpstan/phpdoc-parser/tree/2.3.2" + }, + "time": "2026-01-25T14:56:51+00:00" + }, + { + "name": "psr/container", + "version": "2.0.2", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionCommon.git", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b" + "url": "https://github.com/php-fig/container.git", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionCommon/zipball/1d01c49d4ed62f25aa84a747ad35d5a16924662b", - "reference": "1d01c49d4ed62f25aa84a747ad35d5a16924662b", + "url": "https://api.github.com/repos/php-fig/container/zipball/c71ecc56dfe541dbd90c5360474fbc405f8d5963", + "reference": "c71ecc56dfe541dbd90c5360474fbc405f8d5963", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0" + "php": ">=7.4.0" }, "type": "library", "extra": { "branch-alias": { - "dev-2.x": "2.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src/" + "Psr\\Container\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -723,58 +1950,52 @@ ], "authors": [ { - "name": "Jaap van Otterdijk", - "email": "opensource@ijaap.nl" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "Common reflection classes used by phpdocumentor to reflect the code structure", - "homepage": "http://www.phpdoc.org", + "description": "Common Container Interface (PHP FIG PSR-11)", + "homepage": "https://github.com/php-fig/container", "keywords": [ - "FQSEN", - "phpDocumentor", - "phpdoc", - "reflection", - "static analysis" + "PSR-11", + "container", + "container-interface", + "container-interop", + "psr" ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionCommon/issues", - "source": "https://github.com/phpDocumentor/ReflectionCommon/tree/2.x" + "issues": "https://github.com/php-fig/container/issues", + "source": "https://github.com/php-fig/container/tree/2.0.2" }, - "time": "2020-06-27T09:03:43+00:00" + "time": "2021-11-05T16:47:00+00:00" }, { - "name": "phpdocumentor/reflection-docblock", - "version": "5.2.2", + "name": "psr/http-factory", + "version": "1.1.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/ReflectionDocBlock.git", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556" + "url": "https://github.com/php-fig/http-factory.git", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/ReflectionDocBlock/zipball/069a785b2141f5bcf49f3e353548dc1cce6df556", - "reference": "069a785b2141f5bcf49f3e353548dc1cce6df556", + "url": "https://api.github.com/repos/php-fig/http-factory/zipball/2b4765fddfe3b508ac62f829e852b1501d3f6e8a", + "reference": "2b4765fddfe3b508ac62f829e852b1501d3f6e8a", "shasum": "" }, "require": { - "ext-filter": "*", - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.2", - "phpdocumentor/type-resolver": "^1.3", - "webmozart/assert": "^1.9.1" - }, - "require-dev": { - "mockery/mockery": "~1.3.2" + "php": ">=7.1", + "psr/http-message": "^1.0 || ^2.0" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "5.x-dev" + "dev-master": "1.0.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -783,52 +2004,52 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" - }, - { - "name": "Jaap van Otterdijk", - "email": "account@ijaap.nl" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "With this component, a library can provide support for annotations via DocBlocks or otherwise retrieve information that is embedded in a DocBlock.", + "description": "PSR-17: Common interfaces for PSR-7 HTTP message factories", + "keywords": [ + "factory", + "http", + "message", + "psr", + "psr-17", + "psr-7", + "request", + "response" + ], "support": { - "issues": "https://github.com/phpDocumentor/ReflectionDocBlock/issues", - "source": "https://github.com/phpDocumentor/ReflectionDocBlock/tree/master" + "source": "https://github.com/php-fig/http-factory" }, - "time": "2020-09-03T19:13:55+00:00" + "time": "2024-04-15T12:06:14+00:00" }, { - "name": "phpdocumentor/type-resolver", - "version": "1.5.1", + "name": "psr/http-message", + "version": "2.0", "source": { "type": "git", - "url": "https://github.com/phpDocumentor/TypeResolver.git", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae" + "url": "https://github.com/php-fig/http-message.git", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/phpDocumentor/TypeResolver/zipball/a12f7e301eb7258bb68acd89d4aefa05c2906cae", - "reference": "a12f7e301eb7258bb68acd89d4aefa05c2906cae", + "url": "https://api.github.com/repos/php-fig/http-message/zipball/402d35bcb92c70c026d1a6a9883f06b2ead23d71", + "reference": "402d35bcb92c70c026d1a6a9883f06b2ead23d71", "shasum": "" }, "require": { - "php": "^7.2 || ^8.0", - "phpdocumentor/reflection-common": "^2.0" - }, - "require-dev": { - "ext-tokenizer": "*", - "psalm/phar": "^4.8" + "php": "^7.2 || ^8.0" }, "type": "library", "extra": { "branch-alias": { - "dev-1.x": "1.x-dev" + "dev-master": "2.0.x-dev" } }, "autoload": { "psr-4": { - "phpDocumentor\\Reflection\\": "src" + "Psr\\Http\\Message\\": "src/" } }, "notification-url": "https://packagist.org/downloads/", @@ -837,38 +2058,51 @@ ], "authors": [ { - "name": "Mike van Riel", - "email": "me@mikevanriel.com" + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" } ], - "description": "A PSR-5 based resolver of Class names, Types and Structural Element Names", + "description": "Common interface for HTTP messages", + "homepage": "https://github.com/php-fig/http-message", + "keywords": [ + "http", + "http-message", + "psr", + "psr-7", + "request", + "response" + ], "support": { - "issues": "https://github.com/phpDocumentor/TypeResolver/issues", - "source": "https://github.com/phpDocumentor/TypeResolver/tree/1.5.1" + "source": "https://github.com/php-fig/http-message/tree/2.0" }, - "time": "2021-10-02T14:08:47+00:00" + "time": "2023-04-04T09:54:51+00:00" }, { - "name": "psr/container", - "version": "1.1.1", + "name": "psr/log", + "version": "3.0.2", "source": { "type": "git", - "url": "https://github.com/php-fig/container.git", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf" + "url": "https://github.com/php-fig/log.git", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/container/zipball/8622567409010282b7aeebe4bb841fe98b58dcaf", - "reference": "8622567409010282b7aeebe4bb841fe98b58dcaf", + "url": "https://api.github.com/repos/php-fig/log/zipball/f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", + "reference": "f16e1d5863e37f8d8c2a01719f5b34baa2b714d3", "shasum": "" }, "require": { - "php": ">=7.2.0" + "php": ">=8.0.0" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "3.x-dev" + } + }, "autoload": { "psr-4": { - "Psr\\Container\\": "src/" + "Psr\\Log\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -881,47 +2115,50 @@ "homepage": "https://www.php-fig.org/" } ], - "description": "Common Container Interface (PHP FIG PSR-11)", - "homepage": "https://github.com/php-fig/container", + "description": "Common interface for logging libraries", + "homepage": "https://github.com/php-fig/log", "keywords": [ - "PSR-11", - "container", - "container-interface", - "container-interop", - "psr" + "log", + "psr", + "psr-3" ], "support": { - "issues": "https://github.com/php-fig/container/issues", - "source": "https://github.com/php-fig/container/tree/1.1.1" + "source": "https://github.com/php-fig/log/tree/3.0.2" }, - "time": "2021-03-05T17:36:06+00:00" + "time": "2024-09-11T13:17:53+00:00" }, { - "name": "psr/log", - "version": "1.1.4", + "name": "revolt/event-loop", + "version": "v1.0.9", "source": { "type": "git", - "url": "https://github.com/php-fig/log.git", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11" + "url": "https://github.com/revoltphp/event-loop.git", + "reference": "44061cf513e53c6200372fc935ac42271566295d" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/php-fig/log/zipball/d49695b909c3b7628b6289db5479a1c204601f11", - "reference": "d49695b909c3b7628b6289db5479a1c204601f11", + "url": "https://api.github.com/repos/revoltphp/event-loop/zipball/44061cf513e53c6200372fc935ac42271566295d", + "reference": "44061cf513e53c6200372fc935ac42271566295d", "shasum": "" }, "require": { - "php": ">=5.3.0" + "php": ">=8.1" + }, + "require-dev": { + "ext-json": "*", + "jetbrains/phpstorm-stubs": "^2019.3", + "phpunit/phpunit": "^9", + "psalm/phar": "6.16.*" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "1.1.x-dev" + "dev-main": "1.x-dev" } }, "autoload": { "psr-4": { - "Psr\\Log\\": "Psr/Log/" + "Revolt\\": "src" } }, "notification-url": "https://packagist.org/downloads/", @@ -930,47 +2167,63 @@ ], "authors": [ { - "name": "PHP-FIG", - "homepage": "https://www.php-fig.org/" + "name": "Aaron Piotrowski", + "email": "aaron@trowski.com" + }, + { + "name": "Cees-Jan Kiewiet", + "email": "ceesjank@gmail.com" + }, + { + "name": "Christian Lück", + "email": "christian@clue.engineering" + }, + { + "name": "Niklas Keller", + "email": "me@kelunik.com" } ], - "description": "Common interface for logging libraries", - "homepage": "https://github.com/php-fig/log", + "description": "Rock-solid event loop for concurrent PHP applications.", "keywords": [ - "log", - "psr", - "psr-3" + "async", + "asynchronous", + "concurrency", + "event", + "event-loop", + "non-blocking", + "scheduler" ], "support": { - "source": "https://github.com/php-fig/log/tree/1.1.4" + "issues": "https://github.com/revoltphp/event-loop/issues", + "source": "https://github.com/revoltphp/event-loop/tree/v1.0.9" }, - "time": "2021-05-03T11:20:27+00:00" + "time": "2026-05-16T17:55:38+00:00" }, { "name": "sebastian/diff", - "version": "4.0.4", + "version": "5.1.1", "source": { "type": "git", "url": "https://github.com/sebastianbergmann/diff.git", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d" + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/3461e3fccc7cfdfc2720be910d3bd73c69be590d", - "reference": "3461e3fccc7cfdfc2720be910d3bd73c69be590d", + "url": "https://api.github.com/repos/sebastianbergmann/diff/zipball/c41e007b4b62af48218231d6c2275e4c9b975b2e", + "reference": "c41e007b4b62af48218231d6c2275e4c9b975b2e", "shasum": "" }, "require": { - "php": ">=7.3" + "php": ">=8.1" }, "require-dev": { - "phpunit/phpunit": "^9.3", - "symfony/process": "^4.2 || ^5" + "phpunit/phpunit": "^10.0", + "symfony/process": "^6.4" }, "type": "library", "extra": { "branch-alias": { - "dev-master": "4.0-dev" + "dev-main": "5.1-dev" } }, "autoload": { @@ -1002,7 +2255,8 @@ ], "support": { "issues": "https://github.com/sebastianbergmann/diff/issues", - "source": "https://github.com/sebastianbergmann/diff/tree/4.0.4" + "security": "https://github.com/sebastianbergmann/diff/security/policy", + "source": "https://github.com/sebastianbergmann/diff/tree/5.1.1" }, "funding": [ { @@ -1010,41 +2264,104 @@ "type": "github" } ], - "time": "2020-10-26T13:10:38+00:00" + "time": "2024-03-02T07:15:17+00:00" + }, + { + "name": "spatie/array-to-xml", + "version": "3.4.4", + "source": { + "type": "git", + "url": "https://github.com/spatie/array-to-xml.git", + "reference": "88b2f3852a922dd73177a68938f8eb2ec70c7224" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/spatie/array-to-xml/zipball/88b2f3852a922dd73177a68938f8eb2ec70c7224", + "reference": "88b2f3852a922dd73177a68938f8eb2ec70c7224", + "shasum": "" + }, + "require": { + "ext-dom": "*", + "php": "^8.0" + }, + "require-dev": { + "mockery/mockery": "^1.2", + "pestphp/pest": "^1.21", + "spatie/pest-plugin-snapshots": "^1.1" + }, + "type": "library", + "extra": { + "branch-alias": { + "dev-main": "3.x-dev" + } + }, + "autoload": { + "psr-4": { + "Spatie\\ArrayToXml\\": "src" + } + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Freek Van der Herten", + "email": "freek@spatie.be", + "homepage": "https://freek.dev", + "role": "Developer" + } + ], + "description": "Convert an array to xml", + "homepage": "https://github.com/spatie/array-to-xml", + "keywords": [ + "array", + "convert", + "xml" + ], + "support": { + "source": "https://github.com/spatie/array-to-xml/tree/3.4.4" + }, + "funding": [ + { + "url": "https://spatie.be/open-source/support-us", + "type": "custom" + }, + { + "url": "https://github.com/spatie", + "type": "github" + } + ], + "time": "2025-12-15T09:00:41+00:00" }, { "name": "squizlabs/php_codesniffer", - "version": "3.6.0", + "version": "4.0.1", "source": { "type": "git", - "url": "https://github.com/squizlabs/PHP_CodeSniffer.git", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625" + "url": "https://github.com/PHPCSStandards/PHP_CodeSniffer.git", + "reference": "0525c73950de35ded110cffafb9892946d7771b5" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/squizlabs/PHP_CodeSniffer/zipball/ffced0d2c8fa8e6cdc4d695a743271fab6c38625", - "reference": "ffced0d2c8fa8e6cdc4d695a743271fab6c38625", + "url": "https://api.github.com/repos/PHPCSStandards/PHP_CodeSniffer/zipball/0525c73950de35ded110cffafb9892946d7771b5", + "reference": "0525c73950de35ded110cffafb9892946d7771b5", "shasum": "" }, "require": { "ext-simplexml": "*", "ext-tokenizer": "*", "ext-xmlwriter": "*", - "php": ">=5.4.0" + "php": ">=7.2.0" }, "require-dev": { - "phpunit/phpunit": "^4.0 || ^5.0 || ^6.0 || ^7.0" + "phpunit/phpunit": "^8.4.0 || ^9.3.4 || ^10.5.32 || 11.3.3 - 11.5.28 || ^11.5.31" }, "bin": [ - "bin/phpcs", - "bin/phpcbf" + "bin/phpcbf", + "bin/phpcs" ], "type": "library", - "extra": { - "branch-alias": { - "dev-master": "3.x-dev" - } - }, "notification-url": "https://packagist.org/downloads/", "license": [ "BSD-3-Clause" @@ -1052,70 +2369,93 @@ "authors": [ { "name": "Greg Sherwood", - "role": "lead" + "role": "Former lead" + }, + { + "name": "Juliette Reinders Folmer", + "role": "Current lead" + }, + { + "name": "Contributors", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer/graphs/contributors" } ], - "description": "PHP_CodeSniffer tokenizes PHP, JavaScript and CSS files and detects violations of a defined set of coding standards.", - "homepage": "https://github.com/squizlabs/PHP_CodeSniffer", + "description": "PHP_CodeSniffer tokenizes PHP files and detects violations of a defined set of coding standards.", + "homepage": "https://github.com/PHPCSStandards/PHP_CodeSniffer", "keywords": [ "phpcs", - "standards" + "standards", + "static analysis" ], "support": { - "issues": "https://github.com/squizlabs/PHP_CodeSniffer/issues", - "source": "https://github.com/squizlabs/PHP_CodeSniffer", - "wiki": "https://github.com/squizlabs/PHP_CodeSniffer/wiki" + "issues": "https://github.com/PHPCSStandards/PHP_CodeSniffer/issues", + "security": "https://github.com/PHPCSStandards/PHP_CodeSniffer/security/policy", + "source": "https://github.com/PHPCSStandards/PHP_CodeSniffer", + "wiki": "https://github.com/PHPCSStandards/PHP_CodeSniffer/wiki" }, - "time": "2021-04-09T00:54:41+00:00" + "funding": [ + { + "url": "https://github.com/PHPCSStandards", + "type": "github" + }, + { + "url": "https://github.com/jrfnl", + "type": "github" + }, + { + "url": "https://opencollective.com/php_codesniffer", + "type": "open_collective" + }, + { + "url": "https://thanks.dev/u/gh/phpcsstandards", + "type": "thanks_dev" + } + ], + "time": "2025-11-10T16:43:36+00:00" }, { "name": "symfony/console", - "version": "v5.3.7", + "version": "v6.4.41", "source": { "type": "git", "url": "https://github.com/symfony/console.git", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a" + "reference": "d21b17ed158e79180fac3895ff751707970eeb57" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/console/zipball/8b1008344647462ae6ec57559da166c2bfa5e16a", - "reference": "8b1008344647462ae6ec57559da166c2bfa5e16a", + "url": "https://api.github.com/repos/symfony/console/zipball/d21b17ed158e79180fac3895ff751707970eeb57", + "reference": "d21b17ed158e79180fac3895ff751707970eeb57", "shasum": "" }, "require": { - "php": ">=7.2.5", - "symfony/deprecation-contracts": "^2.1", + "php": ">=8.1", + "symfony/deprecation-contracts": "^2.5|^3", "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php73": "^1.8", - "symfony/polyfill-php80": "^1.16", - "symfony/service-contracts": "^1.1|^2", - "symfony/string": "^5.1" + "symfony/service-contracts": "^2.5|^3", + "symfony/string": "^5.4|^6.0|^7.0" }, "conflict": { - "psr/log": ">=3", - "symfony/dependency-injection": "<4.4", - "symfony/dotenv": "<5.1", - "symfony/event-dispatcher": "<4.4", - "symfony/lock": "<4.4", - "symfony/process": "<4.4" + "symfony/dependency-injection": "<5.4", + "symfony/dotenv": "<5.4", + "symfony/event-dispatcher": "<5.4", + "symfony/lock": "<5.4", + "symfony/process": "<5.4" }, "provide": { - "psr/log-implementation": "1.0|2.0" + "psr/log-implementation": "1.0|2.0|3.0" }, "require-dev": { - "psr/log": "^1|^2", - "symfony/config": "^4.4|^5.0", - "symfony/dependency-injection": "^4.4|^5.0", - "symfony/event-dispatcher": "^4.4|^5.0", - "symfony/lock": "^4.4|^5.0", - "symfony/process": "^4.4|^5.0", - "symfony/var-dumper": "^4.4|^5.0" - }, - "suggest": { - "psr/log": "For using the console logger", - "symfony/event-dispatcher": "", - "symfony/lock": "", - "symfony/process": "" + "psr/log": "^1|^2|^3", + "symfony/config": "^5.4|^6.0|^7.0", + "symfony/dependency-injection": "^5.4|^6.0|^7.0", + "symfony/event-dispatcher": "^5.4|^6.0|^7.0", + "symfony/http-foundation": "^6.4|^7.0", + "symfony/http-kernel": "^6.4|^7.0", + "symfony/lock": "^5.4|^6.0|^7.0", + "symfony/messenger": "^5.4|^6.0|^7.0", + "symfony/process": "^5.4|^6.0|^7.0", + "symfony/stopwatch": "^5.4|^6.0|^7.0", + "symfony/var-dumper": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { @@ -1144,12 +2484,12 @@ "homepage": "https://symfony.com", "keywords": [ "cli", - "command line", + "command-line", "console", "terminal" ], "support": { - "source": "https://github.com/symfony/console/tree/v5.3.7" + "source": "https://github.com/symfony/console/tree/v6.4.41" }, "funding": [ { @@ -1160,38 +2500,42 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-08-25T20:02:16+00:00" + "time": "2026-05-24T08:48:41+00:00" }, { "name": "symfony/deprecation-contracts", - "version": "v2.4.0", + "version": "v3.7.0", "source": { "type": "git", "url": "https://github.com/symfony/deprecation-contracts.git", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627" + "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/5f38c8804a9e97d23e0c8d63341088cd8a22d627", - "reference": "5f38c8804a9e97d23e0c8d63341088cd8a22d627", + "url": "https://api.github.com/repos/symfony/deprecation-contracts/zipball/50f59d1f3ca46d41ac911f97a78626b6756af35b", + "reference": "50f59d1f3ca46d41ac911f97a78626b6756af35b", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=8.1" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" } }, "autoload": { @@ -1205,18 +2549,88 @@ ], "authors": [ { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" + "name": "Nicolas Grekas", + "email": "p@tchwork.com" + }, + { + "name": "Symfony Community", + "homepage": "https://symfony.com/contributors" + } + ], + "description": "A generic function and convention to trigger deprecation notices", + "homepage": "https://symfony.com", + "support": { + "source": "https://github.com/symfony/deprecation-contracts/tree/v3.7.0" + }, + "funding": [ + { + "url": "https://symfony.com/sponsor", + "type": "custom" + }, + { + "url": "https://github.com/fabpot", + "type": "github" + }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, + { + "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", + "type": "tidelift" + } + ], + "time": "2026-04-13T15:52:40+00:00" + }, + { + "name": "symfony/filesystem", + "version": "v6.4.39", + "source": { + "type": "git", + "url": "https://github.com/symfony/filesystem.git", + "reference": "c507b077756b4e3e09adbbe7975fac81cd3722ca" + }, + "dist": { + "type": "zip", + "url": "https://api.github.com/repos/symfony/filesystem/zipball/c507b077756b4e3e09adbbe7975fac81cd3722ca", + "reference": "c507b077756b4e3e09adbbe7975fac81cd3722ca", + "shasum": "" + }, + "require": { + "php": ">=8.1", + "symfony/polyfill-ctype": "~1.8", + "symfony/polyfill-mbstring": "~1.8" + }, + "require-dev": { + "symfony/process": "^5.4|^6.4|^7.0" + }, + "type": "library", + "autoload": { + "psr-4": { + "Symfony\\Component\\Filesystem\\": "" + }, + "exclude-from-classmap": [ + "/Tests/" + ] + }, + "notification-url": "https://packagist.org/downloads/", + "license": [ + "MIT" + ], + "authors": [ + { + "name": "Fabien Potencier", + "email": "fabien@symfony.com" }, { "name": "Symfony Community", "homepage": "https://symfony.com/contributors" } ], - "description": "A generic function and convention to trigger deprecation notices", + "description": "Provides basic utilities for the filesystem", "homepage": "https://symfony.com", "support": { - "source": "https://github.com/symfony/deprecation-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/filesystem/tree/v6.4.39" }, "funding": [ { @@ -1227,50 +2641,54 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-03-23T23:28:01+00:00" + "time": "2026-05-07T13:11:42+00:00" }, { "name": "symfony/polyfill-ctype", - "version": "v1.23.0", + "version": "v1.37.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-ctype.git", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce" + "reference": "141046a8f9477948ff284fa65be2095baafb94f2" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/46cd95797e9df938fdd2b03693b5fca5e64b01ce", - "reference": "46cd95797e9df938fdd2b03693b5fca5e64b01ce", + "url": "https://api.github.com/repos/symfony/polyfill-ctype/zipball/141046a8f9477948ff284fa65be2095baafb94f2", + "reference": "141046a8f9477948ff284fa65be2095baafb94f2", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" + }, + "provide": { + "ext-ctype": "*" }, "suggest": { "ext-ctype": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Ctype\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Ctype\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1295,7 +2713,7 @@ "portable" ], "support": { - "source": "https://github.com/symfony/polyfill-ctype/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-ctype/tree/v1.37.0" }, "funding": [ { @@ -1306,50 +2724,51 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2026-04-10T16:19:22+00:00" }, { "name": "symfony/polyfill-intl-grapheme", - "version": "v1.23.1", + "version": "v1.38.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-grapheme.git", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535" + "reference": "e9247d281d694a5120554d9afaf54e070e88a603" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/16880ba9c5ebe3642d1995ab866db29270b36535", - "reference": "16880ba9c5ebe3642d1995ab866db29270b36535", + "url": "https://api.github.com/repos/symfony/polyfill-intl-grapheme/zipball/e9247d281d694a5120554d9afaf54e070e88a603", + "reference": "e9247d281d694a5120554d9afaf54e070e88a603", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Grapheme\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Grapheme\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1376,7 +2795,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-intl-grapheme/tree/v1.38.1" }, "funding": [ { @@ -1387,50 +2806,51 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-05-27T12:26:48+00:00" + "time": "2026-05-26T05:58:03+00:00" }, { "name": "symfony/polyfill-intl-normalizer", - "version": "v1.23.0", + "version": "v1.38.0", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-intl-normalizer.git", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8" + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/8590a5f561694770bdcd3f9b5c69dde6945028e8", - "reference": "8590a5f561694770bdcd3f9b5c69dde6945028e8", + "url": "https://api.github.com/repos/symfony/polyfill-intl-normalizer/zipball/2d446c214bdbe5b71bde5011b060a05fece3ae6b", + "reference": "2d446c214bdbe5b71bde5011b060a05fece3ae6b", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "suggest": { "ext-intl": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Intl\\Normalizer\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Intl\\Normalizer\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1460,7 +2880,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.23.0" + "source": "https://github.com/symfony/polyfill-intl-normalizer/tree/v1.38.0" }, "funding": [ { @@ -1471,50 +2891,55 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2026-05-25T13:48:31+00:00" }, { "name": "symfony/polyfill-mbstring", - "version": "v1.23.1", + "version": "v1.38.1", "source": { "type": "git", "url": "https://github.com/symfony/polyfill-mbstring.git", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6" + "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/9174a3d80210dca8daa7f31fec659150bbeabfc6", - "reference": "9174a3d80210dca8daa7f31fec659150bbeabfc6", + "url": "https://api.github.com/repos/symfony/polyfill-mbstring/zipball/14c5439eec4ccff081ac14eca2dc57feb2a66d92", + "reference": "14c5439eec4ccff081ac14eca2dc57feb2a66d92", "shasum": "" }, "require": { - "php": ">=7.1" + "ext-iconv": "*", + "php": ">=7.2" + }, + "provide": { + "ext-mbstring": "*" }, "suggest": { "ext-mbstring": "For best performance" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Mbstring\\": "" - }, "files": [ "bootstrap.php" - ] + ], + "psr-4": { + "Symfony\\Polyfill\\Mbstring\\": "" + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1540,7 +2965,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-mbstring/tree/v1.38.1" }, "funding": [ { @@ -1552,82 +2977,7 @@ "type": "github" }, { - "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", - "type": "tidelift" - } - ], - "time": "2021-05-27T12:26:48+00:00" - }, - { - "name": "symfony/polyfill-php73", - "version": "v1.23.0", - "source": { - "type": "git", - "url": "https://github.com/symfony/polyfill-php73.git", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php73/zipball/fba8933c384d6476ab14fb7b8526e5287ca7e010", - "reference": "fba8933c384d6476ab14fb7b8526e5287ca7e010", - "shasum": "" - }, - "require": { - "php": ">=7.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, - "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" - } - }, - "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php73\\": "" - }, - "files": [ - "bootstrap.php" - ], - "classmap": [ - "Resources/stubs" - ] - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Nicolas Grekas", - "email": "p@tchwork.com" - }, - { - "name": "Symfony Community", - "homepage": "https://symfony.com/contributors" - } - ], - "description": "Symfony polyfill backporting some PHP 7.3+ features to lower PHP versions", - "homepage": "https://symfony.com", - "keywords": [ - "compatibility", - "polyfill", - "portable", - "shim" - ], - "support": { - "source": "https://github.com/symfony/polyfill-php73/tree/v1.23.0" - }, - "funding": [ - { - "url": "https://symfony.com/sponsor", - "type": "custom" - }, - { - "url": "https://github.com/fabpot", + "url": "https://github.com/nicolas-grekas", "type": "github" }, { @@ -1635,42 +2985,39 @@ "type": "tidelift" } ], - "time": "2021-02-19T12:13:01+00:00" + "time": "2026-05-26T12:51:13+00:00" }, { - "name": "symfony/polyfill-php80", - "version": "v1.23.1", + "name": "symfony/polyfill-php84", + "version": "v1.38.1", "source": { "type": "git", - "url": "https://github.com/symfony/polyfill-php80.git", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be" + "url": "https://github.com/symfony/polyfill-php84.git", + "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/polyfill-php80/zipball/1100343ed1a92e3a38f9ae122fc0eb21602547be", - "reference": "1100343ed1a92e3a38f9ae122fc0eb21602547be", + "url": "https://api.github.com/repos/symfony/polyfill-php84/zipball/f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", + "reference": "f4e1dfaee5b74aba5964fe1fd4dfc7ba5e3085fa", "shasum": "" }, "require": { - "php": ">=7.1" + "php": ">=7.2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "1.23-dev" - }, "thanks": { - "name": "symfony/polyfill", - "url": "https://github.com/symfony/polyfill" + "url": "https://github.com/symfony/polyfill", + "name": "symfony/polyfill" } }, "autoload": { - "psr-4": { - "Symfony\\Polyfill\\Php80\\": "" - }, "files": [ "bootstrap.php" ], + "psr-4": { + "Symfony\\Polyfill\\Php84\\": "" + }, "classmap": [ "Resources/stubs" ] @@ -1680,10 +3027,6 @@ "MIT" ], "authors": [ - { - "name": "Ion Bazan", - "email": "ion.bazan@gmail.com" - }, { "name": "Nicolas Grekas", "email": "p@tchwork.com" @@ -1693,7 +3036,7 @@ "homepage": "https://symfony.com/contributors" } ], - "description": "Symfony polyfill backporting some PHP 8.0+ features to lower PHP versions", + "description": "Symfony polyfill backporting some PHP 8.4+ features to lower PHP versions", "homepage": "https://symfony.com", "keywords": [ "compatibility", @@ -1702,7 +3045,7 @@ "shim" ], "support": { - "source": "https://github.com/symfony/polyfill-php80/tree/v1.23.1" + "source": "https://github.com/symfony/polyfill-php84/tree/v1.38.1" }, "funding": [ { @@ -1713,48 +3056,56 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-07-28T13:41:28+00:00" + "time": "2026-05-26T12:51:13+00:00" }, { "name": "symfony/service-contracts", - "version": "v2.4.0", + "version": "v3.7.0", "source": { "type": "git", "url": "https://github.com/symfony/service-contracts.git", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb" + "reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/service-contracts/zipball/f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", - "reference": "f040a30e04b57fbcc9c6cbcf4dbaa96bd318b9bb", + "url": "https://api.github.com/repos/symfony/service-contracts/zipball/d25d82433a80eba6aa0e6c24b61d7370d99e444a", + "reference": "d25d82433a80eba6aa0e6c24b61d7370d99e444a", "shasum": "" }, "require": { - "php": ">=7.2.5", - "psr/container": "^1.1" + "php": ">=8.1", + "psr/container": "^1.1|^2.0", + "symfony/deprecation-contracts": "^2.5|^3" }, - "suggest": { - "symfony/service-implementation": "" + "conflict": { + "ext-psr": "<1.1|>=2" }, "type": "library", "extra": { - "branch-alias": { - "dev-main": "2.4-dev" - }, "thanks": { - "name": "symfony/contracts", - "url": "https://github.com/symfony/contracts" + "url": "https://github.com/symfony/contracts", + "name": "symfony/contracts" + }, + "branch-alias": { + "dev-main": "3.7-dev" } }, "autoload": { "psr-4": { "Symfony\\Contracts\\Service\\": "" - } + }, + "exclude-from-classmap": [ + "/Test/" + ] }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1781,7 +3132,7 @@ "standards" ], "support": { - "source": "https://github.com/symfony/service-contracts/tree/v2.4.0" + "source": "https://github.com/symfony/service-contracts/tree/v3.7.0" }, "funding": [ { @@ -1792,49 +3143,55 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-04-01T10:43:52+00:00" + "time": "2026-03-28T09:44:51+00:00" }, { "name": "symfony/string", - "version": "v5.3.7", + "version": "v6.4.39", "source": { "type": "git", "url": "https://github.com/symfony/string.git", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5" + "reference": "62e3c927de664edadb5bef260987eb047a17a113" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/symfony/string/zipball/8d224396e28d30f81969f083a58763b8b9ceb0a5", - "reference": "8d224396e28d30f81969f083a58763b8b9ceb0a5", + "url": "https://api.github.com/repos/symfony/string/zipball/62e3c927de664edadb5bef260987eb047a17a113", + "reference": "62e3c927de664edadb5bef260987eb047a17a113", "shasum": "" }, "require": { - "php": ">=7.2.5", + "php": ">=8.1", "symfony/polyfill-ctype": "~1.8", "symfony/polyfill-intl-grapheme": "~1.0", "symfony/polyfill-intl-normalizer": "~1.0", - "symfony/polyfill-mbstring": "~1.0", - "symfony/polyfill-php80": "~1.15" + "symfony/polyfill-mbstring": "~1.0" + }, + "conflict": { + "symfony/translation-contracts": "<2.5" }, "require-dev": { - "symfony/error-handler": "^4.4|^5.0", - "symfony/http-client": "^4.4|^5.0", - "symfony/translation-contracts": "^1.1|^2", - "symfony/var-exporter": "^4.4|^5.0" + "symfony/http-client": "^5.4|^6.0|^7.0", + "symfony/intl": "^6.2|^7.0", + "symfony/translation-contracts": "^2.5|^3.0", + "symfony/var-exporter": "^5.4|^6.0|^7.0" }, "type": "library", "autoload": { - "psr-4": { - "Symfony\\Component\\String\\": "" - }, "files": [ "Resources/functions.php" ], + "psr-4": { + "Symfony\\Component\\String\\": "" + }, "exclude-from-classmap": [ "/Tests/" ] @@ -1864,7 +3221,7 @@ "utf8" ], "support": { - "source": "https://github.com/symfony/string/tree/v5.3.7" + "source": "https://github.com/symfony/string/tree/v6.4.39" }, "funding": [ { @@ -1875,95 +3232,107 @@ "url": "https://github.com/fabpot", "type": "github" }, + { + "url": "https://github.com/nicolas-grekas", + "type": "github" + }, { "url": "https://tidelift.com/funding/github/packagist/symfony/symfony", "type": "tidelift" } ], - "time": "2021-08-26T08:00:08+00:00" + "time": "2026-05-12T11:44:19+00:00" }, { "name": "vimeo/psalm", - "version": "3.18.2", + "version": "6.16.1", "source": { "type": "git", "url": "https://github.com/vimeo/psalm.git", - "reference": "19aa905f7c3c7350569999a93c40ae91ae4e1626" + "reference": "f1f5de594dc76faf8784e02d3dc4716c91c6f6ac" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/vimeo/psalm/zipball/19aa905f7c3c7350569999a93c40ae91ae4e1626", - "reference": "19aa905f7c3c7350569999a93c40ae91ae4e1626", + "url": "https://api.github.com/repos/vimeo/psalm/zipball/f1f5de594dc76faf8784e02d3dc4716c91c6f6ac", + "reference": "f1f5de594dc76faf8784e02d3dc4716c91c6f6ac", "shasum": "" }, "require": { - "amphp/amp": "^2.1", - "amphp/byte-stream": "^1.5", - "composer/package-versions-deprecated": "^1.8.0", + "amphp/amp": "^3", + "amphp/byte-stream": "^2", + "amphp/parallel": "^2.3", + "composer-runtime-api": "^2", "composer/semver": "^1.4 || ^2.0 || ^3.0", - "composer/xdebug-handler": "^1.1", + "composer/xdebug-handler": "^2.0 || ^3.0", + "danog/advanced-json-rpc": "^3.1", "dnoegel/php-xdg-base-dir": "^0.1.1", + "ext-ctype": "*", "ext-dom": "*", "ext-json": "*", "ext-libxml": "*", "ext-mbstring": "*", "ext-simplexml": "*", "ext-tokenizer": "*", - "felixfbecker/advanced-json-rpc": "^3.0.3", - "felixfbecker/language-server-protocol": "^1.4", - "netresearch/jsonmapper": "^1.0 || ^2.0 || ^3.0", - "nikic/php-parser": "4.3.* || 4.4.* || 4.5.* || 4.6.* || ^4.8", - "openlss/lib-array2xml": "^1.0", - "php": "^7.1.3|^8", - "sebastian/diff": "^3.0 || ^4.0", - "symfony/console": "^3.4.17 || ^4.1.6 || ^5.0", - "webmozart/glob": "^4.1", - "webmozart/path-util": "^2.3" + "felixfbecker/language-server-protocol": "^1.5.3", + "fidry/cpu-core-counter": "^0.4.1 || ^0.5.1 || ^1.0.0", + "netresearch/jsonmapper": "^5.0", + "nikic/php-parser": "^5.0.0", + "php": "~8.1.31 || ~8.2.27 || ~8.3.16 || ~8.4.3 || ~8.5.0", + "sebastian/diff": "^4.0 || ^5.0 || ^6.0 || ^7.0 || ^8.0", + "spatie/array-to-xml": "^2.17.0 || ^3.0", + "symfony/console": "^6.0 || ^7.0 || ^8.0", + "symfony/filesystem": "~6.3.12 || ~6.4.3 || ^7.0.3 || ^8.0", + "symfony/polyfill-php84": "^1.31.0" }, "provide": { "psalm/psalm": "self.version" }, "require-dev": { - "amphp/amp": "^2.4.2", - "bamarni/composer-bin-plugin": "^1.2", - "brianium/paratest": "^4.0.0", + "amphp/phpunit-util": "^3", + "bamarni/composer-bin-plugin": "^1.4", + "brianium/paratest": "^6.9", + "danog/class-finder": "^0.4.8", + "dg/bypass-finals": "^1.5", "ext-curl": "*", - "phpdocumentor/reflection-docblock": "^4.3.4 || ^5", - "phpmyadmin/sql-parser": "5.1.0", - "phpspec/prophecy": ">=1.9.0", - "phpunit/phpunit": "^7.5.16 || ^8.5 || ^9.0", - "psalm/plugin-phpunit": "^0.11", - "slevomat/coding-standard": "^5.0", - "squizlabs/php_codesniffer": "^3.5", - "symfony/process": "^4.3", - "weirdan/prophecy-shim": "^1.0 || ^2.0" + "mockery/mockery": "^1.5", + "nunomaduro/mock-final-classes": "^1.1", + "php-parallel-lint/php-parallel-lint": "^1.2", + "phpstan/phpdoc-parser": "^1.6", + "phpunit/phpunit": "^9.6", + "psalm/plugin-mockery": "^1.1", + "psalm/plugin-phpunit": "^0.19", + "slevomat/coding-standard": "^8.4", + "squizlabs/php_codesniffer": "^3.6", + "symfony/process": "^6.0 || ^7.0 || ^8.0" }, "suggest": { - "ext-igbinary": "^2.0.5" + "ext-curl": "In order to send data to shepherd", + "ext-igbinary": "^2.0.5 is required, used to serialize caching data" }, "bin": [ "psalm", "psalm-language-server", "psalm-plugin", "psalm-refactor", + "psalm-review", "psalter" ], - "type": "library", + "type": "project", "extra": { "branch-alias": { - "dev-master": "3.x-dev", + "dev-1.x": "1.x-dev", "dev-2.x": "2.x-dev", - "dev-1.x": "1.x-dev" + "dev-3.x": "3.x-dev", + "dev-4.x": "4.x-dev", + "dev-5.x": "5.x-dev", + "dev-6.x": "6.x-dev", + "dev-master": "7.x-dev" } }, "autoload": { "psr-4": { "Psalm\\": "src/Psalm/" - }, - "files": [ - "src/functions.php", - "src/spl_object_id.php" - ] + } }, "notification-url": "https://packagist.org/downloads/", "license": [ @@ -1972,46 +3341,57 @@ "authors": [ { "name": "Matthew Brown" + }, + { + "name": "Daniil Gentili", + "email": "daniil@daniil.it" } ], "description": "A static analysis tool for finding errors in PHP applications", "keywords": [ "code", "inspection", - "php" + "php", + "static analysis" ], "support": { + "docs": "https://psalm.dev/docs", "issues": "https://github.com/vimeo/psalm/issues", - "source": "https://github.com/vimeo/psalm/tree/3.18.2" + "source": "https://github.com/vimeo/psalm" }, - "time": "2020-10-20T13:48:22+00:00" + "time": "2026-03-19T10:56:09+00:00" }, { "name": "webmozart/assert", - "version": "1.9.1", + "version": "1.12.1", "source": { "type": "git", "url": "https://github.com/webmozarts/assert.git", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389" + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68" }, "dist": { "type": "zip", - "url": "https://api.github.com/repos/webmozarts/assert/zipball/bafc69caeb4d49c39fd0779086c03a3738cbb389", - "reference": "bafc69caeb4d49c39fd0779086c03a3738cbb389", + "url": "https://api.github.com/repos/webmozarts/assert/zipball/9be6926d8b485f55b9229203f962b51ed377ba68", + "reference": "9be6926d8b485f55b9229203f962b51ed377ba68", "shasum": "" }, "require": { - "php": "^5.3.3 || ^7.0 || ^8.0", - "symfony/polyfill-ctype": "^1.8" - }, - "conflict": { - "phpstan/phpstan": "<0.12.20", - "vimeo/psalm": "<3.9.1" + "ext-ctype": "*", + "ext-date": "*", + "ext-filter": "*", + "php": "^7.2 || ^8.0" }, - "require-dev": { - "phpunit/phpunit": "^4.8.36 || ^7.5.13" + "suggest": { + "ext-intl": "", + "ext-simplexml": "", + "ext-spl": "" }, "type": "library", + "extra": { + "branch-alias": { + "dev-master": "1.10-dev" + } + }, "autoload": { "psr-4": { "Webmozart\\Assert\\": "src/" @@ -2035,119 +3415,19 @@ ], "support": { "issues": "https://github.com/webmozarts/assert/issues", - "source": "https://github.com/webmozarts/assert/tree/1.9.1" - }, - "time": "2020-07-08T17:02:28+00:00" - }, - { - "name": "webmozart/glob", - "version": "4.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozarts/glob.git", - "reference": "06358fafde0f32edb4513f4fd88fe113a40c90ee" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozarts/glob/zipball/06358fafde0f32edb4513f4fd88fe113a40c90ee", - "reference": "06358fafde0f32edb4513f4fd88fe113a40c90ee", - "shasum": "" - }, - "require": { - "php": "^7.3 || ^8.0.0", - "webmozart/path-util": "^2.2" - }, - "require-dev": { - "phpunit/phpunit": "^8.0", - "symfony/filesystem": "^5.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "4.1-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\Glob\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A PHP implementation of Ant's glob.", - "support": { - "issues": "https://github.com/webmozarts/glob/issues", - "source": "https://github.com/webmozarts/glob/tree/4.3.0" - }, - "time": "2021-01-21T06:17:15+00:00" - }, - { - "name": "webmozart/path-util", - "version": "2.3.0", - "source": { - "type": "git", - "url": "https://github.com/webmozart/path-util.git", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725" - }, - "dist": { - "type": "zip", - "url": "https://api.github.com/repos/webmozart/path-util/zipball/d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "reference": "d939f7edc24c9a1bb9c0dee5cb05d8e859490725", - "shasum": "" - }, - "require": { - "php": ">=5.3.3", - "webmozart/assert": "~1.0" - }, - "require-dev": { - "phpunit/phpunit": "^4.6", - "sebastian/version": "^1.0.1" - }, - "type": "library", - "extra": { - "branch-alias": { - "dev-master": "2.3-dev" - } - }, - "autoload": { - "psr-4": { - "Webmozart\\PathUtil\\": "src/" - } - }, - "notification-url": "https://packagist.org/downloads/", - "license": [ - "MIT" - ], - "authors": [ - { - "name": "Bernhard Schussek", - "email": "bschussek@gmail.com" - } - ], - "description": "A robust cross-platform utility for normalizing, comparing and modifying file paths.", - "support": { - "issues": "https://github.com/webmozart/path-util/issues", - "source": "https://github.com/webmozart/path-util/tree/2.3.0" + "source": "https://github.com/webmozarts/assert/tree/1.12.1" }, - "time": "2015-12-17T08:42:14+00:00" + "time": "2025-10-29T15:56:20+00:00" } ], "aliases": [], "minimum-stability": "stable", - "stability-flags": [], + "stability-flags": {}, "prefer-stable": false, "prefer-lowest": false, "platform": { - "php": ">=7.4" + "php": ">=8.1" }, - "platform-dev": [], - "plugin-api-version": "2.1.0" + "platform-dev": {}, + "plugin-api-version": "2.9.0" } diff --git a/src/Acl/Adapter/AbstractAdapter.php b/src/Acl/Adapter/AbstractAdapter.php index 5f40dca5..f703903f 100644 --- a/src/Acl/Adapter/AbstractAdapter.php +++ b/src/Acl/Adapter/AbstractAdapter.php @@ -21,9 +21,9 @@ abstract class AbstractAdapter extends AbstractEventsAware implements \Phalcon\A /** * Access Granted * - * @var bool + * @var int */ - protected $accessGranted = false; + protected $accessGranted = Enum::DENY; /** * Active access which the list is checking if some role can access it diff --git a/src/Acl/Adapter/AdapterInterface.php b/src/Acl/Adapter/AdapterInterface.php index 851d7d7a..f155408d 100644 --- a/src/Acl/Adapter/AdapterInterface.php +++ b/src/Acl/Adapter/AdapterInterface.php @@ -156,10 +156,10 @@ public function getRoles(): array; * @param mixed $roleName * @param mixed $componentName * @param string $access - * @param array $parameters + * @param array|null $parameters * @return bool */ - public function isAllowed($roleName, $componentName, string $access, array $parameters = null): bool; + public function isAllowed($roleName, $componentName, string $access, ?array $parameters = null): bool; /** * Check whether component exist in the components list diff --git a/src/Acl/Adapter/Memory.php b/src/Acl/Adapter/Memory.php index 7c68ca4e..9aa7e275 100644 --- a/src/Acl/Adapter/Memory.php +++ b/src/Acl/Adapter/Memory.php @@ -13,7 +13,16 @@ use Phalcon\Acl\Role; use Phalcon\Acl\RoleInterface; use Phalcon\Acl\Component; -use Phalcon\Acl\Exception; +use Phalcon\Acl\Exceptions\AccessRuleNotFound; +use Phalcon\Acl\Exceptions\CircularInheritanceError; +use Phalcon\Acl\Exceptions\ElementNotFound; +use Phalcon\Acl\Exceptions\InvalidAccessList; +use Phalcon\Acl\Exceptions\InvalidComponentImplementation; +use Phalcon\Acl\Exceptions\InvalidRoleImplementation; +use Phalcon\Acl\Exceptions\InvalidRoleType; +use Phalcon\Acl\Exceptions\MissingFunctionParameters; +use Phalcon\Acl\Exceptions\ParameterTypeMismatch; +use Phalcon\Acl\Exceptions\RoleNotFoundException; use Phalcon\Acl\RoleAwareInterface; use Phalcon\Acl\ComponentAwareInterface; use Phalcon\Acl\ComponentInterface; @@ -140,7 +149,7 @@ class Memory extends \Phalcon\Acl\Adapter\AbstractAdapter * * @var mixed */ - protected $func; + protected $functions; /** * Default action for no arguments is `allow` @@ -406,10 +415,10 @@ public function getRoles(): array * @param mixed $roleName * @param mixed $componentName * @param string $access - * @param array $parameters + * @param array|null $parameters * @return bool */ - public function isAllowed($roleName, $componentName, string $access, array $parameters = null): bool + public function isAllowed($roleName, $componentName, string $access, ?array $parameters = null): bool { } @@ -477,7 +486,7 @@ private function canAccess(string $roleName, string $componentName, string $acce * @param string $elementName * @param string $suffix * - * @throws Exception + * @throws ElementNotFound * @return void */ private function checkExists(array $collection, string $element, string $elementName, string $suffix = 'ACL'): void diff --git a/src/Acl/Component.php b/src/Acl/Component.php index 1239e3de..39d93cab 100644 --- a/src/Acl/Component.php +++ b/src/Acl/Component.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Acl; +use Phalcon\Acl\Exceptions\ForbiddenWildcard; + /** * This class defines component entity and its description */ @@ -32,9 +34,9 @@ class Component implements \Phalcon\Acl\ComponentInterface * Phalcon\Acl\Component constructor * * @param string $name - * @param string $description + * @param string|null $description */ - public function __construct(string $name, string $description = null) + public function __construct(string $name, ?string $description = null) { } diff --git a/src/Acl/Exceptions/AccessRuleNotFound.php b/src/Acl/Exceptions/AccessRuleNotFound.php new file mode 100644 index 00000000..99d74a78 --- /dev/null +++ b/src/Acl/Exceptions/AccessRuleNotFound.php @@ -0,0 +1,23 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Acl\Exceptions; + +use Phalcon\Acl\Exception; + +class AccessRuleNotFound extends Exception +{ + /** + * @param string $accessName + * @param string $componentName + */ + public function __construct(string $accessName, string $componentName) + { + } +} diff --git a/src/Acl/Exceptions/CircularInheritanceError.php b/src/Acl/Exceptions/CircularInheritanceError.php new file mode 100644 index 00000000..c42e7bec --- /dev/null +++ b/src/Acl/Exceptions/CircularInheritanceError.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Acl\Exceptions; + +use Phalcon\Acl\Exception; + +class CircularInheritanceError extends Exception +{ + /** + * @param string $roleName + */ + public function __construct(string $roleName) + { + } +} diff --git a/src/Html/Helper/Input/Tel.php b/src/Acl/Exceptions/ElementNotFound.php similarity index 61% rename from src/Html/Helper/Input/Tel.php rename to src/Acl/Exceptions/ElementNotFound.php index fe347d30..a7822a5a 100644 --- a/src/Html/Helper/Input/Tel.php +++ b/src/Acl/Exceptions/ElementNotFound.php @@ -7,12 +7,10 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class Tel - */ -class Tel extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class ElementNotFound extends Exception { - protected $type = 'tel'; } diff --git a/src/Acl/Exceptions/ForbiddenWildcard.php b/src/Acl/Exceptions/ForbiddenWildcard.php new file mode 100644 index 00000000..effde0e6 --- /dev/null +++ b/src/Acl/Exceptions/ForbiddenWildcard.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Acl\Exceptions; + +use Phalcon\Acl\Exception; + +class ForbiddenWildcard extends Exception +{ + /** + * @param string $elementType + */ + public function __construct(string $elementType) + { + } +} diff --git a/src/Html/Helper/Input/Date.php b/src/Acl/Exceptions/InvalidAccessList.php similarity index 61% rename from src/Html/Helper/Input/Date.php rename to src/Acl/Exceptions/InvalidAccessList.php index 12366855..ee58d0d2 100644 --- a/src/Html/Helper/Input/Date.php +++ b/src/Acl/Exceptions/InvalidAccessList.php @@ -7,12 +7,13 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class Date - */ -class Date extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class InvalidAccessList extends Exception { - protected $type = 'date'; + public function __construct() + { + } } diff --git a/src/Html/Helper/Input/DateTime.php b/src/Acl/Exceptions/InvalidComponentImplementation.php similarity index 59% rename from src/Html/Helper/Input/DateTime.php rename to src/Acl/Exceptions/InvalidComponentImplementation.php index ada1f0a0..68bce116 100644 --- a/src/Html/Helper/Input/DateTime.php +++ b/src/Acl/Exceptions/InvalidComponentImplementation.php @@ -7,12 +7,13 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class DateTime - */ -class DateTime extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class InvalidComponentImplementation extends Exception { - protected $type = 'datetime'; + public function __construct() + { + } } diff --git a/src/Html/Helper/Input/Color.php b/src/Acl/Exceptions/InvalidRoleImplementation.php similarity index 60% rename from src/Html/Helper/Input/Color.php rename to src/Acl/Exceptions/InvalidRoleImplementation.php index 75ab1063..29f9b89f 100644 --- a/src/Html/Helper/Input/Color.php +++ b/src/Acl/Exceptions/InvalidRoleImplementation.php @@ -7,12 +7,13 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class Color - */ -class Color extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class InvalidRoleImplementation extends Exception { - protected $type = 'color'; + public function __construct() + { + } } diff --git a/src/Html/Helper/Input/File.php b/src/Acl/Exceptions/InvalidRoleType.php similarity index 61% rename from src/Html/Helper/Input/File.php rename to src/Acl/Exceptions/InvalidRoleType.php index 7eec4a15..2df95508 100644 --- a/src/Html/Helper/Input/File.php +++ b/src/Acl/Exceptions/InvalidRoleType.php @@ -7,12 +7,13 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class File - */ -class File extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class InvalidRoleType extends Exception { - protected $type = 'file'; + public function __construct() + { + } } diff --git a/src/Html/Helper/Input/Url.php b/src/Acl/Exceptions/MissingFunctionParameters.php similarity index 61% rename from src/Html/Helper/Input/Url.php rename to src/Acl/Exceptions/MissingFunctionParameters.php index 434d648b..d44e4051 100644 --- a/src/Html/Helper/Input/Url.php +++ b/src/Acl/Exceptions/MissingFunctionParameters.php @@ -7,12 +7,10 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Acl\Exceptions; -/** - * Class Url - */ -class Url extends \Phalcon\Html\Helper\Input\AbstractInput +use Phalcon\Acl\Exception; + +class MissingFunctionParameters extends Exception { - protected $type = 'url'; } diff --git a/src/Acl/Exceptions/ParameterTypeMismatch.php b/src/Acl/Exceptions/ParameterTypeMismatch.php new file mode 100644 index 00000000..22324c19 --- /dev/null +++ b/src/Acl/Exceptions/ParameterTypeMismatch.php @@ -0,0 +1,16 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Acl\Exceptions; + +use Phalcon\Acl\Exception; + +class ParameterTypeMismatch extends Exception +{ +} diff --git a/src/Acl/Exceptions/RoleNotFoundException.php b/src/Acl/Exceptions/RoleNotFoundException.php new file mode 100644 index 00000000..a92e441d --- /dev/null +++ b/src/Acl/Exceptions/RoleNotFoundException.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Acl\Exceptions; + +use Phalcon\Acl\Exception; + +class RoleNotFoundException extends Exception +{ + /** + * @param string $roleName + */ + public function __construct(string $roleName) + { + } +} diff --git a/src/Acl/Role.php b/src/Acl/Role.php index 71d999e7..8b808ec7 100644 --- a/src/Acl/Role.php +++ b/src/Acl/Role.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Acl; +use Phalcon\Acl\Exceptions\ForbiddenWildcard; + /** * This class defines role entity and its description */ @@ -32,9 +34,9 @@ class Role implements \Phalcon\Acl\RoleInterface * Phalcon\Acl\Role constructor * * @param string $name - * @param string $description + * @param string|null $description */ - public function __construct(string $name, string $description = null) + public function __construct(string $name, ?string $description = null) { } diff --git a/src/Annotations/Adapter/AbstractAdapter.php b/src/Annotations/Adapter/AbstractAdapter.php index dd208985..ebd35c9f 100644 --- a/src/Annotations/Adapter/AbstractAdapter.php +++ b/src/Annotations/Adapter/AbstractAdapter.php @@ -25,6 +25,16 @@ abstract class AbstractAdapter implements \Phalcon\Annotations\Adapter\AdapterIn */ protected $annotations = []; + /** + * Maximum number of class annotation entries retained in the + * in-memory cache. 0 (default) keeps the original unbounded + * behavior; a positive value clears the cache when adding a new + * class would exceed it. + * + * @var int + */ + protected $annotationsLimit = 0; + /** * @var Reader */ @@ -40,6 +50,16 @@ public function get($className): Reflection { } + /** + * Returns the configured annotations-cache cap (0 = unlimited). + * See setAnnotationsLimit(). + * + * @return int + */ + public function getAnnotationsLimit(): int + { + } + /** * Returns the annotations found in a specific constant * @@ -112,6 +132,18 @@ public function getReader(): ReaderInterface { } + /** + * Caps the number of class entries retained in the annotations + * cache. 0 disables the cap (the default; preserves the original + * unbounded behavior). When the cap is exceeded, the cache is + * cleared and repopulated on subsequent reads. + * + * @param int $annotationsLimit + */ + public function setAnnotationsLimit(int $annotationsLimit) + { + } + /** * Sets the annotations parser * diff --git a/src/Annotations/Adapter/Stream.php b/src/Annotations/Adapter/Stream.php index 59f08df5..67a2190f 100644 --- a/src/Annotations/Adapter/Stream.php +++ b/src/Annotations/Adapter/Stream.php @@ -9,8 +9,10 @@ */ namespace Phalcon\Annotations\Adapter; -use Phalcon\Annotations\Reflection; use Phalcon\Annotations\Exception; +use Phalcon\Annotations\Exceptions\AnnotationsDirectoryNotWritable; +use Phalcon\Annotations\Exceptions\CannotReadAnnotationData; +use Phalcon\Annotations\Reflection; use RuntimeException; /** diff --git a/src/Annotations/Annotation.php b/src/Annotations/Annotation.php index 56342289..6b19f901 100644 --- a/src/Annotations/Annotation.php +++ b/src/Annotations/Annotation.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Annotations; +use Phalcon\Annotations\Exceptions\UnknownAnnotationExpression; + /** * Represents a single annotation in an annotations collection */ diff --git a/src/Annotations/Collection.php b/src/Annotations/Collection.php index db5deef4..6305c0e9 100644 --- a/src/Annotations/Collection.php +++ b/src/Annotations/Collection.php @@ -11,6 +11,7 @@ use Countable; use Iterator; +use Phalcon\Annotations\Exceptions\AnnotationNotFound; /** * Represents a collection of annotations. This class allows to traverse a group diff --git a/src/Annotations/Exceptions/AnnotationNotFound.php b/src/Annotations/Exceptions/AnnotationNotFound.php new file mode 100644 index 00000000..d98800ec --- /dev/null +++ b/src/Annotations/Exceptions/AnnotationNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Annotations\Exceptions; + +use Phalcon\Annotations\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AnnotationNotFound extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Annotations/Exceptions/AnnotationsDirectoryNotWritable.php b/src/Annotations/Exceptions/AnnotationsDirectoryNotWritable.php new file mode 100644 index 00000000..81ec20fd --- /dev/null +++ b/src/Annotations/Exceptions/AnnotationsDirectoryNotWritable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Annotations\Exceptions; + +use Phalcon\Annotations\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AnnotationsDirectoryNotWritable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Annotations/Exceptions/CannotReadAnnotationData.php b/src/Annotations/Exceptions/CannotReadAnnotationData.php new file mode 100644 index 00000000..b3758ab7 --- /dev/null +++ b/src/Annotations/Exceptions/CannotReadAnnotationData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Annotations\Exceptions; + +use RuntimeException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotReadAnnotationData extends RuntimeException +{ + public function __construct() + { + } +} diff --git a/src/Annotations/Exceptions/UnknownAnnotationExpression.php b/src/Annotations/Exceptions/UnknownAnnotationExpression.php new file mode 100644 index 00000000..9f104845 --- /dev/null +++ b/src/Annotations/Exceptions/UnknownAnnotationExpression.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Annotations\Exceptions; + +use Phalcon\Annotations\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownAnnotationExpression extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Application/AbstractApplication.php b/src/Application/AbstractApplication.php index 11db863d..0b61821d 100644 --- a/src/Application/AbstractApplication.php +++ b/src/Application/AbstractApplication.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Application; +use Phalcon\Application\Exceptions\ModuleNotRegistered; use Phalcon\Di\DiInterface; use Phalcon\Di\Injectable; use Phalcon\Events\EventsAwareInterface; @@ -42,9 +43,9 @@ abstract class AbstractApplication extends Injectable implements \Phalcon\Events /** * Phalcon\AbstractApplication constructor * - * @param \Phalcon\Di\DiInterface $container + * @param \Phalcon\Di\DiInterface|null $container */ - public function __construct(\Phalcon\Di\DiInterface $container = null) + public function __construct(?\Phalcon\Di\DiInterface $container = null) { } @@ -105,9 +106,9 @@ public function getModules(): array * * @param array $modules * @param bool $merge - * @return AbstractApplication + * @return static */ - public function registerModules(array $modules, bool $merge = false): AbstractApplication + public function registerModules(array $modules, bool $merge = false): static { } @@ -115,9 +116,9 @@ public function registerModules(array $modules, bool $merge = false): AbstractAp * Sets the module name to be used if the router does not return a valid module * * @param string $defaultModule - * @return AbstractApplication + * @return static */ - public function setDefaultModule(string $defaultModule): AbstractApplication + public function setDefaultModule(string $defaultModule): static { } diff --git a/src/Application/Exceptions/ModuleNotRegistered.php b/src/Application/Exceptions/ModuleNotRegistered.php new file mode 100644 index 00000000..a385599e --- /dev/null +++ b/src/Application/Exceptions/ModuleNotRegistered.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Application\Exceptions; + +use Phalcon\Application\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModuleNotRegistered extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Assets/Asset.php b/src/Assets/Asset.php index 808febad..7ce84e87 100644 --- a/src/Assets/Asset.php +++ b/src/Assets/Asset.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Assets; +use Phalcon\Assets\Exceptions\CannotReadAsset; + /** * Represents an asset * @@ -81,7 +83,7 @@ class Asset implements \Phalcon\Assets\AssetInterface * @param string|null $version * @param bool $isAutoVersion */ - public function __construct(string $type, string $path, bool $isLocal = true, bool $filter = true, array $attributes = [], string $version = null, bool $isAutoVersion = false) + public function __construct(string $type, string $path, bool $isLocal = true, bool $filter = true, array $attributes = [], ?string $version = null, bool $isAutoVersion = false) { } @@ -112,7 +114,7 @@ public function getAttributes(): array * @return string * @throws Exception */ - public function getContent(string $basePath = null): string + public function getContent(?string $basePath = null): string { } @@ -137,7 +139,7 @@ public function getPath(): string * * @return string */ - public function getRealSourcePath(string $basePath = null): string + public function getRealSourcePath(?string $basePath = null): string { } @@ -148,7 +150,7 @@ public function getRealSourcePath(string $basePath = null): string * * @return string */ - public function getRealTargetPath(string $basePath = null): string + public function getRealTargetPath(?string $basePath = null): string { } diff --git a/src/Assets/Asset/Css.php b/src/Assets/Asset/Css.php index 58fac1d8..6816733f 100644 --- a/src/Assets/Asset/Css.php +++ b/src/Assets/Asset/Css.php @@ -23,10 +23,10 @@ class Css extends \Phalcon\Assets\Asset * @param bool $local * @param bool $filter * @param array $attributes - * @param string $version + * @param string|null $version * @param bool $autoVersion */ - public function __construct(string $path, bool $local = true, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false) + public function __construct(string $path, bool $local = true, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false) { } } diff --git a/src/Assets/Asset/Js.php b/src/Assets/Asset/Js.php index f4f75411..86ec989a 100644 --- a/src/Assets/Asset/Js.php +++ b/src/Assets/Asset/Js.php @@ -23,10 +23,10 @@ class Js extends \Phalcon\Assets\Asset * @param bool $local * @param bool $filter * @param array $attributes - * @param string $version + * @param string|null $version * @param bool $autoVersion */ - public function __construct(string $path, bool $local = true, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false) + public function __construct(string $path, bool $local = true, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false) { } } diff --git a/src/Assets/Collection.php b/src/Assets/Collection.php index 03eadc31..9c5cddf2 100644 --- a/src/Assets/Collection.php +++ b/src/Assets/Collection.php @@ -89,9 +89,9 @@ class Collection implements \Countable, \IteratorAggregate * Adds an asset to the collection * * @param AssetInterface $asset - * @return Collection + * @return static */ - public function add(AssetInterface $asset): Collection + public function add(AssetInterface $asset): static { } @@ -104,9 +104,9 @@ public function add(AssetInterface $asset): Collection * @param array $attributes * @param string|null $version * @param bool $autoVersion - * @return Collection + * @return static */ - public function addCss(string $path, $isLocal = null, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false): Collection + public function addCss(string $path, $isLocal = null, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false): static { } @@ -114,9 +114,9 @@ public function addCss(string $path, $isLocal = null, bool $filter = true, array * Adds a filter to the collection * * @param FilterInterface $filter - * @return Collection + * @return static */ - public function addFilter(FilterInterface $filter): Collection + public function addFilter(FilterInterface $filter): static { } @@ -124,9 +124,9 @@ public function addFilter(FilterInterface $filter): Collection * Adds an inline code to the collection * * @param Inline $code - * @return Collection + * @return static */ - public function addInline(Inline $code): Collection + public function addInline(Inline $code): static { } @@ -136,9 +136,9 @@ public function addInline(Inline $code): Collection * @param string $content * @param bool $filter * @param array $attributes - * @return Collection + * @return static */ - public function addInlineCss(string $content, bool $filter = true, array $attributes = []): Collection + public function addInlineCss(string $content, bool $filter = true, array $attributes = []): static { } @@ -148,9 +148,9 @@ public function addInlineCss(string $content, bool $filter = true, array $attrib * @param string $content * @param bool $filter * @param array $attributes - * @return Collection + * @return static */ - public function addInlineJs(string $content, bool $filter = true, array $attributes = []): Collection + public function addInlineJs(string $content, bool $filter = true, array $attributes = []): static { } @@ -163,9 +163,9 @@ public function addInlineJs(string $content, bool $filter = true, array $attribu * @param array $attributes * @param string|null $version * @param bool $autoVersion - * @return Collection + * @return static */ - public function addJs(string $path, $isLocal = null, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false): Collection + public function addJs(string $path, $isLocal = null, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false): static { } @@ -324,9 +324,9 @@ public function isLocal(): bool * * @param bool $flag * - * @return Collection + * @return static */ - public function join(bool $flag): Collection + public function join(bool $flag): static { } @@ -334,17 +334,17 @@ public function join(bool $flag): Collection * Sets extra HTML attributes * * @param array $attributes - * @return Collection + * @return static */ - public function setAttributes(array $attributes): Collection + public function setAttributes(array $attributes): static { } /** * @param bool $flag - * @return Collection + * @return static */ - public function setAutoVersion(bool $flag): Collection + public function setAutoVersion(bool $flag): static { } @@ -352,9 +352,9 @@ public function setAutoVersion(bool $flag): Collection * Sets an array of filters in the collection * * @param array $filters - * @return Collection + * @return static */ - public function setFilters(array $filters): Collection + public function setFilters(array $filters): static { } @@ -362,9 +362,9 @@ public function setFilters(array $filters): Collection * Sets if the collection uses local assets by default * * @param bool $flag - * @return Collection + * @return static */ - public function setIsLocal(bool $flag): Collection + public function setIsLocal(bool $flag): static { } @@ -372,9 +372,9 @@ public function setIsLocal(bool $flag): Collection * Sets a common prefix for all the assets * * @param string $prefix - * @return Collection + * @return static */ - public function setPrefix(string $prefix): Collection + public function setPrefix(string $prefix): static { } @@ -382,9 +382,9 @@ public function setPrefix(string $prefix): Collection * Sets if the target local or not * * @param bool $flag - * @return Collection + * @return static */ - public function setTargetIsLocal(bool $flag): Collection + public function setTargetIsLocal(bool $flag): static { } @@ -392,9 +392,9 @@ public function setTargetIsLocal(bool $flag): Collection * Sets the target path of the file for the filtered/join output * * @param string $targetPath - * @return Collection + * @return static */ - public function setTargetPath(string $targetPath): Collection + public function setTargetPath(string $targetPath): static { } @@ -402,9 +402,9 @@ public function setTargetPath(string $targetPath): Collection * Sets a target uri for the generated HTML * * @param string $targetUri - * @return Collection + * @return static */ - public function setTargetUri(string $targetUri): Collection + public function setTargetUri(string $targetUri): static { } @@ -412,9 +412,9 @@ public function setTargetUri(string $targetUri): Collection * Sets a base source path for all the assets in this collection * * @param string $sourcePath - * @return Collection + * @return static */ - public function setSourcePath(string $sourcePath): Collection + public function setSourcePath(string $sourcePath): static { } @@ -422,9 +422,9 @@ public function setSourcePath(string $sourcePath): Collection * Sets the version * * @param string $version - * @return Collection + * @return static */ - public function setVersion(string $version): Collection + public function setVersion(string $version): static { } @@ -447,11 +447,11 @@ final protected function addAsset(AssetInterface $asset): bool * @param mixed $isLocal * @param bool $filter * @param array $attributes - * @param string $version + * @param string|null $version * @param bool $autoVersion - * @return Collection + * @return static */ - private function processAdd(string $className, string $path, $isLocal = null, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false): Collection + private function processAdd(string $className, string $path, $isLocal = null, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false): static { } @@ -462,9 +462,9 @@ private function processAdd(string $className, string $path, $isLocal = null, bo * @param string $content * @param bool $filter * @param array $attributes - * @return Collection + * @return static */ - private function processAddInline(string $className, string $content, bool $filter = true, array $attributes = []): Collection + private function processAddInline(string $className, string $content, bool $filter = true, array $attributes = []): static { } diff --git a/src/Assets/Exceptions/AssetSourceTargetCollision.php b/src/Assets/Exceptions/AssetSourceTargetCollision.php new file mode 100644 index 00000000..4203ea66 --- /dev/null +++ b/src/Assets/Exceptions/AssetSourceTargetCollision.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AssetSourceTargetCollision extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Exceptions/CannotReadAsset.php b/src/Assets/Exceptions/CannotReadAsset.php new file mode 100644 index 00000000..d369fd6b --- /dev/null +++ b/src/Assets/Exceptions/CannotReadAsset.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotReadAsset extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Exceptions/CollectionNotFound.php b/src/Assets/Exceptions/CollectionNotFound.php new file mode 100644 index 00000000..1035e32d --- /dev/null +++ b/src/Assets/Exceptions/CollectionNotFound.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CollectionNotFound extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Assets/Exceptions/InvalidAssetSourcePath.php b/src/Assets/Exceptions/InvalidAssetSourcePath.php new file mode 100644 index 00000000..c3236549 --- /dev/null +++ b/src/Assets/Exceptions/InvalidAssetSourcePath.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidAssetSourcePath extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Exceptions/InvalidAssetTargetPath.php b/src/Assets/Exceptions/InvalidAssetTargetPath.php new file mode 100644 index 00000000..811e809f --- /dev/null +++ b/src/Assets/Exceptions/InvalidAssetTargetPath.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidAssetTargetPath extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Exceptions/InvalidFilter.php b/src/Assets/Exceptions/InvalidFilter.php new file mode 100644 index 00000000..74e3833f --- /dev/null +++ b/src/Assets/Exceptions/InvalidFilter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidFilter extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Assets/Exceptions/InvalidTargetPath.php b/src/Assets/Exceptions/InvalidTargetPath.php new file mode 100644 index 00000000..6cd68517 --- /dev/null +++ b/src/Assets/Exceptions/InvalidTargetPath.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidTargetPath extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Exceptions/TargetPathIsDirectory.php b/src/Assets/Exceptions/TargetPathIsDirectory.php new file mode 100644 index 00000000..beb5ad2d --- /dev/null +++ b/src/Assets/Exceptions/TargetPathIsDirectory.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Assets\Exceptions; + +use Phalcon\Assets\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TargetPathIsDirectory extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Assets/Manager.php b/src/Assets/Manager.php index 1e463562..f199de88 100644 --- a/src/Assets/Manager.php +++ b/src/Assets/Manager.php @@ -11,6 +11,13 @@ use Phalcon\Assets\Asset\Css as AssetCss; use Phalcon\Assets\Asset\Js as AssetJs; +use Phalcon\Assets\Exceptions\AssetSourceTargetCollision; +use Phalcon\Assets\Exceptions\CollectionNotFound; +use Phalcon\Assets\Exceptions\InvalidAssetSourcePath; +use Phalcon\Assets\Exceptions\InvalidAssetTargetPath; +use Phalcon\Assets\Exceptions\InvalidFilter; +use Phalcon\Assets\Exceptions\InvalidTargetPath; +use Phalcon\Assets\Exceptions\TargetPathIsDirectory; use Phalcon\Assets\Inline\Css as InlineCss; use Phalcon\Assets\Inline\Js as InlineJs; use Phalcon\Di\AbstractInjectionAware; @@ -58,9 +65,9 @@ public function __construct(\Phalcon\Html\TagFactory $tagFactory, array $options * Adds a raw asset to the manager * * @param Asset $asset - * @return Manager + * @return static */ - public function addAsset(Asset $asset): Manager + public function addAsset(Asset $asset): static { } @@ -69,9 +76,9 @@ public function addAsset(Asset $asset): Manager * * @param string $type * @param Asset $asset - * @return Manager + * @return static */ - public function addAssetByType(string $type, Asset $asset): Manager + public function addAssetByType(string $type, Asset $asset): static { } @@ -84,9 +91,9 @@ public function addAssetByType(string $type, Asset $asset): Manager * @param array $attributes * @param string|null $version * @param bool $autoVersion - * @return Manager + * @return static */ - public function addCss(string $path, bool $local = true, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false): Manager + public function addCss(string $path, bool $local = true, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false): static { } @@ -94,9 +101,9 @@ public function addCss(string $path, bool $local = true, bool $filter = true, ar * Adds a raw inline code to the manager * * @param Inline $code - * @return Manager + * @return static */ - public function addInlineCode(Inline $code): Manager + public function addInlineCode(Inline $code): static { } @@ -105,9 +112,9 @@ public function addInlineCode(Inline $code): Manager * * @param string $type * @param Inline $code - * @return Manager + * @return static */ - public function addInlineCodeByType(string $type, Inline $code): Manager + public function addInlineCodeByType(string $type, Inline $code): static { } @@ -117,9 +124,9 @@ public function addInlineCodeByType(string $type, Inline $code): Manager * @param string $content * @param bool $filter * @param array $attributes - * @return Manager + * @return static */ - public function addInlineCss(string $content, bool $filter = true, array $attributes = []): Manager + public function addInlineCss(string $content, bool $filter = true, array $attributes = []): static { } @@ -129,9 +136,9 @@ public function addInlineCss(string $content, bool $filter = true, array $attrib * @param string $content * @param bool $filter * @param array $attributes - * @return Manager + * @return static */ - public function addInlineJs(string $content, bool $filter = true, array $attributes = []): Manager + public function addInlineJs(string $content, bool $filter = true, array $attributes = []): static { } @@ -149,9 +156,9 @@ public function addInlineJs(string $content, bool $filter = true, array $attribu * @param array $attributes * @param string|null $version * @param bool $autoVersion - * @return Manager + * @return static */ - public function addJs(string $path, bool $local = true, bool $filter = true, array $attributes = [], string $version = null, bool $autoVersion = false): Manager + public function addJs(string $path, bool $local = true, bool $filter = true, array $attributes = [], ?string $version = null, bool $autoVersion = false): static { } @@ -284,7 +291,7 @@ public function output(Collection $collection, string $type): string|null * @return string * @throws Exception */ - public function outputCss(string $name = null): string + public function outputCss(?string $name = null): string { } @@ -308,7 +315,7 @@ public function outputInline(Collection $collection, $type): string * * @return string */ - public function outputInlineCss(string $name = null): string + public function outputInlineCss(?string $name = null): string { } @@ -319,7 +326,7 @@ public function outputInlineCss(string $name = null): string * * @return string */ - public function outputInlineJs(string $name = null): string + public function outputInlineJs(?string $name = null): string { } @@ -331,7 +338,7 @@ public function outputInlineJs(string $name = null): string * @return string * @throws Exception */ - public function outputJs(string $name = null): string + public function outputJs(?string $name = null): string { } @@ -344,9 +351,9 @@ public function outputJs(string $name = null): string * * @param string $name * @param Collection $collection - * @return Manager + * @return static */ - public function set(string $name, Collection $collection): Manager + public function set(string $name, Collection $collection): static { } @@ -354,9 +361,9 @@ public function set(string $name, Collection $collection): Manager * Sets the manager options * * @param array $options - * @return Manager + * @return static */ - public function setOptions(array $options): Manager + public function setOptions(array $options): static { } @@ -364,9 +371,9 @@ public function setOptions(array $options): Manager * Sets if the HTML generated must be directly printed or returned * * @param bool $implicitOutput - * @return Manager + * @return static */ - public function useImplicitOutput(bool $implicitOutput): Manager + public function useImplicitOutput(bool $implicitOutput): static { } diff --git a/src/Auth/AbstractAuthDispatcherListener.php b/src/Auth/AbstractAuthDispatcherListener.php new file mode 100644 index 00000000..aebbb315 --- /dev/null +++ b/src/Auth/AbstractAuthDispatcherListener.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth; + +use Phalcon\Auth\Exceptions\AccessDenied; +use Phalcon\Contracts\Auth\Manager; + +/** + * Shared enforcement algorithm for the Cli and Mvc auth dispatcher + * listeners. The dispatcher-specific subclass provides only the action + * name from its typed dispatcher, the action-kind label used in the + * access-denied exception, and (Mvc only) a forward handler for + * Access::redirectTo(). + */ +abstract class AbstractAuthDispatcherListener +{ + /** + * @var Manager + */ + protected $manager; + + /** + * @param \Phalcon\Contracts\Auth\Manager $manager + */ + public function __construct(\Phalcon\Contracts\Auth\Manager $manager) + { + } + + /** + * Returns the kind label used by AccessDenied (e.g. 'task', + * 'action'). + * + * @return string + */ + abstract protected function getActionType(): string; + + /** + * Runs the access check for the given action name. Returns true when + * the dispatch should proceed, false when a forward was issued, and + * throws when access is denied without a redirect target. + * + * @phpstan-param callable|null $forwardHandler + * + * @throws Exception + * @param string $actionName + * @param mixed $forwardHandler + * @return bool + */ + protected function enforce(string $actionName, $forwardHandler = null): bool + { + } +} diff --git a/src/Auth/Access/AbstractAccess.php b/src/Auth/Access/AbstractAccess.php new file mode 100644 index 00000000..b0eb0660 --- /dev/null +++ b/src/Auth/Access/AbstractAccess.php @@ -0,0 +1,89 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Access; + +use Phalcon\Contracts\Auth\Access\Access; +use Phalcon\Contracts\Auth\Manager; + +/** + * @phpstan-import-type ForwardTarget from Access + */ +abstract class AbstractAccess implements \Phalcon\Contracts\Auth\Access\Access +{ + /** + * @var array + */ + protected $exceptActions = []; + + /** + * @var Manager + */ + protected $manager; + + /** + * @var array + */ + protected $onlyActions = []; + + /** + * @param \Phalcon\Contracts\Auth\Manager $manager + */ + public function __construct(\Phalcon\Contracts\Auth\Manager $manager) + { + } + + /** + * @phpstan-return list + * @return array + */ + public function getExceptActions(): array + { + } + + /** + * @phpstan-return list + * @return array + */ + public function getOnlyActions(): array + { + } + + /** + * @param string $actionName + * @return bool + */ + public function isAllowed(string $actionName): bool + { + } + + /** + * @phpstan-return ForwardTarget|null + * @return array|null + */ + public function redirectTo(): array|null + { + } + + /** + * @param list $exceptActions + * @return void + */ + public function setExceptActions(array $exceptActions = []): void + { + } + + /** + * @param list $onlyActions + * @return void + */ + public function setOnlyActions(array $onlyActions = []): void + { + } +} diff --git a/src/Auth/Access/AccessLocator.php b/src/Auth/Access/AccessLocator.php new file mode 100644 index 00000000..1deac187 --- /dev/null +++ b/src/Auth/Access/AccessLocator.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Access; + +use Phalcon\Contracts\Auth\Access\Access; +use Phalcon\Support\AbstractLocator; + +/** + * Service locator for Phalcon\Auth access gates. Utilizes the container to + * obtain the service. For the Phalcon\Container\Container one can use + * autowiring. For the Phalcon\Di\Di, one needs to register the gates in it + * to be used here. + * + * @extends AbstractLocator + * + */ +class AccessLocator extends AbstractLocator +{ + /** + * @return class-string<\Throwable> + */ + protected function getExceptionClass(): string + { + } + + /** + * @return class-string + */ + protected function getInterfaceClass(): string + { + } + + /** + * @return array> + */ + protected function getServices(): array + { + } +} diff --git a/src/Auth/Access/Auth.php b/src/Auth/Access/Auth.php new file mode 100644 index 00000000..d49d23ce --- /dev/null +++ b/src/Auth/Access/Auth.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Access; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class Auth extends \Phalcon\Auth\Access\AbstractAccess +{ + /** + * @return bool + */ + public function allowedIf(): bool + { + } +} diff --git a/src/Auth/Access/Guest.php b/src/Auth/Access/Guest.php new file mode 100644 index 00000000..61745917 --- /dev/null +++ b/src/Auth/Access/Guest.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Access; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class Guest extends \Phalcon\Auth\Access\AbstractAccess +{ + /** + * @return bool + */ + public function allowedIf(): bool + { + } +} diff --git a/src/Auth/Adapter/AbstractAdapter.php b/src/Auth/Adapter/AbstractAdapter.php new file mode 100644 index 00000000..af760259 --- /dev/null +++ b/src/Auth/Adapter/AbstractAdapter.php @@ -0,0 +1,75 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\Adapter\AdapterConfig; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Encryption\Security\Security; + +/** + * @phpstan-import-type AuthCredentials from Adapter + * + * @template TConfig of AdapterConfig + */ +abstract class AbstractAdapter implements \Phalcon\Contracts\Auth\Adapter\Adapter +{ + /** + * @var AdapterConfig + */ + protected $config; + + /** + * @var Security + */ + protected $hasher; + + /** + * @phpstan-param TConfig $config + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param \Phalcon\Contracts\Auth\Adapter\AdapterConfig $config + */ + public function __construct(\Phalcon\Contracts\Encryption\Security\Security $hasher, \Phalcon\Contracts\Auth\Adapter\AdapterConfig $config) + { + } + + /** + * Returns the adapter configuration object. + * + * @phpstan-return TConfig + * @return AdapterConfig + */ + public function getConfig(): AdapterConfig + { + } + + /** + * Returns the model class name, if configured. + * + * @return string|null + */ + public function getModel(): string|null + { + } + + /** + * Validates the supplied plaintext password against the user's stored hash. + * Concrete adapters share this implementation; if your data source needs + * a different verification strategy, override it. + * + * @phpstan-param AuthCredentials $credentials + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(\Phalcon\Contracts\Auth\AuthUser $user, array $credentials): bool + { + } +} diff --git a/src/Auth/Adapter/AbstractArrayAdapter.php b/src/Auth/Adapter/AbstractArrayAdapter.php new file mode 100644 index 00000000..b520914d --- /dev/null +++ b/src/Auth/Adapter/AbstractArrayAdapter.php @@ -0,0 +1,101 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use Phalcon\Auth\AuthUser; +use Phalcon\Contracts\Auth\Adapter\AdapterConfig; +use Phalcon\Contracts\Auth\AuthUser as AuthUserContract; + +/** + * Common base for adapters whose user records come from an in-memory list + * (Memory and Stream). Subclasses provide the row source via loadUsers(); + * everything else — credentials matching, hydration, the empty-credentials + * guard, and a default linear retrieveById — is shared here. + * + * @phpstan-import-type AuthCredentials from \Phalcon\Contracts\Auth\Adapter\Adapter + * @phpstan-type AuthUserRow array{id?: int|string}&array + * + * @template TConfig of AdapterConfig + * @extends AbstractAdapter + */ +abstract class AbstractArrayAdapter extends \Phalcon\Auth\Adapter\AbstractAdapter +{ + /** + * Walks the user list and returns the first row whose non-'password' + * keys all match strictly. Returns null when no row matches or when + * $credentials carries no identifying field at all (only 'password', + * or empty) — protects callers from the silent "first row wins" footgun. + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return AuthUserContract|null + */ + public function retrieveByCredentials(array $credentials): AuthUserContract|null + { + } + + /** + * Default linear-scan implementation. Memory overrides this for an O(1) + * id-keyed lookup; Stream uses this as-is. + * + * @param mixed $id + * @return AuthUserContract|null + */ + public function retrieveById($id): AuthUserContract|null + { + } + + /** + * Tests whether a credentials payload carries at least one identifying + * field (i.e. anything other than 'password'). An empty payload — or a + * payload that only contains 'password' — is treated as "no lookup". + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + protected function hasIdentifyingField(array $credentials): bool + { + } + + /** + * Hydrates a raw user row into either the configured model class or a + * Phalcon\Auth\AuthUser value object. + * + * @phpstan-param AuthUserRow $row + * @param array $row + * @return AuthUserContract + */ + protected function hydrate(array $row): AuthUserContract + { + } + + /** + * Returns the source list of user rows. Concrete subclasses decide + * where they come from (config array, JSON file, etc.). + * + * @phpstan-return list + * @return array + */ + abstract protected function loadUsers(): array; + + /** + * Strict per-key match of a row against credentials, skipping 'password'. + * + * @phpstan-param AuthUserRow $row + * @phpstan-param AuthCredentials $credentials + * @param array $row + * @param array $credentials + * @return bool + */ + protected function matchesRow(array $row, array $credentials): bool + { + } +} diff --git a/src/Auth/Adapter/AdapterLocator.php b/src/Auth/Adapter/AdapterLocator.php new file mode 100644 index 00000000..b67e17a1 --- /dev/null +++ b/src/Auth/Adapter/AdapterLocator.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Support\AbstractLocator; + +/** + * Service locator for Phalcon\Auth adapters. Utilizes the container to + * obtain the service. For the Phalcon\Container\Container one can use + * autowiring. For the Phalcon\Di\Di, one needs to register the gates in it + * to be used here. + * + * @extends AbstractLocator + * + */ +class AdapterLocator extends AbstractLocator +{ + /** + * @return class-string<\Throwable> + */ + protected function getExceptionClass(): string + { + } + + /** + * @return class-string + */ + protected function getInterfaceClass(): string + { + } + + /** + * @return array> + */ + protected function getServices(): array + { + } +} diff --git a/src/Auth/Adapter/Config/AbstractAdapterConfig.php b/src/Auth/Adapter/Config/AbstractAdapterConfig.php new file mode 100644 index 00000000..eebbcba9 --- /dev/null +++ b/src/Auth/Adapter/Config/AbstractAdapterConfig.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter\Config; + +use Phalcon\Contracts\Auth\Adapter\AdapterConfig; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +abstract class AbstractAdapterConfig implements \Phalcon\Contracts\Auth\Adapter\AdapterConfig +{ + /** + * @var string|null + */ + protected $model = null; + + /** + * @param string|null $model + */ + public function __construct(?string $model = null) + { + } + + /** + * @return string|null + */ + public function getModel(): string|null + { + } +} diff --git a/src/Auth/Adapter/Config/MemoryAdapterConfig.php b/src/Auth/Adapter/Config/MemoryAdapterConfig.php new file mode 100644 index 00000000..2bc7f6ab --- /dev/null +++ b/src/Auth/Adapter/Config/MemoryAdapterConfig.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter\Config; + +/** + * @phpstan-type AuthUserRow array{id?: int|string}&array + */ +class MemoryAdapterConfig extends \Phalcon\Auth\Adapter\Config\AbstractAdapterConfig +{ + /** + * @var array + */ + protected $users = []; + + /** + * @phpstan-param list $users + * @param array $users + * @param string|null $model + */ + public function __construct(array $users = [], ?string $model = null) + { + } + + /** + * @phpstan-return list + * @return array + */ + public function getUsers(): array + { + } +} diff --git a/src/Auth/Adapter/Config/ModelAdapterConfig.php b/src/Auth/Adapter/Config/ModelAdapterConfig.php new file mode 100644 index 00000000..a5a0c291 --- /dev/null +++ b/src/Auth/Adapter/Config/ModelAdapterConfig.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter\Config; + +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\ConfigRequiresNonEmptyValue; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class ModelAdapterConfig extends \Phalcon\Auth\Adapter\Config\AbstractAdapterConfig +{ + /** + * @var string + */ + protected $idColumn = 'id'; + + /** + * @throws Exception + * @param string $model + * @param string $idColumn + */ + public function __construct(string $model, string $idColumn = 'id') + { + } + + /** + * @return string + */ + public function getIdColumn(): string + { + } + + /** + * @return string + */ + public function getModel(): string + { + } +} diff --git a/src/Auth/Adapter/Config/StreamAdapterConfig.php b/src/Auth/Adapter/Config/StreamAdapterConfig.php new file mode 100644 index 00000000..74db1cf2 --- /dev/null +++ b/src/Auth/Adapter/Config/StreamAdapterConfig.php @@ -0,0 +1,49 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter\Config; + +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\ConfigRequiresNonEmptyValue; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class StreamAdapterConfig extends \Phalcon\Auth\Adapter\Config\AbstractAdapterConfig +{ + /** + * @var string + */ + protected $file; + + /** + * @throws Exception + * @param string $file + * @param string|null $model + */ + public function __construct(string $file, ?string $model = null) + { + } + + /** + * @return string + */ + public function getFile(): string + { + } +} diff --git a/src/Auth/Adapter/Memory.php b/src/Auth/Adapter/Memory.php new file mode 100644 index 00000000..081fd9a7 --- /dev/null +++ b/src/Auth/Adapter/Memory.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use Phalcon\Auth\Adapter\Config\MemoryAdapterConfig; +use Phalcon\Auth\Internal\Options; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Encryption\Security\Security; + +/** + * In-memory adapter — useful for tests and small read-only user lists. + * + * @phpstan-import-type AuthUserRow from AbstractArrayAdapter + * + * @extends AbstractArrayAdapter + */ +class Memory extends \Phalcon\Auth\Adapter\AbstractArrayAdapter +{ + /** + * Map of id => user row for O(1) retrieveById lookup. + * + * @phpstan-var array + * @var array + */ + private $idStore = []; + + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param \Phalcon\Auth\Adapter\Config\MemoryAdapterConfig $config + */ + public function __construct(\Phalcon\Contracts\Encryption\Security\Security $hasher, \Phalcon\Auth\Adapter\Config\MemoryAdapterConfig $config) + { + } + + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param array $options + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Encryption\Security\Security $hasher, array $options): static + { + } + + /** + * Overridden for O(1) lookup via the id index built in the constructor. + * + * @param mixed $id + * @return AuthUser|null + */ + public function retrieveById($id): AuthUser|null + { + } + + /** + * @phpstan-return list + * @return array + */ + protected function loadUsers(): array + { + } +} diff --git a/src/Auth/Adapter/Model.php b/src/Auth/Adapter/Model.php new file mode 100644 index 00000000..e96b08a1 --- /dev/null +++ b/src/Auth/Adapter/Model.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use Phalcon\Auth\Adapter\Config\ModelAdapterConfig; +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\DoesNotImplement; +use Phalcon\Auth\Internal\Options; +use Phalcon\Contracts\Auth\Adapter\RememberAdapter; +use Phalcon\Contracts\Auth\AuthRemember; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Auth\RememberToken; +use Phalcon\Contracts\Encryption\Security\Security; +use Phalcon\Mvc\ModelInterface; + +/** + * Phalcon Model-backed adapter. + * + * @phpstan-import-type AuthCredentials from \Phalcon\Contracts\Auth\Adapter\Adapter + * + * @extends AbstractAdapter + */ +class Model extends \Phalcon\Auth\Adapter\AbstractAdapter implements \Phalcon\Contracts\Auth\Adapter\RememberAdapter +{ + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param \Phalcon\Auth\Adapter\Config\ModelAdapterConfig $config + */ + public function __construct(\Phalcon\Contracts\Encryption\Security\Security $hasher, \Phalcon\Auth\Adapter\Config\ModelAdapterConfig $config) + { + } + + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param array $options + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Encryption\Security\Security $hasher, array $options): static + { + } + + /** + * Create and persist a new remember token for the user. + * + * @throws Exception + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return RememberToken + */ + public function createRememberToken(\Phalcon\Contracts\Auth\AuthUser $user): RememberToken + { + } + + /** + * Find a user matching the given credentials (excluding 'password' key). + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return AuthUser|null + */ + public function retrieveByCredentials(array $credentials): AuthUser|null + { + } + + /** + * @param mixed $id + * @return AuthUser|null + */ + public function retrieveById($id): AuthUser|null + { + } + + /** + * Retrieve a user by the remember-me cookie payload. + * + * @param mixed $id + * @param string $token + * @param string|null $userAgent + * @return AuthUser|null + */ + public function retrieveByToken($id, string $token, ?string $userAgent = null): AuthUser|null + { + } +} diff --git a/src/Auth/Adapter/Stream.php b/src/Auth/Adapter/Stream.php new file mode 100644 index 00000000..48386a96 --- /dev/null +++ b/src/Auth/Adapter/Stream.php @@ -0,0 +1,79 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Adapter; + +use InvalidArgumentException; +use Phalcon\Auth\Adapter\Config\StreamAdapterConfig; +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\FileCannotRead; +use Phalcon\Auth\Exceptions\FileDoesNotContainJson; +use Phalcon\Auth\Exceptions\FileDoesNotExist; +use Phalcon\Auth\Exceptions\FileNotValidJson; +use Phalcon\Auth\Internal\Options; +use Phalcon\Contracts\Encryption\Security\Security; +use Phalcon\Support\Helper\Json\Decode; + +/** + * JSON file-backed adapter. + * + * The file must contain a JSON array of user records: + * [{"id":1,"email":"a@b","password":""}, ...] + * + * @phpstan-import-type AuthUserRow from AbstractArrayAdapter + * + * @extends AbstractArrayAdapter + */ +class Stream extends \Phalcon\Auth\Adapter\AbstractArrayAdapter +{ + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param \Phalcon\Auth\Adapter\Config\StreamAdapterConfig $config + */ + public function __construct(\Phalcon\Contracts\Encryption\Security\Security $hasher, \Phalcon\Auth\Adapter\Config\StreamAdapterConfig $config) + { + } + + /** + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @param array $options + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Encryption\Security\Security $hasher, array $options): static + { + } + + /** + * Loads and decodes the JSON users file. Re-read on every call — if you + * need caching, wrap it. + * + * @phpstan-return list + * + * @throws Exception + * @return array + */ + protected function loadUsers(): array + { + } + + /** + * @param string $filename + * @return bool + */ + protected function phpFileExists(string $filename): bool + { + } + + /** + * @param string $filename + */ + protected function phpFileGetContents(string $filename) + { + } +} diff --git a/src/Auth/AuthUser.php b/src/Auth/AuthUser.php new file mode 100644 index 00000000..b16075fe --- /dev/null +++ b/src/Auth/AuthUser.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth; + +use Phalcon\Auth\Exceptions\DataMustContainIdKey; +use Phalcon\Contracts\Auth\AuthUser as AuthUserContract; + +/** + * Lightweight value object returned by array-backed adapters (Memory, Stream) + * when no application model class is configured. + */ +class AuthUser implements AuthUserContract +{ + /** + * @phpstan-var array + * @var array + */ + protected $data; + + /** + * @param array $data + * + * @throws Exception when $data does not contain a scalar 'id' key. + */ + public function __construct(array $data) + { + } + + /** + * @return int|string + */ + public function getAuthIdentifier(): int|string + { + } + + /** + * @return string + */ + public function getAuthPassword(): string + { + } + + /** + * Returns the underlying data array. + * + * @return array + */ + public function toArray(): array + { + } +} diff --git a/src/Auth/Cli/AuthDispatcherListener.php b/src/Auth/Cli/AuthDispatcherListener.php new file mode 100644 index 00000000..9e560e8a --- /dev/null +++ b/src/Auth/Cli/AuthDispatcherListener.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Cli; + +use Phalcon\Auth\AbstractAuthDispatcherListener; +use Phalcon\Auth\Exception; +use Phalcon\Cli\Dispatcher; +use Phalcon\Events\Event; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class AuthDispatcherListener extends AbstractAuthDispatcherListener +{ + /** + * @throws Exception + * @param \Phalcon\Events\Event $event + * @param \Phalcon\Cli\Dispatcher $dispatcher + * @return bool + */ + public function beforeExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Cli\Dispatcher $dispatcher): bool + { + } + + /** + * @return string + */ + protected function getActionType(): string + { + } +} diff --git a/src/Html/Helper/Input/Text.php b/src/Auth/Exception.php similarity index 67% rename from src/Html/Helper/Input/Text.php rename to src/Auth/Exception.php index e80d29d2..3751f352 100644 --- a/src/Html/Helper/Input/Text.php +++ b/src/Auth/Exception.php @@ -7,11 +7,11 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Auth; /** - * Class Text + * Exceptions thrown in Phalcon\Auth will use this class */ -class Text extends \Phalcon\Html\Helper\Input\AbstractInput +class Exception extends \Exception { } diff --git a/src/Html/Helper/Input/Input.php b/src/Auth/Exceptions/AccessDenied.php similarity index 54% rename from src/Html/Helper/Input/Input.php rename to src/Auth/Exceptions/AccessDenied.php index f160acd7..3a67f1f8 100644 --- a/src/Html/Helper/Input/Input.php +++ b/src/Auth/Exceptions/AccessDenied.php @@ -7,21 +7,20 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; /** - * Class Input + * Access denied exception */ -class Input extends \Phalcon\Html\Helper\Input\AbstractInput +class AccessDenied extends Exception { /** - * Sets the type of the input - * * @param string $type - * - * @return AbstractInput + * @param string $name */ - public function setType(string $type): AbstractInput + public function __construct(string $type, string $name) { } } diff --git a/src/Auth/Exceptions/ConfigRequiresNonEmptyValue.php b/src/Auth/Exceptions/ConfigRequiresNonEmptyValue.php new file mode 100644 index 00000000..07deb0a7 --- /dev/null +++ b/src/Auth/Exceptions/ConfigRequiresNonEmptyValue.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * Config requires non-empty value + */ +class ConfigRequiresNonEmptyValue extends Exception +{ + /** + * @param string $configName + * @param string $configKey + * @param string $suffix + */ + public function __construct(string $configName, string $configKey, string $suffix = '') + { + } +} diff --git a/src/Auth/Exceptions/DataMustContainIdKey.php b/src/Auth/Exceptions/DataMustContainIdKey.php new file mode 100644 index 00000000..7a1a6568 --- /dev/null +++ b/src/Auth/Exceptions/DataMustContainIdKey.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * AuthUser data must contain "id" + */ +class DataMustContainIdKey extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Auth/Exceptions/DoesNotImplement.php b/src/Auth/Exceptions/DoesNotImplement.php new file mode 100644 index 00000000..e48fac2a --- /dev/null +++ b/src/Auth/Exceptions/DoesNotImplement.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * Does not implement interface + */ +class DoesNotImplement extends Exception +{ + /** + * @param string $type + * @param string $name + */ + public function __construct(string $type, string $name) + { + } +} diff --git a/src/Auth/Exceptions/FileCannotRead.php b/src/Auth/Exceptions/FileCannotRead.php new file mode 100644 index 00000000..79b99788 --- /dev/null +++ b/src/Auth/Exceptions/FileCannotRead.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * Cannot read file + */ +class FileCannotRead extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Auth/Exceptions/FileDoesNotContainJson.php b/src/Auth/Exceptions/FileDoesNotContainJson.php new file mode 100644 index 00000000..bbd55d45 --- /dev/null +++ b/src/Auth/Exceptions/FileDoesNotContainJson.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * File does not contain a JSON array + */ +class FileDoesNotContainJson extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Auth/Exceptions/FileDoesNotExist.php b/src/Auth/Exceptions/FileDoesNotExist.php new file mode 100644 index 00000000..78ede4c0 --- /dev/null +++ b/src/Auth/Exceptions/FileDoesNotExist.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; + +/** + * File does not exist + */ +class FileDoesNotExist extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Auth/Exceptions/FileNotValidJson.php b/src/Auth/Exceptions/FileNotValidJson.php new file mode 100644 index 00000000..074ff10a --- /dev/null +++ b/src/Auth/Exceptions/FileNotValidJson.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Exceptions; + +use Phalcon\Auth\Exception; +use Throwable; + +/** + * Not a valid JSON + */ +class FileNotValidJson extends Exception +{ + /** + * @param string $path + * @param \Throwable $ex + */ + public function __construct(string $path, \Throwable $ex) + { + } +} diff --git a/src/Auth/Guard/AbstractGuard.php b/src/Auth/Guard/AbstractGuard.php new file mode 100644 index 00000000..91ef7071 --- /dev/null +++ b/src/Auth/Guard/AbstractGuard.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard; + +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Auth\Guard\Guard; +use Phalcon\Contracts\Auth\Guard\GuardConfig; +use Phalcon\Events\AbstractEventsAware; + +/** + * @phpstan-import-type AuthCredentials from Adapter + * + * @template TConfig of GuardConfig + */ +abstract class AbstractGuard extends AbstractEventsAware implements \Phalcon\Contracts\Auth\Guard\Guard +{ + /** + * @var Adapter + */ + protected $adapter; + + /** + * @var GuardConfig + */ + protected $config; + + /** + * @var AuthUser | null + */ + protected $lastUserAttempted = null; + + /** + * @var AuthUser | null + */ + protected $user = null; + + /** + * @phpstan-param TConfig $config + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param \Phalcon\Contracts\Auth\Guard\GuardConfig $config + */ + public function __construct(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, \Phalcon\Contracts\Auth\Guard\GuardConfig $config) + { + } + + /** + * Returns the guard configuration object. + * + * @phpstan-return TConfig + * @return GuardConfig + */ + public function getConfig(): GuardConfig + { + } + + /** + * @return bool + */ + public function check(): bool + { + } + + /** + * @return Adapter + */ + public function getAdapter(): Adapter + { + } + + /** + * @return AuthUser|null + */ + public function getLastUserAttempted(): AuthUser|null + { + } + + /** + * @return bool + */ + public function guest(): bool + { + } + + /** + * @return bool + */ + public function hasUser(): bool + { + } + + /** + * @return int|string|null + */ + public function id(): int|string|null + { + } + + /** + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @return static + */ + public function setAdapter(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter): static + { + } + + /** + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return static + */ + public function setUser(\Phalcon\Contracts\Auth\AuthUser $user): static + { + } + + /** + * user should be ?AuthUser + * + * @phpstan-param AuthCredentials $credentials + * + * @phpstan-assert-if-true !null $user + * @param mixed $user + * @param array $credentials + * @return bool + */ + protected function hasValidCredentials($user, array $credentials): bool + { + } +} diff --git a/src/Auth/Guard/Config/AbstractGuardConfig.php b/src/Auth/Guard/Config/AbstractGuardConfig.php new file mode 100644 index 00000000..430bca7c --- /dev/null +++ b/src/Auth/Guard/Config/AbstractGuardConfig.php @@ -0,0 +1,28 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard\Config; + +use Phalcon\Contracts\Auth\Guard\GuardConfig; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +abstract class AbstractGuardConfig implements \Phalcon\Contracts\Auth\Guard\GuardConfig +{ +} diff --git a/src/Auth/Guard/Config/SessionGuardConfig.php b/src/Auth/Guard/Config/SessionGuardConfig.php new file mode 100644 index 00000000..742189f0 --- /dev/null +++ b/src/Auth/Guard/Config/SessionGuardConfig.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard\Config; + +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\ConfigRequiresNonEmptyValue; + +/** + * Configuration for the Session guard. Holds the names under which the + * session key and remember-me cookie are stored. Defaults to 'auth' and + * 'remember'; multi-guard apps can pass a $suffix ('web', 'admin', ...) + * to derive 'auth_web' / 'remember_web' style names, or override either + * full name explicitly. + */ +class SessionGuardConfig extends \Phalcon\Auth\Guard\Config\AbstractGuardConfig +{ + /** + * @var string + */ + private $name; + + /** + * @var string + */ + private $rememberName; + + /** + * @throws Exception + * @param string|null $suffix + * @param string|null $name + * @param string|null $rememberName + */ + public function __construct(?string $suffix = null, ?string $name = null, ?string $rememberName = null) + { + } + + /** + * @return string + */ + public function getName(): string + { + } + + /** + * @return string + */ + public function getRememberName(): string + { + } + + /** + * @param string $prefix + * @param string|null $suffix + * @return string + */ + private function derive(string $prefix, ?string $suffix = null): string + { + } + + /** + * @throws Exception + * @param string $param + * @param string|null $value + * @return void + */ + private function validateNonEmpty(string $param, ?string $value = null): void + { + } +} diff --git a/src/Auth/Guard/Config/TokenGuardConfig.php b/src/Auth/Guard/Config/TokenGuardConfig.php new file mode 100644 index 00000000..b1f3740d --- /dev/null +++ b/src/Auth/Guard/Config/TokenGuardConfig.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard\Config; + +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\ConfigRequiresNonEmptyValue; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +class TokenGuardConfig extends \Phalcon\Auth\Guard\Config\AbstractGuardConfig +{ + /** + * @var string + */ + protected $inputKey; + + /** + * @var string + */ + protected $storageKey; + + /** + * @throws Exception + * @param string $inputKey + * @param string $storageKey + */ + public function __construct(string $inputKey, string $storageKey) + { + } + + /** + * @return string + */ + public function getInputKey(): string + { + } + + /** + * @return string + */ + public function getStorageKey(): string + { + } +} diff --git a/src/Auth/Guard/GuardLocator.php b/src/Auth/Guard/GuardLocator.php new file mode 100644 index 00000000..80dd65f5 --- /dev/null +++ b/src/Auth/Guard/GuardLocator.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard; + +use Phalcon\Contracts\Auth\Guard\Guard; +use Phalcon\Support\AbstractLocator; + +/** + * Service locator for Phalcon\Auth guards. Utilizes the container to obtain + * the service. For Phalcon\Container\Container one can use autowiring; for + * Phalcon\Di\Di, register the guards in it before resolution. + * + * @extends AbstractLocator + */ +class GuardLocator extends AbstractLocator +{ + /** + * @return class-string<\Throwable> + */ + protected function getExceptionClass(): string + { + } + + /** + * @return class-string + */ + protected function getInterfaceClass(): string + { + } + + /** + * @return array> + */ + protected function getServices(): array + { + } +} diff --git a/src/Auth/Guard/Session.php b/src/Auth/Guard/Session.php new file mode 100644 index 00000000..dd451308 --- /dev/null +++ b/src/Auth/Guard/Session.php @@ -0,0 +1,234 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard; + +use Phalcon\Auth\Exception; +use Phalcon\Auth\Exceptions\DoesNotImplement; +use Phalcon\Auth\Guard\Config\SessionGuardConfig; +use Phalcon\Auth\Internal\Options; +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\Adapter\RememberAdapter; +use Phalcon\Contracts\Auth\AuthRemember; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Auth\Guard\BasicAuth; +use Phalcon\Contracts\Auth\Guard\GuardStateful; +use Phalcon\Contracts\Auth\RememberToken; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\DiInterface; +use Phalcon\Http\RequestInterface; +use Phalcon\Http\Response\CookiesInterface; +use Phalcon\Session\ManagerInterface as SessionManagerInterface; +use Phalcon\Support\Helper\Json\Encode; + +/** + * @phpstan-import-type AuthCredentials from Adapter + * + * @extends AbstractGuard + */ +class Session extends \Phalcon\Auth\Guard\AbstractGuard implements \Phalcon\Contracts\Auth\Guard\GuardStateful, \Phalcon\Contracts\Auth\Guard\BasicAuth +{ + /** + * @var CookiesInterface + */ + protected $cookies; + + /** + * @var RequestInterface + */ + protected $request; + + /** + * @var SessionManagerInterface + */ + protected $session; + + /** + * @var bool + */ + protected $viaRemember = false; + + /** + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param \Phalcon\Http\RequestInterface $request + * @param \Phalcon\Http\Response\CookiesInterface $cookies + * @param \Phalcon\Session\ManagerInterface $session + * @param \Phalcon\Auth\Guard\Config\SessionGuardConfig|null $config + */ + public function __construct(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, \Phalcon\Http\RequestInterface $request, \Phalcon\Http\Response\CookiesInterface $cookies, \Phalcon\Session\ManagerInterface $session, ?\Phalcon\Auth\Guard\Config\SessionGuardConfig $config = null) + { + } + + /** + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param mixed $container + * @param array $options + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, $container, array $options): static + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * + * @throws Exception + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], bool $remember = false): bool + { + } + + /** + * @param array $extraConditions + * + * @throws Exception + * @param string $field + * @return bool + */ + public function basic(string $field = 'email', array $extraConditions = []): bool + { + } + + /** + * @return string + */ + public function getName(): string + { + } + + /** + * @return string + */ + public function getRememberName(): string + { + } + + /** + * @throws Exception + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @param bool $remember + * @return void + */ + public function login(\Phalcon\Contracts\Auth\AuthUser $user, bool $remember = false): void + { + } + + /** + * @throws Exception + * @param mixed $id + * @param bool $remember + * @return false|AuthUser + */ + public function loginById($id, bool $remember = false): AuthUser|false + { + } + + /** + * @return void + */ + public function logout(): void + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + public function once(array $credentials = []): bool + { + } + + /** + * @param array $extraConditions + * @param string $field + * @return false|AuthUser + */ + public function onceBasic(string $field = 'email', array $extraConditions = []): AuthUser|false + { + } + + /** + * @return AuthUser|null + */ + public function user(): AuthUser|null + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * + * @phpstan-assert-if-true !null $this->lastUserAttempted + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []): bool + { + } + + /** + * @return bool + */ + public function viaRemember(): bool + { + } + + /** + * @param array $extraConditions + * + * @throws Exception + * @param string $field + * @return bool + */ + protected function attemptBasic(string $field, array $extraConditions = []): bool + { + } + + /** + * @return array|null + * @param string $field + */ + protected function basicCredentials(string $field): array|null + { + } + + /** + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return RememberToken + */ + protected function createRememberToken(\Phalcon\Contracts\Auth\AuthUser $user): RememberToken + { + } + + /** + * @return UserRemember|null + */ + protected function recaller(): UserRemember|null + { + } + + /** + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return void + */ + protected function rememberUser(\Phalcon\Contracts\Auth\AuthUser $user): void + { + } + + /** + * @param UserRemember $recaller + * @return AuthUser|null + */ + protected function userFromRecaller(UserRemember $recaller): AuthUser|null + { + } +} diff --git a/src/Auth/Guard/Token.php b/src/Auth/Guard/Token.php new file mode 100644 index 00000000..8025dc09 --- /dev/null +++ b/src/Auth/Guard/Token.php @@ -0,0 +1,81 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard; + +use Phalcon\Auth\Guard\Config\TokenGuardConfig; +use Phalcon\Auth\Internal\Options; +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\DiInterface; +use Phalcon\Http\RequestInterface; + +/** + * @phpstan-import-type AuthCredentials from Adapter + * + * @extends AbstractGuard + */ +class Token extends \Phalcon\Auth\Guard\AbstractGuard +{ + /** + * @var RequestInterface + */ + protected $request; + + /** + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param \Phalcon\Http\RequestInterface $request + * @param \Phalcon\Auth\Guard\Config\TokenGuardConfig $config + */ + public function __construct(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, \Phalcon\Http\RequestInterface $request, \Phalcon\Auth\Guard\Config\TokenGuardConfig $config) + { + } + + /** + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param mixed $container + * @param array $options + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, $container, array $options): static + { + } + + /** + * @return string|null + */ + public function getTokenForRequest(): string|null + { + } + + /** + * @param \Phalcon\Http\RequestInterface $request + * @return static + */ + public function setRequest(\Phalcon\Http\RequestInterface $request): static + { + } + + /** + * @return AuthUser|null + */ + public function user(): AuthUser|null + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []): bool + { + } +} diff --git a/src/Auth/Guard/UserRemember.php b/src/Auth/Guard/UserRemember.php new file mode 100644 index 00000000..3c33c122 --- /dev/null +++ b/src/Auth/Guard/UserRemember.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Guard; + +use InvalidArgumentException; +use Phalcon\Support\Helper\Json\Decode; + +/** + * Value object representing the contents of a remember-me cookie. + * + * @phpstan-type RememberPayload array{id?: int|string, token?: string, user_agent?: string} + */ +final class UserRemember +{ + /** + * @var int|string|null + */ + protected $id; + + /** + * @var string + */ + protected $token; + + /** + * @var string + */ + protected $userAgent; + + /** + * Accepts either the raw JSON cookie value (string) or the already + * decoded associative array. Malformed input degrades to an empty + * payload so callers can read getters without null-guarding. + * + * @param string|array $payload + */ + public function __construct($payload) + { + } + + /** + * @return int|string|null + */ + public function getId(): int|string|null + { + } + + /** + * @return string + */ + public function getToken(): string + { + } + + /** + * @return string + */ + public function getUserAgent(): string + { + } +} diff --git a/src/Auth/Internal/Options.php b/src/Auth/Internal/Options.php new file mode 100644 index 00000000..f38fc522 --- /dev/null +++ b/src/Auth/Internal/Options.php @@ -0,0 +1,74 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Internal; + +use Phalcon\Auth\Exception; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\DiInterface; + +/** + * Internal option-parsing helpers shared by adapter / guard fromOptions() + * implementations. Not part of the public API. + */ +final class Options +{ + /** + * @phpstan-param array $options + * @phpstan-param list> $defaultValue + * + * @phpstan-return list> + * @param array $options + * @param string $key + * @param array $defaultValue + * @return array + */ + public static function arrayOption(array $options, string $key, array $defaultValue): array + { + } + + /** + * @phpstan-param array $options + * + * @throws Exception + * @param array $options + * @param string $key + * @param string $context + * @return string + */ + public static function requireString(array $options, string $key, string $context): string + { + } + + /** + * @template T of object + * + * @phpstan-param class-string $serviceId + * + * @phpstan-return T + * + * @throws Exception + * @param mixed $container + * @param string $serviceId + * @param string $context + * @return object + */ + public static function resolveService($container, string $serviceId, string $context): object + { + } + + /** + * @param array $options + * @param string $key + * @return string|null + */ + public static function stringOrNull(array $options, string $key): string|null + { + } +} diff --git a/src/Auth/Manager.php b/src/Auth/Manager.php new file mode 100644 index 00000000..7b3daf26 --- /dev/null +++ b/src/Auth/Manager.php @@ -0,0 +1,204 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth; + +use Phalcon\Auth\Access\AccessLocator; +use Phalcon\Contracts\Auth\Access\Access; +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Auth\Guard\Guard; +use Phalcon\Contracts\Auth\Guard\GuardStateful; +use Phalcon\Contracts\Auth\Manager as ManagerContract; + +/** + * Composes guards (authentication) and access gates (authorization) + * behind a single facade. Guard-specific behavior is reached through + * Manager::guard(); callers narrow with instanceof against the + * relevant capability interface (GuardStateful, BasicAuth, etc.). + * + * @phpstan-import-type AuthCredentials from Adapter + */ +class Manager implements ManagerContract +{ + /** + * @var AccessLocator + */ + protected $accessFactory; + + /** + * @var Access | null + */ + protected $activeAccess = null; + + /** + * @var Guard | null + */ + protected $defaultGuard = null; + + /** + * @var array + */ + protected $guards = []; + + /** + * @param \Phalcon\Auth\Access\AccessLocator $accessFactory + */ + public function __construct(\Phalcon\Auth\Access\AccessLocator $accessFactory) + { + } + + /** + * @throws Exception + * @param string $accessName + * @return self + */ + public function access(string $accessName): self + { + } + + /** + * @phpstan-param array> $accessList + * @param array $accessList + * @return self + */ + public function addAccessList(array $accessList): self + { + } + + /** + * @param string $nameGuard + * @param \Phalcon\Contracts\Auth\Guard\Guard $guard + * @param bool $isDefault + * @return self + */ + public function addGuard(string $nameGuard, \Phalcon\Contracts\Auth\Guard\Guard $guard, bool $isDefault = false): self + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * + * @throws Exception + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], bool $remember = false): bool + { + } + + /** + * @return bool + */ + public function check(): bool + { + } + + /** + * @throws Exception + * @param string $actions + * @return self + */ + public function except(string $actions): self + { + } + + /** + * @return Access|null + */ + public function getAccess(): Access|null + { + } + + /** + * @return array> + */ + public function getAccessList(): array + { + } + + /** + * @return Guard|null + */ + public function getDefaultGuard(): Guard|null + { + } + + /** + * @return array + */ + public function getGuards(): array + { + } + + /** + * @throws Exception + * @param string|null $name + * @return Guard + */ + public function guard(?string $name = null): Guard + { + } + + /** + * @return int|string|null + */ + public function id(): int|string|null + { + } + + /** + * @return void + */ + public function logout(): void + { + } + + /** + * @throws Exception + * @param string $actions + * @return self + */ + public function only(string $actions): self + { + } + + /** + * @param \Phalcon\Contracts\Auth\Access\Access $access + * @return self + */ + public function setAccess(\Phalcon\Contracts\Auth\Access\Access $access): self + { + } + + /** + * @param \Phalcon\Contracts\Auth\Guard\Guard $guard + * @return self + */ + public function setDefaultGuard(\Phalcon\Contracts\Auth\Guard\Guard $guard): self + { + } + + /** + * @return AuthUser|null + */ + public function user(): AuthUser|null + { + } + + /** + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []): bool + { + } +} diff --git a/src/Auth/ManagerFactory.php b/src/Auth/ManagerFactory.php new file mode 100644 index 00000000..50883c1f --- /dev/null +++ b/src/Auth/ManagerFactory.php @@ -0,0 +1,147 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth; + +use Phalcon\Auth\Access\AccessLocator; +use Phalcon\Auth\Adapter\AdapterLocator; +use Phalcon\Auth\Guard\GuardLocator; +use Phalcon\Config\ConfigInterface; +use Phalcon\Contracts\Auth\Access\Access; +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\Guard\Guard; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\DiInterface; +use Phalcon\Encryption\Security; + +/** + * Single entry-point factory that builds a fully wired Phalcon\Auth\Manager + * from a config tree. Framework-shared services (RequestInterface, + * CookiesInterface, SessionManagerInterface) are resolved from the injected + * container so the manager wires against the real application singletons, + * not separately constructed copies. + * + * [ + * 'guards' => [ + * 'web' => [ + * 'type' => 'session', + * 'default' => true, + * 'adapter' => [ + * 'name' => 'model', + * 'options' => [ + * 'model' => User::class + * ], + * ], + * 'options' => [], + * ], + * 'api' => [ + * 'type' => 'token', + * 'adapter' => [ + * 'name' => 'model', + * 'options' => [ + * 'model' => User::class + * ] + * ], + * 'options' => [ + * 'inputKey' => 'api_token', + * 'storageKey' => 'api_token' + * ], + * ], + * ], + * 'access' => [ + * 'auth' => \Phalcon\Auth\Access\Auth::class, + * 'guest' => \Phalcon\Auth\Access\Guest::class, + * ], + * ] + * + * @phpstan-type GuardConfig array{ + * type: string, + * default?: bool, + * adapter: array{name: string, options?: array}, + * options?: array, + * } + * + * @phpstan-type AuthConfig array{ + * guards?: array, + * access?: array>, + * } + */ +class ManagerFactory +{ + /** + * @var AccessLocator + */ + protected $accessLocator; + + /** + * @var AdapterLocator + */ + protected $adapterLocator; + + /** + * @var Collection + */ + protected $container; + + /** + * @var GuardLocator + */ + protected $guardLocator; + + /** + * @var Security + */ + protected $hasher; + + /** + * @param \Phalcon\Encryption\Security $hasher + * @param mixed $container + * @param \Phalcon\Auth\Adapter\AdapterLocator|null $adapterLocator + * @param \Phalcon\Auth\Guard\GuardLocator|null $guardLocator + * @param \Phalcon\Auth\Access\AccessLocator|null $accessLocator + */ + public function __construct(\Phalcon\Encryption\Security $hasher, $container, ?\Phalcon\Auth\Adapter\AdapterLocator $adapterLocator = null, ?\Phalcon\Auth\Guard\GuardLocator $guardLocator = null, ?\Phalcon\Auth\Access\AccessLocator $accessLocator = null) + { + } + + /** + * @phpstan-param AuthConfig|ConfigInterface $config + * + * @throws Exception + * @param mixed $config + * @return Manager + */ + public function load($config): Manager + { + } + + /** + * @param array{name: string, options?: array} $cfg + * + * @throws Exception + * @param \Phalcon\Auth\Adapter\AdapterLocator $locator + * @return Adapter + */ + protected function buildAdapter(\Phalcon\Auth\Adapter\AdapterLocator $locator, array $cfg): Adapter + { + } + + /** + * @param array $options + * + * @throws Exception + * @param \Phalcon\Auth\Guard\GuardLocator $locator + * @param string $type + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @return Guard + */ + protected function buildGuard(\Phalcon\Auth\Guard\GuardLocator $locator, string $type, \Phalcon\Contracts\Auth\Adapter\Adapter $adapter, array $options): Guard + { + } +} diff --git a/src/Auth/Mvc/AuthDispatcherListener.php b/src/Auth/Mvc/AuthDispatcherListener.php new file mode 100644 index 00000000..14555429 --- /dev/null +++ b/src/Auth/Mvc/AuthDispatcherListener.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Auth\Mvc; + +use Phalcon\Auth\AbstractAuthDispatcherListener; +use Phalcon\Auth\Exception; +use Phalcon\Events\Event; +use Phalcon\Mvc\Dispatcher; + +/** + * Listener that enforces the active Phalcon\Auth access gate on each MVC + * dispatch. Attach to the events manager: + * + * $eventsManager->attach('dispatch', new AuthDispatcherListener($manager)); + * + * No-op when no active access has been set on the manager. + */ +class AuthDispatcherListener extends AbstractAuthDispatcherListener +{ + /** + * @throws Exception + * @param \Phalcon\Events\Event $event + * @param \Phalcon\Mvc\Dispatcher $dispatcher + * @return bool + */ + public function beforeExecuteRoute(\Phalcon\Events\Event $event, \Phalcon\Mvc\Dispatcher $dispatcher): bool + { + } + + /** + * @return string + */ + protected function getActionType(): string + { + } +} diff --git a/src/Autoload/Exceptions/LoaderDirectoriesNotArray.php b/src/Autoload/Exceptions/LoaderDirectoriesNotArray.php new file mode 100644 index 00000000..a23b1959 --- /dev/null +++ b/src/Autoload/Exceptions/LoaderDirectoriesNotArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Autoload\Exceptions; + +use Phalcon\Autoload\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class LoaderDirectoriesNotArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Autoload/Exceptions/LoaderMethodNotCallable.php b/src/Autoload/Exceptions/LoaderMethodNotCallable.php new file mode 100644 index 00000000..d9de9f49 --- /dev/null +++ b/src/Autoload/Exceptions/LoaderMethodNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Autoload\Exceptions; + +use Phalcon\Autoload\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class LoaderMethodNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Autoload/Loader.php b/src/Autoload/Loader.php index 24fd0eab..705ecf19 100644 --- a/src/Autoload/Loader.php +++ b/src/Autoload/Loader.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Autoload; +use Phalcon\Autoload\Exceptions\LoaderDirectoriesNotArray; +use Phalcon\Autoload\Exceptions\LoaderMethodNotCallable; use Phalcon\Events\AbstractEventsAware; /** @@ -88,9 +90,9 @@ public function __construct(bool $isDebug = false) * @param string $name * @param string $file * - * @return Loader + * @return static */ - public function addClass(string $name, string $file): Loader + public function addClass(string $name, string $file): static { } @@ -99,9 +101,9 @@ public function addClass(string $name, string $file): Loader * * @param string $directory * - * @return Loader + * @return static */ - public function addDirectory(string $directory): Loader + public function addDirectory(string $directory): static { } @@ -110,9 +112,9 @@ public function addDirectory(string $directory): Loader * * @param string $extension * - * @return Loader + * @return static */ - public function addExtension(string $extension): Loader + public function addExtension(string $extension): static { } @@ -121,9 +123,9 @@ public function addExtension(string $extension): Loader * * @param string $file * - * @return Loader + * @return static */ - public function addFile(string $file): Loader + public function addFile(string $file): static { } @@ -132,10 +134,10 @@ public function addFile(string $file): Loader * @param mixed $directories * @param bool $prepend * - * @return Loader + * @return static * @throws Exception */ - public function addNamespace(string $name, $directories, bool $prepend = false): Loader + public function addNamespace(string $name, $directories, bool $prepend = false): static { } @@ -235,9 +237,9 @@ public function loadFiles(): void * Register the autoload method * * @param bool $prepend - * @return Loader + * @return static */ - public function register(bool $prepend = false): Loader + public function register(bool $prepend = false): static { } @@ -247,9 +249,9 @@ public function register(bool $prepend = false): Loader * @param array $classes * @param bool $merge * - * @return Loader + * @return static */ - public function setClasses(array $classes, bool $merge = false): Loader + public function setClasses(array $classes, bool $merge = false): static { } @@ -259,9 +261,9 @@ public function setClasses(array $classes, bool $merge = false): Loader * @param array $directories * @param bool $merge * - * @return Loader + * @return static */ - public function setDirectories(array $directories, bool $merge = false): Loader + public function setDirectories(array $directories, bool $merge = false): static { } @@ -272,9 +274,9 @@ public function setDirectories(array $directories, bool $merge = false): Loader * @param array $extensions * @param bool $merge * - * @return Loader + * @return static */ - public function setExtensions(array $extensions, bool $merge = false): Loader + public function setExtensions(array $extensions, bool $merge = false): static { } @@ -295,10 +297,10 @@ public function setExtensions(array $extensions, bool $merge = false): Loader * * @param string|callable|null $method * - * @return Loader + * @return static * @throws Exception */ - public function setFileCheckingCallback($method = null): Loader + public function setFileCheckingCallback($method = null): static { } @@ -309,9 +311,9 @@ public function setFileCheckingCallback($method = null): Loader * @param array $files * @param bool $merge * - * @return Loader + * @return static */ - public function setFiles(array $files, bool $merge = false): Loader + public function setFiles(array $files, bool $merge = false): static { } @@ -321,27 +323,27 @@ public function setFiles(array $files, bool $merge = false): Loader * @param array $namespaces * @param bool $merge * - * @return Loader + * @return static */ - public function setNamespaces(array $namespaces, bool $merge = false): Loader + public function setNamespaces(array $namespaces, bool $merge = false): static { } /** - * Unregister the autoload method + * returns isRegistered * - * @return Loader + * @return bool */ - public function unregister(): Loader + public function isRegistered(): bool { } /** - * returns isRegister + * Unregister the autoload method * - * @return bool + * @return static */ - public function isRegistered(): bool + public function unregister(): static { } @@ -375,9 +377,9 @@ private function addDebug(string $message): void * @param string $method * @param bool $merge * - * @return Loader + * @return static */ - private function addToCollection(array $collection, string $collectionName, string $method, bool $merge = false): Loader + private function addToCollection(array $collection, string $collectionName, string $method, bool $merge = false): static { } diff --git a/src/Cache/AbstractCache.php b/src/Cache/AbstractCache.php index 5ed7d33f..d4b222dd 100644 --- a/src/Cache/AbstractCache.php +++ b/src/Cache/AbstractCache.php @@ -12,7 +12,9 @@ use DateInterval; use Phalcon\Cache\Adapter\AdapterInterface; use Phalcon\Cache\Adapter\Redis; +use Phalcon\Cache\Exception\CacheKeysNotIterable; use Phalcon\Cache\Exception\InvalidArgumentException; +use Phalcon\Cache\Exception\InvalidCacheKey; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface; use Traversable; diff --git a/src/Cache/AdapterFactory.php b/src/Cache/AdapterFactory.php index e8112260..4555678a 100644 --- a/src/Cache/AdapterFactory.php +++ b/src/Cache/AdapterFactory.php @@ -22,7 +22,7 @@ class AdapterFactory extends AbstractFactory /** * @var SerializerFactory */ - private $serializerFactory; + protected $serializerFactory; /** * AdapterFactory constructor. diff --git a/src/Cache/Exception/CacheKeysNotIterable.php b/src/Cache/Exception/CacheKeysNotIterable.php new file mode 100644 index 00000000..e5af1a22 --- /dev/null +++ b/src/Cache/Exception/CacheKeysNotIterable.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cache\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CacheKeysNotIterable extends \Phalcon\Cache\Exception\InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Cache/Exception/InvalidCacheKey.php b/src/Cache/Exception/InvalidCacheKey.php new file mode 100644 index 00000000..6d7f4380 --- /dev/null +++ b/src/Cache/Exception/InvalidCacheKey.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cache\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCacheKey extends \Phalcon\Cache\Exception\InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Cli/Console.php b/src/Cli/Console.php index bdf8e6d4..8f1b9f43 100644 --- a/src/Cli/Console.php +++ b/src/Cli/Console.php @@ -10,8 +10,12 @@ namespace Phalcon\Cli; use Phalcon\Application\AbstractApplication; -use Phalcon\Cli\Router\Route; use Phalcon\Cli\Console\Exception; +use Phalcon\Cli\Console\Exceptions\ConsoleModuleNotRegistered; +use Phalcon\Cli\Console\Exceptions\ContainerRequired; +use Phalcon\Cli\Console\Exceptions\InvalidModuleDefinitionPath; +use Phalcon\Cli\Console\Exceptions\ModuleDefinitionPathNotFound; +use Phalcon\Cli\Router\Route; use Phalcon\Di\DiInterface; use Phalcon\Events\ManagerInterface; @@ -33,21 +37,21 @@ class Console extends AbstractApplication /** * Handle the whole command-line tasks * - * @param array $arguments + * @param array|null $arguments */ - public function handle(array $arguments = null) + public function handle(?array $arguments = null) { } /** * Set an specific argument * - * @param array $arguments + * @param array|null $arguments * @param bool $str * @param bool $shift - * @return Console + * @return static */ - public function setArgument(array $arguments = null, bool $str = true, bool $shift = true): Console + public function setArgument(?array $arguments = null, bool $str = true, bool $shift = true): static { } } diff --git a/src/Cli/Console/Exceptions/ConsoleModuleNotRegistered.php b/src/Cli/Console/Exceptions/ConsoleModuleNotRegistered.php new file mode 100644 index 00000000..51897666 --- /dev/null +++ b/src/Cli/Console/Exceptions/ConsoleModuleNotRegistered.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Console\Exceptions; + +use Phalcon\Cli\Console\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConsoleModuleNotRegistered extends Exception +{ + /** + * @param string $moduleName + */ + public function __construct(string $moduleName) + { + } +} diff --git a/src/Cli/Console/Exceptions/ContainerRequired.php b/src/Cli/Console/Exceptions/ContainerRequired.php new file mode 100644 index 00000000..3833cd9e --- /dev/null +++ b/src/Cli/Console/Exceptions/ContainerRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Console\Exceptions; + +use Phalcon\Cli\Console\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ContainerRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Cli/Console/Exceptions/InvalidModuleDefinitionPath.php b/src/Cli/Console/Exceptions/InvalidModuleDefinitionPath.php new file mode 100644 index 00000000..2d2e7704 --- /dev/null +++ b/src/Cli/Console/Exceptions/InvalidModuleDefinitionPath.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Console\Exceptions; + +use Phalcon\Cli\Console\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidModuleDefinitionPath extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Cli/Console/Exceptions/ModuleDefinitionPathNotFound.php b/src/Cli/Console/Exceptions/ModuleDefinitionPathNotFound.php new file mode 100644 index 00000000..207bddad --- /dev/null +++ b/src/Cli/Console/Exceptions/ModuleDefinitionPathNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Console\Exceptions; + +use Phalcon\Cli\Console\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModuleDefinitionPathNotFound extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Cli/Router.php b/src/Cli/Router.php index 1b27cc87..e82379e3 100644 --- a/src/Cli/Router.php +++ b/src/Cli/Router.php @@ -9,11 +9,13 @@ */ namespace Phalcon\Cli; -use Phalcon\Di\DiInterface; -use Phalcon\Di\AbstractInjectionAware; -use Phalcon\Cli\Router\Route; use Phalcon\Cli\Router\Exception; +use Phalcon\Cli\Router\Exceptions\BeforeMatchNotCallable; +use Phalcon\Cli\Router\Exceptions\RouterArgumentsInvalidType; +use Phalcon\Cli\Router\Route; use Phalcon\Cli\Router\RouteInterface; +use Phalcon\Di\AbstractInjectionAware; +use Phalcon\Di\DiInterface; /** * Phalcon\Cli\Router is the standard framework router. Routing is the process @@ -35,7 +37,7 @@ * echo $router->getTaskName(); * ``` */ -class Router extends AbstractInjectionAware +class Router extends AbstractInjectionAware implements \Phalcon\Cli\RouterInterface { /** * @var string @@ -113,8 +115,9 @@ public function __construct(bool $defaultRoutes = true) * $router->add("/about", "About::main"); * ``` * - * @param string|array $paths + * @phpstan-param array|string|null $paths * @param string $pattern + * @param mixed $paths * @return RouteInterface */ public function add(string $pattern, $paths = null): RouteInterface @@ -160,26 +163,27 @@ public function getModuleName(): string /** * Returns processed extra params * - * @todo deprecate this in future versions * @return array */ - public function getParams(): array + public function getParameters(): array { } /** * Returns processed extra params * + * @todo deprecate this in future versions * @return array */ - public function getParameters(): array + public function getParams(): array { } /** * Returns a route object by its id * - * @param int $id + * @phpstan-param string $id + * @param mixed $id * @return bool|RouteInterface */ public function getRouteById($id): RouteInterface|bool @@ -227,9 +231,9 @@ public function handle($arguments = null) * Sets the default action name * * @param string $actionName - * @return Router + * @return static */ - public function setDefaultAction(string $actionName): Router + public function setDefaultAction(string $actionName): static { } @@ -237,9 +241,9 @@ public function setDefaultAction(string $actionName): Router * Sets the name of the default module * * @param string $moduleName - * @return Router + * @return static */ - public function setDefaultModule(string $moduleName): Router + public function setDefaultModule(string $moduleName): static { } @@ -258,9 +262,9 @@ public function setDefaultModule(string $moduleName): Router * ``` * * @param array $defaults - * @return Router + * @return static */ - public function setDefaults(array $defaults): Router + public function setDefaults(array $defaults): static { } @@ -268,9 +272,9 @@ public function setDefaults(array $defaults): Router * Sets the default controller name * * @param string $taskName - * @return void + * @return static */ - public function setDefaultTask(string $taskName): void + public function setDefaultTask(string $taskName): static { } diff --git a/src/Cli/Router/Exceptions/BeforeMatchNotCallable.php b/src/Cli/Router/Exceptions/BeforeMatchNotCallable.php new file mode 100644 index 00000000..905146aa --- /dev/null +++ b/src/Cli/Router/Exceptions/BeforeMatchNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Router\Exceptions; + +use Phalcon\Cli\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BeforeMatchNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Cli/Router/Exceptions/InvalidRoutePaths.php b/src/Cli/Router/Exceptions/InvalidRoutePaths.php new file mode 100644 index 00000000..9b025a88 --- /dev/null +++ b/src/Cli/Router/Exceptions/InvalidRoutePaths.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Router\Exceptions; + +use Phalcon\Cli\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRoutePaths extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Cli/Router/Exceptions/RouterArgumentsInvalidType.php b/src/Cli/Router/Exceptions/RouterArgumentsInvalidType.php new file mode 100644 index 00000000..d8ed933c --- /dev/null +++ b/src/Cli/Router/Exceptions/RouterArgumentsInvalidType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Cli\Router\Exceptions; + +use Phalcon\Cli\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RouterArgumentsInvalidType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Cli/Router/Route.php b/src/Cli/Router/Route.php index 83a60e3d..5fda6d0b 100644 --- a/src/Cli/Router/Route.php +++ b/src/Cli/Router/Route.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Cli\Router; +use Phalcon\Cli\Router\Exceptions\InvalidRoutePaths; + /** * This class represents every route added to the router */ @@ -120,10 +122,10 @@ public function convert(string $name, $converter): RouteInterface /** * Set the routing delimiter * - * @param string $delimiter + * @param string|null $delimiter * @return void */ - public static function delimiter(string $delimiter = null): void + public static function delimiter(?string $delimiter = null): void { } diff --git a/src/Cli/Router/RouteInterface.php b/src/Cli/Router/RouteInterface.php index cdfe2c9a..94256dfb 100644 --- a/src/Cli/Router/RouteInterface.php +++ b/src/Cli/Router/RouteInterface.php @@ -26,9 +26,9 @@ public function compilePattern(string $pattern): string; /** * Set the routing delimiter * - * @param string $delimiter + * @param string|null $delimiter */ - public static function delimiter(string $delimiter = null); + public static function delimiter(?string $delimiter = null); /** * Returns the route's pattern diff --git a/src/Cli/RouterInterface.php b/src/Cli/RouterInterface.php index 66e4bfee..3487d41a 100644 --- a/src/Cli/RouterInterface.php +++ b/src/Cli/RouterInterface.php @@ -19,6 +19,7 @@ interface RouterInterface /** * Adds a route to the router on any HTTP method * + * @phpstan-param array|string|null $paths * @param string $pattern * @param mixed $paths * @return RouteInterface @@ -71,18 +72,20 @@ public function getParameters(): array; /** * Returns a route object by its id * + * @todo change param type to string + * @phpstan-param string $id * @param mixed $id - * @return RouteInterface + * @return bool|RouteInterface */ - public function getRouteById($id): RouteInterface; + public function getRouteById($id): RouteInterface|bool; /** * Returns a route object by its name * * @param string $name - * @return RouteInterface + * @return bool|RouteInterface */ - public function getRouteByName(string $name): RouteInterface; + public function getRouteByName(string $name): RouteInterface|bool; /** * Return all the routes defined in the router @@ -109,33 +112,33 @@ public function handle($arguments = null); * Sets the default action name * * @param string $actionName - * @return void + * @return RouterInterface */ - public function setDefaultAction(string $actionName): void; + public function setDefaultAction(string $actionName): RouterInterface; /** * Sets the name of the default module * * @param string $moduleName - * @return void + * @return RouterInterface */ - public function setDefaultModule(string $moduleName): void; + public function setDefaultModule(string $moduleName): RouterInterface; /** * Sets an array of default paths * * @param array $defaults - * @return void + * @return RouterInterface */ - public function setDefaults(array $defaults): void; + public function setDefaults(array $defaults): RouterInterface; /** * Sets the default task name * * @param string $taskName - * @return void + * @return RouterInterface */ - public function setDefaultTask(string $taskName): void; + public function setDefaultTask(string $taskName): RouterInterface; /** * Check if the router matches any of the defined routes diff --git a/src/Config/Adapter/Grouped.php b/src/Config/Adapter/Grouped.php index 4638e0b6..cc3957ec 100644 --- a/src/Config/Adapter/Grouped.php +++ b/src/Config/Adapter/Grouped.php @@ -13,6 +13,7 @@ use Phalcon\Config\ConfigFactory; use Phalcon\Config\ConfigInterface; use Phalcon\Config\Exception; +use Phalcon\Config\Exceptions\GroupedAdapterRequiresArray; use Phalcon\Factory\Exception as FactoryException; /** diff --git a/src/Config/Adapter/Ini.php b/src/Config/Adapter/Ini.php index 219cf4f3..dd745499 100644 --- a/src/Config/Adapter/Ini.php +++ b/src/Config/Adapter/Ini.php @@ -11,7 +11,7 @@ use Phalcon\Config\Config; use Phalcon\Config\Exception; -use Phalcon\Support\Traits\PhpFileTrait; +use Phalcon\Config\Exceptions\CannotLoadConfigFile; /** * Reads ini files and converts them to Phalcon\Config\Config objects. diff --git a/src/Config/Adapter/Yaml.php b/src/Config/Adapter/Yaml.php index ab410e43..5d1c2dfd 100644 --- a/src/Config/Adapter/Yaml.php +++ b/src/Config/Adapter/Yaml.php @@ -11,6 +11,8 @@ use Phalcon\Config\Config; use Phalcon\Config\Exception; +use Phalcon\Config\Exceptions\CannotLoadConfigFile; +use Phalcon\Config\Exceptions\MissingYamlExtension; /** * Reads YAML files and converts them to Phalcon\Config\Config objects. @@ -55,9 +57,9 @@ class Yaml extends Config * Phalcon\Config\Adapter\Yaml constructor * * @param string $filePath - * @param array $callbacks + * @param array|null $callbacks */ - public function __construct(string $filePath, array $callbacks = null) + public function __construct(string $filePath, ?array $callbacks = null) { } diff --git a/src/Config/Config.php b/src/Config/Config.php index 056b30c9..622f1ed3 100644 --- a/src/Config/Config.php +++ b/src/Config/Config.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Config; +use Phalcon\Config\Exceptions\InvalidMergeData; use Phalcon\Support\Collection; /** @@ -94,7 +95,7 @@ public function merge($toMerge): ConfigInterface * * @return mixed */ - public function path(string $path, $defaultValue = null, string $delimiter = null): mixed + public function path(string $path, $defaultValue = null, ?string $delimiter = null): mixed { } @@ -105,7 +106,7 @@ public function path(string $path, $defaultValue = null, string $delimiter = nul * * @return ConfigInterface */ - public function setPathDelimiter(string $delimiter = null): ConfigInterface + public function setPathDelimiter(?string $delimiter = null): ConfigInterface { } diff --git a/src/Config/ConfigFactory.php b/src/Config/ConfigFactory.php index 64896eff..15891437 100644 --- a/src/Config/ConfigFactory.php +++ b/src/Config/ConfigFactory.php @@ -11,6 +11,9 @@ use Phalcon\Config\Config; use Phalcon\Config\ConfigInterface; +use Phalcon\Config\Exceptions\ConfigNotArrayOrObject; +use Phalcon\Config\Exceptions\MissingConfigOption; +use Phalcon\Config\Exceptions\MissingFileExtension; use Phalcon\Factory\AbstractFactory; /** diff --git a/src/Config/ConfigInterface.php b/src/Config/ConfigInterface.php index 690ec4a3..ea0ac430 100644 --- a/src/Config/ConfigInterface.php +++ b/src/Config/ConfigInterface.php @@ -37,12 +37,12 @@ public function merge($toMerge): ConfigInterface; * * @return mixed */ - public function path(string $path, $defaultValue = null, string $delimiter = null): mixed; + public function path(string $path, $defaultValue = null, ?string $delimiter = null): mixed; /** * @param string|null $delimiter * * @return ConfigInterface */ - public function setPathDelimiter(string $delimiter = null): ConfigInterface; + public function setPathDelimiter(?string $delimiter = null): ConfigInterface; } diff --git a/src/Config/Exceptions/CannotLoadConfigFile.php b/src/Config/Exceptions/CannotLoadConfigFile.php new file mode 100644 index 00000000..38717fc8 --- /dev/null +++ b/src/Config/Exceptions/CannotLoadConfigFile.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotLoadConfigFile extends Exception +{ + /** + * @var string + */ + private $fileName; + + /** + * @param string $fileName + */ + public function __construct(string $fileName) + { + } + + /** + * @return string + */ + public function getFileName(): string + { + } +} diff --git a/src/Config/Exceptions/ConfigNotArrayOrObject.php b/src/Config/Exceptions/ConfigNotArrayOrObject.php new file mode 100644 index 00000000..23fa347a --- /dev/null +++ b/src/Config/Exceptions/ConfigNotArrayOrObject.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConfigNotArrayOrObject extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Config/Exceptions/GroupedAdapterRequiresArray.php b/src/Config/Exceptions/GroupedAdapterRequiresArray.php new file mode 100644 index 00000000..5b6ef001 --- /dev/null +++ b/src/Config/Exceptions/GroupedAdapterRequiresArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class GroupedAdapterRequiresArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Config/Exceptions/InvalidMergeData.php b/src/Config/Exceptions/InvalidMergeData.php new file mode 100644 index 00000000..30e6ca6e --- /dev/null +++ b/src/Config/Exceptions/InvalidMergeData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidMergeData extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Config/Exceptions/MissingConfigOption.php b/src/Config/Exceptions/MissingConfigOption.php new file mode 100644 index 00000000..0c4153fd --- /dev/null +++ b/src/Config/Exceptions/MissingConfigOption.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingConfigOption extends Exception +{ + /** + * @var string + */ + private $option; + + /** + * @param string $option + */ + public function __construct(string $option) + { + } + + /** + * @return string + */ + public function getOption(): string + { + } +} diff --git a/src/Config/Exceptions/MissingFileExtension.php b/src/Config/Exceptions/MissingFileExtension.php new file mode 100644 index 00000000..c8aae0a6 --- /dev/null +++ b/src/Config/Exceptions/MissingFileExtension.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingFileExtension extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Config/Exceptions/MissingYamlExtension.php b/src/Config/Exceptions/MissingYamlExtension.php new file mode 100644 index 00000000..1e9c88b7 --- /dev/null +++ b/src/Config/Exceptions/MissingYamlExtension.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Config\Exceptions; + +use Phalcon\Config\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingYamlExtension extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Container/Container.php b/src/Container/Container.php new file mode 100644 index 00000000..5a08cbd0 --- /dev/null +++ b/src/Container/Container.php @@ -0,0 +1,557 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container; + +use Closure; +use Phalcon\Container\Definition\Processor\ClosureProcessor; +use Phalcon\Container\Definition\Processor\ObjectProcessor; +use Phalcon\Container\Definition\Processor\Processor; +use Phalcon\Container\Definition\Processor\StringProcessor; +use Phalcon\Container\Definition\ServiceDefinition; +use Phalcon\Container\Definition\ServiceLifetime; +use Phalcon\Container\Exceptions\CannotExtendResolved; +use Phalcon\Container\Exceptions\CircularAliasFound; +use Phalcon\Container\Exceptions\InstanceNotFound; +use Phalcon\Container\Exceptions\NoProcessorFound; +use Phalcon\Container\Exceptions\ParameterNotFound; +use Phalcon\Container\Exceptions\ServiceNotFound; +use Phalcon\Container\Exceptions\ServiceNotRegistered; +use Phalcon\Container\Resolver\Lazy\Lazy; +use Phalcon\Container\Resolver\Resolver; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\InjectionAwareInterface; +use ReflectionException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Container implements \Phalcon\Contracts\Container\Service\Collection +{ + /** + * @var array + */ + protected $aliases = []; + + /** + * @var bool + */ + protected $autowire = true; + + /** + * @var array + */ + protected $instanceLifetimes = []; + + /** + * @var array + */ + protected $instances = []; + + /** + * @var array + */ + protected $parameters = []; + + /** + * @var array + */ + protected $processors = []; + + /** + * @var Resolver + */ + protected $resolver; + + /** + * @var array + */ + protected $services = []; + + /** + * @var array> + */ + protected $tags = []; + + public function __construct() + { + } + + /** + * Bind an interface to a concrete class + * + * @param string $interface + * @param string $concrete + * + * @return ServiceDefinition + * @param string $interfaceName + */ + public function bind(string $interfaceName, string $concrete): ServiceDefinition + { + } + + /** + * Resolve to a closure on a get() + * + * @param string $name + * + * @return Closure + */ + public function callableGet(string $name): Closure + { + } + + /** + * Resolve to a closure on a new() + * + * @param string $name + * + * @return Closure + */ + public function callableNew(string $name): Closure + { + } + + /** + * Extends the definition + * + * @param string $name + * @param callable $callable + * + * @return void + * @throws CannotExtendResolved + * @throws ServiceNotFound + * @param callable $callableObject + */ + public function extend(string $name, $callableObject): void + { + } + + /** + * Resolve and return an element registerd in the container + * + * @param string $name + * + * @return mixed + * @throws ServiceNotFound + */ + public function get(string $name): mixed + { + } + + /** + * Return an alias + * + * @param string $name + * + * @return string + */ + public function getAlias(string $name): string + { + } + + /** + * Return services by tag + * + * @param string $tag + * + * @return list + */ + public function getByTag(string $tag): array + { + } + + /** + * Return the service definition + * + * @param string $name + * + * @return ServiceDefinition + * @throws ServiceNotFound + */ + public function getDefinition(string $name): ServiceDefinition + { + } + + /** + * Return a stored instance + * + * @param string $name + * + * @return object + * @throws InstanceNotFound + */ + public function getInstance(string $name): object + { + } + + /** + * Return a parameter + * + * @param string $name + * + * @return mixed + * @throws ParameterNotFound + */ + public function getParameter(string $name): mixed + { + } + + /** + * Return the resolver + * + * @return Resolver + */ + public function getResolver(): Resolver + { + } + + /** + * Resolve an return a service + * + * @param string $serviceName + * + * @return object + * @throws ServiceNotFound + * @throws ServiceNotRegistered + */ + public function getService(string $serviceName): object + { + } + + /** + * Does the container have a particular service + * + * @param string $name + * + * @return bool + * @throws CircularAliasFound + */ + public function has(string $name): bool + { + } + + /** + * Does the service have an alias + * + * @param string $name + * + * @return bool + */ + public function hasAlias(string $name): bool + { + } + + /** + * Does the service have a definition + * + * @param string $name + * + * @return bool + */ + public function hasDefinition(string $name): bool + { + } + + /** + * Does the service have an instance + * + * @param string $name + * + * @return bool + */ + public function hasInstance(string $name): bool + { + } + + /** + * Does the service have a parameter + * + * @param string $name + * + * @return bool + */ + public function hasParameter(string $name): bool + { + } + + /** + * Does the container have a particular service + * + * @param string $serviceName + * + * @return bool + * @throws CircularAliasFound + */ + public function hasService(string $serviceName): bool + { + } + + /** + * Is AutoWiring enabled + * + * @return bool + */ + public function isAutowireEnabled(): bool + { + } + + /** + * Resolve and return a new service + * + * @param string $name + * + * @return mixed + * @throws CircularAliasFound + * @throws ReflectionException + * @throws ServiceNotFound + */ + public function new(string $name): mixed + { + } + + /** + * Return a new service definition + * + * @param string $name + * + * @return ServiceDefinition + */ + public function newDefinition(string $name): ServiceDefinition + { + } + + /** + * Set a service + * + * @param string $name + * @param mixed $definition + * + * @return ServiceDefinition + * @throws NoProcessorFound + */ + public function set(string $name, $definition): ServiceDefinition + { + } + + /** + * Set an alias + * + * @param string $name + * @param string $alias + * + * @return static + * @throws CircularAliasFound + */ + public function setAlias(string $name, string $alias): static + { + } + + /** + * Set AutoWire + * + * @param bool $enabled + * + * @return static + */ + public function setAutowire(bool $enabled): static + { + } + + /** + * Set a definition + * + * @param string $name + * @param ServiceDefinition $definition + * + * @return static + */ + public function setDefinition(string $name, \Phalcon\Container\Definition\ServiceDefinition $definition): static + { + } + + /** + * Set an instance + * + * @param string $name + * @param object $instance + * @param string $lifetime + * + * @return static + */ + public function setInstance(string $name, $instance, string $lifetime): static + { + } + + /** + * Set a parameter + * + * @param string $name + * @param mixed $value + * + * @return static + */ + public function setParameter(string $name, $value): static + { + } + + /** + * Register a tag with a service + * + * @param string $tag + * @param string $serviceName + * + * @return void + */ + public function setTag(string $tag, string $serviceName): void + { + } + + /** + * Remove an alias + * + * @param string $name + * + * @return void + */ + public function unsetAlias(string $name): void + { + } + + /** + * Remove a definition + * + * @param string $name + * + * @return void + */ + public function unsetDefinition(string $name): void + { + } + + /** + * Remove an instance + * + * @param string $name + * + * @return void + */ + public function unsetInstance(string $name): void + { + } + + /** + * Remove instances based on lifetime + * + * @param string $lifetime + * + * @return void + */ + public function unsetInstances(string $lifetime): void + { + } + + /** + * Remove a parameter + * + * @param string $name + * + * @return void + */ + public function unsetParameter(string $name): void + { + } + + /** + * Detect circular aliases + * + * @param string $alias + * @param string $target + * + * @return void + * @throws CircularAliasFound + */ + private function detectCircularAlias(string $alias, string $target): void + { + } + + /** + * Locate a processor + * + * @param mixed $definition + * + * @return Processor + * @throws NoProcessorFound + */ + private function findProcessor($definition): Processor + { + } + + /** + * Resolve the service + * + * @param string $name + * @param bool $cache + * + * @return mixed + * @throws ServiceNotFound + * @throws ReflectionException + */ + private function resolve(string $name, bool $cache): mixed + { + } + + /** + * Resolve an alias + * + * @param string $name + * + * @return string + * @throws CircularAliasFound + */ + private function resolveAlias(string $name): string + { + } + + /** + * Resolve a paramater + * + * @param string $name + * + * @return mixed + */ + private function resolveParameter(string $name): mixed + { + } +} diff --git a/src/Container/ContainerFactory.php b/src/Container/ContainerFactory.php new file mode 100644 index 00000000..35b08360 --- /dev/null +++ b/src/Container/ContainerFactory.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container; + +use Phalcon\Contracts\Container\Ioc\IocContainerFactory; +use Phalcon\Contracts\Container\Service\Provider; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ContainerFactory implements \Phalcon\Contracts\Container\Ioc\IocContainerFactory +{ + /** + * @var array + */ + protected $providers = []; + + /** + * Adds a provider + * + * @param Provider $provider + * + * @return static + */ + public function addProvider(\Phalcon\Contracts\Container\Service\Provider $provider): static + { + } + + /** + * Returns a new container + * + * @return Container + */ + public function newContainer(): Container + { + } +} diff --git a/src/Container/Definition/DefinitionType.php b/src/Container/Definition/DefinitionType.php new file mode 100644 index 00000000..136df6b3 --- /dev/null +++ b/src/Container/Definition/DefinitionType.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class DefinitionType +{ + /** + * @var string + */ + const CLOSURE_TYPE = 'closure'; + + /** + * @var string + */ + const OBJECT_TYPE = 'object'; + + /** + * @var string + */ + const PARAMETER_TYPE = 'parameter'; + + /** + * @var string + */ + const STRING_TYPE = 'string'; +} diff --git a/src/Container/Definition/Processor/ClosureProcessor.php b/src/Container/Definition/Processor/ClosureProcessor.php new file mode 100644 index 00000000..c96adf71 --- /dev/null +++ b/src/Container/Definition/Processor/ClosureProcessor.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition\Processor; + +use Closure; +use Phalcon\Container\Definition\DefinitionType; +use Phalcon\Container\Definition\ServiceDefinition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ClosureProcessor implements \Phalcon\Container\Definition\Processor\Processor +{ + /** + * Wheteher the definition is a Closure + * + * @param mixed $definition + * + * @return bool + */ + public function canProcess($definition): bool + { + } + + /** + * Process the Closure + * + * @param string $name + * @param mixed $definition + * @param object $container + * + * @return ServiceDefinition + */ + public function process(string $name, $definition, $container): ServiceDefinition + { + } +} diff --git a/src/Container/Definition/Processor/ObjectProcessor.php b/src/Container/Definition/Processor/ObjectProcessor.php new file mode 100644 index 00000000..09a8fa90 --- /dev/null +++ b/src/Container/Definition/Processor/ObjectProcessor.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition\Processor; + +use Closure; +use Phalcon\Container\Definition\DefinitionType; +use Phalcon\Container\Definition\ServiceDefinition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ObjectProcessor implements \Phalcon\Container\Definition\Processor\Processor +{ + /** + * Whether the definition is an Object (not Closure) + * + * @param mixed $definition + * + * @return bool + */ + public function canProcess($definition): bool + { + } + + /** + * Process the Object + * + * @param string $name + * @param mixed $definition + * @param object $container + * + * @return ServiceDefinition + */ + public function process(string $name, $definition, $container): ServiceDefinition + { + } +} diff --git a/src/Container/Definition/Processor/ParameterProcessor.php b/src/Container/Definition/Processor/ParameterProcessor.php new file mode 100644 index 00000000..e8f0c6df --- /dev/null +++ b/src/Container/Definition/Processor/ParameterProcessor.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition\Processor; + +use Closure; +use Phalcon\Container\Definition\DefinitionType; +use Phalcon\Container\Definition\ServiceDefinition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ParameterProcessor implements \Phalcon\Container\Definition\Processor\Processor +{ + /** + * Whetehr the definition is a parameter + * + * @param mixed $definition + * + * @return bool + */ + public function canProcess($definition): bool + { + } + + /** + * Process the parameter + * + * @param string $name + * @param mixed $definition + * @param object $container + * + * @return ServiceDefinition + */ + public function process(string $name, $definition, $container): ServiceDefinition + { + } +} diff --git a/src/Container/Definition/Processor/Processor.php b/src/Container/Definition/Processor/Processor.php new file mode 100644 index 00000000..770cafa3 --- /dev/null +++ b/src/Container/Definition/Processor/Processor.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition\Processor; + +use Phalcon\Container\Definition\ServiceDefinition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Processor +{ + /** + * Can this definition be processed? + * + * @param mixed $definition + * + * @return bool + */ + public function canProcess($definition): bool; + + /** + * Process the definition + * + * @param string $name + * @param mixed $definition + * @param object $container + * + * @return ServiceDefinition + */ + public function process(string $name, $definition, $container): ServiceDefinition; +} diff --git a/src/Container/Definition/Processor/StringProcessor.php b/src/Container/Definition/Processor/StringProcessor.php new file mode 100644 index 00000000..69effd3c --- /dev/null +++ b/src/Container/Definition/Processor/StringProcessor.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition\Processor; + +use Phalcon\Container\Definition\DefinitionType; +use Phalcon\Container\Definition\ServiceDefinition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class StringProcessor implements \Phalcon\Container\Definition\Processor\Processor +{ + /** + * Whether the definition is a class string + * + * @param mixed $definition + * + * @return bool + */ + public function canProcess($definition): bool + { + } + + /** + * Process the class string + * + * @param string $name + * @param mixed $definition + * @param object $container + * + * @return ServiceDefinition + */ + public function process(string $name, $definition, $container): ServiceDefinition + { + } +} diff --git a/src/Container/Definition/ServiceDefinition.php b/src/Container/Definition/ServiceDefinition.php new file mode 100644 index 00000000..64a52b1c --- /dev/null +++ b/src/Container/Definition/ServiceDefinition.php @@ -0,0 +1,437 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition; + +use Phalcon\Container\Exceptions\FrozenDefinition; +use Phalcon\Container\Exceptions\InvalidExtender; +use Phalcon\Container\Exceptions\NoClassSet; +use Phalcon\Container\Exceptions\NoFactorySet; +use ReflectionClass; +use ReflectionException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ServiceDefinition +{ + /** + * @phpstan-var array + * @var array + */ + protected $arguments = []; + + /** + * @var object | null + */ + protected $container = null; + + /** + * @var string | null + */ + protected $className = null; + + /** + * @var array + */ + protected $constructorArgs = []; + + /** + * @var array + */ + protected $extenders = []; + + /** + * @var callable | null + */ + protected $factory = null; + + /** + * @var bool + */ + protected $frozen = false; + + /** + * @var bool + */ + protected $isCacheable = false; + + /** + * @var string + */ + protected $lifetime = ServiceLifetime::SCOPED; + + /** + * @var mixed + */ + protected $raw = null; + + /** + * @var string + */ + protected $serviceName; + + /** + * @phpstan-var array + * @var array + */ + protected $tags = []; + + /** + * @var string + */ + protected $type; + + /** + * @param string $serviceName + * @param string $type + * @param mixed $raw + */ + public function __construct(string $serviceName, string $type, $raw = null) + { + } + + /** + * Adds an extender + * + * @param callable $extender + * + * @return static + * @throws FrozenDefinition + */ + public function addExtender($extender): static + { + } + + /** + * Adds a tag + * + * @param string $tag + * + * @return static + * @throws FrozenDefinition + */ + public function addTag(string $tag): static + { + } + + /** + * Builds a service and returns the instance back + * + * @param object $container + * + * @return object + * @throws ReflectionException + */ + public function buildService($container): object + { + } + + /** + * Freezes the container + * + * @param object $container + * + * @return void + * @throws ReflectionException + */ + public function freeze($container): void + { + } + + /** + * Returns the arguments + * + * @return array + */ + public function getArguments(): array + { + } + + /** + * Returns the class + * + * @return string + * @throws NoClassSet + */ + public function getClass(): string + { + } + + /** + * Returns the constructor arguments + * + * @return array + */ + public function getConstructorArgs(): array + { + } + + /** + * Returns the extenders + * + * @return array + */ + public function getExtenders(): array + { + } + + /** + * Returns the factory + * + * @return callable + * @throws NoFactorySet + */ + public function getFactory() + { + } + + /** + * Returns the lifetime + * + * @return string + */ + public function getLifetime(): string + { + } + + /** + * Returns the name of the service + * + * @return string + */ + public function getServiceName(): string + { + } + + /** + * Returns the tags + * + * @return array + */ + public function getTags(): array + { + } + + /** + * Returns the type + * + * @return string + */ + public function getType(): string + { + } + + /** + * Does it have a class + * + * @return bool + */ + public function hasClass(): bool + { + } + + /** + * Do we have extenders + * + * @return bool + */ + public function hasExtenders(): bool + { + } + + /** + * Does it have a factory + * + * @return bool + */ + public function hasFactory(): bool + { + } + + /** + * Is it cacheable + * + * @return bool + */ + public function isCacheable(): bool + { + } + + /** + * Is it frozen + * + * @return bool + */ + public function isFrozen(): bool + { + } + + /** + * Set an argument + * + * @param int|string $param + * @param mixed $value + * + * @return static + * @throws FrozenDefinition + */ + public function setArgument($param, $value): static + { + } + + /** + * Set the container + * + * @param object $container + * + * @return static + */ + public function setContainer($container): static + { + } + + /** + * Set a class + * + * @param string $className + * + * @return static + * @throws FrozenDefinition + */ + public function setClass(string $className): static + { + } + + /** + * Set extenders + * + * @param array $extenders + * + * @return static + * @throws FrozenDefinition + * @throws InvalidExtender + */ + public function setExtenders(array $extenders): static + { + } + + /** + * Set a factory + * + * @param callable $factory + * + * @return static + * @throws FrozenDefinition + */ + public function setFactory($factory): static + { + } + + /** + * Set cachable + * + * @param bool $isCacheable + * + * @return static + * @throws FrozenDefinition + */ + public function setIsCacheable(bool $isCacheable): static + { + } + + /** + * Set lifetime + * + * @param string $lifetime + * + * @return static + * @throws FrozenDefinition + */ + public function setLifetime(string $lifetime): static + { + } + + /** + * Unset class + * + * @return static + * @throws FrozenDefinition + */ + public function unsetClass(): static + { + } + + /** + * Unset extenders + * + * @return static + * @throws FrozenDefinition + */ + public function unsetExtenders(): static + { + } + + /** + * Unset the factory + * + * @return static + * @throws FrozenDefinition + */ + public function unsetFactory(): static + { + } + + /** + * Check if frozen + * + * @return void + * @throws FrozenDefinition + */ + protected function checkFrozen(): void + { + } + + /** + * Resolve arguments + * + * @param object $container + * @param array $args + * + * @return array + */ + private function resolveArgs($container, array $args): array + { + } +} diff --git a/src/Container/Definition/ServiceLifetime.php b/src/Container/Definition/ServiceLifetime.php new file mode 100644 index 00000000..7167a27b --- /dev/null +++ b/src/Container/Definition/ServiceLifetime.php @@ -0,0 +1,56 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Definition; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ServiceLifetime +{ + /** + * @var string + */ + const SCOPED = 'SCOPED'; + + /** + * @var string + */ + const SINGLETON = 'SINGLETON'; + + /** + * @var string + */ + const TRANSIENT = 'TRANSIENT'; +} diff --git a/src/Container/Exceptions/CannotExtendResolved.php b/src/Container/Exceptions/CannotExtendResolved.php new file mode 100644 index 00000000..2539743f --- /dev/null +++ b/src/Container/Exceptions/CannotExtendResolved.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CannotExtendResolved extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Cannot extend a resolved service + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/CannotResolveParameter.php b/src/Container/Exceptions/CannotResolveParameter.php new file mode 100644 index 00000000..1aec2480 --- /dev/null +++ b/src/Container/Exceptions/CannotResolveParameter.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CannotResolveParameter extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Cannot resolve a parameter + * + * @param string $param + * @param string $className + * + * @return static + */ + public function __construct(string $param, string $className) + { + } +} diff --git a/src/Container/Exceptions/CircularAliasFound.php b/src/Container/Exceptions/CircularAliasFound.php new file mode 100644 index 00000000..6d82c84c --- /dev/null +++ b/src/Container/Exceptions/CircularAliasFound.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CircularAliasFound extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Circular Alias found + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/ContainerThrowable.php b/src/Container/Exceptions/ContainerThrowable.php new file mode 100644 index 00000000..1aa87713 --- /dev/null +++ b/src/Container/Exceptions/ContainerThrowable.php @@ -0,0 +1,45 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +use Phalcon\Contracts\Container\Ioc\IocThrowable; +use Phalcon\Contracts\Container\Resolver\ResolverThrowable; +use Phalcon\Contracts\Container\Service\Throwable as ServiceThrowable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface ContainerThrowable extends \Phalcon\Contracts\Container\Ioc\IocThrowable, \Phalcon\Contracts\Container\Resolver\ResolverThrowable, ServiceThrowable +{ +} diff --git a/src/Container/Exceptions/EnvNotDefined.php b/src/Container/Exceptions/EnvNotDefined.php new file mode 100644 index 00000000..24797435 --- /dev/null +++ b/src/Container/Exceptions/EnvNotDefined.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +final class EnvNotDefined extends \Phalcon\Container\Exceptions\Exception +{ + /** + * @param string $varname + */ + public function __construct(string $varname) + { + } +} diff --git a/src/Container/Exceptions/Exception.php b/src/Container/Exceptions/Exception.php new file mode 100644 index 00000000..be502bb8 --- /dev/null +++ b/src/Container/Exceptions/Exception.php @@ -0,0 +1,44 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +use Exception as BaseException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Exception extends \Exception implements \Phalcon\Container\Exceptions\ContainerThrowable +{ +} diff --git a/src/Container/Exceptions/FrozenDefinition.php b/src/Container/Exceptions/FrozenDefinition.php new file mode 100644 index 00000000..751eff54 --- /dev/null +++ b/src/Container/Exceptions/FrozenDefinition.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class FrozenDefinition extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Definition is frozen + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/InstanceNotFound.php b/src/Container/Exceptions/InstanceNotFound.php new file mode 100644 index 00000000..a59f0791 --- /dev/null +++ b/src/Container/Exceptions/InstanceNotFound.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +final class InstanceNotFound extends \Phalcon\Container\Exceptions\Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/InvalidExtender.php b/src/Container/Exceptions/InvalidExtender.php new file mode 100644 index 00000000..6635f4db --- /dev/null +++ b/src/Container/Exceptions/InvalidExtender.php @@ -0,0 +1,53 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class InvalidExtender extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Invalid extender (not callable) + * + * @param string $service + * @param string $key + * + * @return static + */ + public function __construct(string $service, string $key) + { + } +} diff --git a/src/Container/Exceptions/NoClassSet.php b/src/Container/Exceptions/NoClassSet.php new file mode 100644 index 00000000..76b66a00 --- /dev/null +++ b/src/Container/Exceptions/NoClassSet.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class NoClassSet extends \Phalcon\Container\Exceptions\Exception +{ + /** + * No set for service + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/NoFactorySet.php b/src/Container/Exceptions/NoFactorySet.php new file mode 100644 index 00000000..41b19c46 --- /dev/null +++ b/src/Container/Exceptions/NoFactorySet.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class NoFactorySet extends \Phalcon\Container\Exceptions\Exception +{ + /** + * No factory for service + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/NoProcessorFound.php b/src/Container/Exceptions/NoProcessorFound.php new file mode 100644 index 00000000..e12c7ee7 --- /dev/null +++ b/src/Container/Exceptions/NoProcessorFound.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class NoProcessorFound extends \Phalcon\Container\Exceptions\Exception +{ + /** + * No processor found + * + * @return static + */ + public function __construct() + { + } +} diff --git a/src/Container/Exceptions/ParameterNotFound.php b/src/Container/Exceptions/ParameterNotFound.php new file mode 100644 index 00000000..fca5bbe4 --- /dev/null +++ b/src/Container/Exceptions/ParameterNotFound.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +final class ParameterNotFound extends \Phalcon\Container\Exceptions\Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/ServiceNotFound.php b/src/Container/Exceptions/ServiceNotFound.php new file mode 100644 index 00000000..047ccd7c --- /dev/null +++ b/src/Container/Exceptions/ServiceNotFound.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ServiceNotFound extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Service not found + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Exceptions/ServiceNotRegistered.php b/src/Container/Exceptions/ServiceNotRegistered.php new file mode 100644 index 00000000..c4d01ef3 --- /dev/null +++ b/src/Container/Exceptions/ServiceNotRegistered.php @@ -0,0 +1,52 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ServiceNotRegistered extends \Phalcon\Container\Exceptions\Exception +{ + /** + * Service not registered + * + * @param string $name + * + * @return static + */ + public function __construct(string $name) + { + } +} diff --git a/src/Container/Provider/Cli.php b/src/Container/Provider/Cli.php new file mode 100644 index 00000000..859cfa3d --- /dev/null +++ b/src/Container/Provider/Cli.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Provider; + +use Phalcon\Auth\Access\AccessLocator; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Contracts\Container\Service\Provider; +use Phalcon\Filter\Filter; +use Phalcon\Filter\FilterFactory; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Cli implements \Phalcon\Contracts\Container\Service\Provider +{ + /** + * Provider for commonly used CLI applications + * + * @param Collection $services + * + * @return void + */ + public function provide(\Phalcon\Contracts\Container\Service\Collection $services): void + { + } +} diff --git a/src/Container/Provider/Web.php b/src/Container/Provider/Web.php new file mode 100644 index 00000000..960ecbf8 --- /dev/null +++ b/src/Container/Provider/Web.php @@ -0,0 +1,58 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Provider; + +use Phalcon\Auth\Access\AccessLocator; +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Contracts\Container\Service\Provider; +use Phalcon\Filter\Filter; +use Phalcon\Filter\FilterFactory; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Web implements \Phalcon\Contracts\Container\Service\Provider +{ + /** + * Provider for commonly used Web applications + * + * @param Collection $services + * + * @return void + */ + public function provide(\Phalcon\Contracts\Container\Service\Collection $services): void + { + } +} diff --git a/src/Container/Resolver/Lazy/ArrayValues.php b/src/Container/Resolver/Lazy/ArrayValues.php new file mode 100644 index 00000000..755ee1d5 --- /dev/null +++ b/src/Container/Resolver/Lazy/ArrayValues.php @@ -0,0 +1,144 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +use ArrayAccess; +use ArrayIterator; +use Countable; +use IteratorAggregate; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class ArrayValues extends \Phalcon\Container\Resolver\Lazy\Lazy implements \ArrayAccess, \Countable, \IteratorAggregate +{ + /** + * @var array + */ + protected $values = []; + + /** + * @param array $values + */ + public function __construct(array $values = []) + { + } + + /** + * @return int + */ + public function count(): int + { + } + + /** + * @return ArrayIterator + */ + public function getIterator(): ArrayIterator + { + } + + /** + * @param iterable $values + * + * @return void + */ + public function merge($values): void + { + } + + /** + * @param mixed $offset + * @return bool + */ + public function offsetExists($offset): bool + { + } + + /** + * @param mixed $offset + * @return mixed + */ + public function offsetGet($offset): mixed + { + } + + /** + * @param mixed $offset + * @param mixed $value + * @return void + */ + public function offsetSet($offset, $value): void + { + } + + /** + * @param mixed $offset + * @return void + */ + public function offsetUnset($offset): void + { + } + + /** + * Resolve to an array, where each element has itself been lazy-resolved. + * + * @param object $ioc + * + * @return array + */ + public function resolve($ioc): array + { + } + + /** + * @param object $ioc + * @param mixed $value + * @return mixed + */ + protected function resolveValue($ioc, $value): mixed + { + } + + /** + * @param object $ioc + * @param array $values + * + * @return array + */ + protected function resolveValues($ioc, array $values): array + { + } +} diff --git a/src/Container/Resolver/Lazy/Call.php b/src/Container/Resolver/Lazy/Call.php new file mode 100644 index 00000000..8fd154ed --- /dev/null +++ b/src/Container/Resolver/Lazy/Call.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Call extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var mixed + */ + protected $callableObject; + + /** + * @param callable $callableObject + */ + public function __construct($callableObject) + { + } + + /** + * Resolve the callable + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/CallableGet.php b/src/Container/Resolver/Lazy/CallableGet.php new file mode 100644 index 00000000..82124626 --- /dev/null +++ b/src/Container/Resolver/Lazy/CallableGet.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CallableGet extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var string|Lazy + */ + protected $id; + + /** + * @param string|Lazy $id + */ + public function __construct($id) + { + } + + /** + * Resolve to a closure on a get() + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/CallableNew.php b/src/Container/Resolver/Lazy/CallableNew.php new file mode 100644 index 00000000..dd6868d0 --- /dev/null +++ b/src/Container/Resolver/Lazy/CallableNew.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CallableNew extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var string|Lazy + */ + protected $id; + + /** + * @param string|Lazy $id + */ + public function __construct($id) + { + } + + /** + * Resolve to a closure on a new() + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/CsEnv.php b/src/Container/Resolver/Lazy/CsEnv.php new file mode 100644 index 00000000..9f04ffc7 --- /dev/null +++ b/src/Container/Resolver/Lazy/CsEnv.php @@ -0,0 +1,55 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +use Phalcon\Container\Exceptions\EnvNotDefined; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class CsEnv extends \Phalcon\Container\Resolver\Lazy\Env +{ + /** + * Resolve the getEnv() from keys as a comma separated list + * + * @param object $ioc + * + * @return array + * @throws EnvNotDefined + */ + public function resolve($ioc): array + { + } +} diff --git a/src/Container/Resolver/Lazy/Env.php b/src/Container/Resolver/Lazy/Env.php new file mode 100644 index 00000000..3143bdb5 --- /dev/null +++ b/src/Container/Resolver/Lazy/Env.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +use Phalcon\Container\Exceptions\EnvNotDefined; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Env extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var string + */ + protected $varname; + + /** + * @var string|null + */ + protected $vartype = null; + + /** + * @param string $varname + * @param string|null $vartype + */ + public function __construct(string $varname, ?string $vartype = null) + { + } + + /** + * Resolve an environment variable + * + * @param object $ioc + * + * @return mixed + * @throws EnvNotDefined + */ + public function resolve($ioc): mixed + { + } + + /** + * Cast a value to the defined type (if any) + * + * @param string $value + * + * @return mixed + */ + protected function cast($value): mixed + { + } + + /** + * Return the env value + * + * @return string + * @throws EnvNotDefined + */ + protected function getEnv(): string + { + } +} diff --git a/src/Container/Resolver/Lazy/EnvDefault.php b/src/Container/Resolver/Lazy/EnvDefault.php new file mode 100644 index 00000000..34238559 --- /dev/null +++ b/src/Container/Resolver/Lazy/EnvDefault.php @@ -0,0 +1,68 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +use Phalcon\Container\Exceptions\EnvNotDefined; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class EnvDefault extends \Phalcon\Container\Resolver\Lazy\Env +{ + /** + * @var mixed + */ + private $defaultValue; + + /** + * @param string $varname + * @param mixed $defaultValue + * @param string|null $vartype + */ + public function __construct(string $varname, $defaultValue, ?string $vartype = null) + { + } + + /** + * Resolve an environment variable, returning the default if not defined + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/FunctionCall.php b/src/Container/Resolver/Lazy/FunctionCall.php new file mode 100644 index 00000000..a05032c5 --- /dev/null +++ b/src/Container/Resolver/Lazy/FunctionCall.php @@ -0,0 +1,70 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class FunctionCall extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var string + */ + protected $functionName; + + /** + * @param string $functionName + * @param array $arguments + */ + public function __construct(string $functionName, array $arguments) + { + } + + /** + * Resolve a function + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/Get.php b/src/Container/Resolver/Lazy/Get.php new file mode 100644 index 00000000..21c0eb18 --- /dev/null +++ b/src/Container/Resolver/Lazy/Get.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Get extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var string|Lazy + */ + protected $id; + + /** + * @param string|Lazy $id + */ + public function __construct($id) + { + } + + /** + * Resolve a shared instance + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/GetCall.php b/src/Container/Resolver/Lazy/GetCall.php new file mode 100644 index 00000000..f5dc3b62 --- /dev/null +++ b/src/Container/Resolver/Lazy/GetCall.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class GetCall extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var string|Lazy + */ + protected $id; + + /** + * @var string + */ + protected $method; + + /** + * @param string|Lazy $id + * @param string $method + * @param array $arguments + */ + public function __construct($id, string $method, array $arguments) + { + } + + /** + * Resolve a shared instance method call + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/Lazy.php b/src/Container/Resolver/Lazy/Lazy.php new file mode 100644 index 00000000..7dc9e453 --- /dev/null +++ b/src/Container/Resolver/Lazy/Lazy.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +use Phalcon\Contracts\Container\Resolver\Resolvable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +abstract class Lazy implements \Phalcon\Contracts\Container\Resolver\Resolvable +{ + /** + * @param object $ioc + * @return mixed + */ + public function __invoke($ioc): mixed + { + } + + /** + * @param object $ioc + * @return mixed + */ + abstract public function resolve($ioc): mixed; + + /** + * @param object $ioc + * @param mixed $argument + * @return mixed + */ + protected function resolveArgument($ioc, $argument): mixed + { + } + + /** + * @param object $ioc + * @param array $arguments + * + * @return array + */ + protected function resolveArguments($ioc, array $arguments): array + { + } +} diff --git a/src/Container/Resolver/Lazy/LazyFactory.php b/src/Container/Resolver/Lazy/LazyFactory.php new file mode 100644 index 00000000..52e3d932 --- /dev/null +++ b/src/Container/Resolver/Lazy/LazyFactory.php @@ -0,0 +1,162 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class LazyFactory +{ + /** + * @param array $values + * + * @return ArrayValues + */ + public static function arrayValues(array $values): ArrayValues + { + } + + /** + * @param callable $callableObject + * @return Call + */ + public static function call($callableObject): Call + { + } + + /** + * @param string $id + * @return CallableGet + */ + public static function callableGet(string $id): CallableGet + { + } + + /** + * @param string $id + * @return CallableNew + */ + public static function callableNew(string $id): CallableNew + { + } + + /** + * @param string $name + * @param string|null $type + * @return CsEnv + */ + public static function csEnv(string $name, ?string $type = null): CsEnv + { + } + + /** + * @param string $name + * @param string|null $type + * @return Env + */ + public static function env(string $name, ?string $type = null): Env + { + } + + /** + * @param string $name + * @param mixed $defaultValue + * @param string|null $type + * @return EnvDefault + */ + public static function envDefault(string $name, $defaultValue, ?string $type = null): EnvDefault + { + } + + /** + * @param string $function + * @param array $args + * + * @return FunctionCall + * @param string $functionName + */ + public static function functionCall(string $functionName, array $args): FunctionCall + { + } + + /** + * @param string $id + * @return Get + */ + public static function get(string $id): Get + { + } + + /** + * @param string $id + * @param string $method + * @param array $args + * + * @return GetCall + */ + public static function getCall(string $id, string $method, array $args): GetCall + { + } + + /** + * @param string $id + * @param string $method + * @param array $args + * + * @return NewCall + */ + public static function newCall(string $id, string $method, array $args): NewCall + { + } + + /** + * @param string $id + * @return NewInstance + */ + public static function newInstance(string $id): NewInstance + { + } + + /** + * @param string $className + * @param string $method + * @param array $args + * + * @return StaticCall + */ + public static function staticCall(string $className, string $method, array $args): StaticCall + { + } +} diff --git a/src/Container/Resolver/Lazy/NewCall.php b/src/Container/Resolver/Lazy/NewCall.php new file mode 100644 index 00000000..f702eae2 --- /dev/null +++ b/src/Container/Resolver/Lazy/NewCall.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class NewCall extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var string|Lazy + */ + protected $id; + + /** + * @var string + */ + protected $method; + + /** + * @param string|Lazy $id + * @param string $method + * @param array $arguments + */ + public function __construct($id, string $method, array $arguments) + { + } + + /** + * Resolve a new instance method call + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/NewInstance.php b/src/Container/Resolver/Lazy/NewInstance.php new file mode 100644 index 00000000..b80cf724 --- /dev/null +++ b/src/Container/Resolver/Lazy/NewInstance.php @@ -0,0 +1,64 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class NewInstance extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var string|Lazy + */ + protected $id; + + /** + * @param string|Lazy $id + */ + public function __construct($id) + { + } + + /** + * Resolve a new instance + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Lazy/StaticCall.php b/src/Container/Resolver/Lazy/StaticCall.php new file mode 100644 index 00000000..76e31950 --- /dev/null +++ b/src/Container/Resolver/Lazy/StaticCall.php @@ -0,0 +1,76 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver\Lazy; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class StaticCall extends \Phalcon\Container\Resolver\Lazy\Lazy +{ + /** + * @var array + */ + protected $arguments; + + /** + * @var string|Lazy + */ + protected $className; + + /** + * @var string + */ + protected $method; + + /** + * @param string|Lazy $className + * @param string $method + * @param array $arguments + */ + public function __construct($className, string $method, array $arguments) + { + } + + /** + * Resolve a static method call + * + * @param object $ioc + * + * @return mixed + */ + public function resolve($ioc): mixed + { + } +} diff --git a/src/Container/Resolver/Resolver.php b/src/Container/Resolver/Resolver.php new file mode 100644 index 00000000..01547d83 --- /dev/null +++ b/src/Container/Resolver/Resolver.php @@ -0,0 +1,152 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Container\Resolver; + +use Closure; +use Phalcon\Container\Exceptions\CannotResolveParameter; +use Phalcon\Container\Resolver\Lazy\Lazy; +use Phalcon\Contracts\Container\Resolver\ResolverService; +use ReflectionClass; +use ReflectionException; +use ReflectionFunction; +use ReflectionMethod; +use ReflectionNamedType; +use ReflectionParameter; +use ReflectionType; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. The + * latter two are copied and re-implemented here: service-interop is not yet + * published on Packagist, and resolver-interop requires PHP 8.4 (this project + * targets PHP 8.1). Once both packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +class Resolver implements \Phalcon\Contracts\Container\Resolver\ResolverService +{ + /** + * Is this a resolvable class? + * + * @param string $className + * + * @return bool + */ + public function isResolvableClass(string $className): bool + { + } + + /** + * Resolve a call + * + * @param object $ioc + * @param callable $callable + * @param array $arguments + * + * @return mixed + * @throws ReflectionException + * @param callable $callableObject + */ + public function resolveCall($ioc, $callableObject, array $arguments): mixed + { + } + + /** + * Resolve a class + * + * @param object $ioc + * @param string $className + * @param array $arguments + * + * @return object + * @throws ReflectionException + */ + public function resolveClass($ioc, string $className, array $arguments): object + { + } + + /** + * Resolve a method + * + * @param object $ioc + * @param ReflectionMethod $method + * @param object $object + * + * @return void + * @throws ReflectionException + * @param object $instance + */ + public function resolveMethod($ioc, \ReflectionMethod $method, $instance): void + { + } + + /** + * Resolve parameters + * + * @param object $ioc + * @param ReflectionParameter $parameter + * + * @return mixed + * @throws CannotResolveParameter + * @throws ReflectionException + */ + public function resolveParameter($ioc, \ReflectionParameter $parameter): mixed + { + } + + /** + * @param object $ioc + * @param array $parameters + * @param array $arguments + * @return array + */ + public function resolveParameters($ioc, array $parameters, array $arguments): array + { + } + + /** + * type is ReflectionType + * + * @param object $ioc + * @param mixed $type + * @return mixed + */ + public function resolveType($ioc, $type): mixed + { + } + + /** + * @param object $ioc + * @param mixed $arg + * @return mixed + */ + private function resolveArg($ioc, $arg): mixed + { + } +} diff --git a/src/Contracts/Auth/Access/Access.php b/src/Contracts/Auth/Access/Access.php new file mode 100644 index 00000000..2422f814 --- /dev/null +++ b/src/Contracts/Auth/Access/Access.php @@ -0,0 +1,61 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Access; + +/** + * @phpstan-type ForwardTarget array{ + * controller?: string, + * action?: string, + * params?: array, + * namespace?: string, + * task?: string, + * }&array + */ +interface Access +{ + /** + * @return bool + */ + public function allowedIf(): bool; + + /** + * @return list + */ + public function getExceptActions(): array; + + /** + * @return list + */ + public function getOnlyActions(): array; + + /** + * @param string $actionName + * @return bool + */ + public function isAllowed(string $actionName): bool; + + /** + * @phpstan-return ForwardTarget|null + * @return array|null + */ + public function redirectTo(): array|null; + + /** + * @param list $exceptActions + * @return void + */ + public function setExceptActions(array $exceptActions = []): void; + + /** + * @param list $onlyActions + * @return void + */ + public function setOnlyActions(array $onlyActions = []): void; +} diff --git a/src/Contracts/Auth/Adapter/Adapter.php b/src/Contracts/Auth/Adapter/Adapter.php new file mode 100644 index 00000000..98554441 --- /dev/null +++ b/src/Contracts/Auth/Adapter/Adapter.php @@ -0,0 +1,69 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Adapter; + +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Encryption\Security\Security; + +/** + * Authentication adapter contract. + * + * Adapters look users up by credentials or by identifier and verify the + * password against the stored hash. The credential payload is intentionally + * unsealed: any user-row field may be used as the lookup key, plus an + * optional `password` entry that is ignored during the row match and + * consumed only by validateCredentials(). + * + * @phpstan-type AuthCredentials array + */ +interface Adapter +{ + /** + * Build an adapter from a flat options map. Used by ManagerFactory to + * wire adapters from the application config; each implementation is + * free to interpret the option keys it cares about. + * + * @param array $options + * @param \Phalcon\Contracts\Encryption\Security\Security $hasher + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Encryption\Security\Security $hasher, array $options): static; + + /** + * Find a user matching the given credentials (e.g. ['email' => 'a@b']). + * The 'password' key, if present, is ignored during the lookup. + * Returns null if no user matches. + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return AuthUser|null + */ + public function retrieveByCredentials(array $credentials): AuthUser|null; + + /** + * Find a user by their unique identifier. + * + * @param mixed $id + * @return AuthUser|null + */ + public function retrieveById($id): AuthUser|null; + + /** + * Validate the provided credentials against the given user. + * Implementations typically verify the password hash held under the + * 'password' key. + * + * @phpstan-param AuthCredentials $credentials + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @param array $credentials + * @return bool + */ + public function validateCredentials(\Phalcon\Contracts\Auth\AuthUser $user, array $credentials): bool; +} diff --git a/src/Contracts/Auth/Adapter/AdapterConfig.php b/src/Contracts/Auth/Adapter/AdapterConfig.php new file mode 100644 index 00000000..4846f6c1 --- /dev/null +++ b/src/Contracts/Auth/Adapter/AdapterConfig.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Adapter; + +/** + * Authentication adapter configuration contract. + * + * Per-adapter config shape is intentionally adapter-specific (e.g. Stream + * exposes getFile(), Memory exposes getUsers()); the only field shared across + * all adapters is the optional model class used during user hydration. + */ +interface AdapterConfig +{ + /** + * Returns the user-model class name to hydrate, if configured. + * + * @return string|null + */ + public function getModel(): string|null; +} diff --git a/src/Contracts/Auth/Adapter/RememberAdapter.php b/src/Contracts/Auth/Adapter/RememberAdapter.php new file mode 100644 index 00000000..d656e96b --- /dev/null +++ b/src/Contracts/Auth/Adapter/RememberAdapter.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Adapter; + +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Auth\RememberToken; + +/** + * Capability extension implemented by adapters that support remember-me. + */ +interface RememberAdapter extends \Phalcon\Contracts\Auth\Adapter\Adapter +{ + /** + * Create and persist a new remember token for the user. + * + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return RememberToken + */ + public function createRememberToken(\Phalcon\Contracts\Auth\AuthUser $user): RememberToken; + + /** + * Retrieve a user by the remember-me cookie payload. + * + * @param mixed $id + * @param string $token + * @param string|null $userAgent + * @return AuthUser|null + */ + public function retrieveByToken($id, string $token, ?string $userAgent = null): AuthUser|null; +} diff --git a/src/Contracts/Auth/AuthRemember.php b/src/Contracts/Auth/AuthRemember.php new file mode 100644 index 00000000..dc6478d4 --- /dev/null +++ b/src/Contracts/Auth/AuthRemember.php @@ -0,0 +1,38 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth; + +/** + * Implemented by authenticatable models that support remember-me tokens. + * This is intentionally separate from AuthUser so that adapters which do + * not support remember-me are not forced to implement it. + */ +interface AuthRemember +{ + /** + * Persists a new remember token for the user. + * + * @param string $token + * @param string|null $userAgent + * + * @return RememberToken + */ + public function createRememberToken(string $token, ?string $userAgent = null): RememberToken; + + /** + * Returns the remember token entry matching the given token value, + * or null if not found. + * + * @param string $token + * + * @return RememberToken|null + */ + public function getRememberToken(string $token): RememberToken|null; +} diff --git a/src/Contracts/Auth/AuthUser.php b/src/Contracts/Auth/AuthUser.php new file mode 100644 index 00000000..822bdab0 --- /dev/null +++ b/src/Contracts/Auth/AuthUser.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth; + +/** + * Implemented by user models that can be authenticated. + */ +interface AuthUser +{ + /** + * Returns the unique identifier for the authenticatable user + * (e.g. the primary key). Implementations MUST return a non-null + * scalar; if a record cannot produce one, the implementation should + * fail at construction time rather than returning null. + * + * @return int|string + */ + public function getAuthIdentifier(): int|string; + + /** + * Returns the hashed password for the authenticatable user. + * + * @return string + */ + public function getAuthPassword(): string; +} diff --git a/src/Contracts/Auth/Guard/BasicAuth.php b/src/Contracts/Auth/Guard/BasicAuth.php new file mode 100644 index 00000000..c02508d3 --- /dev/null +++ b/src/Contracts/Auth/Guard/BasicAuth.php @@ -0,0 +1,47 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Guard; + +use Phalcon\Contracts\Auth\AuthUser; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by sinbadxiii/cphalcon-auth + * + * @link https://github.com/sinbadxiii/cphalcon-auth + */ +interface BasicAuth +{ + /** + * Authenticate against HTTP Basic credentials. Returns true on success. + * + * @param array $extraConditions credentials merged on top of + * the basic-auth pair + * @param string $field + * @return bool + */ + public function basic(string $field = 'email', array $extraConditions = []): bool; + + /** + * Like basic() but does not persist; returns the resolved user on success + * or false on failure. + * + * @param array $extraConditions + * @param string $field + * @return false|AuthUser + */ + public function onceBasic(string $field = 'email', array $extraConditions = []): AuthUser|false; +} diff --git a/src/Contracts/Auth/Guard/Guard.php b/src/Contracts/Auth/Guard/Guard.php new file mode 100644 index 00000000..032702f4 --- /dev/null +++ b/src/Contracts/Auth/Guard/Guard.php @@ -0,0 +1,94 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Guard; + +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\AuthUser; +use Phalcon\Contracts\Container\Service\Collection; + +/** + * @phpstan-import-type AuthCredentials from Adapter + */ +interface Guard +{ + /** + * Build a guard from an adapter, the application container, and a flat + * options map. Used by ManagerFactory to wire guards from the + * application config; each implementation resolves the framework + * services it needs from the container. + * + * @param array $options + * @param \Phalcon\Contracts\Auth\Adapter\Adapter $adapter + * @param \Phalcon\Contracts\Container\Service\Collection $container + * @return static + */ + public static function fromOptions(\Phalcon\Contracts\Auth\Adapter\Adapter $adapter, \Phalcon\Contracts\Container\Service\Collection $container, array $options): static; + + /** + * Whether the current request is authenticated. + * + * @return bool + */ + public function check(): bool; + + /** + * Returns the last user the guard tried to authenticate during this + * request, regardless of success. + * + * @return AuthUser|null + */ + public function getLastUserAttempted(): AuthUser|null; + + /** + * Whether the current request is unauthenticated. + * + * @return bool + */ + public function guest(): bool; + + /** + * Whether the guard currently holds a resolved user. + * + * @return bool + */ + public function hasUser(): bool; + + /** + * Returns the authenticated user's identifier, or null when no + * authenticated user is present. + * + * @return int|string|null + */ + public function id(): int|string|null; + + /** + * Sets the current user explicitly. Returns $this for fluent chaining. + * + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @return static + */ + public function setUser(\Phalcon\Contracts\Auth\AuthUser $user): static; + + /** + * Returns the resolved user for the current request, or null. + * + * @return AuthUser|null + */ + public function user(): AuthUser|null; + + /** + * Validates the given credentials without logging in. + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []): bool; +} diff --git a/src/Contracts/Auth/Guard/GuardConfig.php b/src/Contracts/Auth/Guard/GuardConfig.php new file mode 100644 index 00000000..4995cd36 --- /dev/null +++ b/src/Contracts/Auth/Guard/GuardConfig.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Guard; + +/** + * Authentication guard configuration contract. + * + * Per-guard config shape is intentionally guard-specific (e.g. Token exposes + * getInputKey()/getStorageKey(); Session has no required config today). + * The contract carries no methods of its own — it only marks the type so + * AbstractGuard can accept any guard config uniformly. + */ +interface GuardConfig +{ +} diff --git a/src/Contracts/Auth/Guard/GuardStateful.php b/src/Contracts/Auth/Guard/GuardStateful.php new file mode 100644 index 00000000..e26dab95 --- /dev/null +++ b/src/Contracts/Auth/Guard/GuardStateful.php @@ -0,0 +1,59 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth\Guard; + +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\AuthUser; + +/** + * Implemented by guards backed by persistent state (sessions/cookies). + * + * @phpstan-import-type AuthCredentials from Adapter + */ +interface GuardStateful +{ + /** + * Attempts to authenticate the user with the given credentials and, on + * success, persists the resulting state on the guard. + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], bool $remember = false): bool; + + /** + * @param \Phalcon\Contracts\Auth\AuthUser $user + * @param bool $remember + * @return void + */ + public function login(\Phalcon\Contracts\Auth\AuthUser $user, bool $remember = false): void; + + /** + * Logs in the user identified by $id. Returns the resolved user on + * success or false when no user matches the id. + * + * @param mixed $id + * @param bool $remember + * @return false|AuthUser + */ + public function loginById($id, bool $remember = false): AuthUser|false; + + /** + * @return void + */ + public function logout(): void; + + /** + * @return bool + */ + public function viaRemember(): bool; +} diff --git a/src/Contracts/Auth/Manager.php b/src/Contracts/Auth/Manager.php new file mode 100644 index 00000000..cd63e6a3 --- /dev/null +++ b/src/Contracts/Auth/Manager.php @@ -0,0 +1,149 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth; + +use Phalcon\Auth\Exception; +use Phalcon\Contracts\Auth\Access\Access; +use Phalcon\Contracts\Auth\Adapter\Adapter; +use Phalcon\Contracts\Auth\Guard\Guard; + +/** + * @phpstan-import-type AuthCredentials from Adapter + */ +interface Manager +{ + /** + * @param string $accessName + * @return self + */ + public function access(string $accessName): self; + + /** + * @phpstan-param array> $accessList + * @param array $accessList + * @return self + */ + public function addAccessList(array $accessList): self; + + /** + * @param string $nameGuard + * @param \Phalcon\Contracts\Auth\Guard\Guard $guard + * @param bool $isDefault + * @return self + */ + public function addGuard(string $nameGuard, \Phalcon\Contracts\Auth\Guard\Guard $guard, bool $isDefault = false): self; + + /** + * @phpstan-param AuthCredentials $credentials + * + * @throws Exception + * @param array $credentials + * @param bool $remember + * @return bool + */ + public function attempt(array $credentials = [], bool $remember = false): bool; + + /** + * Whether the default guard reports the current request as authenticated. + * + * @return bool + */ + public function check(): bool; + + /** + * Restricts the active access gate to skip the listed action names. + * + * @param string $actions + * @return self + */ + public function except(string $actions): self; + + /** + * @return Access|null + */ + public function getAccess(): Access|null; + + /** + * @phpstan-return array> + * @return array + */ + public function getAccessList(): array; + + /** + * @return Guard|null + */ + public function getDefaultGuard(): Guard|null; + + /** + * @return array + */ + public function getGuards(): array; + + /** + * Returns the named guard, or the default guard when $name is null. + * + * @param string|null $name + * @return Guard + */ + public function guard(?string $name = null): Guard; + + /** + * Returns the authenticated user's identifier from the default guard, + * or null when no authenticated user is present. + * + * @return int|string|null + */ + public function id(): int|string|null; + + /** + * Logs the current user out via the default guard. + * + * @throws Exception + * @return void + */ + public function logout(): void; + + /** + * Restricts the active access gate to apply only to the listed action names. + * + * @param string $actions + * @return self + */ + public function only(string $actions): self; + + /** + * @param \Phalcon\Contracts\Auth\Access\Access $access + * @return self + */ + public function setAccess(\Phalcon\Contracts\Auth\Access\Access $access): self; + + /** + * @param \Phalcon\Contracts\Auth\Guard\Guard $guard + * @return self + */ + public function setDefaultGuard(\Phalcon\Contracts\Auth\Guard\Guard $guard): self; + + /** + * Returns the resolved user from the default guard, or null. + * + * @return AuthUser|null + */ + public function user(): AuthUser|null; + + /** + * Validates the given credentials against the default guard without + * logging in. + * + * @phpstan-param AuthCredentials $credentials + * @param array $credentials + * @return bool + */ + public function validate(array $credentials = []): bool; +} diff --git a/src/Contracts/Auth/RememberToken.php b/src/Contracts/Auth/RememberToken.php new file mode 100644 index 00000000..197cc603 --- /dev/null +++ b/src/Contracts/Auth/RememberToken.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Auth; + +/** + * A persisted remember-me token row. + */ +interface RememberToken +{ + /** + * Deletes the token from storage. + * + * @return bool + */ + public function delete(): bool; + + /** + * Returns the token value stored for this remember entry. + * + * @return string + */ + public function getToken(): string; + + /** + * Returns the user agent associated with this token, if any. + * + * @return string|null + */ + public function getUserAgent(): string|null; +} diff --git a/src/Contracts/Container/Ioc/IocContainer.php b/src/Contracts/Container/Ioc/IocContainer.php new file mode 100644 index 00000000..927d73ab --- /dev/null +++ b/src/Contracts/Container/Ioc/IocContainer.php @@ -0,0 +1,62 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Ioc; + +/** + * [_IocContainer_][] affords obtaining services by name. + * + * - Notes: + * + * -This interface does not afford service management. The container + * will need to obtain services somehow, e.g. from a [Service-Interop][] + * implementation. + * + * @phpstan-import-type ioc_service_name_string from IocTypeAliases + * @phpstan-import-type ioc_service_object from IocTypeAliases + */ +interface IocContainer +{ + /** + * Is the container able to return an instance of the `$serviceName`? + * + * - Notes: + * + * -The logic for this method is expressly unspecified. The ability + * check may be accomplished by querying a service management subsystem, + * or by some other means. + * + * @param ioc_service_name_string $serviceName + * @return bool + */ + public function hasService(string $serviceName): bool; + + /** + * Returns an instance of the `$serviceName`. + * + * - Directives: + * + * - Implementations MUST throw [_IocThrowable_][] if the container + * cannot return an instance of the `$serviceName`. + * + * - Notes: + * + * -The logic for this method is expressly unspecified. Retrieval + * may be accomplished via a service management subsystem, or by some + * other means. + * + * -The returned instance may be new or shared. The retrieval + * logic defines the service lifetime, not the container (per se) and + * not the caller requesting the service. + * + * @param ioc_service_name_string $serviceName + * @return ioc_service_object + */ + public function getService(string $serviceName): object; +} diff --git a/src/Contracts/Container/Ioc/IocContainerFactory.php b/src/Contracts/Container/Ioc/IocContainerFactory.php new file mode 100644 index 00000000..a47872a7 --- /dev/null +++ b/src/Contracts/Container/Ioc/IocContainerFactory.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Ioc; + +/** + * [_IocContainerFactory_][] affords obtaining a new instance of + * [_IocContainer_][]. + */ +interface IocContainerFactory +{ + /** + * Returns a new instance of [_IocContainer_][]. + * + * - Notes: + * + * -Container instantiation logic is not specified. Implementations + * might use providers, configuration files, attribute or annotation + * collection, or some other means to create and populate a container. + * Implementations might also choose to return a compiled or otherwise + * reconstituted container. + * + * @return IocContainer + */ + public function newContainer(): IocContainer; +} diff --git a/src/Contracts/Container/Ioc/IocThrowable.php b/src/Contracts/Container/Ioc/IocThrowable.php new file mode 100644 index 00000000..de1538b4 --- /dev/null +++ b/src/Contracts/Container/Ioc/IocThrowable.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Ioc; + +use Throwable; + +/** + * [_IocThrowable_][] extends [_Throwable_][] to mark an [_Exception_][] as + * IOC-related. + * + * It adds no class members. + */ +interface IocThrowable extends \Throwable +{ +} diff --git a/src/Html/Helper/Input/DateTimeLocal.php b/src/Contracts/Container/Ioc/IocTypeAliases.php similarity index 57% rename from src/Html/Helper/Input/DateTimeLocal.php rename to src/Contracts/Container/Ioc/IocTypeAliases.php index 6739bffe..2bea88fa 100644 --- a/src/Html/Helper/Input/DateTimeLocal.php +++ b/src/Contracts/Container/Ioc/IocTypeAliases.php @@ -7,12 +7,12 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -namespace Phalcon\Html\Helper\Input; +namespace Phalcon\Contracts\Container\Ioc; /** - * Class DateTimeLocal + * @phpstan-type ioc_service_name_string class-string|non-empty-string + * @phpstan-type ioc_service_object object */ -class DateTimeLocal extends \Phalcon\Html\Helper\Input\AbstractInput +interface IocTypeAliases { - protected $type = 'datetime-local'; } diff --git a/src/Contracts/Container/Resolver/ReflectionMethodResolver.php b/src/Contracts/Container/Resolver/ReflectionMethodResolver.php new file mode 100644 index 00000000..5548f628 --- /dev/null +++ b/src/Contracts/Container/Resolver/ReflectionMethodResolver.php @@ -0,0 +1,51 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Resolver; + +use Phalcon\Contracts\Container\Ioc\IocContainer; +use ReflectionMethod; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface ReflectionMethodResolver +{ + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param \ReflectionMethod $method + * @param object $instance + * @return void + */ + public function resolveMethod(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, \ReflectionMethod $method, $instance): void; +} diff --git a/src/Contracts/Container/Resolver/ReflectionParameterResolver.php b/src/Contracts/Container/Resolver/ReflectionParameterResolver.php new file mode 100644 index 00000000..5c69ddc2 --- /dev/null +++ b/src/Contracts/Container/Resolver/ReflectionParameterResolver.php @@ -0,0 +1,50 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Resolver; + +use Phalcon\Contracts\Container\Ioc\IocContainer; +use ReflectionParameter; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface ReflectionParameterResolver +{ + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param \ReflectionParameter $parameter + * @return mixed + */ + public function resolveParameter(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, \ReflectionParameter $parameter): mixed; +} diff --git a/src/Contracts/Container/Resolver/Resolvable.php b/src/Contracts/Container/Resolver/Resolvable.php new file mode 100644 index 00000000..61c48f2e --- /dev/null +++ b/src/Contracts/Container/Resolver/Resolvable.php @@ -0,0 +1,48 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Resolver; + +use Phalcon\Contracts\Container\Ioc\IocContainer; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Resolvable +{ + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @return mixed + */ + public function resolve(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc): mixed; +} diff --git a/src/Contracts/Container/Resolver/ResolverService.php b/src/Contracts/Container/Resolver/ResolverService.php new file mode 100644 index 00000000..ae5863c4 --- /dev/null +++ b/src/Contracts/Container/Resolver/ResolverService.php @@ -0,0 +1,90 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Resolver; + +use Phalcon\Contracts\Container\Ioc\IocContainer; +use ReflectionMethod; +use ReflectionParameter; +use ReflectionType; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface ResolverService extends \Phalcon\Contracts\Container\Resolver\ReflectionParameterResolver +{ + /** + * @param string $className + * @return bool + */ + public function isResolvableClass(string $className): bool; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param callable $callableObject + * @param array $arguments + * @return mixed + */ + public function resolveCall(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, $callableObject, array $arguments): mixed; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param string $className + * @param array $arguments + * @return object + */ + public function resolveClass(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, string $className, array $arguments): object; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param \ReflectionMethod $method + * @param object $instance + * @return void + */ + public function resolveMethod(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, \ReflectionMethod $method, $instance): void; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param array $parameters + * @param array $arguments + * @return array + */ + public function resolveParameters(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, array $parameters, array $arguments): array; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @param \ReflectionType $type + * @return mixed + */ + public function resolveType(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc, \ReflectionType $type): mixed; +} diff --git a/src/Contracts/Container/Resolver/ResolverThrowable.php b/src/Contracts/Container/Resolver/ResolverThrowable.php new file mode 100644 index 00000000..04b47fb4 --- /dev/null +++ b/src/Contracts/Container/Resolver/ResolverThrowable.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Resolver; + +use Throwable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface ResolverThrowable extends \Throwable +{ +} diff --git a/src/Contracts/Container/Service/Collection.php b/src/Contracts/Container/Service/Collection.php new file mode 100644 index 00000000..27061ec6 --- /dev/null +++ b/src/Contracts/Container/Service/Collection.php @@ -0,0 +1,231 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Service; + +use Closure; +use Phalcon\Container\Definition\ServiceDefinition; +use Phalcon\Container\Resolver\Resolver; +use Phalcon\Contracts\Container\Ioc\IocContainer; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Collection extends \Phalcon\Contracts\Container\Ioc\IocContainer +{ + /** + * @param string $name + * @return string + */ + public function getAlias(string $name): string; + + /** + * @param string $name + * @return bool + */ + public function hasAlias(string $name): bool; + + /** + * @param string $name + * @param string $alias + * @return static + */ + public function setAlias(string $name, string $alias): static; + + /** + * @param string $name + * @return void + */ + public function unsetAlias(string $name): void; + + /** + * @param string $name + * @return ServiceDefinition + */ + public function getDefinition(string $name): ServiceDefinition; + + /** + * @param string $name + * @return bool + */ + public function hasDefinition(string $name): bool; + + /** + * @param string $name + * @return ServiceDefinition + */ + public function newDefinition(string $name): ServiceDefinition; + + /** + * @param string $name + * @param \Phalcon\Container\Definition\ServiceDefinition $definition + * @return static + */ + public function setDefinition(string $name, \Phalcon\Container\Definition\ServiceDefinition $definition): static; + + /** + * @param string $name + * @return void + */ + public function unsetDefinition(string $name): void; + + /** + * @param string $name + * @return object + */ + public function getInstance(string $name): object; + + /** + * @param string $name + * @return bool + */ + public function hasInstance(string $name): bool; + + /** + * @param string $name + * @param object $instance + * @param string $lifetime + * @return static + */ + public function setInstance(string $name, $instance, string $lifetime): static; + + /** + * @param string $name + * @return void + */ + public function unsetInstance(string $name): void; + + /** + * @param string $lifetime + * @return void + */ + public function unsetInstances(string $lifetime): void; + + /** + * @param string $name + * @return mixed + */ + public function getParameter(string $name): mixed; + + /** + * @param string $name + * @return bool + */ + public function hasParameter(string $name): bool; + + /** + * @param string $name + * @param mixed $value + * @return static + */ + public function setParameter(string $name, $value): static; + + /** + * @param string $name + * @return void + */ + public function unsetParameter(string $name): void; + + /** + * @param string $interfaceName + * @param string $concrete + * @return ServiceDefinition + */ + public function bind(string $interfaceName, string $concrete): ServiceDefinition; + + /** + * @param string $name + * @return Closure + */ + public function callableGet(string $name): Closure; + + /** + * @param string $name + * @return Closure + */ + public function callableNew(string $name): Closure; + + /** + * @param string $name + * @param callable $callableObject + * @return void + */ + public function extend(string $name, $callableObject): void; + + /** + * @param string $name + * @return mixed + */ + public function get(string $name): mixed; + + /** + * @param string $tag + * @return array + */ + public function getByTag(string $tag): array; + + /** + * @return Resolver + */ + public function getResolver(): Resolver; + + /** + * @param string $name + * @return bool + */ + public function has(string $name): bool; + + /** + * @return bool + */ + public function isAutowireEnabled(): bool; + + /** + * @param string $name + * @return mixed + */ + public function new(string $name): mixed; + + /** + * @param string $name + * @param mixed $definition + * @return ServiceDefinition + */ + public function set(string $name, $definition): ServiceDefinition; + + /** + * @param bool $enabled + * @return static + */ + public function setAutowire(bool $enabled): static; +} diff --git a/src/Contracts/Container/Service/Definition.php b/src/Contracts/Container/Service/Definition.php new file mode 100644 index 00000000..3ab1fa57 --- /dev/null +++ b/src/Contracts/Container/Service/Definition.php @@ -0,0 +1,133 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Service; + +use Phalcon\Contracts\Container\Ioc\IocContainer; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Definition +{ + /** + * @param callable $extender + * @return static + */ + public function addExtender($extender): static; + + /** + * @param \Phalcon\Contracts\Container\Ioc\IocContainer $ioc + * @return object + */ + public function buildService(\Phalcon\Contracts\Container\Ioc\IocContainer $ioc): object; + + /** + * @return string + */ + public function getClass(): string; + + /** + * @return array + */ + public function getExtenders(): array; + + /** + * @return mixed + */ + public function getFactory(); + + /** + * @return string + */ + public function getLifetime(): string; + + /** + * @return string + */ + public function getServiceName(): string; + + /** + * @return bool + */ + public function hasClass(): bool; + + /** + * @return bool + */ + public function hasExtenders(): bool; + + /** + * @return bool + */ + public function hasFactory(): bool; + + /** + * @param string $className + * @return static + */ + public function setClass(string $className): static; + + /** + * @param array $extenders + * @return static + */ + public function setExtenders(array $extenders): static; + + /** + * @param callable $factory + * @return static + */ + public function setFactory($factory): static; + + /** + * @param string $lifetime + * @return static + */ + public function setLifetime(string $lifetime): static; + + /** + * @return static + */ + public function unsetClass(): static; + + /** + * @return static + */ + public function unsetExtenders(): static; + + /** + * @return static + */ + public function unsetFactory(): static; +} diff --git a/src/Contracts/Container/Service/Provider.php b/src/Contracts/Container/Service/Provider.php new file mode 100644 index 00000000..fd32a88c --- /dev/null +++ b/src/Contracts/Container/Service/Provider.php @@ -0,0 +1,46 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Service; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Provider +{ + /** + * @param Collection $services + * @return void + */ + public function provide(Collection $services): void; +} diff --git a/src/Contracts/Container/Service/Throwable.php b/src/Contracts/Container/Service/Throwable.php new file mode 100644 index 00000000..f44e1a1a --- /dev/null +++ b/src/Contracts/Container/Service/Throwable.php @@ -0,0 +1,43 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Contracts\Container\Service; + +use Throwable as PhpThrowable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been heavily influenced by CapsulePHP. + * Additionally, there are implementations from ioc-interop, which is a + * Composer dependency, and from service-interop and resolver-interop. They + * are copied and re-implemented here because we need to support PHP 8.1. + * Once we move to min 8.4 and packages become available and compatible, the + * copies will be replaced with the actual Composer dependencies. + * + * @link https://github.com/capsulephp/di + * @license https://github.com/capsulephp/di/blob/3.x/LICENSE.md + * + * @link https://github.com/ioc-interop/interface + * @license https://github.com/ioc-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/service-interop/interface + * @license https://github.com/service-interop/interface/blob/1.x/LICENSE.md + * + * @link https://github.com/resolver-interop/interface/tree/1.x + * @license https://github.com/resolver-interop/interface/blob/1.x/LICENSE.md + */ +interface Throwable extends PhpThrowable +{ +} diff --git a/src/Contracts/Db/Adapter/Adapter.php b/src/Contracts/Db/Adapter/Adapter.php index f5affc81..08bfc120 100644 --- a/src/Contracts/Db/Adapter/Adapter.php +++ b/src/Contracts/Db/Adapter/Adapter.php @@ -43,24 +43,24 @@ interface Adapter public function addColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column): bool; /** - * Adds an index to a table + * Adds a foreign key to a table * * @param string $tableName * @param string $schemaName - * @param \Phalcon\Db\IndexInterface $index + * @param \Phalcon\Db\ReferenceInterface $reference * @return bool */ - public function addIndex(string $tableName, string $schemaName, \Phalcon\Db\IndexInterface $index): bool; + public function addForeignKey(string $tableName, string $schemaName, \Phalcon\Db\ReferenceInterface $reference): bool; /** - * Adds a foreign key to a table + * Adds an index to a table * * @param string $tableName * @param string $schemaName - * @param \Phalcon\Db\ReferenceInterface $reference + * @param \Phalcon\Db\IndexInterface $index * @return bool */ - public function addForeignKey(string $tableName, string $schemaName, \Phalcon\Db\ReferenceInterface $reference): bool; + public function addIndex(string $tableName, string $schemaName, \Phalcon\Db\IndexInterface $index): bool; /** * Adds a primary key to a table @@ -136,10 +136,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function createView(string $viewName, array $definition, string $schemaName = null): bool; + public function createView(string $viewName, array $definition, ?string $schemaName = null): bool; /** * Deletes data from a table using custom RDBMS SQL syntax @@ -150,34 +150,34 @@ public function createView(string $viewName, array $definition, string $schemaNa * @param array $dataTypes * * @return bool */ - public function delete($table, string $whereCondition = null, array $placeholders = [], array $dataTypes = []): bool; + public function delete($table, ?string $whereCondition = null, array $placeholders = [], array $dataTypes = []): bool; /** * Returns an array of Phalcon\Db\Column objects describing a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ColumnInterface[] */ - public function describeColumns(string $table, string $schema = null): array; + public function describeColumns(string $table, ?string $schema = null): array; /** * Lists table indexes * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\IndexInterface[] */ - public function describeIndexes(string $table, string $schema = null): array; + public function describeIndexes(string $table, ?string $schema = null): array; /** * Lists table references * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ReferenceInterface[] */ - public function describeReferences(string $table, string $schema = null): array; + public function describeReferences(string $table, ?string $schema = null): array; /** * Drops a column from a table @@ -222,21 +222,21 @@ public function dropPrimaryKey(string $tableName, string $schemaName): bool; * Drops a table from a schema/database * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return bool */ - public function dropTable(string $tableName, string $schemaName = null, bool $ifExists = true): bool; + public function dropTable(string $tableName, ?string $schemaName = null, bool $ifExists = true): bool; /** * Drops a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return bool */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): bool; + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): bool; /** * Escapes a column/table/schema name @@ -393,9 +393,9 @@ public function getDefaultIdValue(): RawValue; * ``` * * @todo Return NULL if this is not supported by the adapter - * @return RawValue + * @return RawValue|null */ - public function getDefaultValue(): RawValue; + public function getDefaultValue(): RawValue|null; /** * Return internal PDO handler @@ -421,16 +421,16 @@ public function getRealSQLStatement(): string; /** * Active SQL statement in the object * - * @return string + * @return array */ - public function getSQLStatement(): string; + public function getSQLBindTypes(): array; /** * Active SQL statement in the object * - * @return array + * @return string */ - public function getSQLBindTypes(): array; + public function getSQLStatement(): string; /** * Active SQL statement in the object @@ -502,32 +502,32 @@ public function isUnderTransaction(): bool; * @param string|null $name Name of the sequence object from which the ID should be returned. * @return string|bool */ - public function lastInsertId(string $name = null): bool|string; + public function lastInsertId(?string $name = null): bool|string; /** * Appends a LIMIT clause to sqlQuery argument * * @param string $sqlQuery - * @param int $number + * @param mixed $number * @return string */ - public function limit(string $sqlQuery, int $number): string; + public function limit(string $sqlQuery, $number): string; /** * List all tables on a database * - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function listTables(string $schemaName = null): array; + public function listTables(?string $schemaName = null): array; /** * List all views on a database * - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function listViews(string $schemaName = null): array; + public function listViews(?string $schemaName = null): array; /** * Modifies a table column based on a definition @@ -535,10 +535,10 @@ public function listViews(string $schemaName = null): array; * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return bool */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): bool; + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): bool; /** * Sends SQL statements to the database server returning the success state. @@ -592,9 +592,9 @@ public function sharedLock(string $sqlQuery, string $modifier = ''): string; * Set if nested transactions should use savepoints * * @param bool $nestedTransactionsWithSavepoints - * @return Adapter + * @return \Phalcon\Db\Adapter\AdapterInterface */ - public function setNestedTransactionsWithSavepoints(bool $nestedTransactionsWithSavepoints): Adapter; + public function setNestedTransactionsWithSavepoints(bool $nestedTransactionsWithSavepoints): \Phalcon\Db\Adapter\AdapterInterface; /** * Check whether the database system requires a sequence to produce @@ -608,19 +608,19 @@ public function supportSequences(): bool; * Generates SQL checking for the existence of a schema.table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function tableExists(string $tableName, string $schemaName = null): bool; + public function tableExists(string $tableName, ?string $schemaName = null): bool; /** * Gets creation options from a table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function tableOptions(string $tableName, string $schemaName = null): array; + public function tableOptions(string $tableName, ?string $schemaName = null): array; /** * Updates data on a table using custom RDBMS SQL syntax @@ -680,8 +680,8 @@ public function supportsDefaultValue(): bool; * Generates SQL checking for the existence of a schema.view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function viewExists(string $viewName, string $schemaName = null): bool; + public function viewExists(string $viewName, ?string $schemaName = null): bool; } diff --git a/src/Contracts/Db/Column.php b/src/Contracts/Db/Column.php index dfb5294f..d8647c3b 100644 --- a/src/Contracts/Db/Column.php +++ b/src/Contracts/Db/Column.php @@ -82,9 +82,9 @@ public function getTypeReference(): int; /** * Returns column type values * - * @return array|string + * @return array|string|int */ - public function getTypeValues(): string|array; + public function getTypeValues(): int|string|array; /** * Check whether column has default value diff --git a/src/Contracts/Db/Dialect.php b/src/Contracts/Db/Dialect.php index df290924..0d448148 100644 --- a/src/Contracts/Db/Dialect.php +++ b/src/Contracts/Db/Dialect.php @@ -31,6 +31,8 @@ interface Dialect { /** * No row-lock modifier — the default behavior for `forUpdate()`. + * + * @var string */ const LOCK_NONE = ''; @@ -39,6 +41,8 @@ interface Dialect * if a row it needs is locked instead of blocking. MySQL 8.0+ and * PostgreSQL 9.5+ recognize this. SQLite has no row-level locking and * silently ignores the modifier. + * + * @var string */ const LOCK_NOWAIT = 'NOWAIT'; @@ -46,6 +50,8 @@ interface Dialect * Append `SKIP LOCKED` to the `FOR UPDATE` clause — the query returns * rows that are not currently locked and silently skips ones that are. * MySQL 8.0+ and PostgreSQL 9.5+ recognize this. SQLite ignores it. + * + * @var string */ const LOCK_SKIP_LOCKED = 'SKIP LOCKED'; @@ -113,37 +119,37 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createView(string $viewName, array $definition, string $schemaName = null): string; + public function createView(string $viewName, array $definition, ?string $schemaName = null): string; /** * Generates SQL to describe a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeColumns(string $table, string $schema = null): string; + public function describeColumns(string $table, ?string $schema = null): string; /** * Generates SQL to query indexes on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeIndexes(string $table, string $schema = null): string; + public function describeIndexes(string $table, ?string $schema = null): string; /** * Generates SQL to query foreign keys on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeReferences(string $table, string $schema = null): string; + public function describeReferences(string $table, ?string $schema = null): string; /** * Generates SQL to delete a column from a table @@ -198,11 +204,11 @@ public function dropTable(string $tableName, string $schemaName, bool $ifExists * Generates SQL to drop a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): string; + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string; /** * Returns a SQL modified with a FOR UPDATE clause. The optional `modifier` @@ -243,11 +249,11 @@ public function getCustomFunctions(): array; * database system valid expression * * @param array $expression - * @param string $escapeChar + * @param string|null $escapeChar * @param array $bindCounts * @return string */ - public function getSqlExpression(array $expression, string $escapeChar = null, array $bindCounts = []): string; + public function getSqlExpression(array $expression, ?string $escapeChar = null, array $bindCounts = []): string; /** * Generates the SQL for LIMIT clause @@ -261,10 +267,10 @@ public function limit(string $sqlQuery, $number): string; /** * List all tables in database * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listTables(string $schemaName = null): string; + public function listTables(?string $schemaName = null): string; /** * Generates SQL to modify a column in a table @@ -272,10 +278,10 @@ public function listTables(string $schemaName = null): string; * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return string */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): string; + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): string; /** * Registers custom SQL functions @@ -342,26 +348,26 @@ public function supportsSavepoints(): bool; * Generates SQL checking for the existence of a schema.table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function tableExists(string $tableName, string $schemaName = null): string; + public function tableExists(string $tableName, ?string $schemaName = null): string; /** * Generates the SQL to describe the table creation options * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function tableOptions(string $table, string $schema = null): string; + public function tableOptions(string $table, ?string $schema = null): string; /** * Generates SQL checking for the existence of a schema.view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function viewExists(string $viewName, string $schemaName = null): string; + public function viewExists(string $viewName, ?string $schemaName = null): string; } diff --git a/src/Contracts/Encryption/Security/CryptoUtils.php b/src/Contracts/Encryption/Security/CryptoUtils.php index ae565ba0..f0d87cfd 100644 --- a/src/Contracts/Encryption/Security/CryptoUtils.php +++ b/src/Contracts/Encryption/Security/CryptoUtils.php @@ -24,11 +24,11 @@ interface CryptoUtils /** * @param string $data * @param string $key - * @param string $algo + * @param string $algorithm * @param bool $raw * @return string */ - public function computeHmac(string $data, string $key, string $algo, bool $raw = false): string; + public function computeHmac(string $data, string $key, string $algorithm, bool $raw = false): string; /** * @return Random diff --git a/src/Contracts/Encryption/Security/CsrfProtection.php b/src/Contracts/Encryption/Security/CsrfProtection.php index 27cabeec..7fce3501 100644 --- a/src/Contracts/Encryption/Security/CsrfProtection.php +++ b/src/Contracts/Encryption/Security/CsrfProtection.php @@ -30,12 +30,12 @@ public function getToken(): string|null; public function getTokenKey(): string|null; /** - * @param string $tokenKey + * @param string|null $tokenKey * @param mixed $tokenValue * @param bool $destroyIfValid * @return bool */ - public function checkToken(string $tokenKey = null, $tokenValue = null, bool $destroyIfValid = true): bool; + public function checkToken(?string $tokenKey = null, $tokenValue = null, bool $destroyIfValid = true): bool; /** * @return Security diff --git a/src/Contracts/Events/Manager.php b/src/Contracts/Events/Manager.php index 86e1896e..4f95a528 100644 --- a/src/Contracts/Events/Manager.php +++ b/src/Contracts/Events/Manager.php @@ -75,10 +75,10 @@ public function detach(string $eventType, $handler): void; /** * Removes all listeners — globally or for a single event type. * - * @param string $type + * @param string|null $type * @return void */ - public function detachAll(string $type = null): void; + public function detachAll(?string $type = null): void; /** * Toggle priority ordering on/off. diff --git a/src/Contracts/Forms/Schema.php b/src/Contracts/Forms/Schema.php index 65cccb46..7eb49b04 100644 --- a/src/Contracts/Forms/Schema.php +++ b/src/Contracts/Forms/Schema.php @@ -31,6 +31,7 @@ interface Schema /** * Returns an ordered list of normalized element definitions. * + * @phpstan-return array> * @return array */ public function load(): array; diff --git a/src/Contracts/Paginator/Adapter.php b/src/Contracts/Paginator/Adapter.php index f9c9a620..6435de73 100644 --- a/src/Contracts/Paginator/Adapter.php +++ b/src/Contracts/Paginator/Adapter.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Contracts\Paginator; +use Phalcon\Paginator\Adapter\AdapterInterface; + /** * Interface for Phalcon\Paginator adapters */ @@ -32,13 +34,17 @@ public function paginate(): Repository; * Set the current page number * * @param int $page + * + * @return AdapterInterface */ - public function setCurrentPage(int $page); + public function setCurrentPage(int $page): AdapterInterface; /** * Set current rows limit * * @param int $limit + * + * @return AdapterInterface */ - public function setLimit(int $limit); + public function setLimit(int $limit): AdapterInterface; } diff --git a/src/Contracts/Paginator/Repository.php b/src/Contracts/Paginator/Repository.php index cca7e9fd..a38abacf 100644 --- a/src/Contracts/Paginator/Repository.php +++ b/src/Contracts/Paginator/Repository.php @@ -123,6 +123,7 @@ public function getTotalItems(): int; * Sets the aliases for properties repository * * @param array $aliases + * * @return Repository */ public function setAliases(array $aliases): Repository; @@ -131,6 +132,7 @@ public function setAliases(array $aliases): Repository; * Sets values for properties of the repository * * @param array $properties + * * @return Repository */ public function setProperties(array $properties): Repository; diff --git a/src/Contracts/Support/Collection.php b/src/Contracts/Support/Collection.php index 40245a2b..c55a7af8 100644 --- a/src/Contracts/Support/Collection.php +++ b/src/Contracts/Support/Collection.php @@ -75,7 +75,7 @@ public function column(string $propertyOrMethod): array; * * @return static */ - public function each($callback): Collection; + public function each($callback): static; /** * Returns a new collection of items for which the callback returns true. @@ -87,7 +87,7 @@ public function each($callback): Collection; * * @return static */ - public function filter($callback): Collection; + public function filter($callback): static; /** * Returns the first value in the collection or null when empty. @@ -107,7 +107,7 @@ public function first(): mixed; * * @return mixed */ - public function get(string $element, $defaultValue = null, string $cast = null): mixed; + public function get(string $element, $defaultValue = null, ?string $cast = null): mixed; /** * Returns the keys (insensitive or not) of the collection. @@ -187,7 +187,7 @@ public function last(): mixed; * * @return static */ - public function map($callback): Collection; + public function map($callback): static; /** * Reduces the collection to a single value using the callback. @@ -238,7 +238,7 @@ public function set(string $element, $value): void; * * @return static */ - public function sort($callback = null, int $order = 4): Collection; + public function sort($callback = null, int $order = 4): static; /** * Returns the collection as an array. @@ -276,5 +276,5 @@ public function values(): array; * * @return static */ - public function where(string $propertyOrMethod, $value): Collection; + public function where(string $propertyOrMethod, $value): static; } diff --git a/src/DataMapper/Pdo/Connection.php b/src/DataMapper/Pdo/Connection.php index 95aac404..68653784 100644 --- a/src/DataMapper/Pdo/Connection.php +++ b/src/DataMapper/Pdo/Connection.php @@ -9,8 +9,8 @@ */ namespace Phalcon\DataMapper\Pdo; -use InvalidArgumentException; use Phalcon\DataMapper\Pdo\Connection\AbstractConnection; +use Phalcon\DataMapper\Pdo\Exception\DriverNotSupported; use Phalcon\DataMapper\Pdo\Profiler\Profiler; use Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface; @@ -38,7 +38,7 @@ class Connection extends AbstractConnection * @param array $queries * @param ProfilerInterface $profiler */ - public function __construct(string $dsn, string $username = null, string $password = null, array $options = [], array $queries = [], \Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler = null) + public function __construct(string $dsn, ?string $username = null, ?string $password = null, array $options = [], array $queries = [], ?\Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler = null) { } diff --git a/src/DataMapper/Pdo/Connection/AbstractConnection.php b/src/DataMapper/Pdo/Connection/AbstractConnection.php index 8bc3addc..87e2d583 100644 --- a/src/DataMapper/Pdo/Connection/AbstractConnection.php +++ b/src/DataMapper/Pdo/Connection/AbstractConnection.php @@ -10,7 +10,7 @@ namespace Phalcon\DataMapper\Pdo\Connection; use BadMethodCallException; -use Phalcon\DataMapper\Pdo\Exception\CannotBindValue; +use Phalcon\DataMapper\Pdo\Exception\UnknownDriverMethod; use Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface; /** @@ -344,7 +344,7 @@ public function isConnected(): bool * * @return string */ - public function lastInsertId(string $name = null): string + public function lastInsertId(?string $name = null): string { } @@ -428,8 +428,9 @@ public function setAttribute(int $attribute, $value): bool * Sets the Profiler instance. * * @param ProfilerInterface $profiler + * @return static */ - public function setProfiler(\Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler) + public function setProfiler(\Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler): static { } diff --git a/src/DataMapper/Pdo/Connection/ConnectionInterface.php b/src/DataMapper/Pdo/Connection/ConnectionInterface.php index 09f9e2b0..fbc951a9 100644 --- a/src/DataMapper/Pdo/Connection/ConnectionInterface.php +++ b/src/DataMapper/Pdo/Connection/ConnectionInterface.php @@ -9,8 +9,6 @@ */ namespace Phalcon\DataMapper\Pdo\Connection; -use Phalcon\DataMapper\Pdo\Exception\CannotBindValue; -use Phalcon\DataMapper\Pdo\Parser\ParserInterface; use Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface; /** diff --git a/src/DataMapper/Pdo/Connection/Decorated.php b/src/DataMapper/Pdo/Connection/Decorated.php index 02eb003c..0f107f12 100644 --- a/src/DataMapper/Pdo/Connection/Decorated.php +++ b/src/DataMapper/Pdo/Connection/Decorated.php @@ -29,7 +29,7 @@ class Decorated extends \Phalcon\DataMapper\Pdo\Connection\AbstractConnection * @param ProfilerInterface|null $profiler * */ - public function __construct(\PDO $pdo, \Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler = null) + public function __construct(\PDO $pdo, ?\Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface $profiler = null) { } diff --git a/src/DataMapper/Pdo/Connection/PdoInterface.php b/src/DataMapper/Pdo/Connection/PdoInterface.php index 25680ebe..0d725e77 100644 --- a/src/DataMapper/Pdo/Connection/PdoInterface.php +++ b/src/DataMapper/Pdo/Connection/PdoInterface.php @@ -87,7 +87,7 @@ public function inTransaction(): bool; * * @return string */ - public function lastInsertId(string $name = null): string; + public function lastInsertId(?string $name = null): string; /** * Prepares an SQL statement for execution. diff --git a/src/DataMapper/Pdo/ConnectionLocator.php b/src/DataMapper/Pdo/ConnectionLocator.php index 84948e25..abc04484 100644 --- a/src/DataMapper/Pdo/ConnectionLocator.php +++ b/src/DataMapper/Pdo/ConnectionLocator.php @@ -98,10 +98,10 @@ public function getWrite(string $name = ''): ConnectionInterface * * @param ConnectionInterface $callable * - * @return ConnectionLocatorInterface + * @return static * @param \Phalcon\DataMapper\Pdo\Connection\ConnectionInterface $callableObject */ - public function setMaster(\Phalcon\DataMapper\Pdo\Connection\ConnectionInterface $callableObject): ConnectionLocatorInterface + public function setMaster(\Phalcon\DataMapper\Pdo\Connection\ConnectionInterface $callableObject): static { } @@ -111,10 +111,10 @@ public function setMaster(\Phalcon\DataMapper\Pdo\Connection\ConnectionInterface * @param string $name * @param callable $callable * - * @return ConnectionLocatorInterface + * @return static * @param callable $callableObject */ - public function setRead(string $name, $callableObject): ConnectionLocatorInterface + public function setRead(string $name, $callableObject): static { } @@ -124,10 +124,10 @@ public function setRead(string $name, $callableObject): ConnectionLocatorInterfa * @param string $name * @param callable $callable * - * @return ConnectionLocatorInterface + * @return static * @param callable $callableObject */ - public function setWrite(string $name, $callableObject): ConnectionLocatorInterface + public function setWrite(string $name, $callableObject): static { } diff --git a/src/DataMapper/Pdo/Exception/DriverNotSupported.php b/src/DataMapper/Pdo/Exception/DriverNotSupported.php new file mode 100644 index 00000000..578751be --- /dev/null +++ b/src/DataMapper/Pdo/Exception/DriverNotSupported.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\DataMapper\Pdo\Exception; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DriverNotSupported extends InvalidArgumentException +{ + /** + * @param string $driver + */ + public function __construct(string $driver) + { + } +} diff --git a/src/DataMapper/Pdo/Exception/UnknownDriverMethod.php b/src/DataMapper/Pdo/Exception/UnknownDriverMethod.php new file mode 100644 index 00000000..3c85c49f --- /dev/null +++ b/src/DataMapper/Pdo/Exception/UnknownDriverMethod.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\DataMapper\Pdo\Exception; + +use BadMethodCallException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownDriverMethod extends BadMethodCallException +{ + /** + * @param string $message + */ + public function __construct(string $message) + { + } +} diff --git a/src/DataMapper/Pdo/Exception/UnknownQueryMethod.php b/src/DataMapper/Pdo/Exception/UnknownQueryMethod.php new file mode 100644 index 00000000..3c6e539b --- /dev/null +++ b/src/DataMapper/Pdo/Exception/UnknownQueryMethod.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\DataMapper\Pdo\Exception; + +use BadMethodCallException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownQueryMethod extends BadMethodCallException +{ + /** + * @param string $method + */ + public function __construct(string $method) + { + } +} diff --git a/src/DataMapper/Pdo/Profiler/Profiler.php b/src/DataMapper/Pdo/Profiler/Profiler.php index 109493b7..4f0d8bcc 100644 --- a/src/DataMapper/Pdo/Profiler/Profiler.php +++ b/src/DataMapper/Pdo/Profiler/Profiler.php @@ -54,7 +54,7 @@ class Profiler implements \Phalcon\DataMapper\Pdo\Profiler\ProfilerInterface * * @param LoggerInterface $logger */ - public function __construct(\Phalcon\Logger\LoggerInterface $logger = null) + public function __construct(?\Phalcon\Logger\LoggerInterface $logger = null) { } @@ -65,7 +65,7 @@ public function __construct(\Phalcon\Logger\LoggerInterface $logger = null) * @param array $values * @return void */ - public function finish(string $statement = null, array $values = []): void + public function finish(?string $statement = null, array $values = []): void { } diff --git a/src/DataMapper/Pdo/Profiler/ProfilerInterface.php b/src/DataMapper/Pdo/Profiler/ProfilerInterface.php index 1247b52d..8ab36352 100644 --- a/src/DataMapper/Pdo/Profiler/ProfilerInterface.php +++ b/src/DataMapper/Pdo/Profiler/ProfilerInterface.php @@ -23,7 +23,7 @@ interface ProfilerInterface * @param array $values * @return void */ - public function finish(string $statement = null, array $values = []): void; + public function finish(?string $statement = null, array $values = []): void; /** * Returns the underlying logger instance. diff --git a/src/DataMapper/Query/Insert.php b/src/DataMapper/Query/Insert.php index f111d5b1..2546892b 100644 --- a/src/DataMapper/Query/Insert.php +++ b/src/DataMapper/Query/Insert.php @@ -68,7 +68,7 @@ public function into(string $table): Insert * * @return string */ - public function getLastInsertId(string $name = null): string + public function getLastInsertId(?string $name = null): string { } diff --git a/src/DataMapper/Query/Select.php b/src/DataMapper/Query/Select.php index 7a9cdaf2..abe91a22 100644 --- a/src/DataMapper/Query/Select.php +++ b/src/DataMapper/Query/Select.php @@ -10,6 +10,7 @@ namespace Phalcon\DataMapper\Query; use BadMethodCallException; +use Phalcon\DataMapper\Pdo\Exception\UnknownQueryMethod; /** * Select Query diff --git a/src/Db/Adapter/AbstractAdapter.php b/src/Db/Adapter/AbstractAdapter.php index c764d4f1..9c51c22e 100644 --- a/src/Db/Adapter/AbstractAdapter.php +++ b/src/Db/Adapter/AbstractAdapter.php @@ -10,15 +10,22 @@ namespace Phalcon\Db\Adapter; use Phalcon\Db\CheckInterface; -use Phalcon\Db\DialectInterface; use Phalcon\Db\ColumnInterface; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Enum; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\CannotInsertWithoutData; +use Phalcon\Db\Exceptions\IncompleteBindTypes; +use Phalcon\Db\Exceptions\InvalidWhereConditions; +use Phalcon\Db\Exceptions\NestedTransactionChangeBlocked; +use Phalcon\Db\Exceptions\SavepointsNotSupported; +use Phalcon\Db\Exceptions\TableMustHaveColumn; +use Phalcon\Db\Exceptions\UpdateFieldCountMismatch; use Phalcon\Db\Index; use Phalcon\Db\IndexInterface; +use Phalcon\Db\RawValue; use Phalcon\Db\Reference; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\RawValue; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface; use Phalcon\Support\Settings; @@ -268,10 +275,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function createView(string $viewName, array $definition, string $schemaName = null): bool + public function createView(string $viewName, array $definition, ?string $schemaName = null): bool { } @@ -295,7 +302,7 @@ public function createView(string $viewName, array $definition, string $schemaNa * @param array $dataTypes * * @return bool */ - public function delete($table, string $whereCondition = null, array $placeholders = [], array $dataTypes = []): bool + public function delete($table, ?string $whereCondition = null, array $placeholders = [], array $dataTypes = []): bool { } @@ -309,10 +316,10 @@ public function delete($table, string $whereCondition = null, array $placeholder * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\IndexInterface[] */ - public function describeIndexes(string $table, string $schema = null): array + public function describeIndexes(string $table, ?string $schema = null): array { } @@ -326,10 +333,10 @@ public function describeIndexes(string $table, string $schema = null): array * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ReferenceInterface[] */ - public function describeReferences(string $table, string $schema = null): array + public function describeReferences(string $table, ?string $schema = null): array { } @@ -396,11 +403,11 @@ public function dropPrimaryKey(string $tableName, string $schemaName): bool * Drops a table from a schema/database * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return bool */ - public function dropTable(string $tableName, string $schemaName = null, bool $ifExists = true): bool + public function dropTable(string $tableName, ?string $schemaName = null, bool $ifExists = true): bool { } @@ -408,11 +415,11 @@ public function dropTable(string $tableName, string $schemaName = null, bool $if * Drops a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return bool */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): bool + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): bool { } @@ -779,10 +786,10 @@ public function isNestedTransactionsWithSavepoints(): bool * ``` * * @param string $sqlQuery - * @param int $number + * @param mixed $number * @return string */ - public function limit(string $sqlQuery, int $number): string + public function limit(string $sqlQuery, $number): string { } @@ -795,10 +802,10 @@ public function limit(string $sqlQuery, int $number): string * ); * ``` * - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function listTables(string $schemaName = null): array + public function listTables(?string $schemaName = null): array { } @@ -811,10 +818,10 @@ public function listTables(string $schemaName = null): array * ); * ``` * - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function listViews(string $schemaName = null): array + public function listViews(?string $schemaName = null): array { } @@ -824,10 +831,10 @@ public function listViews(string $schemaName = null): array * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return bool */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): bool + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): bool { } @@ -909,10 +916,10 @@ public function sharedLock(string $sqlQuery, string $modifier = ''): string * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function createMaterializedView(string $viewName, array $definition, string $schemaName = null): bool + public function createMaterializedView(string $viewName, array $definition, ?string $schemaName = null): bool { } @@ -920,11 +927,11 @@ public function createMaterializedView(string $viewName, array $definition, stri * Drops a materialized view (PostgreSQL only). * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return bool */ - public function dropMaterializedView(string $viewName, string $schemaName = null, bool $ifExists = true): bool + public function dropMaterializedView(string $viewName, ?string $schemaName = null, bool $ifExists = true): bool { } @@ -933,11 +940,11 @@ public function dropMaterializedView(string $viewName, string $schemaName = null * `concurrent = true` for non-blocking refresh. * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $concurrent * @return bool */ - public function refreshMaterializedView(string $viewName, string $schemaName = null, bool $concurrent = false): bool + public function refreshMaterializedView(string $viewName, ?string $schemaName = null, bool $concurrent = false): bool { } @@ -988,10 +995,10 @@ public function supportSequences(): bool * ``` * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function tableExists(string $tableName, string $schemaName = null): bool + public function tableExists(string $tableName, ?string $schemaName = null): bool { } @@ -1005,10 +1012,10 @@ public function tableExists(string $tableName, string $schemaName = null): bool * ``` * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return array */ - public function tableOptions(string $tableName, string $schemaName = null): array + public function tableOptions(string $tableName, ?string $schemaName = null): array { } @@ -1116,10 +1123,10 @@ public function supportsDefaultValue(): bool * ``` * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return bool */ - public function viewExists(string $viewName, string $schemaName = null): bool + public function viewExists(string $viewName, ?string $schemaName = null): bool { } } diff --git a/src/Db/Adapter/Pdo/AbstractPdo.php b/src/Db/Adapter/Pdo/AbstractPdo.php index 116062de..fa90e48d 100644 --- a/src/Db/Adapter/Pdo/AbstractPdo.php +++ b/src/Db/Adapter/Pdo/AbstractPdo.php @@ -12,6 +12,10 @@ use Phalcon\Db\Adapter\AbstractAdapter; use Phalcon\Db\Column; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\CannotPrepareStatement; +use Phalcon\Db\Exceptions\InvalidBindParameter; +use Phalcon\Db\Exceptions\MatchedParameterNotFound; +use Phalcon\Db\Exceptions\NoActiveTransaction; use Phalcon\Db\Result\PdoResult; use Phalcon\Db\ResultInterface; use Phalcon\Events\ManagerInterface; @@ -37,6 +41,11 @@ */ abstract class AbstractPdo extends AbstractAdapter { + /** + * @var string + */ + const BIND_PATTERN = '/\\\\?([0-9]+)|:([a-zA-Z0-9_]+):/'; + /** * Last affected rows * @@ -239,10 +248,10 @@ public function execute(string $sqlStatement, array $bindParams = [], array $bin * * @param \PDOStatement $statement * @param array $placeholders - * @param mixed $dataTypes + * @param array $dataTypes * @return \PDOStatement */ - public function executePrepared(\PDOStatement $statement, array $placeholders, $dataTypes): \PDOStatement + public function executePrepared(\PDOStatement $statement, array $placeholders, array $dataTypes = []): \PDOStatement { } @@ -316,7 +325,7 @@ public function isUnderTransaction(): bool * @param string|null $name * @return string|bool */ - public function lastInsertId(string $name = null): bool|string + public function lastInsertId(?string $name = null): bool|string { } diff --git a/src/Db/Adapter/Pdo/Mysql.php b/src/Db/Adapter/Pdo/Mysql.php index 20a3b00e..e769941c 100644 --- a/src/Db/Adapter/Pdo/Mysql.php +++ b/src/Db/Adapter/Pdo/Mysql.php @@ -14,6 +14,7 @@ use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\MissingForeignKeyChecks; use Phalcon\Db\Index; use Phalcon\Db\IndexInterface; use Phalcon\Db\Reference; @@ -70,10 +71,10 @@ public function addForeignKey(string $tableName, string $schemaName, \Phalcon\Db * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ColumnInterface[] */ - public function describeColumns(string $table, string $schema = null): array + public function describeColumns(string $table, ?string $schema = null): array { } @@ -87,10 +88,10 @@ public function describeColumns(string $table, string $schema = null): array * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\IndexInterface[] */ - public function describeIndexes(string $table, string $schema = null): array + public function describeIndexes(string $table, ?string $schema = null): array { } @@ -104,10 +105,10 @@ public function describeIndexes(string $table, string $schema = null): array * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ReferenceInterface[] */ - public function describeReferences(string $table, string $schema = null): array + public function describeReferences(string $table, ?string $schema = null): array { } diff --git a/src/Db/Adapter/Pdo/Postgresql.php b/src/Db/Adapter/Pdo/Postgresql.php index df497c22..7059a4c8 100644 --- a/src/Db/Adapter/Pdo/Postgresql.php +++ b/src/Db/Adapter/Pdo/Postgresql.php @@ -14,6 +14,7 @@ use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\TableMustHaveColumn; use Phalcon\Db\RawValue; use Phalcon\Db\Reference; use Phalcon\Db\ReferenceInterface; @@ -90,10 +91,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ColumnInterface[] */ - public function describeColumns(string $table, string $schema = null): array + public function describeColumns(string $table, ?string $schema = null): array { } @@ -107,10 +108,10 @@ public function describeColumns(string $table, string $schema = null): array * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ReferenceInterface[] */ - public function describeReferences(string $table, string $schema = null): array + public function describeReferences(string $table, ?string $schema = null): array { } @@ -146,10 +147,10 @@ public function getDefaultIdValue(): RawValue * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return bool */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): bool + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): bool { } diff --git a/src/Db/Adapter/Pdo/Sqlite.php b/src/Db/Adapter/Pdo/Sqlite.php index 4f5e826b..f716e1b6 100644 --- a/src/Db/Adapter/Pdo/Sqlite.php +++ b/src/Db/Adapter/Pdo/Sqlite.php @@ -14,6 +14,7 @@ use Phalcon\Db\ColumnInterface; use Phalcon\Db\Enum; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\MissingSqliteDatabase; use Phalcon\Db\Index; use Phalcon\Db\IndexInterface; use Phalcon\Db\RawValue; @@ -75,10 +76,10 @@ public function connect(array $descriptor = []): void * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ColumnInterface[] */ - public function describeColumns(string $table, string $schema = null): array + public function describeColumns(string $table, ?string $schema = null): array { } @@ -92,10 +93,10 @@ public function describeColumns(string $table, string $schema = null): array * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\IndexInterface[] */ - public function describeIndexes(string $table, string $schema = null): array + public function describeIndexes(string $table, ?string $schema = null): array { } @@ -103,10 +104,10 @@ public function describeIndexes(string $table, string $schema = null): array * Lists table references * * @param string $table - * @param string $schema + * @param string|null $schema * @return array|\Phalcon\Db\ReferenceInterface[] */ - public function describeReferences(string $table, string $schema = null): array + public function describeReferences(string $table, ?string $schema = null): array { } diff --git a/src/Db/Check.php b/src/Db/Check.php index 9c931c10..dc09f131 100644 --- a/src/Db/Check.php +++ b/src/Db/Check.php @@ -9,6 +9,9 @@ */ namespace Phalcon\Db; +use Phalcon\Db\Exceptions\CheckExpressionRequired; +use Phalcon\Db\Exceptions\InvalidCheckExpression; + /** * Allows to define `CHECK` constraints on tables. CHECK constraints enforce * a boolean SQL predicate on each row of the table; rows that fail the diff --git a/src/Db/Column.php b/src/Db/Column.php index d2bb486a..1e0058c5 100644 --- a/src/Db/Column.php +++ b/src/Db/Column.php @@ -9,6 +9,13 @@ */ namespace Phalcon\Db; +use Phalcon\Db\Exceptions\ColumnTypeRejectsAutoIncrement; +use Phalcon\Db\Exceptions\ColumnTypeRejectsScale; +use Phalcon\Db\Exceptions\ColumnTypeRequired; +use Phalcon\Db\Exceptions\GeneratedAutoIncrementConflict; +use Phalcon\Db\Exceptions\GeneratedDefaultConflict; +use Phalcon\Db\Exceptions\InvalidGenerationExpression; + /** * Allows to define columns to be used on create or alter table operations * diff --git a/src/Db/Dialect.php b/src/Db/Dialect.php index 73d1561c..92125fa7 100644 --- a/src/Db/Dialect.php +++ b/src/Db/Dialect.php @@ -9,6 +9,17 @@ */ namespace Phalcon\Db; +use Phalcon\Db\Exceptions\ConflictTargetColumnRequired; +use Phalcon\Db\Exceptions\ConflictUpdateColumnRequired; +use Phalcon\Db\Exceptions\InvalidGroupByExpression; +use Phalcon\Db\Exceptions\InvalidListExpression; +use Phalcon\Db\Exceptions\InvalidOrderByExpression; +use Phalcon\Db\Exceptions\InvalidSqlExpression; +use Phalcon\Db\Exceptions\InvalidSqlExpressionType; +use Phalcon\Db\Exceptions\InvalidUnaryExpression; +use Phalcon\Db\Exceptions\MaterializedViewsNotSupported; +use Phalcon\Db\Exceptions\MissingDefinitionKey; +use Phalcon\Db\Exceptions\ReturningNotSupported; use Phalcon\Support\Settings; /** @@ -41,10 +52,10 @@ public function createSavepoint(string $name): string * Escape identifiers * * @param string $str - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final public function escape(string $str, string $escapeChar = null): string + final public function escape(string $str, ?string $escapeChar = null): string { } @@ -52,10 +63,10 @@ final public function escape(string $str, string $escapeChar = null): string * Escape Schema * * @param string $str - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final public function escapeSchema(string $str, string $escapeChar = null): string + final public function escapeSchema(string $str, ?string $escapeChar = null): string { } @@ -101,11 +112,11 @@ public function forUpdate(string $sqlQuery, string $modifier = ''): string * ``` * * @param array $columnList - * @param string $escapeChar + * @param string|null $escapeChar * @param array $bindCounts * @return string */ - final public function getColumnList(array $columnList, string $escapeChar = null, array $bindCounts = []): string + final public function getColumnList(array $columnList, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -126,7 +137,7 @@ public function getCustomFunctions(): array * @param array $bindCounts * * @return string */ - final public function getSqlColumn($column, string $escapeChar = null, array $bindCounts = []): string + final public function getSqlColumn($column, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -134,11 +145,11 @@ final public function getSqlColumn($column, string $escapeChar = null, array $bi * Transforms an intermediate representation for an expression into a database system valid expression * * @param array $expression - * @param string $escapeChar + * @param string|null $escapeChar * @param array $bindCounts * @return string */ - public function getSqlExpression(array $expression, string $escapeChar = null, array $bindCounts = []): string + public function getSqlExpression(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -147,10 +158,10 @@ public function getSqlExpression(array $expression, string $escapeChar = null, a * database system valid expression * * @param mixed $table - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final public function getSqlTable($table, string $escapeChar = null): string + final public function getSqlTable($table, ?string $escapeChar = null): string { } @@ -184,9 +195,9 @@ public function limit(string $sqlQuery, $number): string * * @param string $name * @param callable $customFunction - * @return Dialect + * @return static */ - public function registerCustomFunction(string $name, $customFunction): Dialect + public function registerCustomFunction(string $name, $customFunction): static { } @@ -197,10 +208,10 @@ public function registerCustomFunction(string $name, $customFunction): Dialect * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createMaterializedView(string $viewName, array $definition, string $schemaName = null): string + public function createMaterializedView(string $viewName, array $definition, ?string $schemaName = null): string { } @@ -208,11 +219,11 @@ public function createMaterializedView(string $viewName, array $definition, stri * Generates SQL to drop a materialized view. Supported by PostgreSQL. * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropMaterializedView(string $viewName, string $schemaName = null, bool $ifExists = true): string + public function dropMaterializedView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -223,11 +234,11 @@ public function dropMaterializedView(string $viewName, string $schemaName = null * the view to have a unique index). * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $concurrent * @return string */ - public function refreshMaterializedView(string $viewName, string $schemaName = null, bool $concurrent = false): string + public function refreshMaterializedView(string $viewName, ?string $schemaName = null, bool $concurrent = false): string { } @@ -400,10 +411,10 @@ protected function getGeneratedClause(ColumnInterface $column, bool $forceStored * Resolve * * @param array $expression - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final protected function getSqlExpressionAll(array $expression, string $escapeChar = null): string + final protected function getSqlExpressionAll(array $expression, ?string $escapeChar = null): string { } @@ -415,7 +426,7 @@ final protected function getSqlExpressionAll(array $expression, string $escapeCh * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionBinaryOperations(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionBinaryOperations(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -427,7 +438,7 @@ final protected function getSqlExpressionBinaryOperations(array $expression, str * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionCase(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionCase(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -439,7 +450,7 @@ final protected function getSqlExpressionCase(array $expression, string $escapeC * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionCastValue(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionCastValue(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -451,7 +462,7 @@ final protected function getSqlExpressionCastValue(array $expression, string $es * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionConvertValue(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionConvertValue(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -459,10 +470,10 @@ final protected function getSqlExpressionConvertValue(array $expression, string * Resolve a FROM clause * * @param mixed $expression - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final protected function getSqlExpressionFrom($expression, string $escapeChar = null): string + final protected function getSqlExpressionFrom($expression, ?string $escapeChar = null): string { } @@ -474,7 +485,7 @@ final protected function getSqlExpressionFrom($expression, string $escapeChar = * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionFunctionCall(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionFunctionCall(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -486,7 +497,7 @@ final protected function getSqlExpressionFunctionCall(array $expression, string * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionGroupBy($expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionGroupBy($expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -498,7 +509,7 @@ final protected function getSqlExpressionGroupBy($expression, string $escapeChar * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionHaving(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionHaving(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -510,7 +521,7 @@ final protected function getSqlExpressionHaving(array $expression, string $escap * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionJoins($expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionJoins($expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -522,7 +533,7 @@ final protected function getSqlExpressionJoins($expression, string $escapeChar = * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionLimit($expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionLimit($expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -534,7 +545,7 @@ final protected function getSqlExpressionLimit($expression, string $escapeChar = * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionList(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionList(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -546,7 +557,7 @@ final protected function getSqlExpressionList(array $expression, string $escapeC * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionObject(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionObject(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -558,7 +569,7 @@ final protected function getSqlExpressionObject(array $expression, string $escap * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionOrderBy($expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionOrderBy($expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -566,10 +577,10 @@ final protected function getSqlExpressionOrderBy($expression, string $escapeChar * Resolve qualified expressions * * @param array $expression - * @param string $escapeChar + * @param string|null $escapeChar * @return string */ - final protected function getSqlExpressionQualified(array $expression, string $escapeChar = null): string + final protected function getSqlExpressionQualified(array $expression, ?string $escapeChar = null): string { } @@ -581,7 +592,7 @@ final protected function getSqlExpressionQualified(array $expression, string $es * @param array $bindCounts * @return string */ - final protected function getSqlExpressionScalar(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionScalar(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -593,7 +604,7 @@ final protected function getSqlExpressionScalar(array $expression, string $escap * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionUnaryOperations(array $expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionUnaryOperations(array $expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -605,7 +616,7 @@ final protected function getSqlExpressionUnaryOperations(array $expression, stri * @param array $bindCounts * * @return string */ - final protected function getSqlExpressionWhere($expression, string $escapeChar = null, array $bindCounts = []): string + final protected function getSqlExpressionWhere($expression, ?string $escapeChar = null, array $bindCounts = []): string { } @@ -613,11 +624,11 @@ final protected function getSqlExpressionWhere($expression, string $escapeChar = * Prepares column for this RDBMS * * @param string $qualified - * @param string $alias - * @param string $escapeChar + * @param string|null $alias + * @param string|null $escapeChar * @return string */ - protected function prepareColumnAlias(string $qualified, string $alias = null, string $escapeChar = null): string + protected function prepareColumnAlias(string $qualified, ?string $alias = null, ?string $escapeChar = null): string { } @@ -625,12 +636,12 @@ protected function prepareColumnAlias(string $qualified, string $alias = null, s * Prepares table for this RDBMS * * @param string $table - * @param string $schema - * @param string $alias - * @param string $escapeChar + * @param string|null $schema + * @param string|null $alias + * @param string|null $escapeChar * @return string */ - protected function prepareTable(string $table, string $schema = null, string $alias = null, string $escapeChar = null): string + protected function prepareTable(string $table, ?string $schema = null, ?string $alias = null, ?string $escapeChar = null): string { } @@ -638,11 +649,11 @@ protected function prepareTable(string $table, string $schema = null, string $al * Prepares qualified for this RDBMS * * @param string $column - * @param string $domain - * @param string $escapeChar + * @param string|null $domain + * @param string|null $escapeChar * @return string */ - protected function prepareQualified(string $column, string $domain = null, string $escapeChar = null): string + protected function prepareQualified(string $column, ?string $domain = null, ?string $escapeChar = null): string { } } diff --git a/src/Db/Dialect/Mysql.php b/src/Db/Dialect/Mysql.php index 3aa1a7e0..56940d2c 100644 --- a/src/Db/Dialect/Mysql.php +++ b/src/Db/Dialect/Mysql.php @@ -9,15 +9,18 @@ */ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; use Phalcon\Db\CheckInterface; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\MissingDefinitionKey; +use Phalcon\Db\Exceptions\MysqlOnConflictNotSupported; +use Phalcon\Db\Exceptions\UnrecognizedDataType; use Phalcon\Db\IndexInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\RawValue; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; /** * Generates database specific SQL for the MySQL RDBMS @@ -107,10 +110,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createView(string $viewName, array $definition, string $schemaName = null): string + public function createView(string $viewName, array $definition, ?string $schemaName = null): string { } @@ -124,10 +127,10 @@ public function createView(string $viewName, array $definition, string $schemaNa * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeColumns(string $table, string $schema = null): string + public function describeColumns(string $table, ?string $schema = null): string { } @@ -135,10 +138,10 @@ public function describeColumns(string $table, string $schema = null): string * Generates SQL to query indexes on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeIndexes(string $table, string $schema = null): string + public function describeIndexes(string $table, ?string $schema = null): string { } @@ -146,10 +149,10 @@ public function describeIndexes(string $table, string $schema = null): string * Generates SQL to query foreign keys on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeReferences(string $table, string $schema = null): string + public function describeReferences(string $table, ?string $schema = null): string { } @@ -216,11 +219,11 @@ public function dropPrimaryKey(string $tableName, string $schemaName): string * Generates SQL to drop a table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropTable(string $tableName, string $schemaName = null, bool $ifExists = true): string + public function dropTable(string $tableName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -228,11 +231,11 @@ public function dropTable(string $tableName, string $schemaName = null, bool $if * Generates SQL to drop a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): string + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -264,20 +267,20 @@ public function getForeignKeyChecks(): string * ); * ``` * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listTables(string $schemaName = null): string + public function listTables(?string $schemaName = null): string { } /** * Generates the SQL to list all views of a schema or user * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listViews(string $schemaName = null): string + public function listViews(?string $schemaName = null): string { } @@ -287,10 +290,10 @@ public function listViews(string $schemaName = null): string * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return string */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): string + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): string { } @@ -341,10 +344,10 @@ public function sharedLock(string $sqlQuery, string $modifier = ''): string * ``` * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function tableExists(string $tableName, string $schemaName = null): string + public function tableExists(string $tableName, ?string $schemaName = null): string { } @@ -352,10 +355,10 @@ public function tableExists(string $tableName, string $schemaName = null): strin * Generates the SQL to describe the table creation options * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function tableOptions(string $table, string $schema = null): string + public function tableOptions(string $table, ?string $schema = null): string { } @@ -374,10 +377,10 @@ public function truncateTable(string $tableName, string $schemaName): string * Generates SQL checking for the existence of a schema.view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function viewExists(string $viewName, string $schemaName = null): string + public function viewExists(string $viewName, ?string $schemaName = null): string { } diff --git a/src/Db/Dialect/Postgresql.php b/src/Db/Dialect/Postgresql.php index 404b5934..fa09de07 100644 --- a/src/Db/Dialect/Postgresql.php +++ b/src/Db/Dialect/Postgresql.php @@ -9,15 +9,18 @@ */ namespace Phalcon\Db\Dialect; -use Phalcon\Db\Dialect; use Phalcon\Db\CheckInterface; use Phalcon\Db\Column; +use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Dialect; +use Phalcon\Db\DialectInterface; use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\MissingDefinitionKey; +use Phalcon\Db\Exceptions\ReturningRequiresColumn; +use Phalcon\Db\Exceptions\UnrecognizedDataType; use Phalcon\Db\IndexInterface; -use Phalcon\Db\ColumnInterface; use Phalcon\Db\RawValue; use Phalcon\Db\ReferenceInterface; -use Phalcon\Db\DialectInterface; /** * Generates database specific SQL for the PostgreSQL RDBMS @@ -106,10 +109,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createMaterializedView(string $viewName, array $definition, string $schemaName = null): string + public function createMaterializedView(string $viewName, array $definition, ?string $schemaName = null): string { } @@ -118,10 +121,10 @@ public function createMaterializedView(string $viewName, array $definition, stri * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createView(string $viewName, array $definition, string $schemaName = null): string + public function createView(string $viewName, array $definition, ?string $schemaName = null): string { } @@ -135,10 +138,10 @@ public function createView(string $viewName, array $definition, string $schemaNa * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeColumns(string $table, string $schema = null): string + public function describeColumns(string $table, ?string $schema = null): string { } @@ -146,10 +149,10 @@ public function describeColumns(string $table, string $schema = null): string * Generates SQL to query indexes on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeIndexes(string $table, string $schema = null): string + public function describeIndexes(string $table, ?string $schema = null): string { } @@ -157,10 +160,10 @@ public function describeIndexes(string $table, string $schema = null): string * Generates SQL to query foreign keys on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeReferences(string $table, string $schema = null): string + public function describeReferences(string $table, ?string $schema = null): string { } @@ -227,11 +230,11 @@ public function dropPrimaryKey(string $tableName, string $schemaName): string * Generates SQL to drop a table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropTable(string $tableName, string $schemaName = null, bool $ifExists = true): string + public function dropTable(string $tableName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -239,11 +242,11 @@ public function dropTable(string $tableName, string $schemaName = null, bool $if * Generates SQL to drop a materialized view. * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropMaterializedView(string $viewName, string $schemaName = null, bool $ifExists = true): string + public function dropMaterializedView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -251,11 +254,11 @@ public function dropMaterializedView(string $viewName, string $schemaName = null * Generates SQL to drop a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): string + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -265,11 +268,11 @@ public function dropView(string $viewName, string $schemaName = null, bool $ifEx * blocking concurrent SELECTs; requires a unique index on the view). * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $concurrent * @return string */ - public function refreshMaterializedView(string $viewName, string $schemaName = null, bool $concurrent = false): string + public function refreshMaterializedView(string $viewName, ?string $schemaName = null, bool $concurrent = false): string { } @@ -292,20 +295,20 @@ public function getColumnDefinition(\Phalcon\Db\ColumnInterface $column): string * ); * ``` * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listTables(string $schemaName = null): string + public function listTables(?string $schemaName = null): string { } /** * Generates the SQL to list all views of a schema or user * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listViews(string $schemaName = null): string + public function listViews(?string $schemaName = null): string { } @@ -315,10 +318,10 @@ public function listViews(string $schemaName = null): string * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return string */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): string + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): string { } @@ -369,10 +372,10 @@ public function sharedLock(string $sqlQuery, string $modifier = ''): string * ``` * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function tableExists(string $tableName, string $schemaName = null): string + public function tableExists(string $tableName, ?string $schemaName = null): string { } @@ -380,10 +383,10 @@ public function tableExists(string $tableName, string $schemaName = null): strin * Generates the SQL to describe the table creation options * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function tableOptions(string $table, string $schema = null): string + public function tableOptions(string $table, ?string $schema = null): string { } @@ -402,10 +405,10 @@ public function truncateTable(string $tableName, string $schemaName): string * Generates SQL checking for the existence of a schema.view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function viewExists(string $viewName, string $schemaName = null): string + public function viewExists(string $viewName, ?string $schemaName = null): string { } diff --git a/src/Db/Dialect/Sqlite.php b/src/Db/Dialect/Sqlite.php index 4bfa16d8..c24aab34 100644 --- a/src/Db/Dialect/Sqlite.php +++ b/src/Db/Dialect/Sqlite.php @@ -11,11 +11,21 @@ use Phalcon\Db\CheckInterface; use Phalcon\Db\Column; -use Phalcon\Db\Exception; -use Phalcon\Db\IndexInterface; +use Phalcon\Db\ColumnInterface; use Phalcon\Db\Dialect; use Phalcon\Db\DialectInterface; -use Phalcon\Db\ColumnInterface; +use Phalcon\Db\Exception; +use Phalcon\Db\Exceptions\MissingDefinitionKey; +use Phalcon\Db\Exceptions\ReturningRequiresColumn; +use Phalcon\Db\Exceptions\SqliteAlterCheckNotSupported; +use Phalcon\Db\Exceptions\SqliteAlterColumnNotSupported; +use Phalcon\Db\Exceptions\SqliteAlterForeignKeyNotSupported; +use Phalcon\Db\Exceptions\SqliteAlterPrimaryKeyNotSupported; +use Phalcon\Db\Exceptions\SqliteDropCheckNotSupported; +use Phalcon\Db\Exceptions\SqliteDropForeignKeyNotSupported; +use Phalcon\Db\Exceptions\SqliteDropPrimaryKeyNotSupported; +use Phalcon\Db\Exceptions\UnrecognizedDataType; +use Phalcon\Db\IndexInterface; use Phalcon\Db\RawValue; use Phalcon\Db\ReferenceInterface; @@ -107,10 +117,10 @@ public function createTable(string $tableName, string $schemaName, array $defini * * @param string $viewName * @param array $definition - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function createView(string $viewName, array $definition, string $schemaName = null): string + public function createView(string $viewName, array $definition, ?string $schemaName = null): string { } @@ -124,10 +134,10 @@ public function createView(string $viewName, array $definition, string $schemaNa * ``` * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeColumns(string $table, string $schema = null): string + public function describeColumns(string $table, ?string $schema = null): string { } @@ -145,10 +155,10 @@ public function describeIndex(string $index): string * Generates SQL to query indexes on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeIndexes(string $table, string $schema = null): string + public function describeIndexes(string $table, ?string $schema = null): string { } @@ -156,10 +166,10 @@ public function describeIndexes(string $table, string $schema = null): string * Generates SQL to query foreign keys on a table * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function describeReferences(string $table, string $schema = null): string + public function describeReferences(string $table, ?string $schema = null): string { } @@ -231,11 +241,11 @@ public function dropPrimaryKey(string $tableName, string $schemaName): string * Generates SQL to drop a table * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropTable(string $tableName, string $schemaName = null, bool $ifExists = true): string + public function dropTable(string $tableName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -243,11 +253,11 @@ public function dropTable(string $tableName, string $schemaName = null, bool $if * Generates SQL to drop a view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @param bool $ifExists * @return string */ - public function dropView(string $viewName, string $schemaName = null, bool $ifExists = true): string + public function dropView(string $viewName, ?string $schemaName = null, bool $ifExists = true): string { } @@ -285,11 +295,11 @@ public function getColumnDefinition(\Phalcon\Db\ColumnInterface $column): string * ``` * * @param string $table - * @param string $schema - * @param string $keyName + * @param string|null $schema + * @param string|null $keyName * @return string */ - public function listIndexesSql(string $table, string $schema = null, string $keyName = null): string + public function listIndexesSql(string $table, ?string $schema = null, ?string $keyName = null): string { } @@ -302,20 +312,20 @@ public function listIndexesSql(string $table, string $schema = null, string $key * ); * ``` * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listTables(string $schemaName = null): string + public function listTables(?string $schemaName = null): string { } /** * Generates the SQL to list all views of a schema or user * - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function listViews(string $schemaName = null): string + public function listViews(?string $schemaName = null): string { } @@ -325,10 +335,10 @@ public function listViews(string $schemaName = null): string * @param string $tableName * @param string $schemaName * @param \Phalcon\Db\ColumnInterface $column - * @param \Phalcon\Db\ColumnInterface $currentColumn + * @param \Phalcon\Db\ColumnInterface|null $currentColumn * @return string */ - public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, \Phalcon\Db\ColumnInterface $currentColumn = null): string + public function modifyColumn(string $tableName, string $schemaName, \Phalcon\Db\ColumnInterface $column, ?\Phalcon\Db\ColumnInterface $currentColumn = null): string { } @@ -367,10 +377,10 @@ public function sharedLock(string $sqlQuery, string $modifier = ''): string * ``` * * @param string $tableName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function tableExists(string $tableName, string $schemaName = null): string + public function tableExists(string $tableName, ?string $schemaName = null): string { } @@ -378,10 +388,10 @@ public function tableExists(string $tableName, string $schemaName = null): strin * Generates the SQL to describe the table creation options * * @param string $table - * @param string $schema + * @param string|null $schema * @return string */ - public function tableOptions(string $table, string $schema = null): string + public function tableOptions(string $table, ?string $schema = null): string { } @@ -400,10 +410,10 @@ public function truncateTable(string $tableName, string $schemaName): string * Generates SQL checking for the existence of a schema.view * * @param string $viewName - * @param string $schemaName + * @param string|null $schemaName * @return string */ - public function viewExists(string $viewName, string $schemaName = null): string + public function viewExists(string $viewName, ?string $schemaName = null): string { } } diff --git a/src/Db/Exceptions/CannotInsertWithoutData.php b/src/Db/Exceptions/CannotInsertWithoutData.php new file mode 100644 index 00000000..ef5a51e7 --- /dev/null +++ b/src/Db/Exceptions/CannotInsertWithoutData.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotInsertWithoutData extends Exception +{ + /** + * @param string $table + */ + public function __construct(string $table) + { + } +} diff --git a/src/Db/Exceptions/CannotPrepareStatement.php b/src/Db/Exceptions/CannotPrepareStatement.php new file mode 100644 index 00000000..24f72e25 --- /dev/null +++ b/src/Db/Exceptions/CannotPrepareStatement.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotPrepareStatement extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/CheckExpressionRequired.php b/src/Db/Exceptions/CheckExpressionRequired.php new file mode 100644 index 00000000..58a73faf --- /dev/null +++ b/src/Db/Exceptions/CheckExpressionRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CheckExpressionRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ColumnTypeRejectsAutoIncrement.php b/src/Db/Exceptions/ColumnTypeRejectsAutoIncrement.php new file mode 100644 index 00000000..1900d0ba --- /dev/null +++ b/src/Db/Exceptions/ColumnTypeRejectsAutoIncrement.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnTypeRejectsAutoIncrement extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ColumnTypeRejectsScale.php b/src/Db/Exceptions/ColumnTypeRejectsScale.php new file mode 100644 index 00000000..ee05c949 --- /dev/null +++ b/src/Db/Exceptions/ColumnTypeRejectsScale.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnTypeRejectsScale extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ColumnTypeRequired.php b/src/Db/Exceptions/ColumnTypeRequired.php new file mode 100644 index 00000000..3fee4245 --- /dev/null +++ b/src/Db/Exceptions/ColumnTypeRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnTypeRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ConflictTargetColumnRequired.php b/src/Db/Exceptions/ConflictTargetColumnRequired.php new file mode 100644 index 00000000..6e464e60 --- /dev/null +++ b/src/Db/Exceptions/ConflictTargetColumnRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConflictTargetColumnRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ConflictUpdateColumnRequired.php b/src/Db/Exceptions/ConflictUpdateColumnRequired.php new file mode 100644 index 00000000..6b677526 --- /dev/null +++ b/src/Db/Exceptions/ConflictUpdateColumnRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConflictUpdateColumnRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ForeignKeyColumnsRequired.php b/src/Db/Exceptions/ForeignKeyColumnsRequired.php new file mode 100644 index 00000000..a51963cd --- /dev/null +++ b/src/Db/Exceptions/ForeignKeyColumnsRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ForeignKeyColumnsRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/GeneratedAutoIncrementConflict.php b/src/Db/Exceptions/GeneratedAutoIncrementConflict.php new file mode 100644 index 00000000..db7f489d --- /dev/null +++ b/src/Db/Exceptions/GeneratedAutoIncrementConflict.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class GeneratedAutoIncrementConflict extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/GeneratedDefaultConflict.php b/src/Db/Exceptions/GeneratedDefaultConflict.php new file mode 100644 index 00000000..12469280 --- /dev/null +++ b/src/Db/Exceptions/GeneratedDefaultConflict.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class GeneratedDefaultConflict extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/IncompleteBindTypes.php b/src/Db/Exceptions/IncompleteBindTypes.php new file mode 100644 index 00000000..bc003b5a --- /dev/null +++ b/src/Db/Exceptions/IncompleteBindTypes.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IncompleteBindTypes extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidBindParameter.php b/src/Db/Exceptions/InvalidBindParameter.php new file mode 100644 index 00000000..65dddc8d --- /dev/null +++ b/src/Db/Exceptions/InvalidBindParameter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidBindParameter extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidCheckExpression.php b/src/Db/Exceptions/InvalidCheckExpression.php new file mode 100644 index 00000000..46f1e15a --- /dev/null +++ b/src/Db/Exceptions/InvalidCheckExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCheckExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidGenerationExpression.php b/src/Db/Exceptions/InvalidGenerationExpression.php new file mode 100644 index 00000000..368aa9d2 --- /dev/null +++ b/src/Db/Exceptions/InvalidGenerationExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidGenerationExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidGroupByExpression.php b/src/Db/Exceptions/InvalidGroupByExpression.php new file mode 100644 index 00000000..d703d890 --- /dev/null +++ b/src/Db/Exceptions/InvalidGroupByExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidGroupByExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidIndexColumns.php b/src/Db/Exceptions/InvalidIndexColumns.php new file mode 100644 index 00000000..003f81a5 --- /dev/null +++ b/src/Db/Exceptions/InvalidIndexColumns.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidIndexColumns extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidIndexDirections.php b/src/Db/Exceptions/InvalidIndexDirections.php new file mode 100644 index 00000000..1cd00987 --- /dev/null +++ b/src/Db/Exceptions/InvalidIndexDirections.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidIndexDirections extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidIndexWhere.php b/src/Db/Exceptions/InvalidIndexWhere.php new file mode 100644 index 00000000..149731ba --- /dev/null +++ b/src/Db/Exceptions/InvalidIndexWhere.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidIndexWhere extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidListExpression.php b/src/Db/Exceptions/InvalidListExpression.php new file mode 100644 index 00000000..33744914 --- /dev/null +++ b/src/Db/Exceptions/InvalidListExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidListExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidOrderByExpression.php b/src/Db/Exceptions/InvalidOrderByExpression.php new file mode 100644 index 00000000..f08e3ddb --- /dev/null +++ b/src/Db/Exceptions/InvalidOrderByExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidOrderByExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidSqlExpression.php b/src/Db/Exceptions/InvalidSqlExpression.php new file mode 100644 index 00000000..b01a8cd9 --- /dev/null +++ b/src/Db/Exceptions/InvalidSqlExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidSqlExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidSqlExpressionType.php b/src/Db/Exceptions/InvalidSqlExpressionType.php new file mode 100644 index 00000000..d55d2411 --- /dev/null +++ b/src/Db/Exceptions/InvalidSqlExpressionType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidSqlExpressionType extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Db/Exceptions/InvalidUnaryExpression.php b/src/Db/Exceptions/InvalidUnaryExpression.php new file mode 100644 index 00000000..a4317001 --- /dev/null +++ b/src/Db/Exceptions/InvalidUnaryExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidUnaryExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/InvalidWhereConditions.php b/src/Db/Exceptions/InvalidWhereConditions.php new file mode 100644 index 00000000..5ee619a7 --- /dev/null +++ b/src/Db/Exceptions/InvalidWhereConditions.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidWhereConditions extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/MatchedParameterNotFound.php b/src/Db/Exceptions/MatchedParameterNotFound.php new file mode 100644 index 00000000..65fa7fef --- /dev/null +++ b/src/Db/Exceptions/MatchedParameterNotFound.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MatchedParameterNotFound extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/MaterializedViewsNotSupported.php b/src/Db/Exceptions/MaterializedViewsNotSupported.php new file mode 100644 index 00000000..6e83320e --- /dev/null +++ b/src/Db/Exceptions/MaterializedViewsNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MaterializedViewsNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/MissingDefinitionKey.php b/src/Db/Exceptions/MissingDefinitionKey.php new file mode 100644 index 00000000..f3494aae --- /dev/null +++ b/src/Db/Exceptions/MissingDefinitionKey.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingDefinitionKey extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Db/Exceptions/MissingForeignKeyChecks.php b/src/Db/Exceptions/MissingForeignKeyChecks.php new file mode 100644 index 00000000..21030619 --- /dev/null +++ b/src/Db/Exceptions/MissingForeignKeyChecks.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingForeignKeyChecks extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/MissingSqliteDatabase.php b/src/Db/Exceptions/MissingSqliteDatabase.php new file mode 100644 index 00000000..ed00563a --- /dev/null +++ b/src/Db/Exceptions/MissingSqliteDatabase.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingSqliteDatabase extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/MysqlOnConflictNotSupported.php b/src/Db/Exceptions/MysqlOnConflictNotSupported.php new file mode 100644 index 00000000..588cb356 --- /dev/null +++ b/src/Db/Exceptions/MysqlOnConflictNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MysqlOnConflictNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/NestedTransactionChangeBlocked.php b/src/Db/Exceptions/NestedTransactionChangeBlocked.php new file mode 100644 index 00000000..da00f388 --- /dev/null +++ b/src/Db/Exceptions/NestedTransactionChangeBlocked.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NestedTransactionChangeBlocked extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/NoActiveTransaction.php b/src/Db/Exceptions/NoActiveTransaction.php new file mode 100644 index 00000000..acc1f5a7 --- /dev/null +++ b/src/Db/Exceptions/NoActiveTransaction.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoActiveTransaction extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ReferencedColumnCountMismatch.php b/src/Db/Exceptions/ReferencedColumnCountMismatch.php new file mode 100644 index 00000000..cc1902e5 --- /dev/null +++ b/src/Db/Exceptions/ReferencedColumnCountMismatch.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReferencedColumnCountMismatch extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ReferencedColumnsRequired.php b/src/Db/Exceptions/ReferencedColumnsRequired.php new file mode 100644 index 00000000..22e60c3f --- /dev/null +++ b/src/Db/Exceptions/ReferencedColumnsRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReferencedColumnsRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ReferencedTableRequired.php b/src/Db/Exceptions/ReferencedTableRequired.php new file mode 100644 index 00000000..dd9ced9d --- /dev/null +++ b/src/Db/Exceptions/ReferencedTableRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReferencedTableRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ReturningNotSupported.php b/src/Db/Exceptions/ReturningNotSupported.php new file mode 100644 index 00000000..89e4941d --- /dev/null +++ b/src/Db/Exceptions/ReturningNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReturningNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/ReturningRequiresColumn.php b/src/Db/Exceptions/ReturningRequiresColumn.php new file mode 100644 index 00000000..b8e2f066 --- /dev/null +++ b/src/Db/Exceptions/ReturningRequiresColumn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReturningRequiresColumn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SavepointsNotSupported.php b/src/Db/Exceptions/SavepointsNotSupported.php new file mode 100644 index 00000000..adc2aaa0 --- /dev/null +++ b/src/Db/Exceptions/SavepointsNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SavepointsNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteAlterCheckNotSupported.php b/src/Db/Exceptions/SqliteAlterCheckNotSupported.php new file mode 100644 index 00000000..17ecb505 --- /dev/null +++ b/src/Db/Exceptions/SqliteAlterCheckNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteAlterCheckNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteAlterColumnNotSupported.php b/src/Db/Exceptions/SqliteAlterColumnNotSupported.php new file mode 100644 index 00000000..94e04228 --- /dev/null +++ b/src/Db/Exceptions/SqliteAlterColumnNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteAlterColumnNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteAlterForeignKeyNotSupported.php b/src/Db/Exceptions/SqliteAlterForeignKeyNotSupported.php new file mode 100644 index 00000000..98fef4f0 --- /dev/null +++ b/src/Db/Exceptions/SqliteAlterForeignKeyNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteAlterForeignKeyNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteAlterPrimaryKeyNotSupported.php b/src/Db/Exceptions/SqliteAlterPrimaryKeyNotSupported.php new file mode 100644 index 00000000..cbc631bf --- /dev/null +++ b/src/Db/Exceptions/SqliteAlterPrimaryKeyNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteAlterPrimaryKeyNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteDropCheckNotSupported.php b/src/Db/Exceptions/SqliteDropCheckNotSupported.php new file mode 100644 index 00000000..616cd882 --- /dev/null +++ b/src/Db/Exceptions/SqliteDropCheckNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteDropCheckNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteDropForeignKeyNotSupported.php b/src/Db/Exceptions/SqliteDropForeignKeyNotSupported.php new file mode 100644 index 00000000..3bb6e51e --- /dev/null +++ b/src/Db/Exceptions/SqliteDropForeignKeyNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteDropForeignKeyNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/SqliteDropPrimaryKeyNotSupported.php b/src/Db/Exceptions/SqliteDropPrimaryKeyNotSupported.php new file mode 100644 index 00000000..f232d79a --- /dev/null +++ b/src/Db/Exceptions/SqliteDropPrimaryKeyNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SqliteDropPrimaryKeyNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/TableMustHaveColumn.php b/src/Db/Exceptions/TableMustHaveColumn.php new file mode 100644 index 00000000..ffdc4d57 --- /dev/null +++ b/src/Db/Exceptions/TableMustHaveColumn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TableMustHaveColumn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Exceptions/UnrecognizedDataType.php b/src/Db/Exceptions/UnrecognizedDataType.php new file mode 100644 index 00000000..fa77ba93 --- /dev/null +++ b/src/Db/Exceptions/UnrecognizedDataType.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnrecognizedDataType extends Exception +{ + /** + * @param string $dialect + * @param string $column + */ + public function __construct(string $dialect, string $column) + { + } +} diff --git a/src/Db/Exceptions/UpdateFieldCountMismatch.php b/src/Db/Exceptions/UpdateFieldCountMismatch.php new file mode 100644 index 00000000..adc2fd49 --- /dev/null +++ b/src/Db/Exceptions/UpdateFieldCountMismatch.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Db\Exceptions; + +use Phalcon\Db\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UpdateFieldCountMismatch extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Db/Index.php b/src/Db/Index.php index 18f66055..c9373df8 100644 --- a/src/Db/Index.php +++ b/src/Db/Index.php @@ -9,6 +9,10 @@ */ namespace Phalcon\Db; +use Phalcon\Db\Exceptions\InvalidIndexColumns; +use Phalcon\Db\Exceptions\InvalidIndexDirections; +use Phalcon\Db\Exceptions\InvalidIndexWhere; + /** * Allows to define indexes to be used on tables. Indexes are a common way * to enhance database performance. An index allows the database server to find diff --git a/src/Db/Profiler.php b/src/Db/Profiler.php index 1f9fdf0a..fee291c5 100644 --- a/src/Db/Profiler.php +++ b/src/Db/Profiler.php @@ -77,6 +77,15 @@ class Profiler */ protected $allProfiles; + /** + * Maximum number of profiles to retain. 0 (default) keeps the + * original unbounded behavior; a positive value drops the oldest + * profile FIFO before a new one is appended. + * + * @var int + */ + protected $maxProfiles = 0; + /** * Total time spent by all profiles to complete in nanoseconds * @@ -93,6 +102,16 @@ public function getLastProfile(): Item { } + /** + * Returns the configured maximum number of retained profiles + * (0 = unlimited) + * + * @return int + */ + public function getMaxProfiles(): int + { + } + /** * Returns the total number of SQL statements processed * @@ -141,9 +160,20 @@ public function getProfiles(): array /** * Resets the profiler, cleaning up all the profiles * - * @return Profiler + * @return static + */ + public function reset(): static + { + } + + /** + * Sets the maximum number of retained profiles. 0 disables the cap + * (the default; preserves the original unbounded behavior). + * + * @param int $maxProfiles + * @return static */ - public function reset(): Profiler + public function setMaxProfiles(int $maxProfiles): static { } @@ -153,18 +183,18 @@ public function reset(): Profiler * @param string $sqlStatement * @param array $sqlVariables * @param array $sqlBindTypes - * @return Profiler + * @return static */ - public function startProfile(string $sqlStatement, array $sqlVariables = [], array $sqlBindTypes = []): Profiler + public function startProfile(string $sqlStatement, array $sqlVariables = [], array $sqlBindTypes = []): static { } /** * Stops the active profile * - * @return Profiler + * @return static */ - public function stopProfile(): Profiler + public function stopProfile(): static { } } diff --git a/src/Db/Profiler/Item.php b/src/Db/Profiler/Item.php index fb1c929c..c7b177f8 100644 --- a/src/Db/Profiler/Item.php +++ b/src/Db/Profiler/Item.php @@ -125,9 +125,9 @@ public function getTotalElapsedSeconds(): float * Return the timestamp when the profile ended * * @param double $finalTime - * @return Item + * @return static */ - public function setFinalTime(float $finalTime): Item + public function setFinalTime(float $finalTime): static { } @@ -135,9 +135,9 @@ public function setFinalTime(float $finalTime): Item * Return the timestamp when the profile started * * @param double $initialTime - * @return Item + * @return static */ - public function setInitialTime(float $initialTime): Item + public function setInitialTime(float $initialTime): static { } @@ -145,9 +145,9 @@ public function setInitialTime(float $initialTime): Item * Return the SQL bind types related to the profile * * @param array $sqlBindTypes - * @return Item + * @return static */ - public function setSqlBindTypes(array $sqlBindTypes): Item + public function setSqlBindTypes(array $sqlBindTypes): static { } @@ -155,9 +155,9 @@ public function setSqlBindTypes(array $sqlBindTypes): Item * Return the SQL statement related to the profile * * @param string $sqlStatement - * @return Item + * @return static */ - public function setSqlStatement(string $sqlStatement): Item + public function setSqlStatement(string $sqlStatement): static { } @@ -165,9 +165,9 @@ public function setSqlStatement(string $sqlStatement): Item * Return the SQL variables related to the profile * * @param array $sqlVariables - * @return Item + * @return static */ - public function setSqlVariables(array $sqlVariables): Item + public function setSqlVariables(array $sqlVariables): static { } } diff --git a/src/Db/Reference.php b/src/Db/Reference.php index aef99144..2a7b832a 100644 --- a/src/Db/Reference.php +++ b/src/Db/Reference.php @@ -9,6 +9,11 @@ */ namespace Phalcon\Db; +use Phalcon\Db\Exceptions\ForeignKeyColumnsRequired; +use Phalcon\Db\Exceptions\ReferencedColumnCountMismatch; +use Phalcon\Db\Exceptions\ReferencedColumnsRequired; +use Phalcon\Db\Exceptions\ReferencedTableRequired; + /** * Allows to define reference constraints on tables * diff --git a/src/Db/Result/PdoResult.php b/src/Db/Result/PdoResult.php index c5bb5032..68e25da7 100644 --- a/src/Db/Result/PdoResult.php +++ b/src/Db/Result/PdoResult.php @@ -139,11 +139,11 @@ public function execute(): bool * } * ``` * - * @param int $fetchStyle + * @param int|null $fetchStyle * @param int $cursorOrientation * @param int $cursorOffset */ - public function fetch(int $fetchStyle = null, int $cursorOrientation = Enum::FETCH_ORI_NEXT, int $cursorOffset = 0) + public function fetch(?int $fetchStyle = null, int $cursorOrientation = Enum::FETCH_ORI_NEXT, int $cursorOffset = 0) { } diff --git a/src/Di/Di.php b/src/Di/Di.php index 7c73e6da..51964db7 100644 --- a/src/Di/Di.php +++ b/src/Di/Di.php @@ -9,18 +9,22 @@ */ namespace Phalcon\Di; -use Phalcon\Di\Service; -use Phalcon\Di\DiInterface; -use Phalcon\Di\Exception; -use Phalcon\Di\Exception\ServiceResolutionException; use Phalcon\Config\Adapter\Php; use Phalcon\Config\Adapter\Yaml; use Phalcon\Config\ConfigInterface; -use Phalcon\Di\ServiceInterface; -use Phalcon\Events\ManagerInterface; +use Phalcon\Di\DiInterface; +use Phalcon\Di\Exception; +use Phalcon\Di\Exception\ServiceResolutionException; +use Phalcon\Di\Exceptions\AliasAlreadyInUse; +use Phalcon\Di\Exceptions\AliasNameMustBeString; +use Phalcon\Di\Exceptions\CircularAliasReference; +use Phalcon\Di\Exceptions\ServiceCannotBeResolved; use Phalcon\Di\InitializationAwareInterface; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Di\Service; +use Phalcon\Di\ServiceInterface; use Phalcon\Di\ServiceProviderInterface; +use Phalcon\Events\ManagerInterface; /** * Phalcon\Di\Di is a component that implements Dependency Injection/Service @@ -292,10 +296,10 @@ public function loadFromPhp(string $filePath): void * * @link https://docs.phalcon.io/latest/di/ * @param string $filePath - * @param array $callbacks + * @param array|null $callbacks * @return void */ - public function loadFromYaml(string $filePath, array $callbacks = null): void + public function loadFromYaml(string $filePath, ?array $callbacks = null): void { } @@ -452,7 +456,7 @@ public function set(string $name, $definition, bool $shared = false): ServiceInt * @return Di * @throws Exception */ - public function setAlias(string $name, $aliases): Di + public function setAlias(string $name, $aliases): self { } diff --git a/src/Di/Exceptions/AliasAlreadyInUse.php b/src/Di/Exceptions/AliasAlreadyInUse.php new file mode 100644 index 00000000..6158a4cc --- /dev/null +++ b/src/Di/Exceptions/AliasAlreadyInUse.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AliasAlreadyInUse extends Exception +{ + /** + * @param string $alias + */ + public function __construct(string $alias) + { + } +} diff --git a/src/Di/Exceptions/AliasNameMustBeString.php b/src/Di/Exceptions/AliasNameMustBeString.php new file mode 100644 index 00000000..b8088afd --- /dev/null +++ b/src/Di/Exceptions/AliasNameMustBeString.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AliasNameMustBeString extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/ArgumentTypeRequired.php b/src/Di/Exceptions/ArgumentTypeRequired.php new file mode 100644 index 00000000..dbf4d5d9 --- /dev/null +++ b/src/Di/Exceptions/ArgumentTypeRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ArgumentTypeRequired extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/CallArgumentsMustBeArray.php b/src/Di/Exceptions/CallArgumentsMustBeArray.php new file mode 100644 index 00000000..2500a4f5 --- /dev/null +++ b/src/Di/Exceptions/CallArgumentsMustBeArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CallArgumentsMustBeArray extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/CircularAliasReference.php b/src/Di/Exceptions/CircularAliasReference.php new file mode 100644 index 00000000..afa9ca89 --- /dev/null +++ b/src/Di/Exceptions/CircularAliasReference.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CircularAliasReference extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Di/Exceptions/ContainerRequired.php b/src/Di/Exceptions/ContainerRequired.php new file mode 100644 index 00000000..9335a909 --- /dev/null +++ b/src/Di/Exceptions/ContainerRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ContainerRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/DefinitionMustBeArrayForRead.php b/src/Di/Exceptions/DefinitionMustBeArrayForRead.php new file mode 100644 index 00000000..411cc512 --- /dev/null +++ b/src/Di/Exceptions/DefinitionMustBeArrayForRead.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DefinitionMustBeArrayForRead extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/DefinitionMustBeArrayForUpdate.php b/src/Di/Exceptions/DefinitionMustBeArrayForUpdate.php new file mode 100644 index 00000000..262e7933 --- /dev/null +++ b/src/Di/Exceptions/DefinitionMustBeArrayForUpdate.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DefinitionMustBeArrayForUpdate extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/MethodCallMustBeArray.php b/src/Di/Exceptions/MethodCallMustBeArray.php new file mode 100644 index 00000000..123bc630 --- /dev/null +++ b/src/Di/Exceptions/MethodCallMustBeArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MethodCallMustBeArray extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/MethodNameRequired.php b/src/Di/Exceptions/MethodNameRequired.php new file mode 100644 index 00000000..ec2241a0 --- /dev/null +++ b/src/Di/Exceptions/MethodNameRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MethodNameRequired extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/MissingClassNameParameter.php b/src/Di/Exceptions/MissingClassNameParameter.php new file mode 100644 index 00000000..6dcc413f --- /dev/null +++ b/src/Di/Exceptions/MissingClassNameParameter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingClassNameParameter extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/MissingParameterKey.php b/src/Di/Exceptions/MissingParameterKey.php new file mode 100644 index 00000000..2d74052d --- /dev/null +++ b/src/Di/Exceptions/MissingParameterKey.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingParameterKey extends Exception +{ + /** + * @param string $key + * @param int $position + */ + public function __construct(string $key, int $position) + { + } +} diff --git a/src/Di/Exceptions/PropertyInjectionRequiresInstance.php b/src/Di/Exceptions/PropertyInjectionRequiresInstance.php new file mode 100644 index 00000000..59e1f65f --- /dev/null +++ b/src/Di/Exceptions/PropertyInjectionRequiresInstance.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PropertyInjectionRequiresInstance extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/PropertyMustBeArray.php b/src/Di/Exceptions/PropertyMustBeArray.php new file mode 100644 index 00000000..6fbaf54e --- /dev/null +++ b/src/Di/Exceptions/PropertyMustBeArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PropertyMustBeArray extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/PropertyNameRequired.php b/src/Di/Exceptions/PropertyNameRequired.php new file mode 100644 index 00000000..f77fcb4a --- /dev/null +++ b/src/Di/Exceptions/PropertyNameRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PropertyNameRequired extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/PropertyValueRequired.php b/src/Di/Exceptions/PropertyValueRequired.php new file mode 100644 index 00000000..eb91ba0c --- /dev/null +++ b/src/Di/Exceptions/PropertyValueRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PropertyValueRequired extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Exceptions/ServiceCannotBeResolved.php b/src/Di/Exceptions/ServiceCannotBeResolved.php new file mode 100644 index 00000000..c49816de --- /dev/null +++ b/src/Di/Exceptions/ServiceCannotBeResolved.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ServiceCannotBeResolved extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Di/Exceptions/SetterInjectionRequiresInstance.php b/src/Di/Exceptions/SetterInjectionRequiresInstance.php new file mode 100644 index 00000000..0b246944 --- /dev/null +++ b/src/Di/Exceptions/SetterInjectionRequiresInstance.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SetterInjectionRequiresInstance extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/SetterParametersMustBeArray.php b/src/Di/Exceptions/SetterParametersMustBeArray.php new file mode 100644 index 00000000..973c650d --- /dev/null +++ b/src/Di/Exceptions/SetterParametersMustBeArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SetterParametersMustBeArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Di/Exceptions/UnknownServiceType.php b/src/Di/Exceptions/UnknownServiceType.php new file mode 100644 index 00000000..92643e73 --- /dev/null +++ b/src/Di/Exceptions/UnknownServiceType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Di\Exceptions; + +use Phalcon\Di\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownServiceType extends Exception +{ + /** + * @param int $position + */ + public function __construct(int $position) + { + } +} diff --git a/src/Di/Injectable.php b/src/Di/Injectable.php index 5a4450fe..015a1d98 100644 --- a/src/Di/Injectable.php +++ b/src/Di/Injectable.php @@ -9,9 +9,10 @@ */ namespace Phalcon\Di; -use stdClass; use Phalcon\Di\Di; +use Phalcon\Di\Exceptions\ContainerRequired; use Phalcon\Session\BagInterface; +use stdClass; /** * This class allows to access services in the services container by just only diff --git a/src/Di/Service.php b/src/Di/Service.php index 4b476eb2..fa5cf576 100644 --- a/src/Di/Service.php +++ b/src/Di/Service.php @@ -11,6 +11,8 @@ use Closure; use Phalcon\Di\Exception\ServiceResolutionException; +use Phalcon\Di\Exceptions\DefinitionMustBeArrayForRead; +use Phalcon\Di\Exceptions\DefinitionMustBeArrayForUpdate; use Phalcon\Di\Service\Builder; /** @@ -98,10 +100,10 @@ public function isShared(): bool * Resolves the service * * @param array $parameters - * @param DiInterface $container + * @param DiInterface|null $container * @return mixed */ - public function resolve($parameters = null, DiInterface $container = null): mixed + public function resolve($parameters = null, ?DiInterface $container = null): mixed { } diff --git a/src/Di/Service/Builder.php b/src/Di/Service/Builder.php index 98c639e8..0185793e 100644 --- a/src/Di/Service/Builder.php +++ b/src/Di/Service/Builder.php @@ -11,6 +11,19 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\Exception; +use Phalcon\Di\Exceptions\ArgumentTypeRequired; +use Phalcon\Di\Exceptions\CallArgumentsMustBeArray; +use Phalcon\Di\Exceptions\MethodCallMustBeArray; +use Phalcon\Di\Exceptions\MethodNameRequired; +use Phalcon\Di\Exceptions\MissingClassNameParameter; +use Phalcon\Di\Exceptions\MissingParameterKey; +use Phalcon\Di\Exceptions\PropertyInjectionRequiresInstance; +use Phalcon\Di\Exceptions\PropertyMustBeArray; +use Phalcon\Di\Exceptions\PropertyNameRequired; +use Phalcon\Di\Exceptions\PropertyValueRequired; +use Phalcon\Di\Exceptions\SetterInjectionRequiresInstance; +use Phalcon\Di\Exceptions\SetterParametersMustBeArray; +use Phalcon\Di\Exceptions\UnknownServiceType; /** * Phalcon\Di\Service\Builder diff --git a/src/Di/ServiceInterface.php b/src/Di/ServiceInterface.php index caae26ab..697e26e4 100644 --- a/src/Di/ServiceInterface.php +++ b/src/Di/ServiceInterface.php @@ -47,10 +47,10 @@ public function isShared(): bool; * Resolves the service * * @param array $parameters - * @param DiInterface $container + * @param DiInterface|null $container * @return mixed */ - public function resolve($parameters = null, DiInterface $container = null): mixed; + public function resolve($parameters = null, ?DiInterface $container = null): mixed; /** * Set the service definition diff --git a/src/Dispatcher/AbstractDispatcher.php b/src/Dispatcher/AbstractDispatcher.php index ad5a4658..7685f7de 100644 --- a/src/Dispatcher/AbstractDispatcher.php +++ b/src/Dispatcher/AbstractDispatcher.php @@ -13,6 +13,7 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; use Phalcon\Dispatcher\Exception as PhalconException; +use Phalcon\Dispatcher\Exceptions\ForwardInInitializeForbidden; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface; use Phalcon\Filter\FilterInterface; @@ -72,6 +73,11 @@ abstract class AbstractDispatcher extends AbstractInjectionAware implements \Pha */ protected $handlerHashes = []; + /** + * @var array + */ + protected $handlerHookCache = []; + /** * @var string */ @@ -525,10 +531,10 @@ public function setModelBinder(\Phalcon\Mvc\Model\BinderInterface $modelBinder, /** * Sets the module where the controller is (only informative) * - * @param string $moduleName + * @param string|null $moduleName * @return void */ - public function setModuleName(string $moduleName = null): void + public function setModuleName(?string $moduleName = null): void { } diff --git a/src/Dispatcher/DispatcherInterface.php b/src/Dispatcher/DispatcherInterface.php index ec96fabc..0fa2b7b5 100644 --- a/src/Dispatcher/DispatcherInterface.php +++ b/src/Dispatcher/DispatcherInterface.php @@ -148,10 +148,10 @@ public function setHandlerSuffix(string $handlerSuffix): void; /** * Sets the module name which the application belongs to * - * @param string $moduleName + * @param string|null $moduleName * @return void */ - public function setModuleName(string $moduleName = null): void; + public function setModuleName(?string $moduleName = null): void; /** * Sets the namespace which the controller belongs to diff --git a/src/Dispatcher/Exceptions/ForwardInInitializeForbidden.php b/src/Dispatcher/Exceptions/ForwardInInitializeForbidden.php new file mode 100644 index 00000000..0c243816 --- /dev/null +++ b/src/Dispatcher/Exceptions/ForwardInInitializeForbidden.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Dispatcher\Exceptions; + +use Phalcon\Dispatcher\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the + * LICENSE.txt file that was distributed with this source code. + */ +class ForwardInInitializeForbidden extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt.php b/src/Encryption/Crypt.php index 8f7f8504..45891915 100644 --- a/src/Encryption/Crypt.php +++ b/src/Encryption/Crypt.php @@ -10,8 +10,18 @@ namespace Phalcon\Encryption; use Phalcon\Encryption\Crypt\CryptInterface; +use Phalcon\Encryption\Crypt\Exception\DecryptionFailed; +use Phalcon\Encryption\Crypt\Exception\EmptyDecryptionKey; +use Phalcon\Encryption\Crypt\Exception\EmptyEncryptionKey; +use Phalcon\Encryption\Crypt\Exception\EncryptionFailed; use Phalcon\Encryption\Crypt\Exception\Exception; +use Phalcon\Encryption\Crypt\Exception\InvalidPaddingSize; +use Phalcon\Encryption\Crypt\Exception\IvLengthCalculationFailed; use Phalcon\Encryption\Crypt\Exception\Mismatch; +use Phalcon\Encryption\Crypt\Exception\MissingAuthData; +use Phalcon\Encryption\Crypt\Exception\MissingOpensslExtension; +use Phalcon\Encryption\Crypt\Exception\RandomBytesGenerationFailed; +use Phalcon\Encryption\Crypt\Exception\UnsupportedAlgorithm; use Phalcon\Encryption\Crypt\PadFactory; /** @@ -116,6 +126,16 @@ class Crypt implements \Phalcon\Encryption\Crypt\CryptInterface */ protected $hashAlgorithm = self::DEFAULT_ALGORITHM; + /** + * Memoized `strlen(hash($algo, "", true))` results, keyed by + * algorithm name. The hash output length is deterministic for a + * given algorithm, so this collapses the per-decrypt strlen+hash + * call to a single hash lookup after warm-up. + * + * @var array + */ + protected $hashLengthCache = []; + /** * The cipher iv length. * @@ -154,7 +174,7 @@ class Crypt implements \Phalcon\Encryption\Crypt\CryptInterface * * @throws Exception */ - public function __construct(string $cipher = self::DEFAULT_CIPHER, bool $useSigning = true, \Phalcon\Encryption\Crypt\PadFactory $padFactory = null) + public function __construct(string $cipher = self::DEFAULT_CIPHER, bool $useSigning = true, ?\Phalcon\Encryption\Crypt\PadFactory $padFactory = null) { } @@ -175,7 +195,7 @@ public function __construct(string $cipher = self::DEFAULT_CIPHER, bool $useSign * @throws Exception * @throws Mismatch */ - public function decrypt(string $input, string $key = null): string + public function decrypt(string $input, ?string $key = null): string { } @@ -190,7 +210,7 @@ public function decrypt(string $input, string $key = null): string * @throws Exception * @throws Mismatch */ - public function decryptBase64(string $input, string $key = null, bool $safe = false): string + public function decryptBase64(string $input, ?string $key = null, bool $safe = false): string { } @@ -210,7 +230,7 @@ public function decryptBase64(string $input, string $key = null, bool $safe = fa * @return string * @throws Exception */ - public function encrypt(string $input, string $key = null): string + public function encrypt(string $input, ?string $key = null): string { } @@ -224,13 +244,14 @@ public function encrypt(string $input, string $key = null): string * @return string * @throws Exception */ - public function encryptBase64(string $input, string $key = null, bool $safe = false): string + public function encryptBase64(string $input, ?string $key = null, bool $safe = false): string { } /** * Returns a list of available ciphers. * + * @phpstan-return array * @return array */ public function getAvailableCiphers(): array @@ -315,27 +336,27 @@ public function isValidDecryptLength(string $input): bool /** * @param string $data * - * @return CryptInterface + * @return static */ - public function setAuthData(string $data): CryptInterface + public function setAuthData(string $data): static { } /** * @param string $tag * - * @return CryptInterface + * @return static */ - public function setAuthTag(string $tag): CryptInterface + public function setAuthTag(string $tag): static { } /** * @param int $length * - * @return CryptInterface + * @return static */ - public function setAuthTagLength(int $length): CryptInterface + public function setAuthTagLength(int $length): static { } @@ -344,10 +365,10 @@ public function setAuthTagLength(int $length): CryptInterface * * @param string $cipher * - * @return CryptInterface + * @return static * @throws Exception */ - public function setCipher(string $cipher): CryptInterface + public function setCipher(string $cipher): static { } @@ -368,9 +389,9 @@ public function setCipher(string $cipher): CryptInterface * * @param string $key * - * @return CryptInterface + * @return static */ - public function setKey(string $key): CryptInterface + public function setKey(string $key): static { } @@ -379,10 +400,10 @@ public function setKey(string $key): CryptInterface * * @param string $hashAlgorithm * - * @return CryptInterface + * @return static * @throws Exception */ - public function setHashAlgorithm(string $hashAlgorithm): CryptInterface + public function setHashAlgorithm(string $hashAlgorithm): static { } @@ -391,9 +412,9 @@ public function setHashAlgorithm(string $hashAlgorithm): CryptInterface * * @param int $scheme * - * @return CryptInterface + * @return static */ - public function setPadding(int $scheme): CryptInterface + public function setPadding(int $scheme): static { } @@ -402,9 +423,9 @@ public function setPadding(int $scheme): CryptInterface * * @param bool $useSigning * - * @return CryptInterface + * @return static */ - public function useSigning(bool $useSigning): CryptInterface + public function useSigning(bool $useSigning): static { } @@ -507,10 +528,10 @@ protected function encryptGcmCcm(string $mode, string $padded, string $encryptKe /** * Initialize available cipher algorithms. * - * @return Crypt + * @return static * @throws Exception */ - protected function initializeAvailableCiphers(): Crypt + protected function initializeAvailableCiphers(): static { } diff --git a/src/Encryption/Crypt/CryptInterface.php b/src/Encryption/Crypt/CryptInterface.php index beddc4fa..7dab73d9 100644 --- a/src/Encryption/Crypt/CryptInterface.php +++ b/src/Encryption/Crypt/CryptInterface.php @@ -22,7 +22,7 @@ interface CryptInterface * * @return string */ - public function decrypt(string $input, string $key = null): string; + public function decrypt(string $input, ?string $key = null): string; /** * Decrypt a text that is coded as a base64 string @@ -32,7 +32,7 @@ public function decrypt(string $input, string $key = null): string; * * @return string */ - public function decryptBase64(string $input, string $key = null): string; + public function decryptBase64(string $input, ?string $key = null): string; /** * Encrypts a text @@ -42,7 +42,7 @@ public function decryptBase64(string $input, string $key = null): string; * * @return string */ - public function encrypt(string $input, string $key = null): string; + public function encrypt(string $input, ?string $key = null): string; /** * Encrypts a text returning the result as a base64 string @@ -52,14 +52,14 @@ public function encrypt(string $input, string $key = null): string; * * @return string */ - public function encryptBase64(string $input, string $key = null): string; + public function encryptBase64(string $input, ?string $key = null): string; /** - * Returns a list of available cyphers + * Returns authentication data * - * @return array + * @return string */ - public function getAvailableCiphers(): array; + public function getAuthData(): string; /** * Returns the authentication tag @@ -69,18 +69,19 @@ public function getAvailableCiphers(): array; public function getAuthTag(): string; /** - * Returns authentication data + * Returns the authentication tag length * - * @return string + * @return int */ - public function getAuthData(): string; + public function getAuthTagLength(): int; /** - * Returns the authentication tag length + * Returns a list of available cyphers * - * @return int + * @phpstan-return array + * @return array */ - public function getAuthTagLength(): int; + public function getAvailableCiphers(): array; /** * Returns the current cipher @@ -97,22 +98,22 @@ public function getCipher(): string; public function getKey(): string; /** - * Sets the authentication tag + * Sets authentication data * - * @param string $tag + * @param string $data * * @return CryptInterface */ - public function setAuthTag(string $tag): CryptInterface; + public function setAuthData(string $data): CryptInterface; /** - * Sets authentication data + * Sets the authentication tag * - * @param string $data + * @param string $tag * * @return CryptInterface */ - public function setAuthData(string $data): CryptInterface; + public function setAuthTag(string $tag): CryptInterface; /** * Sets the authentication tag length diff --git a/src/Encryption/Crypt/Exception/DecryptionFailed.php b/src/Encryption/Crypt/Exception/DecryptionFailed.php new file mode 100644 index 00000000..362cef9a --- /dev/null +++ b/src/Encryption/Crypt/Exception/DecryptionFailed.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DecryptionFailed extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/EmptyDecryptionKey.php b/src/Encryption/Crypt/Exception/EmptyDecryptionKey.php new file mode 100644 index 00000000..1d904821 --- /dev/null +++ b/src/Encryption/Crypt/Exception/EmptyDecryptionKey.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EmptyDecryptionKey extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/EmptyEncryptionKey.php b/src/Encryption/Crypt/Exception/EmptyEncryptionKey.php new file mode 100644 index 00000000..9dd60193 --- /dev/null +++ b/src/Encryption/Crypt/Exception/EmptyEncryptionKey.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EmptyEncryptionKey extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/EncryptionFailed.php b/src/Encryption/Crypt/Exception/EncryptionFailed.php new file mode 100644 index 00000000..65bbfefe --- /dev/null +++ b/src/Encryption/Crypt/Exception/EncryptionFailed.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EncryptionFailed extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/InvalidPaddingSize.php b/src/Encryption/Crypt/Exception/InvalidPaddingSize.php new file mode 100644 index 00000000..0672834e --- /dev/null +++ b/src/Encryption/Crypt/Exception/InvalidPaddingSize.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidPaddingSize extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/IvLengthCalculationFailed.php b/src/Encryption/Crypt/Exception/IvLengthCalculationFailed.php new file mode 100644 index 00000000..fc8f7feb --- /dev/null +++ b/src/Encryption/Crypt/Exception/IvLengthCalculationFailed.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IvLengthCalculationFailed extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/MissingAuthData.php b/src/Encryption/Crypt/Exception/MissingAuthData.php new file mode 100644 index 00000000..f769e0f6 --- /dev/null +++ b/src/Encryption/Crypt/Exception/MissingAuthData.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingAuthData extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/MissingOpensslExtension.php b/src/Encryption/Crypt/Exception/MissingOpensslExtension.php new file mode 100644 index 00000000..81fe8f27 --- /dev/null +++ b/src/Encryption/Crypt/Exception/MissingOpensslExtension.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingOpensslExtension extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/RandomBytesGenerationFailed.php b/src/Encryption/Crypt/Exception/RandomBytesGenerationFailed.php new file mode 100644 index 00000000..acd85aa9 --- /dev/null +++ b/src/Encryption/Crypt/Exception/RandomBytesGenerationFailed.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RandomBytesGenerationFailed extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Crypt/Exception/UnsupportedAlgorithm.php b/src/Encryption/Crypt/Exception/UnsupportedAlgorithm.php new file mode 100644 index 00000000..ff7ce3e0 --- /dev/null +++ b/src/Encryption/Crypt/Exception/UnsupportedAlgorithm.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Crypt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnsupportedAlgorithm extends \Phalcon\Encryption\Crypt\Exception\Exception +{ + /** + * @param string $type + * @param string $cipher + */ + public function __construct(string $type, string $cipher) + { + } +} diff --git a/src/Encryption/Crypt/PadFactory.php b/src/Encryption/Crypt/PadFactory.php index 19a1e017..3f48e0ba 100644 --- a/src/Encryption/Crypt/PadFactory.php +++ b/src/Encryption/Crypt/PadFactory.php @@ -15,9 +15,7 @@ use Phalcon\Support\Helper\Arr\Get; /** - * Class PadFactory - * - * @package Phalcon\Crypt + * Factory for creating pad classes */ class PadFactory extends AbstractFactory { diff --git a/src/Encryption/Crypt/Padding/Iso10126.php b/src/Encryption/Crypt/Padding/Iso10126.php index 5736ddb5..726dce8b 100644 --- a/src/Encryption/Crypt/Padding/Iso10126.php +++ b/src/Encryption/Crypt/Padding/Iso10126.php @@ -17,11 +17,9 @@ class Iso10126 implements \Phalcon\Encryption\Crypt\Padding\PadInterface { /** - * @param string $input - * @param int $blockSize + * @param int $paddingSize * * @return string - * @param int $paddingSize */ public function pad(int $paddingSize): string { diff --git a/src/Encryption/Security.php b/src/Encryption/Security.php index 615056d3..a5913630 100644 --- a/src/Encryption/Security.php +++ b/src/Encryption/Security.php @@ -13,8 +13,9 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; use Phalcon\Http\RequestInterface; -use Phalcon\Encryption\Security\Random; use Phalcon\Encryption\Security\Exception; +use Phalcon\Encryption\Security\Exceptions\UnknownHashAlgorithm; +use Phalcon\Encryption\Security\Random; use Phalcon\Session\ManagerInterface as SessionInterface; /** @@ -167,7 +168,7 @@ class Security extends AbstractInjectionAware implements SecurityContract * @param SessionInterface|null $session * @param RequestInterface|null $request */ - public function __construct(\Phalcon\Session\ManagerInterface $session = null, \Phalcon\Http\RequestInterface $request = null) + public function __construct(?\Phalcon\Session\ManagerInterface $session = null, ?\Phalcon\Http\RequestInterface $request = null) { } @@ -195,7 +196,7 @@ public function checkHash(string $password, string $passwordHash, int $maxPassLe * * @return bool */ - public function checkToken(string $tokenKey = null, $tokenValue = null, bool $destroyIfValid = true): bool + public function checkToken(?string $tokenKey = null, $tokenValue = null, bool $destroyIfValid = true): bool { } @@ -209,17 +210,18 @@ public function checkToken(string $tokenKey = null, $tokenValue = null, bool $de * * @return string * @throws Exception + * @param string $algorithm */ - public function computeHmac(string $data, string $key, string $algo, bool $raw = false): string + public function computeHmac(string $data, string $key, string $algorithm, bool $raw = false): string { } /** * Removes the value of the CSRF token and key from session * - * @return Security + * @return static */ - public function destroyToken(): Security + public function destroyToken(): static { } @@ -351,9 +353,9 @@ public function isLegacyHash(string $passwordHash): bool * after a successful login or any other state change where rotating the * token is appropriate. * - * @return Security + * @return static */ - public function refreshToken(): Security + public function refreshToken(): static { } @@ -365,9 +367,9 @@ public function refreshToken(): Security * * @param bool $autoRefresh * - * @return Security + * @return static */ - public function setAutoRefresh(bool $autoRefresh): Security + public function setAutoRefresh(bool $autoRefresh): static { } @@ -376,9 +378,9 @@ public function setAutoRefresh(bool $autoRefresh): Security * * @param int $defaultHash * - * @return Security + * @return static */ - public function setDefaultHash(int $defaultHash): Security + public function setDefaultHash(int $defaultHash): static { } @@ -388,9 +390,9 @@ public function setDefaultHash(int $defaultHash): Security * * @param int $randomBytes * - * @return Security + * @return static */ - public function setRandomBytes(int $randomBytes): Security + public function setRandomBytes(int $randomBytes): static { } @@ -399,9 +401,9 @@ public function setRandomBytes(int $randomBytes): Security * * @param int $workFactor * - * @return Security + * @return static */ - public function setWorkFactor(int $workFactor): Security + public function setWorkFactor(int $workFactor): static { } @@ -454,7 +456,7 @@ private function processCost(array $options = []): int * * @return string|null */ - private function processTokenKey(string $tokenKey = null): string|null + private function processTokenKey(?string $tokenKey = null): string|null { } @@ -464,7 +466,7 @@ private function processTokenKey(string $tokenKey = null): string|null * * @return string|null */ - private function processUserToken(string $tokenKey, string $tokenValue = null): string|null + private function processUserToken(string $tokenKey, ?string $tokenValue = null): string|null { } } diff --git a/src/Encryption/Security/Exceptions/InvalidRandomInput.php b/src/Encryption/Security/Exceptions/InvalidRandomInput.php new file mode 100644 index 00000000..ed5b222c --- /dev/null +++ b/src/Encryption/Security/Exceptions/InvalidRandomInput.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\Exceptions; + +use Phalcon\Encryption\Security\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRandomInput extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/Exceptions/UnknownHashAlgorithm.php b/src/Encryption/Security/Exceptions/UnknownHashAlgorithm.php new file mode 100644 index 00000000..0cf87cf1 --- /dev/null +++ b/src/Encryption/Security/Exceptions/UnknownHashAlgorithm.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\Exceptions; + +use Phalcon\Encryption\Security\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownHashAlgorithm extends Exception +{ + /** + * @param string $algo + */ + public function __construct(string $algo) + { + } +} diff --git a/src/Encryption/Security/JWT/Builder.php b/src/Encryption/Security/JWT/Builder.php index 1bc108c9..1c29db2a 100644 --- a/src/Encryption/Security/JWT/Builder.php +++ b/src/Encryption/Security/JWT/Builder.php @@ -9,7 +9,12 @@ */ namespace Phalcon\Encryption\Security\JWT; +use Phalcon\Encryption\Security\JWT\Exceptions\EmptyPassphrase; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidAudience; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidExpirationTime; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidNotBefore; use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; +use Phalcon\Encryption\Security\JWT\Exceptions\WeakPassphrase; use Phalcon\Encryption\Security\JWT\Signer\SignerInterface; use Phalcon\Encryption\Security\JWT\Token\Enum; use Phalcon\Encryption\Security\JWT\Token\Item; @@ -20,14 +25,7 @@ use Phalcon\Support\Helper\Json\Encode; /** - * Builder - * - * The builder offers - * - * @property CollectionInterface $claims - * @property CollectionInterface $jose - * @property string $passphrase - * @property SignerInterface $signer + * JWT Builder * * @link https://tools.ietf.org/html/rfc7519 */ @@ -67,22 +65,15 @@ public function __construct(\Phalcon\Encryption\Security\JWT\Signer\SignerInterf { } - /** - * @return Builder - */ - public function init(): Builder - { - } - /** * Adds a custom claim * * @param string $name * @param mixed $value * - * @return Builder + * @return static */ - public function addClaim(string $name, $value): Builder + public function addClaim(string $name, $value): static { } @@ -92,9 +83,9 @@ public function addClaim(string $name, $value): Builder * @param string $name * @param mixed $value * - * @return Builder + * @return static */ - public function addHeader(string $name, $value): Builder + public function addHeader(string $name, $value): static { } @@ -161,6 +152,13 @@ public function getNotBefore(): int|null { } + /** + * @return string + */ + public function getPassphrase(): string + { + } + /** * @return string|null */ @@ -177,9 +175,9 @@ public function getToken(): Token } /** - * @return string + * @return static */ - public function getPassphrase(): string + public function init(): static { } @@ -198,10 +196,10 @@ public function getPassphrase(): string * * @param mixed $audience * - * @return Builder + * @return static * @throws ValidatorException */ - public function setAudience($audience): Builder + public function setAudience($audience): static { } @@ -210,9 +208,9 @@ public function setAudience($audience): Builder * * @param string $contentType * - * @return Builder + * @return static */ - public function setContentType(string $contentType): Builder + public function setContentType(string $contentType): static { } @@ -227,10 +225,10 @@ public function setContentType(string $contentType): Builder * * @param int $timestamp * - * @return Builder + * @return static * @throws ValidatorException */ - public function setExpirationTime(int $timestamp): Builder + public function setExpirationTime(int $timestamp): static { } @@ -244,11 +242,11 @@ public function setExpirationTime(int $timestamp): Builder * to prevent the JWT from being replayed. The "jti" value is a case- * sensitive string. Use of this claim is OPTIONAL. * - * @param string $id + * @param string $jwtId * - * @return Builder + * @return static */ - public function setId(string $id): Builder + public function setId(string $jwtId): static { } @@ -260,9 +258,9 @@ public function setId(string $id): Builder * * @param int $timestamp * - * @return Builder + * @return static */ - public function setIssuedAt(int $timestamp): Builder + public function setIssuedAt(int $timestamp): static { } @@ -274,9 +272,9 @@ public function setIssuedAt(int $timestamp): Builder * * @param string $issuer * - * @return Builder + * @return static */ - public function setIssuer(string $issuer): Builder + public function setIssuer(string $issuer): static { } @@ -291,10 +289,20 @@ public function setIssuer(string $issuer): Builder * * @param int $timestamp * - * @return Builder + * @return static + * @throws ValidatorException + */ + public function setNotBefore(int $timestamp): static + { + } + + /** + * @param string $passphrase + * + * @return static * @throws ValidatorException */ - public function setNotBefore(int $timestamp): Builder + public function setPassphrase(string $passphrase): static { } @@ -309,19 +317,9 @@ public function setNotBefore(int $timestamp): Builder * * @param string $subject * - * @return Builder - */ - public function setSubject(string $subject): Builder - { - } - - /** - * @param string $passphrase - * - * @return Builder - * @throws ValidatorException + * @return static */ - public function setPassphrase(string $passphrase): Builder + public function setSubject(string $subject): static { } diff --git a/src/Encryption/Security/JWT/Exceptions/EmptyPassphrase.php b/src/Encryption/Security/JWT/Exceptions/EmptyPassphrase.php new file mode 100644 index 00000000..32c8c4c3 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/EmptyPassphrase.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EmptyPassphrase extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidAudience.php b/src/Encryption/Security/JWT/Exceptions/InvalidAudience.php new file mode 100644 index 00000000..f102a5a9 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidAudience.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidAudience extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidAudienceType.php b/src/Encryption/Security/JWT/Exceptions/InvalidAudienceType.php new file mode 100644 index 00000000..95498c72 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidAudienceType.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidAudienceType extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidClaims.php b/src/Encryption/Security/JWT/Exceptions/InvalidClaims.php new file mode 100644 index 00000000..ecd38107 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidClaims.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidClaims extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidExpirationTime.php b/src/Encryption/Security/JWT/Exceptions/InvalidExpirationTime.php new file mode 100644 index 00000000..2aa0920e --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidExpirationTime.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidExpirationTime extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidHeader.php b/src/Encryption/Security/JWT/Exceptions/InvalidHeader.php new file mode 100644 index 00000000..6517c761 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidHeader.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidHeader extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/InvalidNotBefore.php b/src/Encryption/Security/JWT/Exceptions/InvalidNotBefore.php new file mode 100644 index 00000000..0fca3c41 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/InvalidNotBefore.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidNotBefore extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/MalformedJwtString.php b/src/Encryption/Security/JWT/Exceptions/MalformedJwtString.php new file mode 100644 index 00000000..afb1b16b --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/MalformedJwtString.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MalformedJwtString extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/MissingJwtTypHeader.php b/src/Encryption/Security/JWT/Exceptions/MissingJwtTypHeader.php new file mode 100644 index 00000000..597af654 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/MissingJwtTypHeader.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingJwtTypHeader extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/UnsupportedHmacAlgorithm.php b/src/Encryption/Security/JWT/Exceptions/UnsupportedHmacAlgorithm.php new file mode 100644 index 00000000..d950d040 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/UnsupportedHmacAlgorithm.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnsupportedHmacAlgorithm extends \Phalcon\Encryption\Security\JWT\Exceptions\UnsupportedAlgorithmException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Exceptions/WeakPassphrase.php b/src/Encryption/Security/JWT/Exceptions/WeakPassphrase.php new file mode 100644 index 00000000..a98eabd0 --- /dev/null +++ b/src/Encryption/Security/JWT/Exceptions/WeakPassphrase.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Encryption\Security\JWT\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class WeakPassphrase extends \Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException +{ + public function __construct() + { + } +} diff --git a/src/Encryption/Security/JWT/Signer/Hmac.php b/src/Encryption/Security/JWT/Signer/Hmac.php index 86444bcb..84c89840 100644 --- a/src/Encryption/Security/JWT/Signer/Hmac.php +++ b/src/Encryption/Security/JWT/Signer/Hmac.php @@ -10,6 +10,7 @@ namespace Phalcon\Encryption\Security\JWT\Signer; use Phalcon\Encryption\Security\JWT\Exceptions\UnsupportedAlgorithmException; +use Phalcon\Encryption\Security\JWT\Exceptions\UnsupportedHmacAlgorithm; /** * HMAC signing class diff --git a/src/Encryption/Security/JWT/Token/Enum.php b/src/Encryption/Security/JWT/Token/Enum.php index 4439ef77..5a98c384 100644 --- a/src/Encryption/Security/JWT/Token/Enum.php +++ b/src/Encryption/Security/JWT/Token/Enum.php @@ -16,29 +16,22 @@ */ class Enum { - /** - * Headers - * - * @var string - */ - const TYPE = 'typ'; - /** * @var string */ const ALGO = 'alg'; /** + * Claims + * * @var string */ - const CONTENT_TYPE = 'cty'; + const AUDIENCE = 'aud'; /** - * Claims - * * @var string */ - const AUDIENCE = 'aud'; + const CONTENT_TYPE = 'cty'; /** * @var string @@ -69,4 +62,11 @@ class Enum * @var string */ const SUBJECT = 'sub'; + + /** + * Headers + * + * @var string + */ + const TYPE = 'typ'; } diff --git a/src/Encryption/Security/JWT/Token/Parser.php b/src/Encryption/Security/JWT/Token/Parser.php index b19e59ed..f204e131 100644 --- a/src/Encryption/Security/JWT/Token/Parser.php +++ b/src/Encryption/Security/JWT/Token/Parser.php @@ -10,6 +10,10 @@ namespace Phalcon\Encryption\Security\JWT\Token; use InvalidArgumentException; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidClaims; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidHeader; +use Phalcon\Encryption\Security\JWT\Exceptions\MalformedJwtString; +use Phalcon\Encryption\Security\JWT\Exceptions\MissingJwtTypHeader; use Phalcon\Support\Helper\Json\Decode; /** @@ -27,9 +31,9 @@ class Parser private $decode; /** - * @param \Phalcon\Support\Helper\Json\Decode $decode + * @param \Phalcon\Support\Helper\Json\Decode|null $decode */ - public function __construct(\Phalcon\Support\Helper\Json\Decode $decode = null) + public function __construct(?\Phalcon\Support\Helper\Json\Decode $decode = null) { } diff --git a/src/Encryption/Security/JWT/Token/Token.php b/src/Encryption/Security/JWT/Token/Token.php index 931a2925..b53076f8 100644 --- a/src/Encryption/Security/JWT/Token/Token.php +++ b/src/Encryption/Security/JWT/Token/Token.php @@ -18,6 +18,10 @@ * A container for Token related data. It stores the claims, headers, signature * and payload. It also calculates and returns the token string. * + * @property Item $claims + * @property Item $headers + * @property Signature $signature + * * @link https://tools.ietf.org/html/rfc7519 */ class Token diff --git a/src/Encryption/Security/JWT/Validator.php b/src/Encryption/Security/JWT/Validator.php index 5a79436e..dbbd1751 100644 --- a/src/Encryption/Security/JWT/Validator.php +++ b/src/Encryption/Security/JWT/Validator.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Encryption\Security\JWT; +use Phalcon\Encryption\Security\JWT\Exceptions\InvalidAudienceType; use Phalcon\Encryption\Security\JWT\Exceptions\ValidatorException; use Phalcon\Encryption\Security\JWT\Signer\SignerInterface; use Phalcon\Encryption\Security\JWT\Token\Enum; @@ -75,9 +76,9 @@ public function get(string $claim): mixed * @param string $claim * @param mixed $value * - * @return Validator + * @return static */ - public function set(string $claim, $value): Validator + public function set(string $claim, $value): static { } @@ -86,9 +87,9 @@ public function set(string $claim, $value): Validator * * @param Token $token * - * @return Validator + * @return static */ - public function setToken(\Phalcon\Encryption\Security\JWT\Token\Token $token): Validator + public function setToken(\Phalcon\Encryption\Security\JWT\Token\Token $token): static { } @@ -98,9 +99,9 @@ public function setToken(\Phalcon\Encryption\Security\JWT\Token\Token $token): V * @param string $name * @param bool|int|string $value * - * @return Validator + * @return static */ - public function validateClaim(string $name, $value): Validator + public function validateClaim(string $name, $value): static { } @@ -109,10 +110,10 @@ public function validateClaim(string $name, $value): Validator * * @param string|array $audience * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateAudience($audience): Validator + public function validateAudience($audience): static { } @@ -121,10 +122,10 @@ public function validateAudience($audience): Validator * * @param int $timestamp * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateExpiration(int $timestamp): Validator + public function validateExpiration(int $timestamp): static { } @@ -133,10 +134,10 @@ public function validateExpiration(int $timestamp): Validator * * @param string $id * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateId(string $id): Validator + public function validateId(string $id): static { } @@ -145,10 +146,10 @@ public function validateId(string $id): Validator * * @param int $timestamp * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateIssuedAt(int $timestamp): Validator + public function validateIssuedAt(int $timestamp): static { } @@ -157,10 +158,10 @@ public function validateIssuedAt(int $timestamp): Validator * * @param string $issuer * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateIssuer(string $issuer): Validator + public function validateIssuer(string $issuer): static { } @@ -169,10 +170,10 @@ public function validateIssuer(string $issuer): Validator * * @param int $timestamp * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateNotBefore(int $timestamp): Validator + public function validateNotBefore(int $timestamp): static { } @@ -182,10 +183,10 @@ public function validateNotBefore(int $timestamp): Validator * @param SignerInterface $signer * @param string $passphrase * - * @return Validator + * @return static * @throws ValidatorException */ - public function validateSignature(\Phalcon\Encryption\Security\JWT\Signer\SignerInterface $signer, string $passphrase): Validator + public function validateSignature(\Phalcon\Encryption\Security\JWT\Signer\SignerInterface $signer, string $passphrase): static { } diff --git a/src/Encryption/Security/Random.php b/src/Encryption/Security/Random.php index 25dd3f4a..26758ab1 100644 --- a/src/Encryption/Security/Random.php +++ b/src/Encryption/Security/Random.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Encryption\Security; +use Phalcon\Encryption\Security\Exceptions\InvalidRandomInput; + /** * Phalcon\Encryption\Security\Random * @@ -270,10 +272,10 @@ public function uuid(): string * @throws Exception If secure random number generator is not available or unexpected partial read * @param string $alphabet * @param int $base - * @param mixed $n + * @param mixed $number * @return string */ - protected function base(string $alphabet, int $base, $n = 16): string + protected function base(string $alphabet, int $base, $number = 16): string { } } diff --git a/src/Encryption/Security/Uuid.php b/src/Encryption/Security/Uuid.php index c3f24460..fac7932d 100644 --- a/src/Encryption/Security/Uuid.php +++ b/src/Encryption/Security/Uuid.php @@ -22,13 +22,6 @@ * Each call creates a new immutable version object. Cast to string for the * UUID value; use the returned object for additional methods such as * getDateTime() or getNode(). - * - * @method Version1 v1() - * @method Version3 v3(string $namespaceName, string $name) - * @method Version4 v4() - * @method Version5 v5(string $namespaceName, string $name) - * @method Version6 v6() - * @method Version7 v7() */ class Uuid { diff --git a/src/Encryption/Security/Uuid/UuidInterface.php b/src/Encryption/Security/Uuid/UuidInterface.php index 92f291bd..162fb53e 100644 --- a/src/Encryption/Security/Uuid/UuidInterface.php +++ b/src/Encryption/Security/Uuid/UuidInterface.php @@ -16,11 +16,23 @@ */ interface UuidInterface { + /** + * @var string + */ const NAMESPACE_DNS = '6ba7b810-9dad-11d1-80b4-00c04fd430c8'; + /** + * @var string + */ const NAMESPACE_OID = '6ba7b812-9dad-11d1-80b4-00c04fd430c8'; + /** + * @var string + */ const NAMESPACE_URL = '6ba7b811-9dad-11d1-80b4-00c04fd430c8'; + /** + * @var string + */ const NAMESPACE_X500 = '6ba7b814-9dad-11d1-80b4-00c04fd430c8'; } diff --git a/src/Encryption/Security/Uuid/Version1.php b/src/Encryption/Security/Uuid/Version1.php index d6ed222d..bbc884ee 100644 --- a/src/Encryption/Security/Uuid/Version1.php +++ b/src/Encryption/Security/Uuid/Version1.php @@ -22,10 +22,10 @@ class Version1 extends \Phalcon\Encryption\Security\Uuid\AbstractUuid implements \Phalcon\Encryption\Security\Uuid\TimeBasedUuidInterface { /** - * @param \DateTimeInterface $dateTime + * @param \DateTimeInterface|null $dateTime * @param mixed $node */ - public function __construct(\DateTimeInterface $dateTime = null, $node = null) + public function __construct(?\DateTimeInterface $dateTime = null, $node = null) { } diff --git a/src/Events/Event.php b/src/Events/Event.php index bdf3b594..c8599ea5 100644 --- a/src/Events/Event.php +++ b/src/Events/Event.php @@ -10,6 +10,8 @@ namespace Phalcon\Events; use Phalcon\Contracts\Events\Stoppable; +use Phalcon\Events\Exceptions\EventNotCancelable; +use Phalcon\Events\Exceptions\InvalidEventSource; /** * This class offers contextual information of a fired event in the @@ -24,7 +26,7 @@ * } * ``` */ -final class Event implements \Phalcon\Events\EventInterface, \Phalcon\Contracts\Events\Stoppable +class Event implements \Phalcon\Events\EventInterface, \Phalcon\Contracts\Events\Stoppable { /** * Is event cancelable? diff --git a/src/Events/Exceptions/EventNotCancelable.php b/src/Events/Exceptions/EventNotCancelable.php new file mode 100644 index 00000000..c25cdc57 --- /dev/null +++ b/src/Events/Exceptions/EventNotCancelable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EventNotCancelable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Events/Exceptions/InvalidEventHandler.php b/src/Events/Exceptions/InvalidEventHandler.php new file mode 100644 index 00000000..0c7fa342 --- /dev/null +++ b/src/Events/Exceptions/InvalidEventHandler.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidEventHandler extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Events/Exceptions/InvalidEventSource.php b/src/Events/Exceptions/InvalidEventSource.php new file mode 100644 index 00000000..4ff6fcb7 --- /dev/null +++ b/src/Events/Exceptions/InvalidEventSource.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidEventSource extends Exception +{ + /** + * @param string $type + * @param string $sourceType + */ + public function __construct(string $type, string $sourceType) + { + } +} diff --git a/src/Events/Exceptions/InvalidEventType.php b/src/Events/Exceptions/InvalidEventType.php new file mode 100644 index 00000000..85db12b2 --- /dev/null +++ b/src/Events/Exceptions/InvalidEventType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidEventType extends Exception +{ + /** + * @param string $eventType + */ + public function __construct(string $eventType) + { + } +} diff --git a/src/Events/Exceptions/InvalidSubscriberConfiguration.php b/src/Events/Exceptions/InvalidSubscriberConfiguration.php new file mode 100644 index 00000000..ebf6a17a --- /dev/null +++ b/src/Events/Exceptions/InvalidSubscriberConfiguration.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidSubscriberConfiguration extends Exception +{ + /** + * @param string $eventName + */ + public function __construct(string $eventName) + { + } +} diff --git a/src/Events/Exceptions/NoListenersForEvent.php b/src/Events/Exceptions/NoListenersForEvent.php new file mode 100644 index 00000000..54824722 --- /dev/null +++ b/src/Events/Exceptions/NoListenersForEvent.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Events\Exceptions; + +use Phalcon\Events\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoListenersForEvent extends Exception +{ + /** + * @param string $eventType + */ + public function __construct(string $eventType) + { + } +} diff --git a/src/Events/Manager.php b/src/Events/Manager.php index 42ea6377..591c9e0e 100644 --- a/src/Events/Manager.php +++ b/src/Events/Manager.php @@ -11,6 +11,10 @@ use Closure; use Phalcon\Contracts\Events\Subscriber; +use Phalcon\Events\Exceptions\InvalidEventHandler; +use Phalcon\Events\Exceptions\InvalidEventType; +use Phalcon\Events\Exceptions\InvalidSubscriberConfiguration; +use Phalcon\Events\Exceptions\NoListenersForEvent; /** * Phalcon Events Manager, offers an easy way to intercept and manipulate, if @@ -94,6 +98,18 @@ class Manager implements \Phalcon\Events\ManagerInterface */ protected $methodExistsCache = []; + /** + * Maximum number of distinct handler classes retained in + * methodExistsCache. 0 (default) keeps the original unbounded + * behavior; a positive value clears the cache when adding a new + * class would exceed it. Re-warming is cheap (method_exists is + * O(1)) and the cap is meant for very long-lived workers that see + * many distinct listener classes over time. + * + * @var int + */ + protected $methodExistsCacheLimit = 0; + /** * Memoized getSubscribedEvents() maps keyed by Subscriber class name. * The static method's return is stable for the lifetime of a class @@ -215,10 +231,10 @@ public function detach(string $eventType, $handler): void /** * Removes all events from the EventsManager * - * @param string $type + * @param string|null $type * @return void */ - public function detachAll(string $type = null): void + public function detachAll(?string $type = null): void { } @@ -254,7 +270,7 @@ public function enablePriorities(bool $enablePriorities): void * @param string $eventType * @param bool $cancelable */ - final public function fire(string $eventType, $source, $data = null, bool $cancelable = true) + public function fire(string $eventType, $source, $data = null, bool $cancelable = true) { } @@ -317,6 +333,16 @@ public function getListeners(string $type): array { } + /** + * Returns the configured method_exists-cache cap (0 = unlimited). + * See setMethodExistsCacheLimit(). + * + * @return int + */ + public function getMethodExistsCacheLimit(): int + { + } + /** * Returns all the responses returned by every handler executed by the last * 'fire' executed @@ -417,6 +443,20 @@ public function resume(): void { } + /** + * Caps the number of distinct handler classes retained in the + * method_exists memoization cache. 0 disables the cap (the + * default; preserves the original unbounded behavior). When the + * cap is exceeded, the cache is cleared and re-warms on subsequent + * fires. + * + * @param int $methodExistsCacheLimit + * @return void + */ + public function setMethodExistsCacheLimit(int $methodExistsCacheLimit): void + { + } + /** * Enables/disables the stop-on-false short-circuit. When true, a * listener returning literal `false` (with cancelable=true) stops @@ -444,6 +484,46 @@ public function setStrict(bool $strict): void { } + /** + * Extension seam invoked after an event has been dispatched to its + * listener queues. Receives the computed dispatch result as `status` + * and returns the value fire() hands back to its caller; the base + * implementation returns `status` unchanged. A subclass can override + * it to run bookkeeping or to post-process / rewrite the result. + * + * Only called when the event was actually dispatched; the halted and + * no-listener short-circuits in fire() return before reaching it. + * + * @param mixed $status + * @param string $eventType + * @param object $source + * @param mixed $data + * @param bool $cancelable + * @return mixed + */ + protected function afterFire($status, string $eventType, $source, $data = null, bool $cancelable = true): mixed + { + } + + /** + * Extension seam invoked before an event is dispatched. The base + * implementation returns true, so dispatch proceeds unchanged. A + * subclass can override it to inspect the source and data and, by + * returning false, abort the dispatch entirely - for example to + * redirect a deferred event onto an external queue. Invoked before the + * no-listener short-circuits, so it sees every fire(), including those + * with no locally attached listeners. + * + * @param string $eventType + * @param object $source + * @param mixed $data + * @param bool $cancelable + * @return bool + */ + protected function beforeFire(string $eventType, $source, $data = null, bool $cancelable = true): bool + { + } + /** * Hot dispatch loop. Called by fire()/fireAll() with hoisted args, * and by fireQueue() as a BC wrapper. Owns the documented diff --git a/src/Filter/Exceptions/FilterNotRegistered.php b/src/Filter/Exceptions/FilterNotRegistered.php new file mode 100644 index 00000000..2bb6895a --- /dev/null +++ b/src/Filter/Exceptions/FilterNotRegistered.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Exceptions; + +use Phalcon\Filter\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FilterNotRegistered extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Filter/Filter.php b/src/Filter/Filter.php index d2d92399..4e57a41f 100644 --- a/src/Filter/Filter.php +++ b/src/Filter/Filter.php @@ -9,6 +9,8 @@ */ namespace Phalcon\Filter; +use Phalcon\Filter\Exceptions\FilterNotRegistered; + /** * Lazy loads, stores and exposes sanitizer objects * @@ -33,8 +35,8 @@ * @method string trim(string $input) * @method string upper(string $input) * @method string upperFirst(string $input) - * @method null upperWords(string $input): strin - * @method null url(string $input): strin + * @method string|null upperWords(string $input) + * @method string|null url(string $input) * * @property array $mapper * @property array $services diff --git a/src/Filter/Validation.php b/src/Filter/Validation.php index a7eb6114..f69666ed 100644 --- a/src/Filter/Validation.php +++ b/src/Filter/Validation.php @@ -13,12 +13,21 @@ use Phalcon\Di\DiInterface; use Phalcon\Di\Injectable; use Phalcon\Filter\FilterInterface; -use Phalcon\Messages\MessageInterface; -use Phalcon\Messages\Messages; -use Phalcon\Filter\Validation\ValidationInterface; +use Phalcon\Filter\Validation\AbstractCombinedFieldsValidator; use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\FilterServiceUnavailable; +use Phalcon\Filter\Validation\Exceptions\InvalidFieldType; +use Phalcon\Filter\Validation\Exceptions\InvalidFilterService; +use Phalcon\Filter\Validation\Exceptions\InvalidValidationData; +use Phalcon\Filter\Validation\Exceptions\InvalidValidator; +use Phalcon\Filter\Validation\Exceptions\InvalidValidatorScope; +use Phalcon\Filter\Validation\Exceptions\NoDataToValidate; +use Phalcon\Filter\Validation\Exceptions\NoValidators; +use Phalcon\Filter\Validation\Exceptions\ValidationEntityNotObject; +use Phalcon\Filter\Validation\ValidationInterface; use Phalcon\Filter\Validation\ValidatorInterface; -use Phalcon\Filter\Validation\AbstractCombinedFieldsValidator; +use Phalcon\Messages\MessageInterface; +use Phalcon\Messages\Messages; /** * Allows to validate data using custom or built-in validators @@ -56,9 +65,9 @@ class Validation extends Injectable implements \Phalcon\Filter\Validation\Valida protected $labels = []; /** - * @var Messages|null + * @var Messages */ - protected $messages = null; + protected $messages; /** * List of validators @@ -89,9 +98,9 @@ public function __construct(array $validators = []) * @param string|array $field * @param ValidatorInterface $validator * - * @return ValidationInterface + * @return static */ - public function add($field, \Phalcon\Filter\Validation\ValidatorInterface $validator): ValidationInterface + public function add($field, \Phalcon\Filter\Validation\ValidatorInterface $validator): static { } @@ -99,9 +108,9 @@ public function add($field, \Phalcon\Filter\Validation\ValidatorInterface $valid * Appends a message to the messages list * * @param MessageInterface $message - * @return ValidationInterface + * @return static */ - public function appendMessage(\Phalcon\Messages\MessageInterface $message): ValidationInterface + public function appendMessage(\Phalcon\Messages\MessageInterface $message): static { } @@ -120,9 +129,9 @@ public function appendMessage(\Phalcon\Messages\MessageInterface $message): Vali * @param object $entity the entity object to assign data to * @param array|object $data the data that needs to be validated * @param array $whitelist only allow these fields to be mutated when entity is used - * @return ValidationInterface + * @return static */ - public function bind($entity, $data, array $whitelist = []): ValidationInterface + public function bind($entity, $data, array $whitelist = []): static { } @@ -145,10 +154,10 @@ public function getEntity(): mixed /** * Returns all the filters or a specific one * - * @param string $field + * @param string|null $field * @return mixed|null */ - public function getFilters(string $field = null): mixed + public function getFilters(?string $field = null): mixed { } @@ -218,9 +227,9 @@ public function getValue(string $field): mixed * @param string|array $field * @param ValidatorInterface $validator * - * @return ValidationInterface + * @return static */ - public function rule($field, \Phalcon\Filter\Validation\ValidatorInterface $validator): ValidationInterface + public function rule($field, \Phalcon\Filter\Validation\ValidatorInterface $validator): static { } @@ -229,9 +238,9 @@ public function rule($field, \Phalcon\Filter\Validation\ValidatorInterface $vali * * @param mixed $field * @param array $validators - * @return ValidationInterface + * @return static */ - public function rules($field, array $validators): ValidationInterface + public function rules($field, array $validators): static { } @@ -250,9 +259,9 @@ public function setEntity($entity): void * * @param string $field * @param array|string $filters - * @return ValidationInterface + * @return static */ - public function setFilters($field, $filters): ValidationInterface + public function setFilters($field, $filters): static { } @@ -268,9 +277,9 @@ public function setLabels(array $labels): void /** * @param array $validators - * @return Validation + * @return static */ - public function setValidators(array $validators): Validation + public function setValidators(array $validators): static { } diff --git a/src/Filter/Validation/AbstractValidator.php b/src/Filter/Validation/AbstractValidator.php index f5d1349c..59baada6 100644 --- a/src/Filter/Validation/AbstractValidator.php +++ b/src/Filter/Validation/AbstractValidator.php @@ -9,8 +9,9 @@ */ namespace Phalcon\Filter\Validation; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exceptions\FieldNotPrintable; +use Phalcon\Messages\Message; use Phalcon\Support\Helper\Arr\Whitelist; /** @@ -66,7 +67,7 @@ public function getOption(string $key, $defaultValue = null): mixed * * @return string */ - public function getTemplate(string $field = null): string + public function getTemplate(?string $field = null): string { } diff --git a/src/Filter/Validation/AbstractValidatorComposite.php b/src/Filter/Validation/AbstractValidatorComposite.php index ba4d7949..6b7f0382 100644 --- a/src/Filter/Validation/AbstractValidatorComposite.php +++ b/src/Filter/Validation/AbstractValidatorComposite.php @@ -10,6 +10,7 @@ namespace Phalcon\Filter\Validation; use Phalcon\Filter\Validation; +use Phalcon\Filter\Validation\Exceptions\NoValidatorsInComposite; /** * This is a base class for combined fields validators diff --git a/src/Filter/Validation/Exceptions/FieldNotPrintable.php b/src/Filter/Validation/Exceptions/FieldNotPrintable.php new file mode 100644 index 00000000..17e22712 --- /dev/null +++ b/src/Filter/Validation/Exceptions/FieldNotPrintable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FieldNotPrintable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/FilterServiceUnavailable.php b/src/Filter/Validation/Exceptions/FilterServiceUnavailable.php new file mode 100644 index 00000000..074bd1fc --- /dev/null +++ b/src/Filter/Validation/Exceptions/FilterServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FilterServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidAllowedTypes.php b/src/Filter/Validation/Exceptions/InvalidAllowedTypes.php new file mode 100644 index 00000000..0a5a1ece --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidAllowedTypes.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidAllowedTypes extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidCallbackReturn.php b/src/Filter/Validation/Exceptions/InvalidCallbackReturn.php new file mode 100644 index 00000000..b30a4221 --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidCallbackReturn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCallbackReturn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidDomainOption.php b/src/Filter/Validation/Exceptions/InvalidDomainOption.php new file mode 100644 index 00000000..b202347f --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidDomainOption.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidDomainOption extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidFieldType.php b/src/Filter/Validation/Exceptions/InvalidFieldType.php new file mode 100644 index 00000000..4aa9a131 --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidFieldType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidFieldType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidFilterService.php b/src/Filter/Validation/Exceptions/InvalidFilterService.php new file mode 100644 index 00000000..adaaa28e --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidFilterService.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidFilterService extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidStrictOption.php b/src/Filter/Validation/Exceptions/InvalidStrictOption.php new file mode 100644 index 00000000..15db9a94 --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidStrictOption.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidStrictOption extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidValidationData.php b/src/Filter/Validation/Exceptions/InvalidValidationData.php new file mode 100644 index 00000000..9dc4b7a7 --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidValidationData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidValidationData extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidValidator.php b/src/Filter/Validation/Exceptions/InvalidValidator.php new file mode 100644 index 00000000..b2c9e706 --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidValidator.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidValidator extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/InvalidValidatorScope.php b/src/Filter/Validation/Exceptions/InvalidValidatorScope.php new file mode 100644 index 00000000..0a9e2e9d --- /dev/null +++ b/src/Filter/Validation/Exceptions/InvalidValidatorScope.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidValidatorScope extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/MissingMbstring.php b/src/Filter/Validation/Exceptions/MissingMbstring.php new file mode 100644 index 00000000..65c2dca3 --- /dev/null +++ b/src/Filter/Validation/Exceptions/MissingMbstring.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingMbstring extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/NoDataToValidate.php b/src/Filter/Validation/Exceptions/NoDataToValidate.php new file mode 100644 index 00000000..ae66598c --- /dev/null +++ b/src/Filter/Validation/Exceptions/NoDataToValidate.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoDataToValidate extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/NoValidators.php b/src/Filter/Validation/Exceptions/NoValidators.php new file mode 100644 index 00000000..28cba826 --- /dev/null +++ b/src/Filter/Validation/Exceptions/NoValidators.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoValidators extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/NoValidatorsInComposite.php b/src/Filter/Validation/Exceptions/NoValidatorsInComposite.php new file mode 100644 index 00000000..b25f3ed5 --- /dev/null +++ b/src/Filter/Validation/Exceptions/NoValidatorsInComposite.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoValidatorsInComposite extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Filter/Validation/Exceptions/UniquenessConversionMustBeArray.php b/src/Filter/Validation/Exceptions/UniquenessConversionMustBeArray.php new file mode 100644 index 00000000..9a69053b --- /dev/null +++ b/src/Filter/Validation/Exceptions/UniquenessConversionMustBeArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UniquenessConversionMustBeArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/UniquenessModelRequired.php b/src/Filter/Validation/Exceptions/UniquenessModelRequired.php new file mode 100644 index 00000000..15002ea1 --- /dev/null +++ b/src/Filter/Validation/Exceptions/UniquenessModelRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UniquenessModelRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/UniquenessOnlyForPhalconModel.php b/src/Filter/Validation/Exceptions/UniquenessOnlyForPhalconModel.php new file mode 100644 index 00000000..6a1e8b64 --- /dev/null +++ b/src/Filter/Validation/Exceptions/UniquenessOnlyForPhalconModel.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UniquenessOnlyForPhalconModel extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/Exceptions/ValidationEntityNotObject.php b/src/Filter/Validation/Exceptions/ValidationEntityNotObject.php new file mode 100644 index 00000000..b1332cbf --- /dev/null +++ b/src/Filter/Validation/Exceptions/ValidationEntityNotObject.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Filter\Validation\Exceptions; + +use Phalcon\Filter\Validation\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ValidationEntityNotObject extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Filter/Validation/ValidationInterface.php b/src/Filter/Validation/ValidationInterface.php index 60f12e81..13b0a069 100644 --- a/src/Filter/Validation/ValidationInterface.php +++ b/src/Filter/Validation/ValidationInterface.php @@ -56,10 +56,10 @@ public function getEntity(): mixed; /** * Returns all the filters or a specific one * - * @param string $field + * @param string|null $field * @return mixed|null */ - public function getFilters(string $field = null): mixed; + public function getFilters(?string $field = null): mixed; /** * Get label for field diff --git a/src/Filter/Validation/Validator/Callback.php b/src/Filter/Validation/Validator/Callback.php index eb83d434..7be8d91e 100644 --- a/src/Filter/Validation/Validator/Callback.php +++ b/src/Filter/Validation/Validator/Callback.php @@ -9,10 +9,11 @@ */ namespace Phalcon\Filter\Validation\Validator; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\ValidatorInterface; use Phalcon\Filter\Validation\AbstractValidator; +use Phalcon\Filter\Validation\Exceptions\InvalidCallbackReturn; +use Phalcon\Filter\Validation\ValidatorInterface; +use Phalcon\Messages\Message; /** * Calls user function for validation diff --git a/src/Filter/Validation/Validator/Confirmation.php b/src/Filter/Validation/Validator/Confirmation.php index 6dba1500..c502a093 100644 --- a/src/Filter/Validation/Validator/Confirmation.php +++ b/src/Filter/Validation/Validator/Confirmation.php @@ -9,10 +9,11 @@ */ namespace Phalcon\Filter\Validation\Validator; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; -use Phalcon\Filter\Validation\Exception; use Phalcon\Filter\Validation\AbstractValidator; +use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\MissingMbstring; +use Phalcon\Messages\Message; /** * Checks that two values have the same value diff --git a/src/Filter/Validation/Validator/ExclusionIn.php b/src/Filter/Validation/Validator/ExclusionIn.php index 98d36001..9c25c6f2 100644 --- a/src/Filter/Validation/Validator/ExclusionIn.php +++ b/src/Filter/Validation/Validator/ExclusionIn.php @@ -9,10 +9,12 @@ */ namespace Phalcon\Filter\Validation\Validator; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; use Phalcon\Filter\Validation\AbstractValidator; use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\InvalidDomainOption; +use Phalcon\Filter\Validation\Exceptions\InvalidStrictOption; +use Phalcon\Messages\Message; /** * Check if a value is not included into a list of values diff --git a/src/Filter/Validation/Validator/File/MimeType.php b/src/Filter/Validation/Validator/File/MimeType.php index beafa328..47e436ee 100644 --- a/src/Filter/Validation/Validator/File/MimeType.php +++ b/src/Filter/Validation/Validator/File/MimeType.php @@ -9,9 +9,10 @@ */ namespace Phalcon\Filter\Validation\Validator\File; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\InvalidAllowedTypes; +use Phalcon\Messages\Message; /** * Checks if a value has a correct file mime type diff --git a/src/Filter/Validation/Validator/InclusionIn.php b/src/Filter/Validation/Validator/InclusionIn.php index fcc8e2be..ea7280c1 100644 --- a/src/Filter/Validation/Validator/InclusionIn.php +++ b/src/Filter/Validation/Validator/InclusionIn.php @@ -9,10 +9,12 @@ */ namespace Phalcon\Filter\Validation\Validator; -use Phalcon\Messages\Message; use Phalcon\Filter\Validation; use Phalcon\Filter\Validation\AbstractValidator; use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\InvalidDomainOption; +use Phalcon\Filter\Validation\Exceptions\InvalidStrictOption; +use Phalcon\Messages\Message; /** * Check if a value is included into a list of values diff --git a/src/Filter/Validation/Validator/Uniqueness.php b/src/Filter/Validation/Validator/Uniqueness.php index 8492bde0..3ed880c5 100644 --- a/src/Filter/Validation/Validator/Uniqueness.php +++ b/src/Filter/Validation/Validator/Uniqueness.php @@ -15,6 +15,9 @@ use Phalcon\Filter\Validation; use Phalcon\Filter\Validation\AbstractCombinedFieldsValidator; use Phalcon\Filter\Validation\Exception; +use Phalcon\Filter\Validation\Exceptions\UniquenessConversionMustBeArray; +use Phalcon\Filter\Validation\Exceptions\UniquenessModelRequired; +use Phalcon\Filter\Validation\Exceptions\UniquenessOnlyForPhalconModel; use Phalcon\Support\Settings; /** diff --git a/src/Flash/AbstractFlash.php b/src/Flash/AbstractFlash.php index d2f8d239..b1fe86ce 100644 --- a/src/Flash/AbstractFlash.php +++ b/src/Flash/AbstractFlash.php @@ -12,6 +12,8 @@ use Phalcon\Di\Di; use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; +use Phalcon\Flash\Exceptions\EscaperServiceUnavailable; +use Phalcon\Flash\Exceptions\FlashMessageNotStringOrArray; use Phalcon\Html\Escaper\EscaperInterface; use Phalcon\Session\ManagerInterface as SessionInterface; use Phalcon\Support\Helper\Str\Interpolate; @@ -87,7 +89,7 @@ abstract class AbstractFlash extends AbstractInjectionAware implements \Phalcon\ * @param EscaperInterface|null $escaper * @param SessionInterface|null $session */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper = null, \Phalcon\Session\ManagerInterface $session = null) + public function __construct(?\Phalcon\Html\Escaper\EscaperInterface $escaper = null, ?\Phalcon\Session\ManagerInterface $session = null) { } @@ -179,9 +181,9 @@ public function notice(string $message): string|null * Set the autoescape mode in generated HTML * * @param bool $autoescape - * @return AbstractFlash + * @return static */ - public function setAutoescape(bool $autoescape): AbstractFlash + public function setAutoescape(bool $autoescape): static { } @@ -189,9 +191,9 @@ public function setAutoescape(bool $autoescape): AbstractFlash * Set if the output must be implicitly formatted with HTML * * @param bool $automaticHtml - * @return AbstractFlash + * @return static */ - public function setAutomaticHtml(bool $automaticHtml): AbstractFlash + public function setAutomaticHtml(bool $automaticHtml): static { } @@ -199,9 +201,9 @@ public function setAutomaticHtml(bool $automaticHtml): AbstractFlash * Set an array with CSS classes to format the messages * * @param array $cssClasses - * @return AbstractFlash + * @return static */ - public function setCssClasses(array $cssClasses): AbstractFlash + public function setCssClasses(array $cssClasses): static { } @@ -209,9 +211,9 @@ public function setCssClasses(array $cssClasses): AbstractFlash * Set an array with CSS classes to format the icon messages * * @param array $cssIconClasses - * @return AbstractFlash + * @return static */ - public function setCssIconClasses(array $cssIconClasses): AbstractFlash + public function setCssIconClasses(array $cssIconClasses): static { } @@ -219,9 +221,9 @@ public function setCssIconClasses(array $cssIconClasses): AbstractFlash * Set a custom template for showing the messages * * @param string $customTemplate - * @return AbstractFlash + * @return static */ - public function setCustomTemplate(string $customTemplate): AbstractFlash + public function setCustomTemplate(string $customTemplate): static { } @@ -229,9 +231,9 @@ public function setCustomTemplate(string $customTemplate): AbstractFlash * Sets the Escaper Service * * @param EscaperInterface $escaperService - * @return AbstractFlash + * @return static */ - public function setEscaperService(\Phalcon\Html\Escaper\EscaperInterface $escaperService): AbstractFlash + public function setEscaperService(\Phalcon\Html\Escaper\EscaperInterface $escaperService): static { } @@ -240,9 +242,9 @@ public function setEscaperService(\Phalcon\Html\Escaper\EscaperInterface $escape * returned as string * * @param bool $implicitFlush - * @return AbstractFlash + * @return static */ - public function setImplicitFlush(bool $implicitFlush): AbstractFlash + public function setImplicitFlush(bool $implicitFlush): static { } diff --git a/src/Flash/Exceptions/EscaperServiceUnavailable.php b/src/Flash/Exceptions/EscaperServiceUnavailable.php new file mode 100644 index 00000000..46204786 --- /dev/null +++ b/src/Flash/Exceptions/EscaperServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Flash\Exceptions; + +use Phalcon\Flash\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EscaperServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Flash/Exceptions/FlashMessageNotStringOrArray.php b/src/Flash/Exceptions/FlashMessageNotStringOrArray.php new file mode 100644 index 00000000..fe6c1d47 --- /dev/null +++ b/src/Flash/Exceptions/FlashMessageNotStringOrArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Flash\Exceptions; + +use Phalcon\Flash\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FlashMessageNotStringOrArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Flash/Exceptions/SessionServiceUnavailable.php b/src/Flash/Exceptions/SessionServiceUnavailable.php new file mode 100644 index 00000000..8ddd894b --- /dev/null +++ b/src/Flash/Exceptions/SessionServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Flash\Exceptions; + +use Phalcon\Flash\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SessionServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Flash/Session.php b/src/Flash/Session.php index 216dae89..3df0390d 100644 --- a/src/Flash/Session.php +++ b/src/Flash/Session.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Flash; +use Phalcon\Flash\Exceptions\SessionServiceUnavailable; use Phalcon\Session\ManagerInterface; /** @@ -59,7 +60,7 @@ public function getMessages($type = null, bool $remove = true): array * @return bool * @throws Exception */ - public function has(string $type = null): bool + public function has(?string $type = null): bool { } @@ -97,7 +98,7 @@ public function output(bool $remove = true): void * @return array * @throws Exception */ - protected function getSessionMessages(bool $remove, string $type = null): array + protected function getSessionMessages(bool $remove, ?string $type = null): array { } diff --git a/src/Forms/Element/AbstractElement.php b/src/Forms/Element/AbstractElement.php index 92aad1a4..19ac528d 100644 --- a/src/Forms/Element/AbstractElement.php +++ b/src/Forms/Element/AbstractElement.php @@ -10,10 +10,12 @@ namespace Phalcon\Forms\Element; use InvalidArgumentException; -use Phalcon\Di\DiInterface; use Phalcon\Di\Di; +use Phalcon\Di\DiInterface; use Phalcon\Filter\Validation\ValidatorInterface; use Phalcon\Forms\Exception; +use Phalcon\Forms\Exceptions\FormElementNameRequired; +use Phalcon\Forms\Exceptions\InvalidFilterType; use Phalcon\Forms\Form; use Phalcon\Html\TagFactory; use Phalcon\Messages\MessageInterface; @@ -385,9 +387,9 @@ public function setName(string $name): ElementInterface * Sets the TagFactory * * @param \Phalcon\Html\TagFactory $tagFactory - * @return AbstractElement + * @return static */ - public function setTagFactory(\Phalcon\Html\TagFactory $tagFactory): AbstractElement + public function setTagFactory(\Phalcon\Html\TagFactory $tagFactory): static { } diff --git a/src/Forms/Element/Check.php b/src/Forms/Element/Check.php index 60371c1f..9b5431fe 100644 --- a/src/Forms/Element/Check.php +++ b/src/Forms/Element/Check.php @@ -55,9 +55,9 @@ public function hasUncheckedValue(): bool * untouched. See cphalcon issue #16982. * * @param mixed $value - * @return Check + * @return static */ - public function setUncheckedValue($value): Check + public function setUncheckedValue($value): static { } } diff --git a/src/Forms/Exception.php b/src/Forms/Exception.php index e2bed4be..e0729b11 100644 --- a/src/Forms/Exception.php +++ b/src/Forms/Exception.php @@ -15,16 +15,16 @@ class Exception extends \Exception { /** - * @return Exception + * @return self */ - public static function tagFactoryNotFound(): Exception + public static function tagFactoryNotFound(): self { } /** - * @return Exception + * @return self */ - public static function usingParameterRequired(): Exception + public static function usingParameterRequired(): self { } } diff --git a/src/Forms/Exceptions/ElementNotInForm.php b/src/Forms/Exceptions/ElementNotInForm.php new file mode 100644 index 00000000..cb2aee16 --- /dev/null +++ b/src/Forms/Exceptions/ElementNotInForm.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ElementNotInForm extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Forms/Exceptions/FormElementNameRequired.php b/src/Forms/Exceptions/FormElementNameRequired.php new file mode 100644 index 00000000..ff38a5e9 --- /dev/null +++ b/src/Forms/Exceptions/FormElementNameRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FormElementNameRequired extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/FormNotInLocator.php b/src/Forms/Exceptions/FormNotInLocator.php new file mode 100644 index 00000000..3d63d934 --- /dev/null +++ b/src/Forms/Exceptions/FormNotInLocator.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FormNotInLocator extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Forms/Exceptions/FormNotRegistered.php b/src/Forms/Exceptions/FormNotRegistered.php new file mode 100644 index 00000000..e68b15ec --- /dev/null +++ b/src/Forms/Exceptions/FormNotRegistered.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FormNotRegistered extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Forms/Exceptions/InvalidEntity.php b/src/Forms/Exceptions/InvalidEntity.php new file mode 100644 index 00000000..ab1259ba --- /dev/null +++ b/src/Forms/Exceptions/InvalidEntity.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidEntity extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/InvalidFilterType.php b/src/Forms/Exceptions/InvalidFilterType.php new file mode 100644 index 00000000..c9c81714 --- /dev/null +++ b/src/Forms/Exceptions/InvalidFilterType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidFilterType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/InvalidJsonSchema.php b/src/Forms/Exceptions/InvalidJsonSchema.php new file mode 100644 index 00000000..714d7b76 --- /dev/null +++ b/src/Forms/Exceptions/InvalidJsonSchema.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidJsonSchema extends Exception +{ + /** + * @param string $detail + */ + public function __construct(string $detail) + { + } +} diff --git a/src/Forms/Exceptions/JsonSchemaNotArray.php b/src/Forms/Exceptions/JsonSchemaNotArray.php new file mode 100644 index 00000000..ea00d6ea --- /dev/null +++ b/src/Forms/Exceptions/JsonSchemaNotArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class JsonSchemaNotArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/NoFormElements.php b/src/Forms/Exceptions/NoFormElements.php new file mode 100644 index 00000000..54858bc8 --- /dev/null +++ b/src/Forms/Exceptions/NoFormElements.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoFormElements extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/SchemaEntryMissingKey.php b/src/Forms/Exceptions/SchemaEntryMissingKey.php new file mode 100644 index 00000000..6cfc3ca3 --- /dev/null +++ b/src/Forms/Exceptions/SchemaEntryMissingKey.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SchemaEntryMissingKey extends Exception +{ + /** + * @param int $index + * @param string $key + */ + public function __construct(int $index, string $key) + { + } +} diff --git a/src/Forms/Exceptions/SchemaEntryNotArray.php b/src/Forms/Exceptions/SchemaEntryNotArray.php new file mode 100644 index 00000000..c344174b --- /dev/null +++ b/src/Forms/Exceptions/SchemaEntryNotArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SchemaEntryNotArray extends Exception +{ + /** + * @param int $index + */ + public function __construct(int $index) + { + } +} diff --git a/src/Forms/Exceptions/UnknownFormElementType.php b/src/Forms/Exceptions/UnknownFormElementType.php new file mode 100644 index 00000000..9931e552 --- /dev/null +++ b/src/Forms/Exceptions/UnknownFormElementType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownFormElementType extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Forms/Exceptions/YamlExtensionRequired.php b/src/Forms/Exceptions/YamlExtensionRequired.php new file mode 100644 index 00000000..a82122e9 --- /dev/null +++ b/src/Forms/Exceptions/YamlExtensionRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class YamlExtensionRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Exceptions/YamlSchemaNotArray.php b/src/Forms/Exceptions/YamlSchemaNotArray.php new file mode 100644 index 00000000..9cf6e045 --- /dev/null +++ b/src/Forms/Exceptions/YamlSchemaNotArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Forms\Exceptions; + +use Phalcon\Forms\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class YamlSchemaNotArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Forms/Form.php b/src/Forms/Form.php index 8530cc86..2a7ca276 100644 --- a/src/Forms/Form.php +++ b/src/Forms/Form.php @@ -11,17 +11,20 @@ use Countable; use Iterator; -use Phalcon\Di\Injectable; -use Phalcon\Support\Settings; -use Phalcon\Di\DiInterface; use Phalcon\Contracts\Forms\Schema; +use Phalcon\Di\DiInterface; +use Phalcon\Di\Injectable; use Phalcon\Filter\FilterInterface; use Phalcon\Forms\Element\Check; use Phalcon\Forms\Element\ElementInterface; +use Phalcon\Forms\Exceptions\ElementNotInForm; +use Phalcon\Forms\Exceptions\InvalidEntity; +use Phalcon\Forms\Exceptions\NoFormElements; use Phalcon\Html\Attributes; use Phalcon\Html\Attributes\AttributesInterface; use Phalcon\Html\TagFactory; use Phalcon\Messages\Messages; +use Phalcon\Support\Settings; use Phalcon\Tag; use Phalcon\Filter\Validation; use Phalcon\Filter\Validation\ValidationInterface; @@ -62,9 +65,9 @@ class Form extends Injectable implements \Countable, \Iterator, \Phalcon\Html\At protected $entity = null; /** - * @var Messages|array|null + * @var Messages */ - protected $messages = null; + protected $messages; /** * @var int @@ -105,11 +108,11 @@ public function __construct($entity = null, array $userOptions = []) * Adds an element to the form * * @param \Phalcon\Forms\Element\ElementInterface $element - * @param string $position - * @param bool $type - * @return Form + * @param string|null $position + * @param bool|null $type + * @return static */ - public function add(\Phalcon\Forms\Element\ElementInterface $element, string $position = null, bool $type = null): Form + public function add(\Phalcon\Forms\Element\ElementInterface $element, ?string $position = null, ?bool $type = null): static { } @@ -119,9 +122,9 @@ public function add(\Phalcon\Forms\Element\ElementInterface $element, string $po * @param object $entity * @param array $whitelist * @param array $data - * @return Form + * @return static */ - public function bind(array $data, $entity = null, array $whitelist = []): Form + public function bind(array $data, $entity = null, array $whitelist = []): static { } @@ -129,9 +132,9 @@ public function bind(array $data, $entity = null, array $whitelist = []): Form * Clears every element in the form to its default value * * @param array|string|null $fields - * @return Form + * @return static */ - public function clear($fields = null): Form + public function clear($fields = null): static { } @@ -232,9 +235,9 @@ public function getLabel(string $name): string * } * ``` * - * @return array|Messages + * @return Messages */ - public function getMessages(): Messages|array + public function getMessages(): Messages { } @@ -356,10 +359,10 @@ public function key(): int * @param Schema $schema * @param FormsLocator $locator * - * @return Form + * @return static * @throws Exception */ - public function load(\Phalcon\Contracts\Forms\Schema $schema, FormsLocator $locator): Form + public function load(\Phalcon\Contracts\Forms\Schema $schema, FormsLocator $locator): static { } @@ -416,10 +419,10 @@ public function rewind(): void /** * Sets the form's action * - * @return Form + * @return static * @param string $action */ - public function setAction(string $action): Form + public function setAction(string $action): static { } @@ -427,9 +430,9 @@ public function setAction(string $action): Form * Set form attributes collection * * @param \Phalcon\Html\Attributes $attributes - * @return AttributesInterface + * @return static */ - public function setAttributes(\Phalcon\Html\Attributes $attributes): AttributesInterface + public function setAttributes(\Phalcon\Html\Attributes $attributes): static { } @@ -437,9 +440,9 @@ public function setAttributes(\Phalcon\Html\Attributes $attributes): AttributesI * Sets the entity related to the model * * @param object $entity - * @return Form + * @return static */ - public function setEntity($entity): Form + public function setEntity($entity): static { } @@ -447,9 +450,9 @@ public function setEntity($entity): Form * Sets the tagFactory for the form * * @param \Phalcon\Html\TagFactory $tagFactory - * @return Form + * @return static */ - public function setTagFactory(\Phalcon\Html\TagFactory $tagFactory): Form + public function setTagFactory(\Phalcon\Html\TagFactory $tagFactory): static { } @@ -457,9 +460,9 @@ public function setTagFactory(\Phalcon\Html\TagFactory $tagFactory): Form * Sets the default validation * * @param ValidationInterface $validation - * @return Form + * @return static */ - public function setValidation(\Phalcon\Filter\Validation\ValidationInterface $validation): Form + public function setValidation(\Phalcon\Filter\Validation\ValidationInterface $validation): static { } @@ -467,9 +470,9 @@ public function setValidation(\Phalcon\Filter\Validation\ValidationInterface $va * Sets the default whitelist * * @param array $whitelist - * @return Form + * @return static */ - public function setWhitelist(array $whitelist): Form + public function setWhitelist(array $whitelist): static { } @@ -478,9 +481,9 @@ public function setWhitelist(array $whitelist): Form * * @param string $option * @param mixed $value - * @return Form + * @return static */ - public function setUserOption(string $option, $value): Form + public function setUserOption(string $option, $value): static { } @@ -488,9 +491,9 @@ public function setUserOption(string $option, $value): Form * Sets options for the element * * @param array $options - * @return Form + * @return static */ - public function setUserOptions(array $options): Form + public function setUserOptions(array $options): static { } diff --git a/src/Forms/FormsLocator.php b/src/Forms/FormsLocator.php index be3e0301..c3de8bf0 100644 --- a/src/Forms/FormsLocator.php +++ b/src/Forms/FormsLocator.php @@ -11,6 +11,8 @@ use Phalcon\Forms\Element\Check; use Phalcon\Forms\Element\CheckGroup; +use Phalcon\Forms\Exceptions\FormNotInLocator; +use Phalcon\Forms\Exceptions\UnknownFormElementType; use Phalcon\Forms\Element\Date; use Phalcon\Forms\Element\Email; use Phalcon\Forms\Element\File; diff --git a/src/Forms/Loader/ArrayLoader.php b/src/Forms/Loader/ArrayLoader.php index 42205a59..6895ea0d 100644 --- a/src/Forms/Loader/ArrayLoader.php +++ b/src/Forms/Loader/ArrayLoader.php @@ -11,6 +11,8 @@ use Phalcon\Contracts\Forms\Schema; use Phalcon\Forms\Exception; +use Phalcon\Forms\Exceptions\SchemaEntryMissingKey; +use Phalcon\Forms\Exceptions\SchemaEntryNotArray; /** * Supplies form element definitions from a PHP array. @@ -30,8 +32,9 @@ public function __construct(array $definitions) } /** - * @return array + * @phpstan-return array> * @throws Exception + * @return array */ public function load(): array { diff --git a/src/Forms/Loader/JsonLoader.php b/src/Forms/Loader/JsonLoader.php index 8145d2b7..c4d2b8cd 100644 --- a/src/Forms/Loader/JsonLoader.php +++ b/src/Forms/Loader/JsonLoader.php @@ -12,6 +12,8 @@ use InvalidArgumentException; use Phalcon\Contracts\Forms\Schema; use Phalcon\Forms\Exception; +use Phalcon\Forms\Exceptions\InvalidJsonSchema; +use Phalcon\Forms\Exceptions\JsonSchemaNotArray; use Phalcon\Support\Helper\Json\Decode; /** @@ -35,8 +37,9 @@ public function __construct(string $source) } /** - * @return array + * @phpstan-return array> * @throws Exception + * @return array */ public function load(): array { diff --git a/src/Forms/Loader/YamlLoader.php b/src/Forms/Loader/YamlLoader.php index ed12b7ba..d7864fae 100644 --- a/src/Forms/Loader/YamlLoader.php +++ b/src/Forms/Loader/YamlLoader.php @@ -11,6 +11,8 @@ use Phalcon\Contracts\Forms\Schema; use Phalcon\Forms\Exception; +use Phalcon\Forms\Exceptions\YamlExtensionRequired; +use Phalcon\Forms\Exceptions\YamlSchemaNotArray; /** * Supplies form element definitions from a YAML string or file. @@ -35,8 +37,9 @@ public function __construct(string $source) } /** - * @return array + * @phpstan-return array> * @throws Exception + * @return array */ public function load(): array { diff --git a/src/Forms/Manager.php b/src/Forms/Manager.php index f2c9e8b3..c7b87d84 100644 --- a/src/Forms/Manager.php +++ b/src/Forms/Manager.php @@ -10,6 +10,7 @@ namespace Phalcon\Forms; use Phalcon\Contracts\Forms\Schema; +use Phalcon\Forms\Exceptions\FormNotRegistered; use Phalcon\Forms\Form; /** @@ -32,7 +33,7 @@ class Manager * * @param FormsLocator|null $locator */ - public function __construct(FormsLocator $locator = null) + public function __construct(?FormsLocator $locator = null) { } @@ -96,9 +97,9 @@ public function loadForm(string $name, \Phalcon\Contracts\Forms\Schema $schema, * * @param string $name * @param \Phalcon\Forms\Form $form - * @return Manager + * @return static */ - public function set(string $name, \Phalcon\Forms\Form $form): Manager + public function set(string $name, \Phalcon\Forms\Form $form): static { } } diff --git a/src/Html/Attributes.php b/src/Html/Attributes.php index 302410c3..432b806a 100644 --- a/src/Html/Attributes.php +++ b/src/Html/Attributes.php @@ -9,8 +9,9 @@ */ namespace Phalcon\Html; -use Phalcon\Support\Collection; use Phalcon\Html\Attributes\RenderInterface; +use Phalcon\Html\Exceptions\AttributeNotRenderable; +use Phalcon\Support\Collection; /** * This class helps to work with HTML Attributes diff --git a/src/Html/Attributes/AttributesInterface.php b/src/Html/Attributes/AttributesInterface.php index 401c1dfc..ec3fc8b6 100644 --- a/src/Html/Attributes/AttributesInterface.php +++ b/src/Html/Attributes/AttributesInterface.php @@ -12,9 +12,7 @@ use Phalcon\Html\Attributes; /** - * Phalcon\Html\Attributes\AttributesInterface - * - * Interface Phalcon\Html\Attributes\AttributesInterface + * Html Attributes Interface */ interface AttributesInterface { diff --git a/src/Html/Attributes/RenderInterface.php b/src/Html/Attributes/RenderInterface.php index 2d65a23a..2c20ca80 100644 --- a/src/Html/Attributes/RenderInterface.php +++ b/src/Html/Attributes/RenderInterface.php @@ -10,14 +10,12 @@ namespace Phalcon\Html\Attributes; /** - * Phalcon\Html\Attributes\RenderInterface - * - * Interface Phalcon\Html\Attributes\RenderInterface + * Rendering interface for HTML attributes */ interface RenderInterface { /** - * Generate a string represetation + * Generate a string representation * * @return string */ diff --git a/src/Html/Breadcrumbs.php b/src/Html/Breadcrumbs.php index bb23d0d6..d0c2c213 100644 --- a/src/Html/Breadcrumbs.php +++ b/src/Html/Breadcrumbs.php @@ -9,8 +9,6 @@ */ namespace Phalcon\Html; -use Phalcon\Di\DiInterface; - /** * Phalcon\Html\Breadcrumbs * @@ -57,9 +55,9 @@ class Breadcrumbs * * @param string $label * @param string $link - * @return Breadcrumbs + * @return static */ - public function add(string $label, string $link = ''): Breadcrumbs + public function add(string $label, string $link = ''): static { } @@ -118,9 +116,9 @@ public function render(): string /** * @param string $separator * - * @return Breadcrumbs + * @return static */ - public function setSeparator(string $separator): Breadcrumbs + public function setSeparator(string $separator): static { } diff --git a/src/Html/Escaper.php b/src/Html/Escaper.php index 069af882..3d16ff25 100644 --- a/src/Html/Escaper.php +++ b/src/Html/Escaper.php @@ -73,7 +73,12 @@ class Escaper implements \Phalcon\Html\Escaper\EscaperInterface */ protected $urlEscaper; - public function __construct() + /** + * @param string $encoding + * @param int $flags + * @param bool $doubleEncode + */ + public function __construct(string $encoding = 'utf-8', int $flags = 11, bool $doubleEncode = true) { } @@ -85,7 +90,7 @@ public function __construct() * * @return string */ - public function attributes($input): string + public function attributes($input = null): string { } @@ -120,12 +125,12 @@ public function escapeCss(string $input): string } /** - * @param string $input + * @param string|null $input * * @return string * @deprecated */ - public function escapeJs(string $input): string + public function escapeHtml(?string $input = null): string { } @@ -135,17 +140,17 @@ public function escapeJs(string $input): string * @return string * @deprecated */ - public function escapeHtml(string $input = null): string + public function escapeHtmlAttr(?string $input = null): string { } /** - * @param string|null $input + * @param string $input * * @return string * @deprecated */ - public function escapeHtmlAttr(string $input = null): string + public function escapeJs(string $input): string { } @@ -215,7 +220,7 @@ public function getUrlEscaper(): UrlEscaper * * @return string */ - public function html(string $input = null): string + public function html(?string $input = null): string { } @@ -242,18 +247,18 @@ final public function normalizeEncoding(string $input): string /** * @param AttributeEscaper $escaper * - * @return Escaper + * @return static */ - public function setAttributeEscaper(\Phalcon\Html\Escaper\AttributeEscaper $escaper): Escaper + public function setAttributeEscaper(\Phalcon\Html\Escaper\AttributeEscaper $escaper): static { } /** * @param CssEscaper $escaper * - * @return Escaper + * @return static */ - public function setCssEscaper(\Phalcon\Html\Escaper\CssEscaper $escaper): Escaper + public function setCssEscaper(\Phalcon\Html\Escaper\CssEscaper $escaper): static { } @@ -261,9 +266,9 @@ public function setCssEscaper(\Phalcon\Html\Escaper\CssEscaper $escaper): Escape * Sets the double_encode flag. Fans out to all sub-objects. * * @param bool $doubleEncode - * @return Escaper + * @return static */ - public function setDoubleEncode(bool $doubleEncode): Escaper + public function setDoubleEncode(bool $doubleEncode): static { } @@ -271,9 +276,9 @@ public function setDoubleEncode(bool $doubleEncode): Escaper * Sets the encoding. Fans out to all sub-objects. * * @param string $encoding - * @return EscaperInterface + * @return static */ - public function setEncoding(string $encoding): EscaperInterface + public function setEncoding(string $encoding): static { } @@ -281,18 +286,18 @@ public function setEncoding(string $encoding): EscaperInterface * Sets the htmlspecialchars flags. Fans out to all sub-objects. * * @param int $flags - * @return EscaperInterface + * @return static */ - public function setFlags(int $flags): EscaperInterface + public function setFlags(int $flags): static { } /** * @param HtmlEscaper $escaper * - * @return Escaper + * @return static */ - public function setHtmlEscaper(\Phalcon\Html\Escaper\HtmlEscaper $escaper): Escaper + public function setHtmlEscaper(\Phalcon\Html\Escaper\HtmlEscaper $escaper): static { } @@ -300,27 +305,27 @@ public function setHtmlEscaper(\Phalcon\Html\Escaper\HtmlEscaper $escaper): Esca * @param int $flags * * @deprecated - * @return EscaperInterface + * @return static */ - public function setHtmlQuoteType(int $flags): EscaperInterface + public function setHtmlQuoteType(int $flags): static { } /** * @param JsEscaper $escaper * - * @return Escaper + * @return static */ - public function setJsEscaper(\Phalcon\Html\Escaper\JsEscaper $escaper): Escaper + public function setJsEscaper(\Phalcon\Html\Escaper\JsEscaper $escaper): static { } /** * @param UrlEscaper $escaper * - * @return Escaper + * @return static */ - public function setUrlEscaper(\Phalcon\Html\Escaper\UrlEscaper $escaper): Escaper + public function setUrlEscaper(\Phalcon\Html\Escaper\UrlEscaper $escaper): static { } diff --git a/src/Html/Escaper/AbstractEscaper.php b/src/Html/Escaper/AbstractEscaper.php index eac36829..1febcfaf 100644 --- a/src/Html/Escaper/AbstractEscaper.php +++ b/src/Html/Escaper/AbstractEscaper.php @@ -89,22 +89,25 @@ final public function normalizeEncoding(string $input): string /** * @param bool $doubleEncode + * @return static */ - public function setDoubleEncode(bool $doubleEncode) + public function setDoubleEncode(bool $doubleEncode): static { } /** * @param string $encoding + * @return static */ - public function setEncoding(string $encoding) + public function setEncoding(string $encoding): static { } /** * @param int $flags + * @return static */ - public function setFlags(int $flags) + public function setFlags(int $flags): static { } } diff --git a/src/Html/Escaper/CssEscaper.php b/src/Html/Escaper/CssEscaper.php index a4eef8cf..ac343dae 100644 --- a/src/Html/Escaper/CssEscaper.php +++ b/src/Html/Escaper/CssEscaper.php @@ -11,8 +11,7 @@ /** * Escapes a string for use inside a CSS value by replacing non-alphanumeric - * characters with their hexadecimal escape sequence. Wraps the C-level - * `phalcon_escape_css` after normalising the input to UTF-32. + * characters with their hexadecimal escape sequence. */ class CssEscaper extends \Phalcon\Html\Escaper\AbstractEscaper { diff --git a/src/Html/Escaper/Exception.php b/src/Html/Escaper/Exception.php index 0816474d..38081a01 100644 --- a/src/Html/Escaper/Exception.php +++ b/src/Html/Escaper/Exception.php @@ -10,7 +10,7 @@ namespace Phalcon\Html\Escaper; /** - * Exceptions thrown in Phalcon\Html\Escaper will use this class + * Class Exception */ class Exception extends \Exception { diff --git a/src/Html/Escaper/HtmlEscaper.php b/src/Html/Escaper/HtmlEscaper.php index cee3173e..6658aa6a 100644 --- a/src/Html/Escaper/HtmlEscaper.php +++ b/src/Html/Escaper/HtmlEscaper.php @@ -19,7 +19,7 @@ class HtmlEscaper extends \Phalcon\Html\Escaper\AbstractEscaper * * @return string */ - public function __invoke(string $input = null): string + public function __invoke(?string $input = null): string { } @@ -28,7 +28,7 @@ public function __invoke(string $input = null): string * * @return string */ - public function escape(string $input = null): string + public function escape(?string $input = null): string { } } diff --git a/src/Html/Escaper/JsEscaper.php b/src/Html/Escaper/JsEscaper.php index 0e39f9bb..de7156f6 100644 --- a/src/Html/Escaper/JsEscaper.php +++ b/src/Html/Escaper/JsEscaper.php @@ -12,8 +12,6 @@ /** * Escapes a string for use inside a JavaScript context by replacing * non-alphanumeric characters with their hexadecimal escape sequence. - * Wraps the C-level `phalcon_escape_js` after normalising the input to - * UTF-32. */ class JsEscaper extends \Phalcon\Html\Escaper\AbstractEscaper { diff --git a/src/Html/Escaper/UrlEscaper.php b/src/Html/Escaper/UrlEscaper.php index e324e94c..4a1053a2 100644 --- a/src/Html/Escaper/UrlEscaper.php +++ b/src/Html/Escaper/UrlEscaper.php @@ -10,9 +10,7 @@ namespace Phalcon\Html\Escaper; /** - * Escapes a string for use as a URL component via `rawurlencode`. The - * encoding/flags/doubleEncode setters are accepted for symmetry with the - * other contexts but have no effect on the output. + * Escapes a string for use as a URL component via `rawurlencode`. */ class UrlEscaper extends \Phalcon\Html\Escaper\AbstractEscaper { diff --git a/src/Html/Exception.php b/src/Html/Exception.php index 22ebfabc..629f5acc 100644 --- a/src/Html/Exception.php +++ b/src/Html/Exception.php @@ -10,9 +10,9 @@ namespace Phalcon\Html; /** - * Phalcon\Html\Tag\Exception + * Phalcon\Html\Exception * - * Exceptions thrown in Phalcon\Html\Tag will use this class + * Exceptions thrown in Phalcon\Html will use this class */ class Exception extends \Exception { diff --git a/src/Html/Exceptions/AttributeNotRenderable.php b/src/Html/Exceptions/AttributeNotRenderable.php new file mode 100644 index 00000000..c44d807a --- /dev/null +++ b/src/Html/Exceptions/AttributeNotRenderable.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Html\Exceptions; + +use Phalcon\Html\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AttributeNotRenderable extends Exception +{ + /** + * @param string $key + * @param string $type + */ + public function __construct(string $key, string $type) + { + } +} diff --git a/src/Html/Exceptions/FriendlyTitleConversionFailed.php b/src/Html/Exceptions/FriendlyTitleConversionFailed.php new file mode 100644 index 00000000..475e0c67 --- /dev/null +++ b/src/Html/Exceptions/FriendlyTitleConversionFailed.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Html\Exceptions; + +use Phalcon\Html\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FriendlyTitleConversionFailed extends Exception +{ + /** + * @param string $message + */ + public function __construct(string $message) + { + } +} diff --git a/src/Html/Exceptions/InvalidResultsetValue.php b/src/Html/Exceptions/InvalidResultsetValue.php new file mode 100644 index 00000000..e31100b2 --- /dev/null +++ b/src/Html/Exceptions/InvalidResultsetValue.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Html\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidResultsetValue extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Html/Exceptions/ServiceNotRegistered.php b/src/Html/Exceptions/ServiceNotRegistered.php new file mode 100644 index 00000000..099c8822 --- /dev/null +++ b/src/Html/Exceptions/ServiceNotRegistered.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Html\Exceptions; + +use Phalcon\Html\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ServiceNotRegistered extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Html/Exceptions/UsingRequiresTwoValues.php b/src/Html/Exceptions/UsingRequiresTwoValues.php new file mode 100644 index 00000000..a1b31492 --- /dev/null +++ b/src/Html/Exceptions/UsingRequiresTwoValues.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Html\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UsingRequiresTwoValues extends InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Html/Helper/AbstractHelper.php b/src/Html/Helper/AbstractHelper.php index fc4bd71b..f3fccba5 100644 --- a/src/Html/Helper/AbstractHelper.php +++ b/src/Html/Helper/AbstractHelper.php @@ -49,9 +49,9 @@ abstract class AbstractHelper * AbstractHelper constructor. * * @param EscaperInterface $escaper - * @param Doctype $doctype + * @param Doctype|null $doctype */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null) { } @@ -67,6 +67,22 @@ protected function close(string $tag, bool $raw = false): string { } + /** + * Forces a single key into the attribute array, stripping any user-supplied + * value for that key first. Used by helpers whose first positional argument + * is itself an attribute (`href` for Anchor, `src` for Img, etc.) to make + * sure that argument always wins. + * + * @param string $key + * @param string $value + * @param array $attributes + * + * @return array + */ + protected function injectAttribute(string $key, string $value, array $attributes): array + { + } + /** * Replicates the indent x times as per indentLevel * @@ -77,7 +93,7 @@ protected function indent(): string } /** - * Keeps all the attributes sorted - same order all the tome + * Keeps all the attributes sorted - same order all the time * * @param array $overrides * @param array $attributes @@ -112,22 +128,6 @@ protected function renderAttributes(array $attributes): string { } - /** - * Forces a single key into the attribute array, stripping any user-supplied - * value for that key first. Used by helpers whose first positional argument - * is itself an attribute (`href` for Anchor, `src` for Img, etc.) to make - * sure that argument always wins. - * - * @param string $key - * @param string $value - * @param array $attributes - * - * @return array - */ - protected function injectAttribute(string $key, string $value, array $attributes): array - { - } - /** * Renders an element * diff --git a/src/Html/Helper/AbstractList.php b/src/Html/Helper/AbstractList.php index 5f2c247a..757332cd 100644 --- a/src/Html/Helper/AbstractList.php +++ b/src/Html/Helper/AbstractList.php @@ -36,9 +36,9 @@ abstract class AbstractList extends \Phalcon\Html\Helper\AbstractHelper * @param string $delimiter * @param array $attributes * - * @return AbstractList + * @return static */ - public function __invoke(string $indent = ' ', string $delimiter = null, array $attributes = []): AbstractList + public function __invoke(string $indent = ' ', ?string $delimiter = null, array $attributes = []): static { } diff --git a/src/Html/Helper/AbstractSeries.php b/src/Html/Helper/AbstractSeries.php index 34d72419..30945ea8 100644 --- a/src/Html/Helper/AbstractSeries.php +++ b/src/Html/Helper/AbstractSeries.php @@ -29,9 +29,9 @@ abstract class AbstractSeries extends \Phalcon\Html\Helper\AbstractHelper * @param string $indent * @param string $delimiter * - * @return AbstractSeries + * @return static */ - public function __invoke(string $indent = ' ', string $delimiter = null): AbstractSeries + public function __invoke(string $indent = ' ', ?string $delimiter = null): static { } @@ -50,9 +50,9 @@ public function __toString() /** * Resets the internal store. * - * @return AbstractSeries + * @return static */ - public function reset(): AbstractSeries + public function reset(): static { } diff --git a/src/Html/Helper/Anchor.php b/src/Html/Helper/Anchor.php index 963e870c..d9b974c9 100644 --- a/src/Html/Helper/Anchor.php +++ b/src/Html/Helper/Anchor.php @@ -29,7 +29,7 @@ class Anchor extends \Phalcon\Html\Helper\AbstractHelper * @param Doctype $doctype * @param bool $forceRaw */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = false) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null, bool $forceRaw = false) { } diff --git a/src/Html/Helper/Base.php b/src/Html/Helper/Base.php index 2b7dc357..eeb2f6f0 100644 --- a/src/Html/Helper/Base.php +++ b/src/Html/Helper/Base.php @@ -25,7 +25,7 @@ class Base extends \Phalcon\Html\Helper\AbstractHelper * @return string * @throws Exception */ - public function __invoke(string $href = null, array $attributes = []): string + public function __invoke(?string $href = null, array $attributes = []): string { } } diff --git a/src/Html/Helper/Breadcrumbs.php b/src/Html/Helper/Breadcrumbs.php index 90a862cb..60fb4b4c 100644 --- a/src/Html/Helper/Breadcrumbs.php +++ b/src/Html/Helper/Breadcrumbs.php @@ -92,7 +92,7 @@ class Breadcrumbs extends \Phalcon\Html\Helper\AbstractHelper * @param EscaperInterface $escaper * @param UrlInterface|null $url */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, \Phalcon\Mvc\Url\UrlInterface $url = null) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?\Phalcon\Mvc\Url\UrlInterface $url = null) { } @@ -100,10 +100,10 @@ public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, \Ph * Sets the indent and delimiter and returns the object back. * * @param string $indent - * @param string $delimiter - * @return Breadcrumbs + * @param string|null $delimiter + * @return static */ - public function __invoke(string $indent = ' ', string $delimiter = null): Breadcrumbs + public function __invoke(string $indent = ' ', ?string $delimiter = null): static { } @@ -125,9 +125,9 @@ public function __invoke(string $indent = ' ', string $delimiter = null): Bre * @param string $link * @param string $icon * @param array $attributes - * @return Breadcrumbs + * @return static */ - public function add(string $text, string $link = '', string $icon = '', array $attributes = []): Breadcrumbs + public function add(string $text, string $link = '', string $icon = '', array $attributes = []): static { } @@ -147,9 +147,9 @@ public function clear(): void /** * Clear the attributes of the parent element. * - * @return Breadcrumbs + * @return static */ - public function clearAttributes(): Breadcrumbs + public function clearAttributes(): static { } @@ -221,9 +221,9 @@ public function render(): string * Set the attributes for the parent element. * * @param array $attributes - * @return Breadcrumbs + * @return static */ - public function setAttributes(array $attributes): Breadcrumbs + public function setAttributes(array $attributes): static { } @@ -232,9 +232,9 @@ public function setAttributes(array $attributes): Breadcrumbs * When a Url service was injected, calling this method replaces it. * * @param string $prefix - * @return Breadcrumbs + * @return static */ - public function setPrefix(string $prefix): Breadcrumbs + public function setPrefix(string $prefix): static { } @@ -242,9 +242,9 @@ public function setPrefix(string $prefix): Breadcrumbs * Set the separator. * * @param string $separator - * @return Breadcrumbs + * @return static */ - public function setSeparator(string $separator): Breadcrumbs + public function setSeparator(string $separator): static { } @@ -254,9 +254,9 @@ public function setSeparator(string $separator): Breadcrumbs * @param string $main * @param string $line * @param string $last - * @return Breadcrumbs + * @return static */ - public function setTemplate(string $main, string $line, string $last): Breadcrumbs + public function setTemplate(string $main, string $line, string $last): static { } diff --git a/src/Html/Helper/Button.php b/src/Html/Helper/Button.php index 27021c6f..af7bb310 100644 --- a/src/Html/Helper/Button.php +++ b/src/Html/Helper/Button.php @@ -29,7 +29,7 @@ class Button extends \Phalcon\Html\Helper\AbstractHelper * @param Doctype $doctype * @param bool $forceRaw */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = false) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null, bool $forceRaw = false) { } diff --git a/src/Html/Helper/Doctype.php b/src/Html/Helper/Doctype.php index ae30925c..18075299 100644 --- a/src/Html/Helper/Doctype.php +++ b/src/Html/Helper/Doctype.php @@ -88,9 +88,9 @@ public function __construct() * * @param int $type * @param string $delimiter - * @return Doctype + * @return static */ - public function __invoke(int $type = self::HTML5, string $delimiter = '\\n'): Doctype + public function __invoke(int $type = self::HTML5, string $delimiter = '\\n'): static { } diff --git a/src/Html/Helper/Element.php b/src/Html/Helper/Element.php index 687c8c14..cbe9ae29 100644 --- a/src/Html/Helper/Element.php +++ b/src/Html/Helper/Element.php @@ -29,7 +29,7 @@ class Element extends \Phalcon\Html\Helper\AbstractHelper * @param Doctype $doctype * @param bool $forceRaw */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = false) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null, bool $forceRaw = false) { } diff --git a/src/Html/Helper/FriendlyTitle.php b/src/Html/Helper/FriendlyTitle.php index 965808fb..4aa207a5 100644 --- a/src/Html/Helper/FriendlyTitle.php +++ b/src/Html/Helper/FriendlyTitle.php @@ -11,6 +11,7 @@ use Phalcon\Html\Escaper\EscaperInterface; use Phalcon\Html\Exception; +use Phalcon\Html\Exceptions\FriendlyTitleConversionFailed; use Phalcon\Support\Helper\Str\Friendly; /** diff --git a/src/Html/Helper/Input/AbstractChecked.php b/src/Html/Helper/Input/AbstractChecked.php index 7fa93032..5c13223a 100644 --- a/src/Html/Helper/Input/AbstractChecked.php +++ b/src/Html/Helper/Input/AbstractChecked.php @@ -41,7 +41,7 @@ abstract class AbstractChecked extends \Phalcon\Html\Helper\Input\AbstractInput * @param EscaperInterface $escaper * @param Doctype $doctype */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, \Phalcon\Html\Helper\Doctype $doctype = null) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?\Phalcon\Html\Helper\Doctype $doctype = null) { } @@ -64,9 +64,9 @@ public function __toString() * * @param array $attributes * - * @return AbstractChecked + * @return static */ - public function label(array $attributes = []): AbstractChecked + public function label(array $attributes = []): static { } @@ -79,9 +79,9 @@ public function label(array $attributes = []): AbstractChecked * * @param bool $flag * - * @return AbstractChecked + * @return static */ - public function strict(bool $flag = true): AbstractChecked + public function strict(bool $flag = true): static { } diff --git a/src/Html/Helper/Input/AbstractGroup.php b/src/Html/Helper/Input/AbstractGroup.php index 9fee2df1..e0a47877 100644 --- a/src/Html/Helper/Input/AbstractGroup.php +++ b/src/Html/Helper/Input/AbstractGroup.php @@ -56,9 +56,9 @@ abstract class AbstractGroup extends AbstractHelper * @param mixed $checked * @param array $attributes * - * @return AbstractGroup + * @return static */ - public function __invoke(string $name, array $options, $checked = null, array $attributes = []): AbstractGroup + public function __invoke(string $name, array $options, $checked = null, array $attributes = []): static { } diff --git a/src/Html/Helper/Input/AbstractInput.php b/src/Html/Helper/Input/AbstractInput.php index 19aa690d..61c13e91 100644 --- a/src/Html/Helper/Input/AbstractInput.php +++ b/src/Html/Helper/Input/AbstractInput.php @@ -36,9 +36,9 @@ abstract class AbstractInput extends AbstractHelper * @param string|null $value * @param array $attributes * - * @return AbstractInput + * @return static */ - public function __invoke(string $name, string $value = null, array $attributes = []): AbstractInput + public function __invoke(string $name, ?string $value = null, array $attributes = []): static { } @@ -56,9 +56,9 @@ public function __toString() * * @param string|null $value * - * @return AbstractInput + * @return static */ - public function setValue(string $value = null): AbstractInput + public function setValue(?string $value = null): static { } } diff --git a/src/Html/Helper/Input/Email.php b/src/Html/Helper/Input/Email.php deleted file mode 100644 index 4e65729f..00000000 --- a/src/Html/Helper/Input/Email.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Email - */ -class Email extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'email'; -} diff --git a/src/Html/Helper/Input/Generic.php b/src/Html/Helper/Input/Generic.php index b500bf84..d98fbfc1 100644 --- a/src/Html/Helper/Input/Generic.php +++ b/src/Html/Helper/Input/Generic.php @@ -26,7 +26,7 @@ class Generic extends \Phalcon\Html\Helper\Input\AbstractInput * @param Doctype $doctype * @param string $type */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, \Phalcon\Html\Helper\Doctype $doctype = null, string $type = 'text') + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?\Phalcon\Html\Helper\Doctype $doctype = null, string $type = 'text') { } diff --git a/src/Html/Helper/Input/Hidden.php b/src/Html/Helper/Input/Hidden.php deleted file mode 100644 index 218fda1a..00000000 --- a/src/Html/Helper/Input/Hidden.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Hidden - */ -class Hidden extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'hidden'; -} diff --git a/src/Html/Helper/Input/Image.php b/src/Html/Helper/Input/Image.php deleted file mode 100644 index 98cacd9c..00000000 --- a/src/Html/Helper/Input/Image.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Image - */ -class Image extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'image'; -} diff --git a/src/Html/Helper/Input/Month.php b/src/Html/Helper/Input/Month.php deleted file mode 100644 index 1835a7aa..00000000 --- a/src/Html/Helper/Input/Month.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Month - */ -class Month extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'month'; -} diff --git a/src/Html/Helper/Input/Numeric.php b/src/Html/Helper/Input/Numeric.php deleted file mode 100644 index 1b9768d0..00000000 --- a/src/Html/Helper/Input/Numeric.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Numeric - */ -class Numeric extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'number'; -} diff --git a/src/Html/Helper/Input/Password.php b/src/Html/Helper/Input/Password.php deleted file mode 100644 index f03f3911..00000000 --- a/src/Html/Helper/Input/Password.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Password - */ -class Password extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'password'; -} diff --git a/src/Html/Helper/Input/Range.php b/src/Html/Helper/Input/Range.php deleted file mode 100644 index 59c8f6d1..00000000 --- a/src/Html/Helper/Input/Range.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Range - */ -class Range extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'range'; -} diff --git a/src/Html/Helper/Input/Search.php b/src/Html/Helper/Input/Search.php deleted file mode 100644 index b3908c25..00000000 --- a/src/Html/Helper/Input/Search.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Search - */ -class Search extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'search'; -} diff --git a/src/Html/Helper/Input/Select.php b/src/Html/Helper/Input/Select.php index d08ae12f..df8b9598 100644 --- a/src/Html/Helper/Input/Select.php +++ b/src/Html/Helper/Input/Select.php @@ -45,9 +45,9 @@ class Select extends AbstractList * @param array $attributes * @param bool $raw * - * @return Select + * @return static */ - public function add(string $text, string $value = null, array $attributes = [], bool $raw = false): Select + public function add(string $text, ?string $value = null, array $attributes = [], bool $raw = false): static { } @@ -59,9 +59,9 @@ public function add(string $text, string $value = null, array $attributes = [], * @param array $attributes * @param bool $raw * - * @return Select + * @return static */ - public function addPlaceholder(string $text, $value = null, array $attributes = [], bool $raw = false): Select + public function addPlaceholder(string $text, ?string $value = null, array $attributes = [], bool $raw = false): static { } @@ -72,9 +72,9 @@ public function addPlaceholder(string $text, $value = null, array $attributes = * Optgroup entries: key = group label, value = [value => label] array. * * @param SelectData $data * - * @return Select + * @return static */ - public function fromData(\Phalcon\Contracts\Html\Helper\Input\SelectData $data): Select + public function fromData(\Phalcon\Contracts\Html\Helper\Input\SelectData $data): static { } @@ -84,31 +84,31 @@ public function fromData(\Phalcon\Contracts\Html\Helper\Input\SelectData $data): * @param string $label * @param array $attributes * - * @return Select + * @return static */ - public function optGroup(string $label = null, array $attributes = []): Select + public function optGroup(?string $label = null, array $attributes = []): static { } /** * Adds a non-selectable placeholder option as the first entry. Renders * as ``, matching the - * common HTML idiom for "Choose…"-style prompts. + * common HTML idiom for "Choose..."-style prompts. * * @param string $text * - * @return Select + * @return static */ - public function placeholder(string $text): Select + public function placeholder(string $text): static { } /** * @param string $selected * - * @return Select + * @return static */ - public function selected(string $selected): Select + public function selected(string $selected): static { } @@ -120,9 +120,9 @@ public function selected(string $selected): Select * * @param bool $flag * - * @return Select + * @return static */ - public function strict(bool $flag = true): Select + public function strict(bool $flag = true): static { } @@ -159,7 +159,7 @@ protected function optGroupStart(string $label, array $attributes): string * * @return array */ - private function processValue(array $attributes, $value = null): array + private function processValue(array $attributes, ?string $value = null): array { } } diff --git a/src/Html/Helper/Input/Select/ResultsetData.php b/src/Html/Helper/Input/Select/ResultsetData.php index 22e9b56b..3b586f56 100644 --- a/src/Html/Helper/Input/Select/ResultsetData.php +++ b/src/Html/Helper/Input/Select/ResultsetData.php @@ -11,6 +11,8 @@ use InvalidArgumentException; use Phalcon\Contracts\Html\Helper\Input\SelectData; +use Phalcon\Html\Exceptions\InvalidResultsetValue; +use Phalcon\Html\Exceptions\UsingRequiresTwoValues; use Phalcon\Mvc\Model\ResultsetInterface; /** @@ -63,6 +65,8 @@ public function __construct(\Phalcon\Mvc\Model\ResultsetInterface $resultset, ar } /** + * Returns per-option attribute maps, keyed by option value. + * * @return array */ public function getAttributes(): array @@ -90,7 +94,8 @@ protected function readField($option, string $field) /** * Walks the resultset once, building both the option map and the * per-option resolved attribute map. Closures in `attributesMap` - * receive the current row; string values are passed through. + * receive the current row; static values are passed through. + * `false` or `null` values skip the attribute entirely. * * @return void */ diff --git a/src/Html/Helper/Input/Select/SelectDataInterface.php b/src/Html/Helper/Input/Select/SelectDataInterface.php deleted file mode 100644 index 01788582..00000000 --- a/src/Html/Helper/Input/Select/SelectDataInterface.php +++ /dev/null @@ -1,24 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input\Select; - -/** - * Interface for SELECT option data providers. - * - * Return format: [value => label] for flat options; - * [groupLabel => [value => label, ...]] for optgroups. - */ -interface SelectDataInterface -{ - /** - * @return array - */ - public function getOptions(): array; -} diff --git a/src/Html/Helper/Input/Submit.php b/src/Html/Helper/Input/Submit.php deleted file mode 100644 index b0f217f8..00000000 --- a/src/Html/Helper/Input/Submit.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Submit - */ -class Submit extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'submit'; -} diff --git a/src/Html/Helper/Input/Time.php b/src/Html/Helper/Input/Time.php deleted file mode 100644 index a81826c0..00000000 --- a/src/Html/Helper/Input/Time.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Time - */ -class Time extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'time'; -} diff --git a/src/Html/Helper/Input/Week.php b/src/Html/Helper/Input/Week.php deleted file mode 100644 index c88ab568..00000000 --- a/src/Html/Helper/Input/Week.php +++ /dev/null @@ -1,18 +0,0 @@ - - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. - */ -namespace Phalcon\Html\Helper\Input; - -/** - * Class Week - */ -class Week extends \Phalcon\Html\Helper\Input\AbstractInput -{ - protected $type = 'week'; -} diff --git a/src/Html/Helper/Label.php b/src/Html/Helper/Label.php index ba7c37db..7007e2a2 100644 --- a/src/Html/Helper/Label.php +++ b/src/Html/Helper/Label.php @@ -29,7 +29,7 @@ class Label extends \Phalcon\Html\Helper\AbstractHelper * @param Doctype $doctype * @param bool $forceRaw */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = false) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null, bool $forceRaw = false) { } diff --git a/src/Html/Helper/Link.php b/src/Html/Helper/Link.php index e37dc773..af367654 100644 --- a/src/Html/Helper/Link.php +++ b/src/Html/Helper/Link.php @@ -20,15 +20,9 @@ class Link extends \Phalcon\Html\Helper\Style * @param string $url * @param array $attributes * @param int $position + * @return static */ - public function add(string $url, array $attributes = [], int $position = -1) - { - } - - /** - * @return string - */ - protected function getTag(): string + public function add(string $url, array $attributes = [], int $position = -1): static { } @@ -43,4 +37,11 @@ protected function getTag(): string protected function getAttributes(string $url, array $attributes): array { } + + /** + * @return string + */ + protected function getTag(): string + { + } } diff --git a/src/Html/Helper/Meta.php b/src/Html/Helper/Meta.php index 43270f91..a114242c 100644 --- a/src/Html/Helper/Meta.php +++ b/src/Html/Helper/Meta.php @@ -21,10 +21,10 @@ class Meta extends \Phalcon\Html\Helper\AbstractSeries * * @param array $attributes * - * @return Meta + * @return static * @param int $position */ - public function add(array $attributes = [], int $position = -1): Meta + public function add(array $attributes = [], int $position = -1): static { } @@ -33,10 +33,10 @@ public function add(array $attributes = [], int $position = -1): Meta * @param string $content * @param int $position * - * @return Meta + * @return static * @throws Exception */ - public function addHttp(string $httpEquiv, string $content, int $position = -1): Meta + public function addHttp(string $httpEquiv, string $content, int $position = -1): static { } @@ -45,10 +45,10 @@ public function addHttp(string $httpEquiv, string $content, int $position = -1): * @param string $content * @param int $position * - * @return Meta + * @return static * @throws Exception */ - public function addName(string $name, string $content, int $position = -1): Meta + public function addName(string $name, string $content, int $position = -1): static { } @@ -57,10 +57,10 @@ public function addName(string $name, string $content, int $position = -1): Meta * @param string $content * @param int $position * - * @return Meta + * @return static * @throws Exception */ - public function addProperty(string $name, string $content, int $position = -1): Meta + public function addProperty(string $name, string $content, int $position = -1): static { } @@ -77,10 +77,10 @@ protected function getTag(): string * @param string $content * @param int $position * - * @return Meta + * @return static * @throws Exception */ - private function addElement(string $element, string $value, string $content, int $position = -1): Meta + private function addElement(string $element, string $value, string $content, int $position = -1): static { } } diff --git a/src/Html/Helper/Ol.php b/src/Html/Helper/Ol.php index 7641c610..cb820078 100644 --- a/src/Html/Helper/Ol.php +++ b/src/Html/Helper/Ol.php @@ -28,7 +28,7 @@ class Ol extends \Phalcon\Html\Helper\AbstractList * @param Doctype $doctype * @param bool $forceRaw */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doctype $doctype = null, bool $forceRaw = false) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?Doctype $doctype = null, bool $forceRaw = false) { } @@ -39,9 +39,9 @@ public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, Doc * @param array $attributes * @param bool $raw * - * @return AbstractList + * @return static */ - public function add(string $text, array $attributes = [], bool $raw = false): AbstractList + public function add(string $text, array $attributes = [], bool $raw = false): static { } diff --git a/src/Html/Helper/Preload.php b/src/Html/Helper/Preload.php index 55a63e9d..23602405 100644 --- a/src/Html/Helper/Preload.php +++ b/src/Html/Helper/Preload.php @@ -29,7 +29,7 @@ class Preload extends \Phalcon\Html\Helper\AbstractHelper * @param EscaperInterface $escaper * @param ResponseInterface|null $response */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, \Phalcon\Http\ResponseInterface $response = null) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, ?\Phalcon\Http\ResponseInterface $response = null) { } diff --git a/src/Html/Helper/Script.php b/src/Html/Helper/Script.php index 3dfdb51c..2338da5a 100644 --- a/src/Html/Helper/Script.php +++ b/src/Html/Helper/Script.php @@ -22,11 +22,11 @@ class Script extends \Phalcon\Html\Helper\AbstractSeries * @param string $url * @param array $attributes * - * @return $this + * @return static * @throws Exception * @param int $position */ - public function add(string $url, array $attributes = [], int $position = -1) + public function add(string $url, array $attributes = [], int $position = -1): static { } @@ -50,9 +50,9 @@ public function beginInternal(): void * @param array $attributes * @param int $position * - * @return Script + * @return static */ - public function endInternal(array $attributes = [], int $position = -1): Script + public function endInternal(array $attributes = [], int $position = -1): static { } diff --git a/src/Html/Helper/Style.php b/src/Html/Helper/Style.php index dd399f90..decd543d 100644 --- a/src/Html/Helper/Style.php +++ b/src/Html/Helper/Style.php @@ -27,11 +27,11 @@ class Style extends \Phalcon\Html\Helper\AbstractSeries * @param string $url * @param array $attributes * - * @return $this + * @return static * @throws Exception * @param int $position */ - public function add(string $url, array $attributes = [], int $position = -1) + public function add(string $url, array $attributes = [], int $position = -1): static { } @@ -39,9 +39,9 @@ public function add(string $url, array $attributes = [], int $position = -1) * Sets if this is a style or link tag * * @param bool $flag - * @return Style + * @return static */ - public function setStyle(bool $flag): Style + public function setStyle(bool $flag): static { } diff --git a/src/Html/Helper/Title.php b/src/Html/Helper/Title.php index e05ce4c2..2add0d36 100644 --- a/src/Html/Helper/Title.php +++ b/src/Html/Helper/Title.php @@ -49,9 +49,9 @@ class Title extends \Phalcon\Html\Helper\AbstractHelper * @param string $indent * @param string|null $delimiter * - * @return Title + * @return static */ - public function __invoke(string $indent = ' ', string $delimiter = null): Title + public function __invoke(string $indent = ' ', ?string $delimiter = null): static { } @@ -71,9 +71,9 @@ public function __toString() * @param string $text * @param bool $raw * - * @return Title + * @return static */ - public function append(string $text, bool $raw = false): Title + public function append(string $text, bool $raw = false): static { } @@ -92,9 +92,9 @@ public function get(): string * @param string $text * @param bool $raw * - * @return Title + * @return static */ - public function set(string $text, bool $raw = false): Title + public function set(string $text, bool $raw = false): static { } @@ -104,9 +104,9 @@ public function set(string $text, bool $raw = false): Title * @param string $separator * @param bool $raw * - * @return Title + * @return static */ - public function setSeparator(string $separator, bool $raw = false): Title + public function setSeparator(string $separator, bool $raw = false): static { } @@ -116,9 +116,9 @@ public function setSeparator(string $separator, bool $raw = false): Title * @param string $text * @param bool $raw * - * @return Title + * @return static */ - public function prepend(string $text, bool $raw = false): Title + public function prepend(string $text, bool $raw = false): static { } } diff --git a/src/Html/Link/AbstractLink.php b/src/Html/Link/AbstractLink.php index a8062d43..3c04bec3 100644 --- a/src/Html/Link/AbstractLink.php +++ b/src/Html/Link/AbstractLink.php @@ -12,10 +12,10 @@ use Phalcon\Support\Collection; /** - * @property array $attributes - * @property string $href - * @property array $rels - * @property bool $templated + * @property Collection $attributes + * @property string $href + * @property Collection $rels + * @property bool $templated */ abstract class AbstractLink { @@ -102,34 +102,30 @@ protected function doIsTemplated(): bool } /** - * Determines if a href is a templated link or not. - * - * @see https://tools.ietf.org/html/rfc6570 - * - * @param string $href + * @param string $key + * @param string|array $value * - * @return bool + * @return mixed */ - protected function hrefIsTemplated(string $href): bool + protected function doWithAttribute(string $key, $value): static { } /** - * @param string $key - * @param string|array $value + * @param string $href * * @return mixed */ - protected function doWithAttribute(string $key, $value) + protected function doWithHref(string $href): static { } /** - * @param string $href + * @param string $key * * @return mixed */ - protected function doWithHref(string $href) + protected function doWithRel(string $key): static { } @@ -138,7 +134,7 @@ protected function doWithHref(string $href) * * @return mixed */ - protected function doWithRel(string $key) + protected function doWithoutAttribute(string $key): static { } @@ -147,16 +143,20 @@ protected function doWithRel(string $key) * * @return mixed */ - protected function doWithoutAttribute(string $key) + protected function doWithoutRel(string $key): static { } /** - * @param string $key + * Determines if a href is a templated link or not. * - * @return mixed + * @see https://tools.ietf.org/html/rfc6570 + * + * @param string $href + * + * @return bool */ - protected function doWithoutRel(string $key) + protected function hrefIsTemplated(string $href): bool { } } diff --git a/src/Html/Link/AbstractLinkProvider.php b/src/Html/Link/AbstractLinkProvider.php index bbf21b83..8f5ccbc6 100644 --- a/src/Html/Link/AbstractLinkProvider.php +++ b/src/Html/Link/AbstractLinkProvider.php @@ -67,9 +67,9 @@ protected function doGetLinksByRel(string $rel): array * @param mixed $link A link object that should be included in this * collection. * - * @return $this + * @return static */ - protected function doWithLink($link) + protected function doWithLink($link): static { } @@ -82,9 +82,9 @@ protected function doWithLink($link) * * @param mixed $link The link to remove. * - * @return $this + * @return static */ - protected function doWithoutLink($link) + protected function doWithoutLink($link): static { } diff --git a/src/Html/Link/EvolvableLink.php b/src/Html/Link/EvolvableLink.php index 9f63fb1a..f34e41c5 100644 --- a/src/Html/Link/EvolvableLink.php +++ b/src/Html/Link/EvolvableLink.php @@ -12,12 +12,7 @@ use Phalcon\Html\Link\Interfaces\EvolvableLinkInterface; /** - * Class Phalcon\Http\Link\EvolvableLink - * - * @property array attributes - * @property string href - * @property array rels - * @property bool templated + * Class Phalcon\Html\Link\EvolvableLink */ class EvolvableLink extends \Phalcon\Html\Link\Link implements \Phalcon\Html\Link\Interfaces\EvolvableLinkInterface { @@ -29,9 +24,9 @@ class EvolvableLink extends \Phalcon\Html\Link\Link implements \Phalcon\Html\Lin * * @param string $attribute The attribute to include. * @param string|array $value The value of the attribute to set. - * @return EvolvableLinkInterface + * @return static */ - public function withAttribute($attribute, $value): EvolvableLinkInterface + public function withAttribute($attribute, $value): static { } @@ -50,9 +45,9 @@ public function withAttribute($attribute, $value): EvolvableLinkInterface * immediately rather than waiting for it to be returned later. * * @param string $rel The relationship value to add. - * @return EvolvableLinkInterface + * @return static */ - public function withHref(string $href): EvolvableLinkInterface + public function withHref(string $href): static { } @@ -63,9 +58,9 @@ public function withHref(string $href): EvolvableLinkInterface * normally without errors, but without adding the rel a second time. * * @param string $rel The relationship value to add. - * @return EvolvableLinkInterface + * @return static */ - public function withRel(string $rel): EvolvableLinkInterface + public function withRel(string $rel): static { } @@ -76,9 +71,9 @@ public function withRel(string $rel): EvolvableLinkInterface * normally without errors. * * @param string $attribute The attribute to remove. - * @return EvolvableLinkInterface + * @return static */ - public function withoutAttribute(string $attribute): EvolvableLinkInterface + public function withoutAttribute(string $attribute): static { } @@ -89,9 +84,9 @@ public function withoutAttribute(string $attribute): EvolvableLinkInterface * normally without errors. * * @param string $rel The relationship value to exclude. - * @return EvolvableLinkInterface + * @return static */ - public function withoutRel(string $rel): EvolvableLinkInterface + public function withoutRel(string $rel): static { } } diff --git a/src/Html/Link/EvolvableLinkProvider.php b/src/Html/Link/EvolvableLinkProvider.php index a8d8aa51..2e89b3e6 100644 --- a/src/Html/Link/EvolvableLinkProvider.php +++ b/src/Html/Link/EvolvableLinkProvider.php @@ -13,9 +13,9 @@ use Phalcon\Html\Link\Interfaces\LinkInterface; /** - * Class Phalcon\Http\Link\LinkProvider + * Class Phalcon\Html\Link\EvolvableLinkProvider * - * @property LinkInterface[] links + * @property LinkInterface[] $links */ class EvolvableLinkProvider extends \Phalcon\Html\Link\LinkProvider implements \Phalcon\Html\Link\Interfaces\EvolvableLinkProviderInterface { @@ -30,7 +30,7 @@ class EvolvableLinkProvider extends \Phalcon\Html\Link\LinkProvider implements \ * * @return static */ - public function withLink(\Phalcon\Html\Link\Interfaces\LinkInterface $link): EvolvableLinkProviderInterface + public function withLink(\Phalcon\Html\Link\Interfaces\LinkInterface $link): static { } @@ -45,7 +45,7 @@ public function withLink(\Phalcon\Html\Link\Interfaces\LinkInterface $link): Evo * * @return static */ - public function withoutLink(\Phalcon\Html\Link\Interfaces\LinkInterface $link): EvolvableLinkProviderInterface + public function withoutLink(\Phalcon\Html\Link\Interfaces\LinkInterface $link): static { } } diff --git a/src/Html/Link/Interfaces/EvolvableLinkInterface.php b/src/Html/Link/Interfaces/EvolvableLinkInterface.php index ee5b2fc9..25745459 100644 --- a/src/Html/Link/Interfaces/EvolvableLinkInterface.php +++ b/src/Html/Link/Interfaces/EvolvableLinkInterface.php @@ -14,6 +14,18 @@ */ interface EvolvableLinkInterface extends \Phalcon\Html\Link\Interfaces\LinkInterface { + /** + * Returns an instance with the specified attribute added. + * + * If the specified attribute is already present, it will be overwritten + * with the new value. + * + * @param string $attribute The attribute to include. + * @param string $value The value of the attribute to set. + * @return EvolvableLinkInterface + */ + public function withAttribute(string $attribute, string $value): EvolvableLinkInterface; + /** * Returns an instance with the specified href. * @@ -44,36 +56,24 @@ public function withHref(string $href): EvolvableLinkInterface; public function withRel(string $rel): EvolvableLinkInterface; /** - * Returns an instance with the specified relationship excluded. + * Returns an instance with the specified attribute excluded. * - * If the specified rel is already not present, this method MUST return + * If the specified attribute is not present, this method MUST return * normally without errors. * - * @param string $rel The relationship value to exclude. - * @return EvolvableLinkInterface - */ - public function withoutRel(string $rel): EvolvableLinkInterface; - - /** - * Returns an instance with the specified attribute added. - * - * If the specified attribute is already present, it will be overwritten - * with the new value. - * - * @param string $attribute The attribute to include. - * @param string $value The value of the attribute to set. + * @param string $attribute The attribute to remove. * @return EvolvableLinkInterface */ - public function withAttribute(string $attribute, string $value): EvolvableLinkInterface; + public function withoutAttribute(string $attribute): EvolvableLinkInterface; /** - * Returns an instance with the specified attribute excluded. + * Returns an instance with the specified relationship excluded. * - * If the specified attribute is not present, this method MUST return + * If the specified rel is already not present, this method MUST return * normally without errors. * - * @param string $attribute The attribute to remove. + * @param string $rel The relationship value to exclude. * @return EvolvableLinkInterface */ - public function withoutAttribute(string $attribute): EvolvableLinkInterface; + public function withoutRel(string $rel): EvolvableLinkInterface; } diff --git a/src/Html/Link/Interfaces/EvolvableLinkProviderInterface.php b/src/Html/Link/Interfaces/EvolvableLinkProviderInterface.php index 2628b768..8d2f0a27 100644 --- a/src/Html/Link/Interfaces/EvolvableLinkProviderInterface.php +++ b/src/Html/Link/Interfaces/EvolvableLinkProviderInterface.php @@ -27,7 +27,7 @@ interface EvolvableLinkProviderInterface extends \Phalcon\Html\Link\Interfaces\L public function withLink(LinkInterface $link): EvolvableLinkProviderInterface; /** - * Returns an instance with the specifed link removed. + * Returns an instance with the specified link removed. * * If the specified link is not present, this method MUST return normally * without errors. The link is present if $link is === identical to a link diff --git a/src/Html/Link/Link.php b/src/Html/Link/Link.php index 1fee80f3..0cba3570 100644 --- a/src/Html/Link/Link.php +++ b/src/Html/Link/Link.php @@ -9,17 +9,10 @@ */ namespace Phalcon\Html\Link; -use Phalcon\Support\Collection; -use Phalcon\Support\Collection\CollectionInterface; use Phalcon\Html\Link\Interfaces\LinkInterface; /** - * Class Phalcon\Http\Link\Link - * - * @property array attributes - * @property string href - * @property array rels - * @property bool templated + * Class Phalcon\Html\Link\Link */ class Link extends \Phalcon\Html\Link\AbstractLink implements \Phalcon\Html\Link\Interfaces\LinkInterface { diff --git a/src/Html/TagFactory.php b/src/Html/TagFactory.php index 196cc7a1..529a77a3 100644 --- a/src/Html/TagFactory.php +++ b/src/Html/TagFactory.php @@ -11,6 +11,7 @@ use Closure; use Phalcon\Html\Escaper\EscaperInterface; +use Phalcon\Html\Exceptions\ServiceNotRegistered; use Phalcon\Html\Helper\Anchor; use Phalcon\Html\Helper\Base; use Phalcon\Html\Helper\Body; @@ -144,10 +145,10 @@ class TagFactory * @phpstan-param array $services * @param \Phalcon\Html\Escaper\EscaperInterface $escaper * @param array $services - * @param \Phalcon\Http\ResponseInterface $response - * @param \Phalcon\Mvc\Url\UrlInterface $url + * @param \Phalcon\Http\ResponseInterface|null $response + * @param \Phalcon\Mvc\Url\UrlInterface|null $url */ - public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, array $services = [], \Phalcon\Http\ResponseInterface $response = null, \Phalcon\Mvc\Url\UrlInterface $url = null) + public function __construct(\Phalcon\Html\Escaper\EscaperInterface $escaper, array $services = [], ?\Phalcon\Http\ResponseInterface $response = null, ?\Phalcon\Mvc\Url\UrlInterface $url = null) { } diff --git a/src/Http/Cookie.php b/src/Http/Cookie.php index 338b6425..0881dd73 100644 --- a/src/Http/Cookie.php +++ b/src/Http/Cookie.php @@ -9,14 +9,17 @@ */ namespace Phalcon\Http; -use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; +use Phalcon\Di\DiInterface; use Phalcon\Encryption\Crypt\CryptInterface; -use Phalcon\Encryption\Crypt\Mismatch; use Phalcon\Filter\FilterInterface; -use Phalcon\Http\Response\Exception; use Phalcon\Http\Cookie\CookieInterface; use Phalcon\Http\Cookie\Exception as CookieException; +use Phalcon\Http\Cookie\Exceptions\CookieKeyTooShort; +use Phalcon\Http\Cookie\Exceptions\CryptInterfaceRequired; +use Phalcon\Http\Cookie\Exceptions\CryptServiceUnavailable; +use Phalcon\Http\Cookie\Exceptions\FilterServiceUnavailable; +use Phalcon\Http\Response\Exception; use Phalcon\Session\ManagerInterface as SessionManagerInterface; /** @@ -67,7 +70,7 @@ class Cookie extends AbstractInjectionAware implements \Phalcon\Http\Cookie\Cook /** * @var bool */ - protected $restored = false; + protected $isRestored = false; /** * @var bool @@ -299,12 +302,12 @@ public function setSecure(bool $secure): CookieInterface * * Use NULL to disable cookie signing. * - * @see \Phalcon\Security\Random + * @see \Phalcon\Encryption\Security\Random * @throws \Phalcon\Http\Cookie\Exception - * @param string $signKey + * @param string|null $signKey * @return CookieInterface */ - public function setSignKey(string $signKey = null): CookieInterface + public function setSignKey(?string $signKey = null): CookieInterface { } diff --git a/src/Http/Cookie/Exceptions/CookieKeyTooShort.php b/src/Http/Cookie/Exceptions/CookieKeyTooShort.php new file mode 100644 index 00000000..b3c11ffd --- /dev/null +++ b/src/Http/Cookie/Exceptions/CookieKeyTooShort.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Cookie\Exceptions; + +use Phalcon\Http\Cookie\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CookieKeyTooShort extends Exception +{ + /** + * @param int $length + */ + public function __construct(int $length) + { + } +} diff --git a/src/Http/Cookie/Exceptions/CryptInterfaceRequired.php b/src/Http/Cookie/Exceptions/CryptInterfaceRequired.php new file mode 100644 index 00000000..435431c3 --- /dev/null +++ b/src/Http/Cookie/Exceptions/CryptInterfaceRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Cookie\Exceptions; + +use Phalcon\Http\Cookie\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CryptInterfaceRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Cookie/Exceptions/CryptServiceUnavailable.php b/src/Http/Cookie/Exceptions/CryptServiceUnavailable.php new file mode 100644 index 00000000..7554cd78 --- /dev/null +++ b/src/Http/Cookie/Exceptions/CryptServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Cookie\Exceptions; + +use Phalcon\Http\Cookie\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CryptServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Cookie/Exceptions/FilterServiceUnavailable.php b/src/Http/Cookie/Exceptions/FilterServiceUnavailable.php new file mode 100644 index 00000000..921a768e --- /dev/null +++ b/src/Http/Cookie/Exceptions/FilterServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Cookie\Exceptions; + +use Phalcon\Http\Cookie\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FilterServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Request.php b/src/Http/Request.php index 884255fd..6562fa7b 100644 --- a/src/Http/Request.php +++ b/src/Http/Request.php @@ -9,16 +9,20 @@ */ namespace Phalcon\Http; -use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; +use Phalcon\Di\DiInterface; use Phalcon\Events\ManagerInterface; use Phalcon\Filter\FilterInterface; use Phalcon\Http\Message\RequestMethodInterface; +use Phalcon\Http\Request\Exception; +use Phalcon\Http\Request\Exceptions\FilterServiceUnavailable; +use Phalcon\Http\Request\Exceptions\InvalidHost; +use Phalcon\Http\Request\Exceptions\InvalidHttpMethod; +use Phalcon\Http\Request\Exceptions\MissingFilters; +use Phalcon\Http\Request\Exceptions\SanitizerNotFound; use Phalcon\Http\Request\File; use Phalcon\Http\Request\FileInterface; -use Phalcon\Http\Request\Exception; use Phalcon\Support\Helper\Json\Decode; -use UnexpectedValueException; use stdClass; /** @@ -57,7 +61,7 @@ class Request extends AbstractInjectionAware implements \Phalcon\Http\RequestInt /** * @var bool */ - protected $httpMethodParameterOverride = false; + protected $methodOverride = false; /** * @var array @@ -101,14 +105,14 @@ class Request extends AbstractInjectionAware implements \Phalcon\Http\RequestInt * $userEmail = $request->get("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function get(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function get(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } @@ -162,31 +166,6 @@ public function getBestLanguage(): string { } - /** - * Return the HTTP method parameter override flag - * - * @return bool - */ - public function getHttpMethodParameterOverride(): bool - { - } - - /** - * Gets the preferred ISO locale variant. - * - * Gets the preferred locale accepted by the client from the - * "Accept-Language" request HTTP header and returns the - * base part of it i.e. `en` instead of `en-US`. - * - * Note: This method relies on the `$_SERVER["HTTP_ACCEPT_LANGUAGE"]` header. - * - * @link https://www.iso.org/standard/50707.html - * @return string - */ - public function getPreferredIsoLocaleVariant(): string - { - } - /** * Gets most possible client IP Address. This method searches in * `$_SERVER["REMOTE_ADDR"]` and optionally in @@ -247,54 +226,69 @@ public function getDigestAuth(): array } /** - * Retrieves a query/get value always sanitized with the preset filters + * Gets filtered data * - * @param string $name + * @param string $methodKey + * @param string $method + * @param string|null $name * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getFilteredQuery(string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getFilteredData(string $methodKey, string $method, ?string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } /** * Retrieves a patch value always sanitized with the preset filters * - * @param string $name + * @param string|null $name * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getFilteredPatch(string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getFilteredPatch(?string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } /** * Retrieves a post value always sanitized with the preset filters * - * @param string $name + * @param string|null $name * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getFilteredPost(string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getFilteredPost(?string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } /** * Retrieves a put value always sanitized with the preset filters * - * @param string $name + * @param string|null $name + * @param mixed $defaultValue + * @param bool $notAllowEmpty + * @param bool $noRecursive + * @return mixed + */ + public function getFilteredPut(?string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + { + } + + /** + * Retrieves a query/get value always sanitized with the preset filters + * + * @param string|null $name * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getFilteredPut(string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getFilteredQuery(?string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } @@ -368,6 +362,15 @@ public function getHttpHost(): string { } + /** + * Return the HTTP method parameter override flag + * + * @return bool + */ + public function getHttpMethodParameterOverride(): bool + { + } + /** * Gets web page that refers active request. ie: http://www.google.com * @@ -425,14 +428,14 @@ public function getMethod(): string * $userEmail = $request->getPatch("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getPatch(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getPatch(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } @@ -457,14 +460,30 @@ public function getPort(): int * $userEmail = $request->getPost("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getPost(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getPost(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + { + } + + /** + * Gets the preferred ISO locale variant. + * + * Gets the preferred locale accepted by the client from the + * "Accept-Language" request HTTP header and returns the + * base part of it i.e. `en` instead of `en-US`. + * + * Note: This method relies on the `$_SERVER["HTTP_ACCEPT_LANGUAGE"]` header. + * + * @link https://www.iso.org/standard/50707.html + * @return string + */ + public function getPreferredIsoLocaleVariant(): string { } @@ -479,14 +498,14 @@ public function getPost(string $name = null, $filters = null, $defaultValue = nu * $userEmail = $request->getPut("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getPut(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getPut(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } @@ -505,14 +524,14 @@ public function getPut(string $name = null, $filters = null, $defaultValue = nul * $id = $request->getQuery("id", null, 150); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getQuery(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + public function getQuery(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed { } @@ -688,15 +707,6 @@ public function isAjax(): bool { } - /** - * Checks whether request content type contains json data - * - * @return bool - */ - public function isJson(): bool - { - } - /** * Checks whether HTTP method is CONNECT. * if _SERVER["REQUEST_METHOD"]==="CONNECT" @@ -737,6 +747,15 @@ public function isHead(): bool { } + /** + * Checks whether request content type contains json data + * + * @return bool + */ + public function isJson(): bool + { + } + /** * Check if HTTP method match any of the passed methods * When strict is true it checks if validated methods are real HTTP methods @@ -780,22 +799,22 @@ public function isPost(): bool } /** - * Checks whether HTTP method is PUT. - * if _SERVER["REQUEST_METHOD"]==="PUT" + * Checks whether HTTP method is PURGE (Squid and Varnish support). + * if _SERVER["REQUEST_METHOD"]==="PURGE" * * @return bool */ - public function isPut(): bool + public function isPurge(): bool { } /** - * Checks whether HTTP method is PURGE (Squid and Varnish support). - * if _SERVER["REQUEST_METHOD"]==="PURGE" + * Checks whether HTTP method is PUT. + * if _SERVER["REQUEST_METHOD"]==="PUT" * * @return bool */ - public function isPurge(): bool + public function isPut(): bool { } @@ -809,21 +828,21 @@ public function isSecure(): bool } /** - * Checks if the `Request::getHttpHost` method will be use strict validation - * of host name or not + * Checks whether request has been made using SOAP * * @return bool */ - public function isStrictHostCheck(): bool + public function isSoap(): bool { } /** - * Checks whether request has been made using SOAP + * Checks if the `Request::getHttpHost` method will be use strict validation + * of host name or not * * @return bool */ - public function isSoap(): bool + public function isStrictHostCheck(): bool { } @@ -862,9 +881,9 @@ public function numFiles(bool $onlySuccessful = false): int * * @param bool $override * - * @return Request + * @return static */ - public function setHttpMethodParameterOverride(bool $override): Request + public function setHttpMethodParameterOverride(bool $override): static { } @@ -875,9 +894,9 @@ public function setHttpMethodParameterOverride(bool $override): Request * @param string $name * @param array $filters * @param array $scope - * @return RequestInterface + * @return static */ - public function setParameterFilters(string $name, array $filters = [], array $scope = []): RequestInterface + public function setParameterFilters(string $name, array $filters = [], array $scope = []): static { } @@ -886,9 +905,9 @@ public function setParameterFilters(string $name, array $filters = [], array $sc * of host name or not * * @param bool $flag - * @return RequestInterface + * @return static */ - public function setStrictHostCheck(bool $flag = true): RequestInterface + public function setStrictHostCheck(bool $flag = true): static { } @@ -896,10 +915,10 @@ public function setStrictHostCheck(bool $flag = true): RequestInterface * Set a trusted proxy list for X-Forwarded-For header * * @param array $trustedProxies - * @return RequestInterface + * @return static * @throws Exception */ - public function setTrustedProxies(array $trustedProxies): RequestInterface + public function setTrustedProxies(array $trustedProxies): static { } @@ -908,20 +927,9 @@ public function setTrustedProxies(array $trustedProxies): RequestInterface * The header return only 1 single IP address, prefixed with HTTP_ eg. HTTP_CLIENT_IP. * * @param string $trustedProxyHeader - * @return RequestInterface + * @return static */ - public function setTrustedProxyHeader(string $trustedProxyHeader): RequestInterface - { - } - - /** - * Check if an IP address exists in CIDR range - * - * @param string $ip The IP address to check. - * @param string $cidr The CIDR range to compare against. - * @return bool True if the IP is in range, false otherwise. - */ - protected function isIpAddressInCIDR(string $ip, string $cidr): bool + public function setTrustedProxyHeader(string $trustedProxyHeader): static { } @@ -941,14 +949,25 @@ protected function getBestQuality(array $qualityParts, string $name): string * If no parameters are given the superglobal is returned. * * @param array $source - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - protected function getHelper(array $source, string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + protected function getHelper(array $source, ?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + { + } + + /** + * Process a request header and return an array of values with their qualities + * + * @param string $serverIndex + * @param string $name + * @return array + */ + protected function getQualityHeader(string $serverIndex, string $name): array { } @@ -964,13 +983,13 @@ protected function hasFileHelper($data, bool $onlySuccessful): int } /** - * Process a request header and return an array of values with their qualities + * Check if an IP address exists in CIDR range * - * @param string $serverIndex - * @param string $name - * @return array + * @param string $ip The IP address to check. + * @param string $cidr The CIDR range to compare against. + * @return bool True if the IP is in range, false otherwise. */ - protected function getQualityHeader(string $serverIndex, string $name): array + protected function isIpAddressInCIDR(string $ip, string $cidr): bool { } @@ -1008,24 +1027,28 @@ private function getFilterService(): FilterInterface } /** + * parse multipart/form-data from raw data + * * @return array */ - private function getServerArray(): array + private function getFormData(): array { } /** - * Gets filtered data + * Return post data from rawBody, form data, or urlencoded form data * - * @param string $methodKey - * @param string $method - * @param string $name - * @param mixed $defaultValue - * @param bool $notAllowEmpty - * @param bool $noRecursive - * @return mixed + * @param array|null $data + * @return array + */ + private function getPostData($data): array + { + } + + /** + * @return array */ - public function getFilteredData(string $methodKey, string $method, string $name = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed + private function getServerArray(): array { } @@ -1051,21 +1074,15 @@ private function isValidPublicIp(string $forwardedIp): bool|string } /** - * Return post data from rawBody, form data, or urlencoded form data - * - * @param array|null $data - * @return array - */ - private function getPostData($data): array - { - } - - /** - * parse multipart/form-data from raw data + * Helper to build the uploaded files array * + * @param array $files + * @param bool $namedKeys + * @param array $input + * @param string $key * @return array */ - private function getFormData(): array + private function processFiles(array $files, bool $namedKeys, array $input, string $key): array { } } diff --git a/src/Http/Request/Exceptions/FilterServiceUnavailable.php b/src/Http/Request/Exceptions/FilterServiceUnavailable.php new file mode 100644 index 00000000..2577b2d3 --- /dev/null +++ b/src/Http/Request/Exceptions/FilterServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Request\Exceptions; + +use Phalcon\Http\Request\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FilterServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Request/Exceptions/InvalidHost.php b/src/Http/Request/Exceptions/InvalidHost.php new file mode 100644 index 00000000..a3f9bbb7 --- /dev/null +++ b/src/Http/Request/Exceptions/InvalidHost.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Request\Exceptions; + +use UnexpectedValueException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidHost extends UnexpectedValueException +{ + /** + * @param string $host + */ + public function __construct(string $host) + { + } +} diff --git a/src/Http/Request/Exceptions/InvalidHttpMethod.php b/src/Http/Request/Exceptions/InvalidHttpMethod.php new file mode 100644 index 00000000..186ae9e9 --- /dev/null +++ b/src/Http/Request/Exceptions/InvalidHttpMethod.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Request\Exceptions; + +use Phalcon\Http\Request\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidHttpMethod extends Exception +{ + /** + * @param string $method + */ + public function __construct(string $method) + { + } +} diff --git a/src/Http/Request/Exceptions/MissingFilters.php b/src/Http/Request/Exceptions/MissingFilters.php new file mode 100644 index 00000000..0a475d73 --- /dev/null +++ b/src/Http/Request/Exceptions/MissingFilters.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Request\Exceptions; + +use Phalcon\Http\Request\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingFilters extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Http/Request/Exceptions/SanitizerNotFound.php b/src/Http/Request/Exceptions/SanitizerNotFound.php new file mode 100644 index 00000000..21ba5da7 --- /dev/null +++ b/src/Http/Request/Exceptions/SanitizerNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Request\Exceptions; + +use Phalcon\Http\Request\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SanitizerNotFound extends Exception +{ + /** + * @param string $sanitizer + */ + public function __construct(string $sanitizer) + { + } +} diff --git a/src/Http/Request/File.php b/src/Http/Request/File.php index 06d23426..a9cddc13 100644 --- a/src/Http/Request/File.php +++ b/src/Http/Request/File.php @@ -35,24 +35,24 @@ class File implements \Phalcon\Http\Request\FileInterface { /** - * @var string|null + * @var int */ - protected $error = null; + protected $error = 0; /** * @var string */ - protected $extension; + protected $extension = ''; /** - * @var string|null + * @var string */ - protected $key = null; + protected $key = ''; /** * @var string */ - protected $name; + protected $name = ''; /** * @var string @@ -65,29 +65,29 @@ class File implements \Phalcon\Http\Request\FileInterface protected $size = 0; /** - * @var string|null + * @var string */ - protected $tmp = null; + protected $tmpName = ''; /** * @var string */ - protected $type; + protected $type = ''; /** * Phalcon\Http\Request\File constructor * * @param array $file - * @param mixed $key + * @param string $key */ - public function __construct(array $file, $key = null) + public function __construct(array $file, string $key = '') { } /** - * @return string|null + * @return int */ - public function getError(): string|null + public function getError(): int { } @@ -99,9 +99,9 @@ public function getExtension(): string } /** - * @return string|null + * @return string */ - public function getKey(): string|null + public function getKey(): string { } diff --git a/src/Http/Request/FileInterface.php b/src/Http/Request/FileInterface.php index 51df3a2c..e7a83549 100644 --- a/src/Http/Request/FileInterface.php +++ b/src/Http/Request/FileInterface.php @@ -17,9 +17,9 @@ interface FileInterface /** * Returns the error if any * - * @return string|null + * @return int */ - public function getError(): string|null; + public function getError(): int; /** * Returns the real name of the uploaded file diff --git a/src/Http/RequestInterface.php b/src/Http/RequestInterface.php index 61fc64ad..6d201340 100644 --- a/src/Http/RequestInterface.php +++ b/src/Http/RequestInterface.php @@ -29,14 +29,14 @@ interface RequestInterface * $userEmail = $request->get("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function get(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; + public function get(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; /** * Gets an array with mime/types and their quality accepted by the @@ -220,22 +220,6 @@ public function getMethod(): string; */ public function getPort(): int; - /** - * Gets HTTP URI which request has been made to - * - * ```php - * // Returns /some/path?with=queryParams - * $uri = $request->getURI(); - * - * // Returns /some/path - * $uri = $request->getURI(true); - * ``` - * - * @param bool $onlyPath If true, query part will be omitted - * @return string - */ - public function getURI(bool $onlyPath = false): string; - /** * Gets a variable from the $_POST superglobal applying filters if needed * If no parameters are given the $_POST superglobal is returned @@ -248,14 +232,14 @@ public function getURI(bool $onlyPath = false): string; * $userEmail = $request->getPost("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getPost(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; + public function getPost(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; /** * Gets a variable from the PUT request @@ -268,14 +252,14 @@ public function getPost(string $name = null, $filters = null, $defaultValue = nu * $userEmail = $request->getPut("user_email", "email"); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getPut(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; + public function getPut(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; /** * Gets variable from $_GET superglobal applying filters if needed @@ -292,14 +276,14 @@ public function getPut(string $name = null, $filters = null, $defaultValue = nul * $id = $request->getQuery("id", null, 150); * ``` * - * @param string $name + * @param string|null $name * @param mixed $filters * @param mixed $defaultValue * @param bool $notAllowEmpty * @param bool $noRecursive * @return mixed */ - public function getQuery(string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; + public function getQuery(?string $name = null, $filters = null, $defaultValue = null, bool $notAllowEmpty = false, bool $noRecursive = false): mixed; /** * Gets HTTP raw request body @@ -347,6 +331,22 @@ public function getServerName(): string; */ public function getUploadedFiles(bool $onlySuccessful = false, bool $namedKeys = false): array; + /** + * Gets HTTP URI which request has been made to + * + * ```php + * // Returns /some/path?with=queryParams + * $uri = $request->getURI(); + * + * // Returns /some/path + * $uri = $request->getURI(true); + * ``` + * + * @param bool $onlyPath If true, query part will be omitted + * @return string + */ + public function getURI(bool $onlyPath = false): string; + /** * Gets HTTP user agent used to made the request * @@ -378,28 +378,28 @@ public function hasFiles(): bool; public function hasHeader(string $header): bool; /** - * Checks whether $_GET superglobal has certain index + * Checks whether $_POST superglobal has certain index * * @param string $name * @return bool */ - public function hasQuery(string $name): bool; + public function hasPost(string $name): bool; /** - * Checks whether $_POST superglobal has certain index + * Checks whether the PUT data has certain index * * @param string $name * @return bool */ - public function hasPost(string $name): bool; + public function hasPut(string $name): bool; /** - * Checks whether the PUT data has certain index + * Checks whether $_GET superglobal has certain index * * @param string $name * @return bool */ - public function hasPut(string $name): bool; + public function hasQuery(string $name): bool; /** * Checks whether $_SERVER superglobal has certain index diff --git a/src/Http/Response.php b/src/Http/Response.php index afb4a6bc..485676ff 100644 --- a/src/Http/Response.php +++ b/src/Http/Response.php @@ -18,11 +18,14 @@ use Phalcon\Events\ManagerInterface; use Phalcon\Http\Message\ResponseStatusCodeInterface; use Phalcon\Http\Response\CookiesInterface; -use Phalcon\Http\Response\Exception; +use Phalcon\Http\Response\Exceptions\NonStandardStatusCodeRequiresMessage; +use Phalcon\Http\Response\Exceptions\ResponseAlreadySent; +use Phalcon\Http\Response\Exceptions\UrlServiceUnavailable; +use Phalcon\Http\Response\Headers; use Phalcon\Http\Response\HeadersInterface; use Phalcon\Mvc\Url\UrlInterface; use Phalcon\Mvc\ViewInterface; -use Phalcon\Http\Response\Headers; +use Phalcon\Support\Helper\File\Basename; use Phalcon\Support\Helper\Json\Encode; /** @@ -76,11 +79,6 @@ class Response implements \Phalcon\Http\ResponseInterface, \Phalcon\Di\Injection */ protected $sent = false; - /** - * @var array - */ - protected $statusCodes = []; - /** * @var Encode */ @@ -89,11 +87,11 @@ class Response implements \Phalcon\Http\ResponseInterface, \Phalcon\Di\Injection /** * Phalcon\Http\Response constructor * - * @param string $content + * @param string|null $content * @param mixed $code * @param mixed $status */ - public function __construct(string $content = null, $code = null, $status = null) + public function __construct(?string $content = null, $code = null, $status = null) { } @@ -375,6 +373,16 @@ public function setEtag(string $etag): ResponseInterface { } + /** + * Sets the events manager + * + * @param \Phalcon\Events\ManagerInterface $eventsManager + * @return void + */ + public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager): void + { + } + /** * Sets an Expires header in the response that allows to use the HTTP cache * @@ -391,16 +399,6 @@ public function setExpires(\DateTime $datetime): ResponseInterface { } - /** - * Sets the events manager - * - * @param \Phalcon\Events\ManagerInterface $eventsManager - * @return void - */ - public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager): void - { - } - /** * Sets an attached file to be sent at the end of the request * @@ -485,41 +483,31 @@ public function setNotModified(): ResponseInterface } /** - * Sets the HTTP response code + * Send a raw header to the response * * ```php - * $response->setStatusCode(404, "Not Found"); + * $response->setRawHeader("HTTP/1.1 404 Not Found"); * ``` * - * @param int $code - * @param string $message + * @param string $header * @return ResponseInterface */ - public function setStatusCode(int $code, string $message = null): ResponseInterface + public function setRawHeader(string $header): ResponseInterface { } /** - * Send a raw header to the response + * Sets the HTTP response code * * ```php - * $response->setRawHeader("HTTP/1.1 404 Not Found"); + * $response->setStatusCode(404, "Not Found"); * ``` * - * @param string $header + * @param int $code + * @param string|null $message * @return ResponseInterface */ - public function setRawHeader(string $header): ResponseInterface - { - } - - /** - * @todo Remove this when we get traits - * @param string $uri - * @param mixed $suffix - * @return string - */ - private function getBasename(string $uri, $suffix = null): string + public function setStatusCode(int $code, ?string $message = null): ResponseInterface { } } diff --git a/src/Http/Response/Cookies.php b/src/Http/Response/Cookies.php index 17ed9ac4..45a32adb 100644 --- a/src/Http/Response/Cookies.php +++ b/src/Http/Response/Cookies.php @@ -9,14 +9,13 @@ */ namespace Phalcon\Http\Response; -use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; -use Phalcon\Http\Cookie\Exception; +use Phalcon\Di\DiInterface; use Phalcon\Http\Cookie\CookieInterface; +use Phalcon\Http\Cookie\Exception; +use Phalcon\Http\Response\Exceptions\ResponseServiceUnavailable; /** - * Phalcon\Http\Response\Cookies - * * This class is a bag to manage the cookies. * * A cookies bag is automatically registered as part of the 'response' service @@ -77,7 +76,7 @@ class Cookies extends AbstractInjectionAware implements \Phalcon\Http\Response\C /** * @var bool */ - protected $registered = false; + protected $isRegistered = false; /** * The cookie's sign key. @@ -95,9 +94,9 @@ class Cookies extends AbstractInjectionAware implements \Phalcon\Http\Response\C * Phalcon\Http\Response\Cookies constructor * * @param bool $useEncryption - * @param string $signKey + * @param string|null $signKey */ - public function __construct(bool $useEncryption = true, string $signKey = null) + public function __construct(bool $useEncryption = true, ?string $signKey = null) { } @@ -221,10 +220,10 @@ public function set(string $name, $value = null, int $expire = 0, string $path = * Use NULL to disable cookie signing. * * @see \Phalcon\Security\Random - * @param string $signKey + * @param string|null $signKey * @return CookiesInterface */ - public function setSignKey(string $signKey = null): CookiesInterface + public function setSignKey(?string $signKey = null): CookiesInterface { } diff --git a/src/Http/Response/CookiesInterface.php b/src/Http/Response/CookiesInterface.php index d6237091..32b61222 100644 --- a/src/Http/Response/CookiesInterface.php +++ b/src/Http/Response/CookiesInterface.php @@ -12,8 +12,6 @@ use Phalcon\Http\Cookie\CookieInterface; /** - * Phalcon\Http\Response\CookiesInterface - * * Interface for Phalcon\Http\Response\Cookies */ interface CookiesInterface diff --git a/src/Http/Response/Exceptions/NonStandardStatusCodeRequiresMessage.php b/src/Http/Response/Exceptions/NonStandardStatusCodeRequiresMessage.php new file mode 100644 index 00000000..9833bab7 --- /dev/null +++ b/src/Http/Response/Exceptions/NonStandardStatusCodeRequiresMessage.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Response\Exceptions; + +use Phalcon\Http\Response\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NonStandardStatusCodeRequiresMessage extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Response/Exceptions/ResponseAlreadySent.php b/src/Http/Response/Exceptions/ResponseAlreadySent.php new file mode 100644 index 00000000..82ed24cd --- /dev/null +++ b/src/Http/Response/Exceptions/ResponseAlreadySent.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Response\Exceptions; + +use Phalcon\Http\Response\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResponseAlreadySent extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Response/Exceptions/ResponseServiceUnavailable.php b/src/Http/Response/Exceptions/ResponseServiceUnavailable.php new file mode 100644 index 00000000..3a837321 --- /dev/null +++ b/src/Http/Response/Exceptions/ResponseServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Response\Exceptions; + +use Phalcon\Http\Response\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResponseServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Response/Exceptions/UrlServiceUnavailable.php b/src/Http/Response/Exceptions/UrlServiceUnavailable.php new file mode 100644 index 00000000..9888b235 --- /dev/null +++ b/src/Http/Response/Exceptions/UrlServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Http\Response\Exceptions; + +use Phalcon\Http\Response\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UrlServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Http/Response/Headers.php b/src/Http/Response/Headers.php index 46836a16..635869d2 100644 --- a/src/Http/Response/Headers.php +++ b/src/Http/Response/Headers.php @@ -9,12 +9,13 @@ */ namespace Phalcon\Http\Response; +use IteratorAggregate; +use Traversable; + /** - * Phalcon\Http\Response\Headers - * * This class is a bag to manage the response headers */ -class Headers implements \Phalcon\Http\Response\HeadersInterface +class Headers implements \Phalcon\Http\Response\HeadersInterface, \IteratorAggregate { /** * @var array @@ -30,9 +31,17 @@ class Headers implements \Phalcon\Http\Response\HeadersInterface * Gets a header value from the internal bag * * @param string $name - * @return string|bool + * + * @return string|bool|null + */ + public function get(string $name): bool|string|null + { + } + + /** + * @return Traversable */ - public function get(string $name): bool|string + public function getIterator(): Traversable { } @@ -40,6 +49,7 @@ public function get(string $name): bool|string * Checks if a header exists * * @param string $name + * * @return bool */ public function has(string $name): bool @@ -67,8 +77,10 @@ public function remove(string $header): HeadersInterface /** * Reset set headers + * + * @return void */ - public function reset() + public function reset(): void { } diff --git a/src/Http/Response/HeadersInterface.php b/src/Http/Response/HeadersInterface.php index cb2c73ee..f9e2647b 100644 --- a/src/Http/Response/HeadersInterface.php +++ b/src/Http/Response/HeadersInterface.php @@ -10,8 +10,6 @@ namespace Phalcon\Http\Response; /** - * Phalcon\Http\Response\HeadersInterface - * * Interface for Phalcon\Http\Response\Headers compatible bags */ interface HeadersInterface @@ -20,22 +18,26 @@ interface HeadersInterface * Gets a header value from the internal bag * * @param string $name - * @return string|bool + * + * @return string|bool|null */ - public function get(string $name): bool|string; + public function get(string $name): bool|string|null; /** * Checks if a header exists * * @param string $name + * * @return bool */ public function has(string $name): bool; /** * Reset set headers + * + * @return void */ - public function reset(); + public function reset(): void; /** * Sends the headers to the client @@ -49,13 +51,17 @@ public function send(): bool; * * @param string $name * @param string $value + * + * @return HeadersInterface */ - public function set(string $name, string $value); + public function set(string $name, string $value): HeadersInterface; /** * Sets a raw header to be sent at the end of the request * * @param string $header + * + * @return HeadersInterface */ - public function setRaw(string $header); + public function setRaw(string $header): HeadersInterface; } diff --git a/src/Http/ResponseInterface.php b/src/Http/ResponseInterface.php index 8aba7056..4ea99c31 100644 --- a/src/Http/ResponseInterface.php +++ b/src/Http/ResponseInterface.php @@ -22,10 +22,10 @@ interface ResponseInterface /** * Appends a string to the HTTP response body * - * @param mixed $content + * @param string $content * @return ResponseInterface */ - public function appendContent($content): ResponseInterface; + public function appendContent(string $content): ResponseInterface; /** * Gets the HTTP response body @@ -35,18 +35,18 @@ public function appendContent($content): ResponseInterface; public function getContent(): string; /** - * Returns the status code + * Returns headers set by the user * - * @return int|null + * @return HeadersInterface */ - public function getStatusCode(): int|null; + public function getHeaders(): HeadersInterface; /** - * Returns headers set by the user + * Returns the status code * - * @return HeadersInterface + * @return int|null */ - public function getHeaders(): HeadersInterface; + public function getStatusCode(): int|null; /** * Checks if a header exists @@ -66,12 +66,12 @@ public function isSent(): bool; /** * Redirect by HTTP to another action or URL * - * @param mixed $location + * @param string|null $location * @param bool $externalRedirect * @param int $statusCode * @return ResponseInterface */ - public function redirect($location = null, bool $externalRedirect = false, int $statusCode = 302): ResponseInterface; + public function redirect(?string $location = null, bool $externalRedirect = false, int $statusCode = 302): ResponseInterface; /** * Resets all the established headers @@ -80,6 +80,27 @@ public function redirect($location = null, bool $externalRedirect = false, int $ */ public function resetHeaders(): ResponseInterface; + /** + * Prints out HTTP response to the client + * + * @return ResponseInterface + */ + public function send(): ResponseInterface; + + /** + * Sends cookies to the client + * + * @return ResponseInterface + */ + public function sendCookies(): ResponseInterface; + + /** + * Sends headers to the client + * + * @return bool|ResponseInterface + */ + public function sendHeaders(): ResponseInterface|bool; + /** * Sets HTTP response body * @@ -99,11 +120,11 @@ public function setContentLength(int $contentLength): ResponseInterface; /** * Sets the response content-type mime, optionally the charset * - * @param string $charset * @param string $contentType + * @param string|null $charset * @return ResponseInterface */ - public function setContentType(string $contentType, $charset = null): ResponseInterface; + public function setContentType(string $contentType, ?string $charset = null): ResponseInterface; /** * Sets output expire time header @@ -117,19 +138,19 @@ public function setExpires(\DateTime $datetime): ResponseInterface; * Sets an attached file to be sent at the end of the request * * @param string $filePath - * @param mixed $attachmentName + * @param string|null $attachmentName * @return ResponseInterface */ - public function setFileToSend(string $filePath, $attachmentName = null): ResponseInterface; + public function setFileToSend(string $filePath, ?string $attachmentName = null): ResponseInterface; /** * Overwrites a header in the response * * @param string $name - * @param mixed $value + * @param string $value * @return ResponseInterface */ - public function setHeader(string $name, $value): ResponseInterface; + public function setHeader(string $name, string $value): ResponseInterface; /** * Sets HTTP response body. The parameter is automatically converted to JSON @@ -166,29 +187,8 @@ public function setRawHeader(string $header): ResponseInterface; * Sets the HTTP response code * * @param int $code - * @param string $message - * @return ResponseInterface - */ - public function setStatusCode(int $code, string $message = null): ResponseInterface; - - /** - * Prints out HTTP response to the client - * - * @return ResponseInterface - */ - public function send(): ResponseInterface; - - /** - * Sends cookies to the client - * + * @param string|null $message * @return ResponseInterface */ - public function sendCookies(): ResponseInterface; - - /** - * Sends headers to the client - * - * @return bool|ResponseInterface - */ - public function sendHeaders(): ResponseInterface|bool; + public function setStatusCode(int $code, ?string $message = null): ResponseInterface; } diff --git a/src/Image/Adapter/AbstractAdapter.php b/src/Image/Adapter/AbstractAdapter.php index 6295b3ea..df1223fb 100644 --- a/src/Image/Adapter/AbstractAdapter.php +++ b/src/Image/Adapter/AbstractAdapter.php @@ -11,6 +11,9 @@ use Phalcon\Image\Enum; use Phalcon\Image\Exception; +use Phalcon\Image\Exceptions\MissingDimensions; +use Phalcon\Image\Exceptions\MissingHeight; +use Phalcon\Image\Exceptions\MissingWidth; /** * All image adapters must use this class @@ -195,7 +198,7 @@ public function reflection(int $height, int $opacity = 100, bool $fadeIn = false * * @return string */ - public function render(string $extension = null, int $quality = 100): string + public function render(?string $extension = null, int $quality = 100): string { } @@ -209,7 +212,7 @@ public function render(string $extension = null, int $quality = 100): string * @return AdapterInterface * @throws Exception */ - public function resize(int $width = null, int $height = null, int $master = Enum::AUTO): AdapterInterface + public function resize(?int $width = null, ?int $height = null, int $master = Enum::AUTO): AdapterInterface { } @@ -232,7 +235,7 @@ public function rotate(int $degrees): AdapterInterface * * @return AdapterInterface */ - public function save(string $file = null, int $quality = -1): AdapterInterface + public function save(?string $file = null, int $quality = -1): AdapterInterface { } @@ -260,7 +263,7 @@ public function sharpen(int $amount): AdapterInterface * * @return AdapterInterface */ - public function text(string $text, $offsetX = false, $offsetY = false, int $opacity = 100, string $color = '000000', int $size = 12, string $fontFile = null): AdapterInterface + public function text(string $text, $offsetX = false, $offsetY = false, int $opacity = 100, string $color = '000000', int $size = 12, ?string $fontFile = null): AdapterInterface { } diff --git a/src/Image/Adapter/AdapterInterface.php b/src/Image/Adapter/AdapterInterface.php index f3e6dfc5..4d1a65d5 100644 --- a/src/Image/Adapter/AdapterInterface.php +++ b/src/Image/Adapter/AdapterInterface.php @@ -45,7 +45,7 @@ public function blur(int $radius): AdapterInterface; * * @return AdapterInterface */ - public function crop(int $width, int $height, int $offsetX = null, int $offsetY = null): AdapterInterface; + public function crop(int $width, int $height, ?int $offsetX = null, ?int $offsetY = null): AdapterInterface; /** * Flip an image @@ -56,6 +56,16 @@ public function crop(int $width, int $height, int $offsetX = null, int $offsetY */ public function flip(int $direction): AdapterInterface; + /** + * @return int + */ + public function getHeight(): int; + + /** + * @return int + */ + public function getWidth(): int; + /** * Add a mask to an image * @@ -93,7 +103,7 @@ public function reflection(int $height, int $opacity = 100, bool $fadeIn = false * * @return string */ - public function render(string $extension = null, int $quality = 100): string; + public function render(?string $extension = null, int $quality = 100): string; /** * Resize an image @@ -104,7 +114,7 @@ public function render(string $extension = null, int $quality = 100): string; * * @return AdapterInterface */ - public function resize(int $width = null, int $height = null, int $master = Enum::AUTO): AdapterInterface; + public function resize(?int $width = null, ?int $height = null, int $master = Enum::AUTO): AdapterInterface; /** * Rotate an image @@ -123,7 +133,7 @@ public function rotate(int $degrees): AdapterInterface; * * @return AdapterInterface */ - public function save(string $file = null, int $quality = 100): AdapterInterface; + public function save(?string $file = null, int $quality = 100): AdapterInterface; /** * Sharpen an image @@ -147,7 +157,7 @@ public function sharpen(int $amount): AdapterInterface; * * @return AdapterInterface */ - public function text(string $text, int $offsetX = 0, int $offsetY = 0, int $opacity = 100, string $color = '000000', int $size = 12, string $fontFile = null): AdapterInterface; + public function text(string $text, int $offsetX = 0, int $offsetY = 0, int $opacity = 100, string $color = '000000', int $size = 12, ?string $fontFile = null): AdapterInterface; /** * Add a watermark on an image diff --git a/src/Image/Adapter/Gd.php b/src/Image/Adapter/Gd.php index 3d0d711a..979dc816 100644 --- a/src/Image/Adapter/Gd.php +++ b/src/Image/Adapter/Gd.php @@ -11,6 +11,11 @@ use Phalcon\Image\Enum; use Phalcon\Image\Exception; +use Phalcon\Image\Exceptions\ExtensionNotLoaded; +use Phalcon\Image\Exceptions\ImageLoadFailed; +use Phalcon\Image\Exceptions\TextRenderingFailed; +use Phalcon\Image\Exceptions\UnsupportedImageType; +use Phalcon\Image\Exceptions\VersionMismatch; /** * This file is part of the Phalcon Framework. @@ -29,7 +34,7 @@ class Gd extends \Phalcon\Image\Adapter\AbstractAdapter * * @throws Exception */ - public function __construct(string $file, int $width = null, int $height = null) + public function __construct(string $file, ?int $width = null, ?int $height = null) { } @@ -193,7 +198,7 @@ protected function processSharpen(int $amount): void * @return void * @throws Exception */ - protected function processText(string $text, $offsetX, $offsetY, int $opacity, int $red, int $green, int $blue, int $size, string $fontFile = null): void + protected function processText(string $text, $offsetX, $offsetY, int $opacity, int $red, int $green, int $blue, int $size, ?string $fontFile = null): void { } diff --git a/src/Image/Adapter/Imagick.php b/src/Image/Adapter/Imagick.php index d10525e1..56841feb 100644 --- a/src/Image/Adapter/Imagick.php +++ b/src/Image/Adapter/Imagick.php @@ -17,6 +17,11 @@ use ImagickPixelException; use Phalcon\Image\Enum; use Phalcon\Image\Exception; +use Phalcon\Image\Exceptions\CompositeFailed; +use Phalcon\Image\Exceptions\ExtensionNotLoaded; +use Phalcon\Image\Exceptions\ImageLoadFailed; +use Phalcon\Image\Exceptions\ResizeFailed; +use Phalcon\Image\Exceptions\ResourceTypeError; /** * Phalcon\Image\Adapter\Imagick @@ -50,7 +55,7 @@ class Imagick extends \Phalcon\Image\Adapter\AbstractAdapter * @throws Exception * @throws ImagickException */ - public function __construct(string $file, int $width = null, int $height = null) + public function __construct(string $file, ?int $width = null, ?int $height = null) { } @@ -273,7 +278,7 @@ protected function processSharpen(int $amount): void * @throws ImagickException * @throws ImagickPixelException */ - protected function processText(string $text, $offsetX, $offsetY, int $opacity, int $red, int $green, int $blue, int $size, string $fontFile = null): void + protected function processText(string $text, $offsetX, $offsetY, int $opacity, int $red, int $green, int $blue, int $size, ?string $fontFile = null): void { } diff --git a/src/Image/Exceptions/CompositeFailed.php b/src/Image/Exceptions/CompositeFailed.php new file mode 100644 index 00000000..2132b74f --- /dev/null +++ b/src/Image/Exceptions/CompositeFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CompositeFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/ExtensionNotLoaded.php b/src/Image/Exceptions/ExtensionNotLoaded.php new file mode 100644 index 00000000..1608e37c --- /dev/null +++ b/src/Image/Exceptions/ExtensionNotLoaded.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ExtensionNotLoaded extends Exception +{ + /** + * @param string $extension + */ + public function __construct(string $extension) + { + } +} diff --git a/src/Image/Exceptions/ImageLoadFailed.php b/src/Image/Exceptions/ImageLoadFailed.php new file mode 100644 index 00000000..c8726341 --- /dev/null +++ b/src/Image/Exceptions/ImageLoadFailed.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ImageLoadFailed extends Exception +{ + /** + * @param string $file + */ + public function __construct(string $file) + { + } +} diff --git a/src/Image/Exceptions/MissingDimensions.php b/src/Image/Exceptions/MissingDimensions.php new file mode 100644 index 00000000..5df4b431 --- /dev/null +++ b/src/Image/Exceptions/MissingDimensions.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingDimensions extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/MissingHeight.php b/src/Image/Exceptions/MissingHeight.php new file mode 100644 index 00000000..20ad1e3a --- /dev/null +++ b/src/Image/Exceptions/MissingHeight.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingHeight extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/MissingWidth.php b/src/Image/Exceptions/MissingWidth.php new file mode 100644 index 00000000..6b9704de --- /dev/null +++ b/src/Image/Exceptions/MissingWidth.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingWidth extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/ResizeFailed.php b/src/Image/Exceptions/ResizeFailed.php new file mode 100644 index 00000000..316d221e --- /dev/null +++ b/src/Image/Exceptions/ResizeFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResizeFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/ResourceTypeError.php b/src/Image/Exceptions/ResourceTypeError.php new file mode 100644 index 00000000..040fb084 --- /dev/null +++ b/src/Image/Exceptions/ResourceTypeError.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResourceTypeError extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/TextRenderingFailed.php b/src/Image/Exceptions/TextRenderingFailed.php new file mode 100644 index 00000000..32cad244 --- /dev/null +++ b/src/Image/Exceptions/TextRenderingFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TextRenderingFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Image/Exceptions/UnsupportedImageType.php b/src/Image/Exceptions/UnsupportedImageType.php new file mode 100644 index 00000000..375f2fb4 --- /dev/null +++ b/src/Image/Exceptions/UnsupportedImageType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnsupportedImageType extends Exception +{ + /** + * @param string $format + */ + public function __construct(string $format = '') + { + } +} diff --git a/src/Image/Exceptions/VersionMismatch.php b/src/Image/Exceptions/VersionMismatch.php new file mode 100644 index 00000000..818d8dce --- /dev/null +++ b/src/Image/Exceptions/VersionMismatch.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Image\Exceptions; + +use Phalcon\Image\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class VersionMismatch extends Exception +{ + /** + * @param string $version + */ + public function __construct(string $version) + { + } +} diff --git a/src/Image/ImageFactory.php b/src/Image/ImageFactory.php index 386e6699..d10d05e3 100644 --- a/src/Image/ImageFactory.php +++ b/src/Image/ImageFactory.php @@ -9,16 +9,12 @@ */ namespace Phalcon\Image; +use Phalcon\Config\ConfigInterface; use Phalcon\Factory\AbstractFactory; use Phalcon\Image\Adapter\AdapterInterface; /** - * This file is part of the Phalcon Framework. - * - * (c) Phalcon Team - * - * For the full copyright and license information, please view the LICENSE.txt - * file that was distributed with this source code. + * Factory to create adapters for image manipulation */ class ImageFactory extends AbstractFactory { @@ -34,7 +30,7 @@ public function __construct(array $services = []) /** * Factory to create an instance from a Config object * - * @param array|\Phalcon\Config\Config $config = [ + * @param array|ConfigInterface $config = [ * 'adapter' => 'gd', * 'file' => 'image.jpg', * 'height' => null, @@ -51,11 +47,11 @@ public function load($config): AdapterInterface * * @param string $name * @param string $file - * @param int $width - * @param int $height + * @param int|null $width + * @param int|null $height * @return AdapterInterface */ - public function newInstance(string $name, string $file, int $width = null, int $height = null): AdapterInterface + public function newInstance(string $name, string $file, ?int $width = null, ?int $height = null): AdapterInterface { } diff --git a/src/Logger/AbstractLogger.php b/src/Logger/AbstractLogger.php index c4a1191b..10f87e57 100644 --- a/src/Logger/AbstractLogger.php +++ b/src/Logger/AbstractLogger.php @@ -12,8 +12,9 @@ use DateTimeImmutable; use DateTimeZone; use Exception; -use Phalcon\Logger\Exception as LoggerException; use Phalcon\Logger\Adapter\AdapterInterface; +use Phalcon\Logger\Exceptions\AdapterNotFound; +use Phalcon\Logger\Exceptions\NoAdaptersConfigured; /** * Abstract Logger Class @@ -117,7 +118,7 @@ abstract class AbstractLogger * @param DateTimeZone|null $timezone Timezone. If omitted, * date_Default_timezone_get() is used */ - public function __construct(string $name, array $adapters = [], \DateTimeZone $timezone = null) + public function __construct(string $name, array $adapters = [], ?\DateTimeZone $timezone = null) { } @@ -127,9 +128,9 @@ public function __construct(string $name, array $adapters = [], \DateTimeZone $t * @param string $name The name of the adapter * @param AdapterInterface $adapter The adapter to add to the stack * - * @return AbstractLogger + * @return static */ - public function addAdapter(string $name, \Phalcon\Logger\Adapter\AdapterInterface $adapter): AbstractLogger + public function addAdapter(string $name, \Phalcon\Logger\Adapter\AdapterInterface $adapter): static { } @@ -138,9 +139,9 @@ public function addAdapter(string $name, \Phalcon\Logger\Adapter\AdapterInterfac * * @param array $adapters * - * @return AbstractLogger + * @return static */ - public function excludeAdapters(array $adapters = []): AbstractLogger + public function excludeAdapters(array $adapters = []): static { } @@ -150,7 +151,7 @@ public function excludeAdapters(array $adapters = []): AbstractLogger * @param string $name The name of the adapter * * @return AdapterInterface - * @throws LoggerException + * @throws AdapterNotFound */ public function getAdapter(string $name): AdapterInterface { @@ -188,10 +189,10 @@ public function getName(): string * * @param string $name The name of the adapter * - * @return AbstractLogger - * @throws LoggerException + * @return static + * @throws AdapterNotFound */ - public function removeAdapter(string $name): AbstractLogger + public function removeAdapter(string $name): static { } @@ -200,9 +201,9 @@ public function removeAdapter(string $name): AbstractLogger * * @param array $adapters An array of adapters * - * @return AbstractLogger + * @return static */ - public function setAdapters(array $adapters): AbstractLogger + public function setAdapters(array $adapters): static { } @@ -211,9 +212,9 @@ public function setAdapters(array $adapters): AbstractLogger * * @param int $level * - * @return AbstractLogger + * @return static */ - public function setLogLevel(int $level): AbstractLogger + public function setLogLevel(int $level): static { } @@ -226,7 +227,7 @@ public function setLogLevel(int $level): AbstractLogger * * @return bool * @throws Exception - * @throws LoggerException + * @throws NoAdaptersConfigured */ protected function addMessage(int $level, string $message, array $context = []): bool { diff --git a/src/Logger/Adapter/AbstractAdapter.php b/src/Logger/Adapter/AbstractAdapter.php index 061c78be..4b9095c3 100644 --- a/src/Logger/Adapter/AbstractAdapter.php +++ b/src/Logger/Adapter/AbstractAdapter.php @@ -9,7 +9,10 @@ */ namespace Phalcon\Logger\Adapter; -use Phalcon\Logger\Exception; +use Phalcon\Logger\Exceptions\DeserializationFailed; +use Phalcon\Logger\Exceptions\SerializationFailed; +use Phalcon\Logger\Exceptions\TransactionAlreadyActive; +use Phalcon\Logger\Exceptions\TransactionNotActive; use Phalcon\Logger\Formatter\FormatterInterface; use Phalcon\Logger\Formatter\Line; use Phalcon\Logger\Item; @@ -52,10 +55,20 @@ abstract class AbstractAdapter implements \Phalcon\Logger\Adapter\AdapterInterfa */ protected $queue = []; + /** + * Maximum number of items retained in the transaction queue. + * 0 (default) keeps the original unbounded behavior; a positive + * value drops the oldest queued item FIFO before a new one is + * appended in add(). + * + * @var int + */ + protected $queueLimit = 0; + /** * Destructor cleanup * - * @throws Exception + * @throws TransactionAlreadyActive */ public function __destruct() { @@ -104,7 +117,7 @@ public function begin(): AdapterInterface * Commits the internal transaction * * @return AdapterInterface - * @throws Exception + * @throws TransactionNotActive */ public function commit(): AdapterInterface { @@ -117,6 +130,15 @@ public function getFormatter(): FormatterInterface { } + /** + * Returns the configured transaction-queue cap (0 = unlimited) + * + * @return int + */ + public function getQueueLimit(): int + { + } + /** * Returns the whether the logger is currently in an active transaction or * not @@ -139,7 +161,7 @@ abstract public function process(\Phalcon\Logger\Item $item): void; * Rollbacks the internal transaction * * @return AdapterInterface - * @throws Exception + * @throws TransactionNotActive */ public function rollback(): AdapterInterface { @@ -156,6 +178,18 @@ public function setFormatter(\Phalcon\Logger\Formatter\FormatterInterface $forma { } + /** + * Sets the maximum number of items retained in the transaction + * queue. 0 disables the cap (the default; preserves the original + * unbounded behavior). + * + * @param int $queueLimit + * @return AdapterInterface + */ + public function setQueueLimit(int $queueLimit): AdapterInterface + { + } + /** * Returns the formatted item * @@ -169,7 +203,7 @@ protected function getFormattedItem(\Phalcon\Logger\Item $item): string /** * Checks if the transaction is active * - * @throws Exception + * @throws TransactionNotActive * @return void */ private function checkTransaction(): void diff --git a/src/Logger/Adapter/Exceptions/FileOpenFailed.php b/src/Logger/Adapter/Exceptions/FileOpenFailed.php new file mode 100644 index 00000000..2530e20d --- /dev/null +++ b/src/Logger/Adapter/Exceptions/FileOpenFailed.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Adapter\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FileOpenFailed extends Exception +{ + /** + * @param string $name + * @param string $mode + */ + public function __construct(string $name, string $mode) + { + } +} diff --git a/src/Logger/Adapter/Exceptions/InvalidStreamMode.php b/src/Logger/Adapter/Exceptions/InvalidStreamMode.php new file mode 100644 index 00000000..ee603ac9 --- /dev/null +++ b/src/Logger/Adapter/Exceptions/InvalidStreamMode.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Adapter\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidStreamMode extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Adapter/Exceptions/SyslogOpenFailed.php b/src/Logger/Adapter/Exceptions/SyslogOpenFailed.php new file mode 100644 index 00000000..b951439c --- /dev/null +++ b/src/Logger/Adapter/Exceptions/SyslogOpenFailed.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Adapter\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SyslogOpenFailed extends Exception +{ + /** + * @param string $name + * @param int $facility + */ + public function __construct(string $name, int $facility) + { + } +} diff --git a/src/Logger/Adapter/Stream.php b/src/Logger/Adapter/Stream.php index 724f9aa1..195472ec 100644 --- a/src/Logger/Adapter/Stream.php +++ b/src/Logger/Adapter/Stream.php @@ -9,8 +9,8 @@ */ namespace Phalcon\Logger\Adapter; -use LogicException; -use Phalcon\Logger\Exception; +use Phalcon\Logger\Adapter\Exceptions\FileOpenFailed; +use Phalcon\Logger\Adapter\Exceptions\InvalidStreamMode; use Phalcon\Logger\Item; /** @@ -31,7 +31,6 @@ * @property resource|null $handler * @property string $mode * @property string $name - * @property array $options */ class Stream extends \Phalcon\Logger\Adapter\AbstractAdapter { @@ -56,20 +55,13 @@ class Stream extends \Phalcon\Logger\Adapter\AbstractAdapter */ protected $name; - /** - * Path options - * - * @var array - */ - protected $options; - /** * Stream constructor. * * @param string $name * @param array $options * - * @throws Exception + * @throws InvalidStreamMode */ public function __construct(string $name, array $options = []) { diff --git a/src/Logger/Adapter/Syslog.php b/src/Logger/Adapter/Syslog.php index 12ef8d52..6cdddbc5 100644 --- a/src/Logger/Adapter/Syslog.php +++ b/src/Logger/Adapter/Syslog.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Logger\Adapter; -use LogicException; +use Phalcon\Logger\Adapter\Exceptions\SyslogOpenFailed; use Phalcon\Logger\Enum; use Phalcon\Logger\Item; @@ -68,7 +68,7 @@ public function close(): bool * * @param Item $item * - * @throws LogicException + * @throws SyslogOpenFailed * @return void */ public function process(\Phalcon\Logger\Item $item): void diff --git a/src/Logger/Exceptions/AdapterNotFound.php b/src/Logger/Exceptions/AdapterNotFound.php new file mode 100644 index 00000000..f045f1a2 --- /dev/null +++ b/src/Logger/Exceptions/AdapterNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AdapterNotFound extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Logger/Exceptions/DeserializationFailed.php b/src/Logger/Exceptions/DeserializationFailed.php new file mode 100644 index 00000000..173a0ac1 --- /dev/null +++ b/src/Logger/Exceptions/DeserializationFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DeserializationFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Exceptions/NoAdaptersConfigured.php b/src/Logger/Exceptions/NoAdaptersConfigured.php new file mode 100644 index 00000000..59a5f558 --- /dev/null +++ b/src/Logger/Exceptions/NoAdaptersConfigured.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoAdaptersConfigured extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Exceptions/SerializationFailed.php b/src/Logger/Exceptions/SerializationFailed.php new file mode 100644 index 00000000..6ae677e3 --- /dev/null +++ b/src/Logger/Exceptions/SerializationFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SerializationFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Exceptions/TransactionAlreadyActive.php b/src/Logger/Exceptions/TransactionAlreadyActive.php new file mode 100644 index 00000000..5e90bb3c --- /dev/null +++ b/src/Logger/Exceptions/TransactionAlreadyActive.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TransactionAlreadyActive extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Exceptions/TransactionNotActive.php b/src/Logger/Exceptions/TransactionNotActive.php new file mode 100644 index 00000000..8bb5b423 --- /dev/null +++ b/src/Logger/Exceptions/TransactionNotActive.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Logger\Exceptions; + +use Phalcon\Logger\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TransactionNotActive extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Logger/Formatter/Line.php b/src/Logger/Formatter/Line.php index 42453305..4aff9c8d 100644 --- a/src/Logger/Formatter/Line.php +++ b/src/Logger/Formatter/Line.php @@ -62,9 +62,9 @@ public function getFormat(): string * * @param string $format * - * @return Line + * @return static */ - public function setFormat(string $format): Line + public function setFormat(string $format): static { } } diff --git a/src/Logger/Item.php b/src/Logger/Item.php index 22dcbf36..d241d47a 100644 --- a/src/Logger/Item.php +++ b/src/Logger/Item.php @@ -20,7 +20,7 @@ * @property string $message * @property int $level * @property string $levelName - * @property DateTimeImmutable $datetime + * @property DateTimeImmutable $dateTime */ class Item { @@ -34,11 +34,6 @@ class Item */ protected $dateTime; - /** - * @var string - */ - protected $message; - /** * @var int */ @@ -49,15 +44,19 @@ class Item */ protected $levelName; + /** + * @var string + */ + protected $message; + /** * Item constructor. * * @param string $message * @param string $levelName * @param int $level - * @param DateTimeImmutable $datetime + * @param DateTimeImmutable $dateTime * @param array $context - * @param \DateTimeImmutable $dateTime */ public function __construct(string $message, string $levelName, int $level, \DateTimeImmutable $dateTime, array $context = []) { @@ -78,23 +77,23 @@ public function getDateTime(): DateTimeImmutable } /** - * @return string + * @return int */ - public function getMessage(): string + public function getLevel(): int { } /** - * @return int + * @return string */ - public function getLevel(): int + public function getLevelName(): string { } /** * @return string */ - public function getLevelName(): string + public function getMessage(): string { } } diff --git a/src/Logger/LoggerFactory.php b/src/Logger/LoggerFactory.php index ee90919c..a125128b 100644 --- a/src/Logger/LoggerFactory.php +++ b/src/Logger/LoggerFactory.php @@ -62,7 +62,7 @@ public function load($config): Logger * * @return Logger */ - public function newInstance(string $name, array $adapters = [], \DateTimeZone $timezone = null): Logger + public function newInstance(string $name, array $adapters = [], ?\DateTimeZone $timezone = null): Logger { } diff --git a/src/Logger/LoggerInterface.php b/src/Logger/LoggerInterface.php index 73f371db..55ceb920 100644 --- a/src/Logger/LoggerInterface.php +++ b/src/Logger/LoggerInterface.php @@ -139,7 +139,10 @@ public function log($level, string $message, array $context = []): void; public function notice(string $message, array $context = []): void; /** - * Normal but significant events. + * Exceptional occurrences that are not errors. + * + * Example: Use of deprecated APIs, poor use of an API, undesirable things + * that are not necessarily wrong. * * @param string $message * @param array $context diff --git a/src/Messages/Exceptions/MessageNotObject.php b/src/Messages/Exceptions/MessageNotObject.php new file mode 100644 index 00000000..cb89fbdb --- /dev/null +++ b/src/Messages/Exceptions/MessageNotObject.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Messages\Exceptions; + +use Phalcon\Messages\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MessageNotObject extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Messages/Exceptions/MessagesNotIterable.php b/src/Messages/Exceptions/MessagesNotIterable.php new file mode 100644 index 00000000..5487ff04 --- /dev/null +++ b/src/Messages/Exceptions/MessagesNotIterable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Messages\Exceptions; + +use Phalcon\Messages\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MessagesNotIterable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Messages/Message.php b/src/Messages/Message.php index 99f7078a..5d302ce5 100644 --- a/src/Messages/Message.php +++ b/src/Messages/Message.php @@ -34,25 +34,25 @@ class Message implements \Phalcon\Messages\MessageInterface, \JsonSerializable protected $message; /** - * @var string + * @var array */ - protected $type; + protected $metaData = []; /** - * @var array + * @var string */ - protected $metaData = []; + protected $type; /** * Phalcon\Messages\Message constructor * * @param string $message - * @param mixed $field + * @param string $field * @param string $type * @param int $code * @param array $metaData */ - public function __construct(string $message, $field = '', string $type = '', int $code = 0, array $metaData = []) + public function __construct(string $message, string $field = '', string $type = '', int $code = 0, array $metaData = []) { } @@ -87,16 +87,16 @@ public function getMessage(): string } /** - * @return string + * @return array */ - public function getType(): string + public function getMetaData(): array { } /** - * @return array + * @return string */ - public function getMetaData(): array + public function getType(): string { } @@ -122,10 +122,10 @@ public function setCode(int $code): MessageInterface /** * Sets field name related to message * - * @param mixed $field + * @param string $field * @return MessageInterface */ - public function setField($field): MessageInterface + public function setField(string $field): MessageInterface { } diff --git a/src/Messages/MessageInterface.php b/src/Messages/MessageInterface.php index 8c399289..001fc24c 100644 --- a/src/Messages/MessageInterface.php +++ b/src/Messages/MessageInterface.php @@ -28,14 +28,14 @@ public function __toString(): string; * * @return int */ - public function getCode(); + public function getCode(): int; /** * Returns field name related to message * * @return string */ - public function getField(); + public function getField(): string; /** * Returns verbose message diff --git a/src/Messages/Messages.php b/src/Messages/Messages.php index 74fe9686..683710cf 100644 --- a/src/Messages/Messages.php +++ b/src/Messages/Messages.php @@ -13,6 +13,8 @@ use Countable; use Iterator; use JsonSerializable; +use Phalcon\Messages\Exceptions\MessageNotObject; +use Phalcon\Messages\Exceptions\MessagesNotIterable; /** * Represents a collection of messages @@ -48,8 +50,9 @@ public function __construct(array $messages = []) * ``` * * @param MessageInterface $message + * @return void */ - public function appendMessage(MessageInterface $message) + public function appendMessage(MessageInterface $message): void { } diff --git a/src/Mvc/Application.php b/src/Mvc/Application.php index 46ab3e8e..1244806e 100644 --- a/src/Mvc/Application.php +++ b/src/Mvc/Application.php @@ -12,11 +12,14 @@ use Closure; use Phalcon\Application\AbstractApplication; use Phalcon\Di\DiInterface; -use Phalcon\Http\ResponseInterface; use Phalcon\Events\ManagerInterface; +use Phalcon\Http\ResponseInterface; use Phalcon\Mvc\Application\Exception; -use Phalcon\Mvc\Router\RouteInterface; +use Phalcon\Mvc\Application\Exceptions\ContainerRequired; +use Phalcon\Mvc\Application\Exceptions\InvalidModuleDefinition; +use Phalcon\Mvc\Application\Exceptions\ModuleDefinitionPathNotFound; use Phalcon\Mvc\ModuleDefinitionInterface; +use Phalcon\Mvc\Router\RouteInterface; /** * Phalcon\Mvc\Application @@ -95,9 +98,9 @@ public function handle(string $uri): ResponseInterface|bool * Enables or disables sending cookies by each request handling * * @param bool $sendCookies - * @return Application + * @return static */ - public function sendCookiesOnHandleRequest(bool $sendCookies): Application + public function sendCookiesOnHandleRequest(bool $sendCookies): static { } @@ -105,9 +108,9 @@ public function sendCookiesOnHandleRequest(bool $sendCookies): Application * Enables or disables sending headers by each request handling * * @param bool $sendHeaders - * @return Application + * @return static */ - public function sendHeadersOnHandleRequest(bool $sendHeaders): Application + public function sendHeadersOnHandleRequest(bool $sendHeaders): static { } @@ -116,9 +119,9 @@ public function sendHeadersOnHandleRequest(bool $sendHeaders): Application * You can full disable the view component using this method * * @param bool $implicitView - * @return Application + * @return static */ - public function useImplicitView(bool $implicitView): Application + public function useImplicitView(bool $implicitView): static { } } diff --git a/src/Mvc/Application/Exceptions/ContainerRequired.php b/src/Mvc/Application/Exceptions/ContainerRequired.php new file mode 100644 index 00000000..81d0b096 --- /dev/null +++ b/src/Mvc/Application/Exceptions/ContainerRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Application\Exceptions; + +use Phalcon\Mvc\Application\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ContainerRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Application/Exceptions/InvalidModuleDefinition.php b/src/Mvc/Application/Exceptions/InvalidModuleDefinition.php new file mode 100644 index 00000000..520b1e77 --- /dev/null +++ b/src/Mvc/Application/Exceptions/InvalidModuleDefinition.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Application\Exceptions; + +use Phalcon\Mvc\Application\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidModuleDefinition extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Application/Exceptions/ModuleDefinitionPathNotFound.php b/src/Mvc/Application/Exceptions/ModuleDefinitionPathNotFound.php new file mode 100644 index 00000000..bd0b6950 --- /dev/null +++ b/src/Mvc/Application/Exceptions/ModuleDefinitionPathNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Application\Exceptions; + +use Phalcon\Mvc\Application\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModuleDefinitionPathNotFound extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Mvc/Controller.php b/src/Mvc/Controller.php index 7829a1df..b087c6dd 100644 --- a/src/Mvc/Controller.php +++ b/src/Mvc/Controller.php @@ -55,11 +55,6 @@ */ abstract class Controller extends Injectable implements \Phalcon\Mvc\ControllerInterface, \Phalcon\Events\EventsAwareInterface { - /** - * @var ManagerInterface|null - */ - protected $eventsManager = null; - /** * Phalcon\Mvc\Controller constructor */ diff --git a/src/Mvc/Dispatcher.php b/src/Mvc/Dispatcher.php index 9b0c4b55..d0e253fb 100644 --- a/src/Mvc/Dispatcher.php +++ b/src/Mvc/Dispatcher.php @@ -9,10 +9,11 @@ */ namespace Phalcon\Mvc; -use Phalcon\Mvc\Dispatcher\Exception; +use Phalcon\Dispatcher\AbstractDispatcher as BaseDispatcher; use Phalcon\Events\ManagerInterface; use Phalcon\Http\ResponseInterface; -use Phalcon\Dispatcher\AbstractDispatcher as BaseDispatcher; +use Phalcon\Mvc\Dispatcher\Exception; +use Phalcon\Mvc\Dispatcher\Exceptions\ResponseServiceUnavailable; /** * Dispatching is the process of taking the request object, extracting the @@ -174,8 +175,9 @@ public function getPreviousNamespaceName(): string * Sets the controller name to be dispatched * * @param string $controllerName + * @return DispatcherInterface */ - public function setControllerName(string $controllerName) + public function setControllerName(string $controllerName): DispatcherInterface { } @@ -183,8 +185,9 @@ public function setControllerName(string $controllerName) * Sets the default controller suffix * * @param string $controllerSuffix + * @return DispatcherInterface */ - public function setControllerSuffix(string $controllerSuffix) + public function setControllerSuffix(string $controllerSuffix): DispatcherInterface { } @@ -192,8 +195,9 @@ public function setControllerSuffix(string $controllerSuffix) * Sets the default controller name * * @param string $controllerName + * @return DispatcherInterface */ - public function setDefaultController(string $controllerName) + public function setDefaultController(string $controllerName): DispatcherInterface { } diff --git a/src/Mvc/Dispatcher/Exceptions/ResponseServiceUnavailable.php b/src/Mvc/Dispatcher/Exceptions/ResponseServiceUnavailable.php new file mode 100644 index 00000000..1e1c77b0 --- /dev/null +++ b/src/Mvc/Dispatcher/Exceptions/ResponseServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Dispatcher\Exceptions; + +use Phalcon\Mvc\Dispatcher\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResponseServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/DispatcherInterface.php b/src/Mvc/DispatcherInterface.php index 7baca38c..d8f5dcd1 100644 --- a/src/Mvc/DispatcherInterface.php +++ b/src/Mvc/DispatcherInterface.php @@ -21,9 +21,9 @@ interface DispatcherInterface extends DispatcherInterfaceBase /** * Returns the active controller in the dispatcher * - * @return ControllerInterface + * @return ControllerInterface|null */ - public function getActiveController(): ControllerInterface; + public function getActiveController(): ControllerInterface|null; /** * Gets last dispatched controller name @@ -35,28 +35,31 @@ public function getControllerName(): string; /** * Returns the latest dispatched controller * - * @return ControllerInterface + * @return ControllerInterface|null */ - public function getLastController(): ControllerInterface; + public function getLastController(): ControllerInterface|null; /** - * Sets the default controller suffix + * Sets the controller name to be dispatched * - * @param string $controllerSuffix + * @param string $controllerName + * @return DispatcherInterfaceBase */ - public function setControllerSuffix(string $controllerSuffix); + public function setControllerName(string $controllerName): DispatcherInterfaceBase; /** - * Sets the controller name to be dispatched + * Sets the default controller suffix * - * @param string $controllerName + * @param string $controllerSuffix + * @return DispatcherInterfaceBase */ - public function setControllerName(string $controllerName); + public function setControllerSuffix(string $controllerSuffix): DispatcherInterfaceBase; /** * Sets the default controller name * * @param string $controllerName + * @return DispatcherInterfaceBase */ - public function setDefaultController(string $controllerName); + public function setDefaultController(string $controllerName): DispatcherInterfaceBase; } diff --git a/src/Mvc/Micro.php b/src/Mvc/Micro.php index 1843fae7..fd79796b 100644 --- a/src/Mvc/Micro.php +++ b/src/Mvc/Micro.php @@ -11,20 +11,30 @@ use ArrayAccess; use Closure; +use Phalcon\Cache\Adapter\AdapterInterface; use Phalcon\Di\DiInterface; -use Phalcon\Di\Injectable; use Phalcon\Di\FactoryDefault; -use Phalcon\Mvc\Micro\Exception; +use Phalcon\Di\Injectable; use Phalcon\Di\ServiceInterface; +use Phalcon\Events\EventsAwareInterface; +use Phalcon\Events\ManagerInterface; +use Phalcon\Http\ResponseInterface; use Phalcon\Mvc\Micro\Collection; +use Phalcon\Mvc\Micro\CollectionInterface; +use Phalcon\Mvc\Micro\Exception; +use Phalcon\Mvc\Micro\Exceptions\ContainerRequired; +use Phalcon\Mvc\Micro\Exceptions\ErrorHandlerNotCallable; +use Phalcon\Mvc\Micro\Exceptions\HandlerNotCallable; +use Phalcon\Mvc\Micro\Exceptions\InvalidRegisteredHandler; +use Phalcon\Mvc\Micro\Exceptions\MissingCollectionMainHandler; +use Phalcon\Mvc\Micro\Exceptions\NoHandlersToMount; +use Phalcon\Mvc\Micro\Exceptions\NoMatchedRouteHandler; +use Phalcon\Mvc\Micro\Exceptions\NotFoundHandlerNotCallable; +use Phalcon\Mvc\Micro\Exceptions\ResponseHandlerNotCallable; use Phalcon\Mvc\Micro\LazyLoader; -use Phalcon\Http\ResponseInterface; +use Phalcon\Mvc\Micro\MiddlewareInterface; use Phalcon\Mvc\Model\BinderInterface; use Phalcon\Mvc\Router\RouteInterface; -use Phalcon\Events\EventsAwareInterface; -use Phalcon\Events\ManagerInterface; -use Phalcon\Mvc\Micro\MiddlewareInterface; -use Phalcon\Mvc\Micro\CollectionInterface; use Throwable; /** @@ -128,9 +138,9 @@ class Micro extends Injectable implements \ArrayAccess, \Phalcon\Events\EventsAw /** * Phalcon\Mvc\Micro constructor * - * @param \Phalcon\Di\DiInterface $container + * @param \Phalcon\Di\DiInterface|null $container */ - public function __construct(\Phalcon\Di\DiInterface $container = null) + public function __construct(?\Phalcon\Di\DiInterface $container = null) { } @@ -138,9 +148,9 @@ public function __construct(\Phalcon\Di\DiInterface $container = null) * Appends an 'after' middleware to be called after execute the route * * @param callable|MiddlewareInterface $handler - * @return Micro + * @return static */ - public function after($handler): Micro + public function after($handler): static { } @@ -148,9 +158,9 @@ public function after($handler): Micro * Appends a afterBinding middleware to be called after model binding * * @param callable $handler - * @return Micro + * @return static */ - public function afterBinding($handler): Micro + public function afterBinding($handler): static { } @@ -158,9 +168,9 @@ public function afterBinding($handler): Micro * Appends a before middleware to be called before execute the route * * @param callable|MiddlewareInterface $handler - * @return Micro + * @return static */ - public function before($handler): Micro + public function before($handler): static { } @@ -180,9 +190,9 @@ public function delete(string $routePattern, $handler): RouteInterface * the route * * @param callable $handler - * @return Micro + * @return static */ - public function error($handler): Micro + public function error($handler): static { } @@ -190,9 +200,9 @@ public function error($handler): Micro * Appends a 'finish' middleware to be called when the request is finished * * @param callable $handler - * @return Micro + * @return static */ - public function finish($handler): Micro + public function finish($handler): static { } @@ -346,9 +356,9 @@ public function map(string $routePattern, $handler): RouteInterface * Mounts a collection of handlers * * @param \Phalcon\Mvc\Micro\CollectionInterface $collection - * @return Micro + * @return static */ - public function mount(\Phalcon\Mvc\Micro\CollectionInterface $collection): Micro + public function mount(\Phalcon\Mvc\Micro\CollectionInterface $collection): static { } @@ -357,9 +367,9 @@ public function mount(\Phalcon\Mvc\Micro\CollectionInterface $collection): Micro * the defined routes * * @param callable $handler - * @return Micro + * @return static */ - public function notFound($handler): Micro + public function notFound($handler): static { } @@ -466,8 +476,9 @@ public function put(string $routePattern, $handler): RouteInterface * Sets externally the handler that must be called by the matched route * * @param callable $activeHandler + * @return self */ - public function setActiveHandler($activeHandler) + public function setActiveHandler($activeHandler): self { } @@ -495,9 +506,9 @@ public function setDI(\Phalcon\Di\DiInterface $container): void * * @param \Phalcon\Mvc\Model\BinderInterface $modelBinder * @param mixed $cache - * @return Micro + * @return static */ - public function setModelBinder(\Phalcon\Mvc\Model\BinderInterface $modelBinder, $cache = null): Micro + public function setModelBinder(\Phalcon\Mvc\Model\BinderInterface $modelBinder, $cache = null): static { } @@ -506,9 +517,9 @@ public function setModelBinder(\Phalcon\Mvc\Model\BinderInterface $modelBinder, * response handler * * @param callable $handler - * @return Micro + * @return static */ - public function setResponseHandler($handler): Micro + public function setResponseHandler($handler): static { } @@ -517,10 +528,10 @@ public function setResponseHandler($handler): Micro * * @param string $serviceName * @param mixed $definition - * @param bool $shared + * @param bool $isShared * @return ServiceInterface */ - public function setService(string $serviceName, $definition, bool $shared = false): ServiceInterface + public function setService(string $serviceName, $definition, bool $isShared = false): ServiceInterface { } @@ -533,4 +544,23 @@ public function setService(string $serviceName, $definition, bool $shared = fals public function stop(): void { } + + /** + * Helper method to route an action + * + * @param string $method + * @param string $routePattern + * @param array|callable $handler * + * @return RouteInterface + */ + private function addRoute(string $method, string $routePattern, $handler): RouteInterface + { + } + + /** + * @return void + */ + private function checkDiContainer(): void + { + } } diff --git a/src/Mvc/Micro/Collection.php b/src/Mvc/Micro/Collection.php index 393f5c60..3f5aad84 100644 --- a/src/Mvc/Micro/Collection.php +++ b/src/Mvc/Micro/Collection.php @@ -43,7 +43,7 @@ class Collection implements \Phalcon\Mvc\Micro\CollectionInterface /** * @var bool */ - protected $lazy = false; + protected $isLazy = false; /** * @var string @@ -58,7 +58,7 @@ class Collection implements \Phalcon\Mvc\Micro\CollectionInterface * @param string|null $name * * @return CollectionInterface */ - public function delete(string $routePattern, $handler, string $name = null): CollectionInterface + public function delete(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -70,7 +70,7 @@ public function delete(string $routePattern, $handler, string $name = null): Col * @param string|null $name * * @return CollectionInterface */ - public function get(string $routePattern, $handler, string $name = null): CollectionInterface + public function get(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -109,7 +109,7 @@ public function getPrefix(): string * @param string|null $name * * @return CollectionInterface */ - public function head(string $routePattern, $handler, string $name = null): CollectionInterface + public function head(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -130,7 +130,7 @@ public function isLazy(): bool * @param string|null $name * * @return CollectionInterface */ - public function map(string $routePattern, $handler, string $name = null): CollectionInterface + public function map(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -152,7 +152,7 @@ public function map(string $routePattern, $handler, string $name = null): Collec * @param string|null $name * * @return CollectionInterface */ - public function mapVia(string $routePattern, $handler, $method, string $name = null): CollectionInterface + public function mapVia(string $routePattern, $handler, $method, ?string $name = null): CollectionInterface { } @@ -165,7 +165,7 @@ public function mapVia(string $routePattern, $handler, $method, string $name = n * @param string|null $name * * @return CollectionInterface */ - public function options(string $routePattern, $handler, string $name = null): CollectionInterface + public function options(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -177,7 +177,7 @@ public function options(string $routePattern, $handler, string $name = null): Co * @param string|null $name * * @return CollectionInterface */ - public function patch(string $routePattern, $handler, string $name = null): CollectionInterface + public function patch(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -189,7 +189,7 @@ public function patch(string $routePattern, $handler, string $name = null): Coll * @param string|null $name * * @return CollectionInterface */ - public function post(string $routePattern, $handler, string $name = null): CollectionInterface + public function post(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -201,7 +201,7 @@ public function post(string $routePattern, $handler, string $name = null): Colle * @param string|null $name * * @return CollectionInterface */ - public function put(string $routePattern, $handler, string $name = null): CollectionInterface + public function put(string $routePattern, $handler, ?string $name = null): CollectionInterface { } @@ -209,20 +209,20 @@ public function put(string $routePattern, $handler, string $name = null): Collec * Sets the main handler. * * @param mixed $handler - * @param bool $lazy * + * @param bool $isLazy * * @return CollectionInterface */ - public function setHandler($handler, bool $lazy = false): CollectionInterface + public function setHandler($handler, bool $isLazy = false): CollectionInterface { } /** * Sets if the main handler must be lazy loaded * - * @param bool $lazy * + * @param bool $isLazy * * @return CollectionInterface */ - public function setLazy(bool $lazy): CollectionInterface + public function setLazy(bool $isLazy): CollectionInterface { } @@ -245,7 +245,7 @@ public function setPrefix(string $prefix): CollectionInterface * @param string|null $name * @return void */ - protected function addMap($method, string $routePattern, $handler, string $name = null): void + protected function addMap($method, string $routePattern, $handler, ?string $name = null): void { } } diff --git a/src/Mvc/Micro/CollectionInterface.php b/src/Mvc/Micro/CollectionInterface.php index dd5ca9e8..bf45741f 100644 --- a/src/Mvc/Micro/CollectionInterface.php +++ b/src/Mvc/Micro/CollectionInterface.php @@ -21,20 +21,20 @@ interface CollectionInterface * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function delete(string $routePattern, $handler, string $name = null): CollectionInterface; + public function delete(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Maps a route to a handler that only matches if the HTTP method is GET * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function get(string $routePattern, $handler, string $name = null): CollectionInterface; + public function get(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Returns the main handler @@ -62,10 +62,10 @@ public function getPrefix(): string; * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function head(string $routePattern, $handler, string $name = null): CollectionInterface; + public function head(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Returns if the main handler must be lazy loaded @@ -79,68 +79,68 @@ public function isLazy(): bool; * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function map(string $routePattern, $handler, string $name = null): CollectionInterface; + public function map(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Maps a route to a handler that only matches if the HTTP method is OPTIONS * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function options(string $routePattern, $handler, string $name = null): CollectionInterface; + public function options(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Maps a route to a handler that only matches if the HTTP method is PATCH * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function patch(string $routePattern, $handler, string $name = null): CollectionInterface; + public function patch(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Maps a route to a handler that only matches if the HTTP method is POST * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function post(string $routePattern, $handler, string $name = null): CollectionInterface; + public function post(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Maps a route to a handler that only matches if the HTTP method is PUT * * @param string $routePattern * @param callable $handler - * @param string $name + * @param string|null $name * @return CollectionInterface */ - public function put(string $routePattern, $handler, string $name = null): CollectionInterface; + public function put(string $routePattern, $handler, ?string $name = null): CollectionInterface; /** * Sets the main handler * * @param mixed $handler - * @param bool $lazy + * @param bool $isLazy * * @return CollectionInterface */ - public function setHandler($handler, bool $lazy = false): CollectionInterface; + public function setHandler($handler, bool $isLazy = false): CollectionInterface; /** * Sets if the main handler must be lazy loaded * - * @param bool $lazy + * @param bool $isLazy * @return CollectionInterface */ - public function setLazy(bool $lazy): CollectionInterface; + public function setLazy(bool $isLazy): CollectionInterface; /** * Sets a prefix for all routes added to the collection diff --git a/src/Mvc/Micro/Exceptions/ContainerRequired.php b/src/Mvc/Micro/Exceptions/ContainerRequired.php new file mode 100644 index 00000000..7685778a --- /dev/null +++ b/src/Mvc/Micro/Exceptions/ContainerRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ContainerRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/ErrorHandlerNotCallable.php b/src/Mvc/Micro/Exceptions/ErrorHandlerNotCallable.php new file mode 100644 index 00000000..ec4df961 --- /dev/null +++ b/src/Mvc/Micro/Exceptions/ErrorHandlerNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ErrorHandlerNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/HandlerNotCallable.php b/src/Mvc/Micro/Exceptions/HandlerNotCallable.php new file mode 100644 index 00000000..98244d4e --- /dev/null +++ b/src/Mvc/Micro/Exceptions/HandlerNotCallable.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class HandlerNotCallable extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Mvc/Micro/Exceptions/InvalidRegisteredHandler.php b/src/Mvc/Micro/Exceptions/InvalidRegisteredHandler.php new file mode 100644 index 00000000..c91ffade --- /dev/null +++ b/src/Mvc/Micro/Exceptions/InvalidRegisteredHandler.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRegisteredHandler extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/LazyHandlerNotFound.php b/src/Mvc/Micro/Exceptions/LazyHandlerNotFound.php new file mode 100644 index 00000000..59079383 --- /dev/null +++ b/src/Mvc/Micro/Exceptions/LazyHandlerNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class LazyHandlerNotFound extends Exception +{ + /** + * @param string $definition + */ + public function __construct(string $definition) + { + } +} diff --git a/src/Mvc/Micro/Exceptions/MissingCollectionMainHandler.php b/src/Mvc/Micro/Exceptions/MissingCollectionMainHandler.php new file mode 100644 index 00000000..7a088e3d --- /dev/null +++ b/src/Mvc/Micro/Exceptions/MissingCollectionMainHandler.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingCollectionMainHandler extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/NoHandlersToMount.php b/src/Mvc/Micro/Exceptions/NoHandlersToMount.php new file mode 100644 index 00000000..f5c5ee77 --- /dev/null +++ b/src/Mvc/Micro/Exceptions/NoHandlersToMount.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoHandlersToMount extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/NoMatchedRouteHandler.php b/src/Mvc/Micro/Exceptions/NoMatchedRouteHandler.php new file mode 100644 index 00000000..824d0273 --- /dev/null +++ b/src/Mvc/Micro/Exceptions/NoMatchedRouteHandler.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoMatchedRouteHandler extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/NotFoundHandlerNotCallable.php b/src/Mvc/Micro/Exceptions/NotFoundHandlerNotCallable.php new file mode 100644 index 00000000..86be99f0 --- /dev/null +++ b/src/Mvc/Micro/Exceptions/NotFoundHandlerNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NotFoundHandlerNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/Exceptions/ResponseHandlerNotCallable.php b/src/Mvc/Micro/Exceptions/ResponseHandlerNotCallable.php new file mode 100644 index 00000000..1ee412bf --- /dev/null +++ b/src/Mvc/Micro/Exceptions/ResponseHandlerNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Micro\Exceptions; + +use Phalcon\Mvc\Micro\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResponseHandlerNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Micro/LazyLoader.php b/src/Mvc/Micro/LazyLoader.php index f56cef08..ca15e9c8 100644 --- a/src/Mvc/Micro/LazyLoader.php +++ b/src/Mvc/Micro/LazyLoader.php @@ -9,6 +9,7 @@ */ namespace Phalcon\Mvc\Micro; +use Phalcon\Mvc\Micro\Exceptions\LazyHandlerNotFound; use Phalcon\Mvc\Model\BinderInterface; /** @@ -43,9 +44,9 @@ public function __construct(string $definition) * @param array $arguments * @return mixed * @param string $method - * @param \Phalcon\Mvc\Model\BinderInterface $modelBinder + * @param \Phalcon\Mvc\Model\BinderInterface|null $modelBinder */ - public function callMethod(string $method, $arguments, \Phalcon\Mvc\Model\BinderInterface $modelBinder = null) + public function callMethod(string $method, $arguments, ?\Phalcon\Mvc\Model\BinderInterface $modelBinder = null) { } diff --git a/src/Mvc/Model.php b/src/Mvc/Model.php index c4ecc308..42f74c6d 100644 --- a/src/Mvc/Model.php +++ b/src/Mvc/Model.php @@ -12,7 +12,6 @@ use JsonSerializable; use Phalcon\Db\Adapter\AdapterInterface; use Phalcon\Db\Column; -use Phalcon\Db\DialectInterface; use Phalcon\Db\Enum; use Phalcon\Db\RawValue; use Phalcon\Di\AbstractInjectionAware; @@ -25,17 +24,42 @@ use Phalcon\Mvc\Model\Criteria; use Phalcon\Mvc\Model\CriteriaInterface; use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\Exceptions\BelongsToRequiresObject; +use Phalcon\Mvc\Model\Exceptions\BindTypeNotDefined; +use Phalcon\Mvc\Model\Exceptions\CannotResolveAttribute; +use Phalcon\Mvc\Model\Exceptions\ColumnNotInMap; +use Phalcon\Mvc\Model\Exceptions\ColumnNotInTableColumns; +use Phalcon\Mvc\Model\Exceptions\ColumnNotInTableMap; +use Phalcon\Mvc\Model\Exceptions\DataTypeNotDefined; +use Phalcon\Mvc\Model\Exceptions\IdentityNotInColumnMap; +use Phalcon\Mvc\Model\Exceptions\IdentityNotInTableColumns; +use Phalcon\Mvc\Model\Exceptions\InvalidDumpResultKey; +use Phalcon\Mvc\Model\Exceptions\InvalidFindParameters; +use Phalcon\Mvc\Model\Exceptions\InvalidModelsManagerService; +use Phalcon\Mvc\Model\Exceptions\InvalidModelsMetadataService; +use Phalcon\Mvc\Model\Exceptions\MethodNotFound; +use Phalcon\Mvc\Model\Exceptions\ModelOrmServicesUnavailable; +use Phalcon\Mvc\Model\Exceptions\PrimaryKeyAttributeNotSet; +use Phalcon\Mvc\Model\Exceptions\PrimaryKeyRequired; +use Phalcon\Mvc\Model\Exceptions\PropertyNotAccessible; +use Phalcon\Mvc\Model\Exceptions\RecordCannotRefresh; +use Phalcon\Mvc\Model\Exceptions\RecordNotPersisted; +use Phalcon\Mvc\Model\Exceptions\RelationNotDefined; +use Phalcon\Mvc\Model\Exceptions\RelationRequiresObjectOrArray; +use Phalcon\Mvc\Model\Exceptions\SnapshotsDisabled; +use Phalcon\Mvc\Model\Exceptions\StaticMethodRequiresOneArgument; +use Phalcon\Mvc\Model\Exceptions\UpdateSnapshotDisabled; use Phalcon\Mvc\Model\ManagerInterface; use Phalcon\Mvc\Model\MetaDataInterface; use Phalcon\Mvc\Model\Query; use Phalcon\Mvc\Model\Query\Builder; use Phalcon\Mvc\Model\Query\BuilderInterface; use Phalcon\Mvc\Model\QueryInterface; +use Phalcon\Mvc\Model\Relation; +use Phalcon\Mvc\Model\RelationInterface; use Phalcon\Mvc\Model\ResultInterface; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; -use Phalcon\Mvc\Model\Relation; -use Phalcon\Mvc\Model\RelationInterface; use Phalcon\Mvc\Model\TransactionInterface; use Phalcon\Mvc\Model\ValidationFailed; use Phalcon\Mvc\ModelInterface; @@ -205,10 +229,10 @@ abstract class Model extends AbstractInjectionAware implements \Phalcon\Mvc\Enti * Phalcon\Mvc\Model constructor * * @param mixed $data - * @param \Phalcon\Di\DiInterface $container - * @param \Phalcon\Mvc\Model\ManagerInterface $modelsManager + * @param \Phalcon\Di\DiInterface|null $container + * @param \Phalcon\Mvc\Model\ManagerInterface|null $modelsManager */ - final public function __construct($data = null, \Phalcon\Di\DiInterface $container = null, \Phalcon\Mvc\Model\ManagerInterface $modelsManager = null) + final public function __construct($data = null, ?\Phalcon\Di\DiInterface $container = null, ?\Phalcon\Mvc\Model\ManagerInterface $modelsManager = null) { } @@ -492,7 +516,7 @@ public static function cloneResult(\Phalcon\Mvc\ModelInterface $base, array $dat * @return ModelInterface * @param array $data */ - public static function cloneResultMap($base, array $data, $columnMap, int $dirtyState = 0, bool $keepSnapshots = null): ModelInterface + public static function cloneResultMap($base, array $data, $columnMap, int $dirtyState = 0, ?bool $keepSnapshots = null): ModelInterface { } @@ -1270,10 +1294,10 @@ public static function minimum($parameters = null): mixed /** * Create a criteria for a specific model * - * @param \Phalcon\Di\DiInterface $container + * @param \Phalcon\Di\DiInterface|null $container * @return CriteriaInterface */ - public static function query(\Phalcon\Di\DiInterface $container = null): CriteriaInterface + public static function query(?\Phalcon\Di\DiInterface $container = null): CriteriaInterface { } diff --git a/src/Mvc/Model/Behavior.php b/src/Mvc/Model/Behavior.php index 7f7ddf50..866bde73 100644 --- a/src/Mvc/Model/Behavior.php +++ b/src/Mvc/Model/Behavior.php @@ -33,43 +33,43 @@ public function __construct(array $options = []) } /** - * Returns the behavior options related to an event + * Acts as fallbacks when a missing method is called on the model * - * @return array - * @param string $eventName + * @param \Phalcon\Mvc\ModelInterface $model + * @param string $method + * @param array $arguments */ - protected function getOptions(string $eventName = null) + public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $method, array $arguments = []) { } /** - * Acts as fallbacks when a missing method is called on the model + * This method receives the notifications from the EventsManager * + * @param string $type * @param \Phalcon\Mvc\ModelInterface $model - * @param string $method - * @param array $arguments */ - public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $method, array $arguments = []) + public function notify(string $type, \Phalcon\Mvc\ModelInterface $model) { } /** - * Checks whether the behavior must take action on certain event + * Returns the behavior options related to an event * - * @param string $eventName - * @return bool + * @return array + * @param string|null $eventName */ - protected function mustTakeAction(string $eventName): bool + protected function getOptions(?string $eventName = null) { } /** - * This method receives the notifications from the EventsManager + * Checks whether the behavior must take action on certain event * - * @param string $type - * @param \Phalcon\Mvc\ModelInterface $model + * @param string $eventName + * @return bool */ - public function notify(string $type, \Phalcon\Mvc\ModelInterface $model) + protected function mustTakeAction(string $eventName): bool { } } diff --git a/src/Mvc/Model/Behavior/Exceptions/MissingRequiredOption.php b/src/Mvc/Model/Behavior/Exceptions/MissingRequiredOption.php new file mode 100644 index 00000000..bc5c1568 --- /dev/null +++ b/src/Mvc/Model/Behavior/Exceptions/MissingRequiredOption.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Behavior\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingRequiredOption extends Exception +{ + /** + * @param string $option + */ + public function __construct(string $option) + { + } +} diff --git a/src/Mvc/Model/Behavior/SoftDelete.php b/src/Mvc/Model/Behavior/SoftDelete.php index 5fdb83e6..040e6353 100644 --- a/src/Mvc/Model/Behavior/SoftDelete.php +++ b/src/Mvc/Model/Behavior/SoftDelete.php @@ -9,9 +9,10 @@ */ namespace Phalcon\Mvc\Model\Behavior; -use Phalcon\Mvc\ModelInterface; use Phalcon\Mvc\Model\Behavior; +use Phalcon\Mvc\Model\Behavior\Exceptions\MissingRequiredOption; use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\ModelInterface; use Phalcon\Support\Settings; /** diff --git a/src/Mvc/Model/Behavior/Timestampable.php b/src/Mvc/Model/Behavior/Timestampable.php index d016bd38..3a0c0a8a 100644 --- a/src/Mvc/Model/Behavior/Timestampable.php +++ b/src/Mvc/Model/Behavior/Timestampable.php @@ -10,9 +10,10 @@ namespace Phalcon\Mvc\Model\Behavior; use Closure; -use Phalcon\Mvc\ModelInterface; use Phalcon\Mvc\Model\Behavior; +use Phalcon\Mvc\Model\Behavior\Exceptions\MissingRequiredOption; use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\ModelInterface; /** * Phalcon\Mvc\Model\Behavior\Timestampable diff --git a/src/Mvc/Model/Binder.php b/src/Mvc/Model/Binder.php index c31c2fbd..278cb7f7 100644 --- a/src/Mvc/Model/Binder.php +++ b/src/Mvc/Model/Binder.php @@ -10,9 +10,13 @@ namespace Phalcon\Mvc\Model; use Closure; +use Phalcon\Cache\Adapter\AdapterInterface; use Phalcon\Mvc\Controller\BindModelInterface; use Phalcon\Mvc\Model\Binder\BindableInterface; -use Phalcon\Cache\Adapter\AdapterInterface; +use Phalcon\Mvc\Model\Exceptions\HandlerMustImplementBindable; +use Phalcon\Mvc\Model\Exceptions\InvalidGetModelNameReturn; +use Phalcon\Mvc\Model\Exceptions\MissingMethodName; +use Phalcon\Mvc\Model\Exceptions\MissingModelClassName; use ReflectionFunction; use ReflectionMethod; use ReflectionNamedType; @@ -55,9 +59,9 @@ class Binder implements \Phalcon\Mvc\Model\BinderInterface /** * Phalcon\Mvc\Model\Binder constructor * - * @param \Phalcon\Cache\Adapter\AdapterInterface $cache + * @param \Phalcon\Cache\Adapter\AdapterInterface|null $cache */ - public function __construct(\Phalcon\Cache\Adapter\AdapterInterface $cache = null) + public function __construct(?\Phalcon\Cache\Adapter\AdapterInterface $cache = null) { } @@ -67,30 +71,28 @@ public function __construct(\Phalcon\Cache\Adapter\AdapterInterface $cache = nul * @param object $handler * @param array $params * @param string $cacheKey - * @param string $methodName + * @param string|null $methodName * @return array */ - public function bindToHandler($handler, array $params, string $cacheKey, string $methodName = null): array + public function bindToHandler($handler, array $params, string $cacheKey, ?string $methodName = null): array { } /** - * Find the model by param value. + * Return the active bound models * - * @return mixed - * @param mixed $paramValue - * @param string $className + * @return array */ - protected function findBoundModel($paramValue, string $className): mixed + public function getBoundModels(): array { } /** - * Return the active bound models + * Sets cache instance * - * @return array + * @return AdapterInterface */ - public function getBoundModels(): array + public function getCache(): AdapterInterface { } @@ -104,11 +106,23 @@ public function getOriginalValues(): array } /** - * Sets cache instance + * Gets cache instance * - * @return AdapterInterface + * @param \Phalcon\Cache\Adapter\AdapterInterface $cache + * @return BinderInterface */ - public function getCache(): AdapterInterface + public function setCache(\Phalcon\Cache\Adapter\AdapterInterface $cache): BinderInterface + { + } + + /** + * Find the model by param value. + * + * @return mixed + * @param mixed $paramValue + * @param string $className + */ + protected function findBoundModel($paramValue, string $className): mixed { } @@ -134,14 +148,4 @@ protected function getParamsFromCache(string $cacheKey): array|null protected function getParamsFromReflection($handler, array $params, string $cacheKey, string $methodName): array { } - - /** - * Gets cache instance - * - * @param \Phalcon\Cache\Adapter\AdapterInterface $cache - * @return BinderInterface - */ - public function setCache(\Phalcon\Cache\Adapter\AdapterInterface $cache): BinderInterface - { - } } diff --git a/src/Mvc/Model/BinderInterface.php b/src/Mvc/Model/BinderInterface.php index 7140d8d2..d15c04d0 100644 --- a/src/Mvc/Model/BinderInterface.php +++ b/src/Mvc/Model/BinderInterface.php @@ -24,10 +24,10 @@ interface BinderInterface * @param object $handler * @param array $params * @param string $cacheKey - * @param string $methodName + * @param string|null $methodName * @return array */ - public function bindToHandler($handler, array $params, string $cacheKey, string $methodName = null): array; + public function bindToHandler($handler, array $params, string $cacheKey, ?string $methodName = null): array; /** * Gets active bound models diff --git a/src/Mvc/Model/Criteria.php b/src/Mvc/Model/Criteria.php index f026126a..1f790f17 100644 --- a/src/Mvc/Model/Criteria.php +++ b/src/Mvc/Model/Criteria.php @@ -9,10 +9,11 @@ */ namespace Phalcon\Mvc\Model; -use Phalcon\Di\Di; use Phalcon\Db\Column; +use Phalcon\Di\Di; use Phalcon\Di\DiInterface; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Mvc\Model\Exceptions\InvalidModelName; use Phalcon\Mvc\Model\Query\BuilderInterface; /** @@ -352,6 +353,21 @@ public function having($having): CriteriaInterface { } + /** + * Appends an IN condition to the current conditions + * + * ```php + * $criteria->inWhere("id", [1, 2, 3]); + * ``` + * + * @param string $expr + * @param array $values + * @return CriteriaInterface + */ + public function inWhere(string $expr, array $values): CriteriaInterface + { + } + /** * Adds an INNER join to the query * @@ -383,21 +399,6 @@ public function innerJoin(string $model, $conditions = null, $alias = null): Cri { } - /** - * Appends an IN condition to the current conditions - * - * ```php - * $criteria->inWhere("id", [1, 2, 3]); - * ``` - * - * @param string $expr - * @param array $values - * @return CriteriaInterface - */ - public function inWhere(string $expr, array $values): CriteriaInterface - { - } - /** * Adds an INNER join to the query * @@ -508,24 +509,24 @@ public function notInWhere(string $expr, array $values): CriteriaInterface } /** - * Adds the order-by clause to the criteria + * Appends a condition to the current conditions using an OR operator * - * @param string $orderColumns + * @param string $conditions + * @param mixed $bindParams + * @param mixed $bindTypes * @return CriteriaInterface */ - public function orderBy(string $orderColumns): CriteriaInterface + public function orWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface { } /** - * Appends a condition to the current conditions using an OR operator + * Adds the order-by clause to the criteria * - * @param string $conditions - * @param mixed $bindParams - * @param mixed $bindTypes + * @param string $orderColumns * @return CriteriaInterface */ - public function orWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface + public function orderBy(string $orderColumns): CriteriaInterface { } diff --git a/src/Mvc/Model/CriteriaInterface.php b/src/Mvc/Model/CriteriaInterface.php index 0a487b2a..399f5d6d 100644 --- a/src/Mvc/Model/CriteriaInterface.php +++ b/src/Mvc/Model/CriteriaInterface.php @@ -179,6 +179,19 @@ public function groupBy($group): CriteriaInterface; */ public function having($having): CriteriaInterface; + /** + * Appends an IN condition to the current conditions + * + * ```php + * $criteria->inWhere("id", [1, 2, 3]); + * ``` + * + * @param string $expr + * @param array $values + * @return CriteriaInterface + */ + public function inWhere(string $expr, array $values): CriteriaInterface; + /** * Adds an INNER join to the query * @@ -206,19 +219,6 @@ public function having($having): CriteriaInterface; */ public function innerJoin(string $model, $conditions = null, $alias = null): CriteriaInterface; - /** - * Appends an IN condition to the current conditions - * - * ```php - * $criteria->inWhere("id", [1, 2, 3]); - * ``` - * - * @param string $expr - * @param array $values - * @return CriteriaInterface - */ - public function inWhere(string $expr, array $values): CriteriaInterface; - /** * Adds a LEFT join to the query * @@ -273,14 +273,6 @@ public function notBetweenWhere(string $expr, $minimum, $maximum): CriteriaInter */ public function notInWhere(string $expr, array $values): CriteriaInterface; - /** - * Adds the order-by parameter to the criteria - * - * @param string $orderColumns - * @return CriteriaInterface - */ - public function orderBy(string $orderColumns): CriteriaInterface; - /** * Appends a condition to the current conditions using an OR operator * @@ -291,6 +283,14 @@ public function orderBy(string $orderColumns): CriteriaInterface; */ public function orWhere(string $conditions, $bindParams = null, $bindTypes = null): CriteriaInterface; + /** + * Adds the order-by parameter to the criteria + * + * @param string $orderColumns + * @return CriteriaInterface + */ + public function orderBy(string $orderColumns): CriteriaInterface; + /** * Adds a RIGHT join to the query * diff --git a/src/Mvc/Model/Exceptions/BelongsToRequiresObject.php b/src/Mvc/Model/Exceptions/BelongsToRequiresObject.php new file mode 100644 index 00000000..79c9b65d --- /dev/null +++ b/src/Mvc/Model/Exceptions/BelongsToRequiresObject.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BelongsToRequiresObject extends Exception +{ + /** + * @param string $className + * @param string $relationName + */ + public function __construct(string $className, string $relationName) + { + } +} diff --git a/src/Mvc/Model/Exceptions/BindTypeNotDefined.php b/src/Mvc/Model/Exceptions/BindTypeNotDefined.php new file mode 100644 index 00000000..c1fd1b82 --- /dev/null +++ b/src/Mvc/Model/Exceptions/BindTypeNotDefined.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BindTypeNotDefined extends Exception +{ + /** + * @param string $column + * @param string $className + */ + public function __construct(string $column, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/CannotResolveAttribute.php b/src/Mvc/Model/Exceptions/CannotResolveAttribute.php new file mode 100644 index 00000000..9d86e8f8 --- /dev/null +++ b/src/Mvc/Model/Exceptions/CannotResolveAttribute.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotResolveAttribute extends Exception +{ + /** + * @param string $attribute + * @param string $className + */ + public function __construct(string $attribute, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ColumnNotInMap.php b/src/Mvc/Model/Exceptions/ColumnNotInMap.php new file mode 100644 index 00000000..ad07595d --- /dev/null +++ b/src/Mvc/Model/Exceptions/ColumnNotInMap.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnNotInMap extends Exception +{ + /** + * @param string $column + * @param string $className + */ + public function __construct(string $column, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ColumnNotInTableColumns.php b/src/Mvc/Model/Exceptions/ColumnNotInTableColumns.php new file mode 100644 index 00000000..db75065b --- /dev/null +++ b/src/Mvc/Model/Exceptions/ColumnNotInTableColumns.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnNotInTableColumns extends Exception +{ + /** + * @param string $column + * @param string $className + */ + public function __construct(string $column, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ColumnNotInTableMap.php b/src/Mvc/Model/Exceptions/ColumnNotInTableMap.php new file mode 100644 index 00000000..ef3c2739 --- /dev/null +++ b/src/Mvc/Model/Exceptions/ColumnNotInTableMap.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnNotInTableMap extends Exception +{ + /** + * @param string $column + * @param string $className + */ + public function __construct(string $column, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/CorruptColumnType.php b/src/Mvc/Model/Exceptions/CorruptColumnType.php new file mode 100644 index 00000000..cc8a8bd5 --- /dev/null +++ b/src/Mvc/Model/Exceptions/CorruptColumnType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptColumnType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/CursorIsImmutable.php b/src/Mvc/Model/Exceptions/CursorIsImmutable.php new file mode 100644 index 00000000..bfacf94a --- /dev/null +++ b/src/Mvc/Model/Exceptions/CursorIsImmutable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CursorIsImmutable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/DataTypeNotDefined.php b/src/Mvc/Model/Exceptions/DataTypeNotDefined.php new file mode 100644 index 00000000..b0161d64 --- /dev/null +++ b/src/Mvc/Model/Exceptions/DataTypeNotDefined.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DataTypeNotDefined extends Exception +{ + /** + * @param string $column + * @param string $className + */ + public function __construct(string $column, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/HandlerMustImplementBindable.php b/src/Mvc/Model/Exceptions/HandlerMustImplementBindable.php new file mode 100644 index 00000000..0c2a3d76 --- /dev/null +++ b/src/Mvc/Model/Exceptions/HandlerMustImplementBindable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class HandlerMustImplementBindable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/IdentityNotInColumnMap.php b/src/Mvc/Model/Exceptions/IdentityNotInColumnMap.php new file mode 100644 index 00000000..83c91e65 --- /dev/null +++ b/src/Mvc/Model/Exceptions/IdentityNotInColumnMap.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IdentityNotInColumnMap extends Exception +{ + /** + * @param string $identityField + * @param string $className + */ + public function __construct(string $identityField, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/IdentityNotInTableColumns.php b/src/Mvc/Model/Exceptions/IdentityNotInTableColumns.php new file mode 100644 index 00000000..1b0624d1 --- /dev/null +++ b/src/Mvc/Model/Exceptions/IdentityNotInTableColumns.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IdentityNotInTableColumns extends Exception +{ + /** + * @param string $identityField + * @param string $className + */ + public function __construct(string $identityField, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/IndexNotInCursor.php b/src/Mvc/Model/Exceptions/IndexNotInCursor.php new file mode 100644 index 00000000..2c37c6b6 --- /dev/null +++ b/src/Mvc/Model/Exceptions/IndexNotInCursor.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IndexNotInCursor extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/IndexNotInRow.php b/src/Mvc/Model/Exceptions/IndexNotInRow.php new file mode 100644 index 00000000..936373fd --- /dev/null +++ b/src/Mvc/Model/Exceptions/IndexNotInRow.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class IndexNotInRow extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidConnectionService.php b/src/Mvc/Model/Exceptions/InvalidConnectionService.php new file mode 100644 index 00000000..a0e604dc --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidConnectionService.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidConnectionService extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidContainer.php b/src/Mvc/Model/Exceptions/InvalidContainer.php new file mode 100644 index 00000000..7d1f6c8a --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidContainer.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidContainer extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidDumpResultKey.php b/src/Mvc/Model/Exceptions/InvalidDumpResultKey.php new file mode 100644 index 00000000..ed7dce07 --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidDumpResultKey.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidDumpResultKey extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidFindParameters.php b/src/Mvc/Model/Exceptions/InvalidFindParameters.php new file mode 100644 index 00000000..7c85a70f --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidFindParameters.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidFindParameters extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidGetModelNameReturn.php b/src/Mvc/Model/Exceptions/InvalidGetModelNameReturn.php new file mode 100644 index 00000000..754d71e0 --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidGetModelNameReturn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidGetModelNameReturn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidModelName.php b/src/Mvc/Model/Exceptions/InvalidModelName.php new file mode 100644 index 00000000..6d09564d --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidModelName.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidModelName extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidModelsManagerService.php b/src/Mvc/Model/Exceptions/InvalidModelsManagerService.php new file mode 100644 index 00000000..2b8e0f3a --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidModelsManagerService.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidModelsManagerService extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidModelsMetadataService.php b/src/Mvc/Model/Exceptions/InvalidModelsMetadataService.php new file mode 100644 index 00000000..b00dba58 --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidModelsMetadataService.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidModelsMetadataService extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidResultsetCacheService.php b/src/Mvc/Model/Exceptions/InvalidResultsetCacheService.php new file mode 100644 index 00000000..5e908008 --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidResultsetCacheService.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidResultsetCacheService extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidReturnedRecord.php b/src/Mvc/Model/Exceptions/InvalidReturnedRecord.php new file mode 100644 index 00000000..6756e16d --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidReturnedRecord.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidReturnedRecord extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/InvalidSerializationData.php b/src/Mvc/Model/Exceptions/InvalidSerializationData.php new file mode 100644 index 00000000..8a3fd68c --- /dev/null +++ b/src/Mvc/Model/Exceptions/InvalidSerializationData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidSerializationData extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/ManagerOrmServicesUnavailable.php b/src/Mvc/Model/Exceptions/ManagerOrmServicesUnavailable.php new file mode 100644 index 00000000..6bd8c6e9 --- /dev/null +++ b/src/Mvc/Model/Exceptions/ManagerOrmServicesUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ManagerOrmServicesUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/MethodNotFound.php b/src/Mvc/Model/Exceptions/MethodNotFound.php new file mode 100644 index 00000000..b2437d68 --- /dev/null +++ b/src/Mvc/Model/Exceptions/MethodNotFound.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MethodNotFound extends Exception +{ + /** + * @param string $method + * @param string $modelName + */ + public function __construct(string $method, string $modelName) + { + } +} diff --git a/src/Mvc/Model/Exceptions/MissingMethodName.php b/src/Mvc/Model/Exceptions/MissingMethodName.php new file mode 100644 index 00000000..bb5d55ac --- /dev/null +++ b/src/Mvc/Model/Exceptions/MissingMethodName.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingMethodName extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/MissingModelClassName.php b/src/Mvc/Model/Exceptions/MissingModelClassName.php new file mode 100644 index 00000000..8d330374 --- /dev/null +++ b/src/Mvc/Model/Exceptions/MissingModelClassName.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingModelClassName extends Exception +{ + /** + * @param string $paramKey + */ + public function __construct(string $paramKey) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ModelCouldNotLoad.php b/src/Mvc/Model/Exceptions/ModelCouldNotLoad.php new file mode 100644 index 00000000..df92a10b --- /dev/null +++ b/src/Mvc/Model/Exceptions/ModelCouldNotLoad.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModelCouldNotLoad extends Exception +{ + /** + * @param string $modelName + */ + public function __construct(string $modelName) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ModelOrmServicesUnavailable.php b/src/Mvc/Model/Exceptions/ModelOrmServicesUnavailable.php new file mode 100644 index 00000000..58d54453 --- /dev/null +++ b/src/Mvc/Model/Exceptions/ModelOrmServicesUnavailable.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModelOrmServicesUnavailable extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/PrimaryKeyAttributeNotSet.php b/src/Mvc/Model/Exceptions/PrimaryKeyAttributeNotSet.php new file mode 100644 index 00000000..1c9d7159 --- /dev/null +++ b/src/Mvc/Model/Exceptions/PrimaryKeyAttributeNotSet.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PrimaryKeyAttributeNotSet extends Exception +{ + /** + * @param string $attribute + * @param string $className + */ + public function __construct(string $attribute, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/PrimaryKeyRequired.php b/src/Mvc/Model/Exceptions/PrimaryKeyRequired.php new file mode 100644 index 00000000..a2343109 --- /dev/null +++ b/src/Mvc/Model/Exceptions/PrimaryKeyRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PrimaryKeyRequired extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/PropertyNotAccessible.php b/src/Mvc/Model/Exceptions/PropertyNotAccessible.php new file mode 100644 index 00000000..152f7291 --- /dev/null +++ b/src/Mvc/Model/Exceptions/PropertyNotAccessible.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PropertyNotAccessible extends Exception +{ + /** + * @param string $property + * @param string $className + */ + public function __construct(string $property, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RecordCannotRefresh.php b/src/Mvc/Model/Exceptions/RecordCannotRefresh.php new file mode 100644 index 00000000..9f890663 --- /dev/null +++ b/src/Mvc/Model/Exceptions/RecordCannotRefresh.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RecordCannotRefresh extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RecordNotPersisted.php b/src/Mvc/Model/Exceptions/RecordNotPersisted.php new file mode 100644 index 00000000..d36d692e --- /dev/null +++ b/src/Mvc/Model/Exceptions/RecordNotPersisted.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RecordNotPersisted extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ReferencedFieldsMismatch.php b/src/Mvc/Model/Exceptions/ReferencedFieldsMismatch.php new file mode 100644 index 00000000..e67d73e9 --- /dev/null +++ b/src/Mvc/Model/Exceptions/ReferencedFieldsMismatch.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReferencedFieldsMismatch extends Exception +{ + /** + * @param string $relationType + * @param string $entityName + * @param string $referencedEntity + */ + public function __construct(string $relationType, string $entityName, string $referencedEntity) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RelationAliasMustBeString.php b/src/Mvc/Model/Exceptions/RelationAliasMustBeString.php new file mode 100644 index 00000000..b03b7d39 --- /dev/null +++ b/src/Mvc/Model/Exceptions/RelationAliasMustBeString.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RelationAliasMustBeString extends Exception +{ + /** + * @param string $relationType + * @param string $entityName + * @param string $referencedEntity + */ + public function __construct(string $relationType, string $entityName, string $referencedEntity) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RelationNotDefined.php b/src/Mvc/Model/Exceptions/RelationNotDefined.php new file mode 100644 index 00000000..a29b508f --- /dev/null +++ b/src/Mvc/Model/Exceptions/RelationNotDefined.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RelationNotDefined extends Exception +{ + /** + * @param string $className + * @param string $alias + */ + public function __construct(string $className, string $alias) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RelationRequiresObjectOrArray.php b/src/Mvc/Model/Exceptions/RelationRequiresObjectOrArray.php new file mode 100644 index 00000000..d4d69267 --- /dev/null +++ b/src/Mvc/Model/Exceptions/RelationRequiresObjectOrArray.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RelationRequiresObjectOrArray extends Exception +{ + /** + * @param string $className + * @param string $relationName + */ + public function __construct(string $className, string $relationName) + { + } +} diff --git a/src/Mvc/Model/Exceptions/ResultsetColumnNotInMap.php b/src/Mvc/Model/Exceptions/ResultsetColumnNotInMap.php new file mode 100644 index 00000000..450d0ee2 --- /dev/null +++ b/src/Mvc/Model/Exceptions/ResultsetColumnNotInMap.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResultsetColumnNotInMap extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Mvc/Model/Exceptions/RowIsImmutable.php b/src/Mvc/Model/Exceptions/RowIsImmutable.php new file mode 100644 index 00000000..9b3cfa57 --- /dev/null +++ b/src/Mvc/Model/Exceptions/RowIsImmutable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RowIsImmutable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/SnapshotsDisabled.php b/src/Mvc/Model/Exceptions/SnapshotsDisabled.php new file mode 100644 index 00000000..cc1c1f78 --- /dev/null +++ b/src/Mvc/Model/Exceptions/SnapshotsDisabled.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SnapshotsDisabled extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/StaticMethodRequiresOneArgument.php b/src/Mvc/Model/Exceptions/StaticMethodRequiresOneArgument.php new file mode 100644 index 00000000..0c563370 --- /dev/null +++ b/src/Mvc/Model/Exceptions/StaticMethodRequiresOneArgument.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class StaticMethodRequiresOneArgument extends Exception +{ + /** + * @param string $method + * @param string $className + */ + public function __construct(string $method, string $className) + { + } +} diff --git a/src/Mvc/Model/Exceptions/UnknownRelationType.php b/src/Mvc/Model/Exceptions/UnknownRelationType.php new file mode 100644 index 00000000..a5a56339 --- /dev/null +++ b/src/Mvc/Model/Exceptions/UnknownRelationType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownRelationType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Exceptions/UpdateSnapshotDisabled.php b/src/Mvc/Model/Exceptions/UpdateSnapshotDisabled.php new file mode 100644 index 00000000..081baab2 --- /dev/null +++ b/src/Mvc/Model/Exceptions/UpdateSnapshotDisabled.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UpdateSnapshotDisabled extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Manager.php b/src/Mvc/Model/Manager.php index 8d65378a..60ba0336 100644 --- a/src/Mvc/Model/Manager.php +++ b/src/Mvc/Model/Manager.php @@ -15,10 +15,16 @@ use Phalcon\Di\InjectionAwareInterface; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface as EventsManagerInterface; -use Phalcon\Mvc\ModelInterface; +use Phalcon\Mvc\Model\Exceptions\InvalidConnectionService; +use Phalcon\Mvc\Model\Exceptions\ManagerOrmServicesUnavailable; +use Phalcon\Mvc\Model\Exceptions\ModelCouldNotLoad; +use Phalcon\Mvc\Model\Exceptions\ReferencedFieldsMismatch; +use Phalcon\Mvc\Model\Exceptions\RelationAliasMustBeString; +use Phalcon\Mvc\Model\Exceptions\UnknownRelationType; use Phalcon\Mvc\Model\Query\Builder; use Phalcon\Mvc\Model\Query\BuilderInterface; use Phalcon\Mvc\Model\Query\StatusInterface; +use Phalcon\Mvc\ModelInterface; use Phalcon\Support\Settings; use ReflectionClass; use ReflectionProperty; @@ -472,7 +478,7 @@ public function getBelongsTo(\Phalcon\Mvc\ModelInterface $model): array * * @return ResultsetInterface | bool */ - public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ResultsetInterface|bool + public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ResultsetInterface|bool { } @@ -545,10 +551,10 @@ public function getHasMany(\Phalcon\Mvc\ModelInterface $model): array * @param string $modelRelation * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters - * @param string $method + * @param string|null $method * @return bool|ResultsetInterface */ - public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ResultsetInterface|bool + public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ResultsetInterface|bool { } @@ -589,10 +595,10 @@ public function getHasOneAndHasMany(\Phalcon\Mvc\ModelInterface $model): array * @param string $modelRelation * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters - * @param string $method + * @param string|null $method * @return bool|ModelInterface */ - public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ModelInterface|bool + public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ModelInterface|bool { } @@ -609,9 +615,9 @@ public function getHasOneThrough(\Phalcon\Mvc\ModelInterface $model): array /** * Get last initialized model * - * @return ModelInterface + * @return ModelInterface|null */ - public function getLastInitialized(): ModelInterface + public function getLastInitialized(): ModelInterface|null { } @@ -694,7 +700,7 @@ public function getRelationByAlias(string $modelName, string $alias): RelationIn * * @return \Phalcon\Mvc\Model\Resultset\Simple|int|false */ - public function getRelationRecords(RelationInterface $relation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null) + public function getRelationRecords(RelationInterface $relation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null) { } @@ -901,6 +907,19 @@ public function load(string $modelName): ModelInterface { } + /** + * Dispatch an event to the listeners and behaviors + * This method expects that the endpoint listeners/behaviors returns true + * meaning that a least one was implemented + * + * @param ModelInterface $model + * @param string $eventName + * @param mixed $data + */ + public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $eventName, $data) + { + } + /** * Receives events generated in the models and dispatches them to an * events-manager if available. Notify the behaviors that are listening in @@ -914,15 +933,14 @@ public function notifyEvent(string $eventName, \Phalcon\Mvc\ModelInterface $mode } /** - * Dispatch an event to the listeners and behaviors - * This method expects that the endpoint listeners/behaviors returns true - * meaning that a least one was implemented + * Removes a behavior from a model * * @param ModelInterface $model - * @param string $eventName - * @param mixed $data + * @param string $behaviorClass + * + * @return void */ - public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $eventName, $data) + public function removeBehavior(\Phalcon\Mvc\ModelInterface $model, string $behaviorClass): void { } diff --git a/src/Mvc/Model/ManagerInterface.php b/src/Mvc/Model/ManagerInterface.php index c526f492..a38b3ec6 100644 --- a/src/Mvc/Model/ManagerInterface.php +++ b/src/Mvc/Model/ManagerInterface.php @@ -54,6 +54,21 @@ public function addBelongsTo(\Phalcon\Mvc\ModelInterface $model, $fields, string */ public function addHasMany(\Phalcon\Mvc\ModelInterface $model, $fields, string $referencedModel, $referencedFields, array $options = []): RelationInterface; + /** + * Setups a relation n-m between two models + * + * @param string $fields + * @param string $intermediateFields + * @param string $intermediateReferencedFields + * @param string $referencedFields + * @param array $options + * @param \Phalcon\Mvc\ModelInterface $model + * @param string $intermediateModel + * @param string $referencedModel + * @return RelationInterface + */ + public function addHasManyToMany(\Phalcon\Mvc\ModelInterface $model, $fields, string $intermediateModel, $intermediateFields, $intermediateReferencedFields, string $referencedModel, $referencedFields, array $options = []): RelationInterface; + /** * Setup a 1-1 relation between two models * @@ -82,19 +97,11 @@ public function addHasOne(\Phalcon\Mvc\ModelInterface $model, $fields, string $r public function addHasOneThrough(\Phalcon\Mvc\ModelInterface $model, $fields, string $intermediateModel, $intermediateFields, $intermediateReferencedFields, string $referencedModel, $referencedFields, array $options = []): RelationInterface; /** - * Setups a relation n-m between two models + * Clears the internal reusable list * - * @param string $fields - * @param string $intermediateFields - * @param string $intermediateReferencedFields - * @param string $referencedFields - * @param array $options - * @param \Phalcon\Mvc\ModelInterface $model - * @param string $intermediateModel - * @param string $referencedModel - * @return RelationInterface + * @return void */ - public function addHasManyToMany(\Phalcon\Mvc\ModelInterface $model, $fields, string $intermediateModel, $intermediateFields, $intermediateReferencedFields, string $referencedModel, $referencedFields, array $options = []): RelationInterface; + public function clearReusableObjects(): void; /** * Creates a Phalcon\Mvc\Model\Query\Builder @@ -112,13 +119,6 @@ public function createBuilder($params = null): BuilderInterface; */ public function createQuery(string $phql): QueryInterface; - /** - * Clears the internal reusable list - * - * @return void - */ - public function clearReusableObjects(): void; - /** * Creates a Phalcon\Mvc\Model\Query and execute it * @@ -147,7 +147,7 @@ public function getBelongsTo(\Phalcon\Mvc\ModelInterface $model): array; * @param string|null $method * @return bool|ResultsetInterface */ - public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ResultsetInterface|bool; + public function getBelongsToRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ResultsetInterface|bool; /** * Returns the newly created Phalcon\Mvc\Model\Query\Builder or null @@ -174,7 +174,7 @@ public function getHasMany(\Phalcon\Mvc\ModelInterface $model): array; * @param string|null $method * @return bool|ResultsetInterface */ - public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ResultsetInterface|bool; + public function getHasManyRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ResultsetInterface|bool; /** * Gets hasManyToMany relations defined on a model @@ -192,14 +192,6 @@ public function getHasManyToMany(\Phalcon\Mvc\ModelInterface $model): array; */ public function getHasOne(\Phalcon\Mvc\ModelInterface $model): array; - /** - * Gets hasOneThrough relations defined on a model - * - * @param \Phalcon\Mvc\ModelInterface $model - * @return array|RelationInterface[] - */ - public function getHasOneThrough(\Phalcon\Mvc\ModelInterface $model): array; - /** * Gets hasOne relations defined on a model * @@ -218,14 +210,22 @@ public function getHasOneAndHasMany(\Phalcon\Mvc\ModelInterface $model): array; * @param string|null $method * @return bool|ModelInterface */ - public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null): ModelInterface|bool; + public function getHasOneRecords(string $modelName, string $modelRelation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null): ModelInterface|bool; + + /** + * Gets hasOneThrough relations defined on a model + * + * @param \Phalcon\Mvc\ModelInterface $model + * @return array|RelationInterface[] + */ + public function getHasOneThrough(\Phalcon\Mvc\ModelInterface $model): array; /** * Get last initialized model * - * @return ModelInterface + * @return ModelInterface|null */ - public function getLastInitialized(): ModelInterface; + public function getLastInitialized(): ModelInterface|null; /** * Returns the last query created or executed in the models manager @@ -282,9 +282,9 @@ public function getRelationByAlias(string $modelName, string $alias): RelationIn * @param RelationInterface $relation * @param \Phalcon\Mvc\ModelInterface $record * @param mixed $parameters - * @param string $method + * @param string|null $method */ - public function getRelationRecords(RelationInterface $relation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, string $method = null); + public function getRelationRecords(RelationInterface $relation, \Phalcon\Mvc\ModelInterface $record, $parameters = null, ?string $method = null); /** * Query all the relationships defined on a model @@ -348,39 +348,31 @@ public function hasBelongsTo(string $modelName, string $modelRelation): bool; public function hasHasMany(string $modelName, string $modelRelation): bool; /** - * Checks whether a model has a hasOne relation with another model + * Checks whether a model has a hasManyToMany relation with another model * * @param string $modelName * @param string $modelRelation * @return bool */ - public function hasHasOne(string $modelName, string $modelRelation): bool; + public function hasHasManyToMany(string $modelName, string $modelRelation): bool; /** - * Checks whether a model has a hasOneThrough relation with another model + * Checks whether a model has a hasOne relation with another model * * @param string $modelName * @param string $modelRelation * @return bool */ - public function hasHasOneThrough(string $modelName, string $modelRelation): bool; + public function hasHasOne(string $modelName, string $modelRelation): bool; /** - * Checks whether a model has a hasManyToMany relation with another model + * Checks whether a model has a hasOneThrough relation with another model * * @param string $modelName * @param string $modelRelation * @return bool */ - public function hasHasManyToMany(string $modelName, string $modelRelation): bool; - - /** - * Loads a model throwing an exception if it does not exist - * - * @param string $modelName - * @return ModelInterface - */ - public function load(string $modelName): ModelInterface; + public function hasHasOneThrough(string $modelName, string $modelRelation): bool; /** * Initializes a model in the model manager @@ -438,6 +430,14 @@ public function isVisibleModelProperty(\Phalcon\Mvc\ModelInterface $model, strin */ public function keepSnapshots(\Phalcon\Mvc\ModelInterface $model, bool $keepSnapshots): void; + /** + * Loads a model throwing an exception if it does not exist + * + * @param string $modelName + * @return ModelInterface + */ + public function load(string $modelName): ModelInterface; + /** * Dispatch an event to the listeners and behaviors * This method expects that the endpoint listeners/behaviors returns true @@ -460,33 +460,22 @@ public function missingMethod(\Phalcon\Mvc\ModelInterface $model, string $eventN public function notifyEvent(string $eventName, \Phalcon\Mvc\ModelInterface $model); /** - * Sets both write and read connection service for a model + * Removes a behavior from a model * * @param \Phalcon\Mvc\ModelInterface $model - * @param string $connectionService + * @param string $behaviorClass * @return void */ - public function setConnectionService(\Phalcon\Mvc\ModelInterface $model, string $connectionService): void; + public function removeBehavior(\Phalcon\Mvc\ModelInterface $model, string $behaviorClass): void; /** - * Sets read connection service for a model + * Sets both write and read connection service for a model * * @param \Phalcon\Mvc\ModelInterface $model * @param string $connectionService * @return void */ - public function setReadConnectionService(\Phalcon\Mvc\ModelInterface $model, string $connectionService): void; - - /** - * Stores a reusable record in the internal list - * - * @param string $modelName - * @param string $key - * @param mixed $records - * - * @return void - */ - public function setReusableRecords(string $modelName, string $key, $records): void; + public function setConnectionService(\Phalcon\Mvc\ModelInterface $model, string $connectionService): void; /** * Sets the mapped schema for a model @@ -506,6 +495,26 @@ public function setModelSchema(\Phalcon\Mvc\ModelInterface $model, string $schem */ public function setModelSource(\Phalcon\Mvc\ModelInterface $model, string $source): void; + /** + * Sets read connection service for a model + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param string $connectionService + * @return void + */ + public function setReadConnectionService(\Phalcon\Mvc\ModelInterface $model, string $connectionService): void; + + /** + * Stores a reusable record in the internal list + * + * @param string $modelName + * @param string $key + * @param mixed $records + * + * @return void + */ + public function setReusableRecords(string $modelName, string $key, $records): void; + /** * Sets write connection service for a model * diff --git a/src/Mvc/Model/MetaData.php b/src/Mvc/Model/MetaData.php index 9ad824c0..76a9d8e1 100644 --- a/src/Mvc/Model/MetaData.php +++ b/src/Mvc/Model/MetaData.php @@ -12,6 +12,10 @@ use Phalcon\Cache\Adapter\AdapterInterface as CacheAdapterInterface; use Phalcon\Di\DiInterface; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Mvc\Model\MetaData\Exceptions\ContainerRequired; +use Phalcon\Mvc\Model\MetaData\Exceptions\CorruptedMetaData; +use Phalcon\Mvc\Model\MetaData\Exceptions\InvalidMetaDataForModel; +use Phalcon\Mvc\Model\MetaData\Exceptions\MetaDataStrategyFailed; use Phalcon\Mvc\Model\MetaData\Strategy\Introspection; use Phalcon\Mvc\Model\MetaData\Strategy\StrategyInterface; use Phalcon\Mvc\ModelInterface; @@ -62,27 +66,27 @@ abstract class MetaData implements \Phalcon\Di\InjectionAwareInterface, \Phalcon /** * @var int */ - const MODELS_DATE_AT = 6; + const MODELS_DATA_TYPES = 4; /** * @var int */ - const MODELS_DATE_IN = 7; + const MODELS_DATA_TYPES_BIND = 9; /** * @var int */ - const MODELS_DATA_TYPES = 4; + const MODELS_DATA_TYPES_NUMERIC = 5; /** * @var int */ - const MODELS_DATA_TYPES_BIND = 9; + const MODELS_DATE_AT = 6; /** * @var int */ - const MODELS_DATA_TYPES_NUMERIC = 5; + const MODELS_DATE_IN = 7; /** * @var int @@ -254,20 +258,21 @@ public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): array|null } /** - * Returns attributes (which have default values) and their default values - * - * ```php - * print_r( - * $metaData->getDefaultValues( - * new Robots() - * ) - * ); - * ``` + * Returns a ColumnMap Unique key for meta-data is created using className * + * @return string * @param \Phalcon\Mvc\ModelInterface $model - * @return array */ - public function getDefaultValues(\Phalcon\Mvc\ModelInterface $model): array + final public function getColumnMapUniqueKey(\Phalcon\Mvc\ModelInterface $model): string|null + { + } + + /** + * Returns the DependencyInjector container + * + * @return DiInterface + */ + public function getDI(): DiInterface { } @@ -308,11 +313,20 @@ public function getDataTypesNumeric(\Phalcon\Mvc\ModelInterface $model): array } /** - * Returns the DependencyInjector container + * Returns attributes (which have default values) and their default values * - * @return DiInterface + * ```php + * print_r( + * $metaData->getDefaultValues( + * new Robots() + * ) + * ); + * ``` + * + * @param \Phalcon\Mvc\ModelInterface $model + * @return array */ - public function getDI(): DiInterface + public function getDefaultValues(\Phalcon\Mvc\ModelInterface $model): array { } @@ -346,9 +360,30 @@ public function getEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model): ar * ``` * * @param \Phalcon\Mvc\ModelInterface $model + * @return bool|string|null + */ + public function getIdentityField(\Phalcon\Mvc\ModelInterface $model): bool|string|null + { + } + + /** + * Returns a MetaData Unique key for meta-data is created using className + * + * @return string + * @param \Phalcon\Mvc\ModelInterface $model + */ + final public function getMetaDataUniqueKey(\Phalcon\Mvc\ModelInterface $model): string|null + { + } + + /** + * Returns the model UniqueID based on model and array row primary key(s) value(s) + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param array $row * @return string|null */ - public function getIdentityField(\Phalcon\Mvc\ModelInterface $model): string|null + public function getModelUUID(\Phalcon\Mvc\ModelInterface $model, array $row): string|null { } @@ -468,13 +503,24 @@ public function isEmpty(): bool { } + /** + * Compares if two models are the same in memory + * + * @param \Phalcon\Mvc\ModelInterface $first + * @param \Phalcon\Mvc\ModelInterface $other + * @return bool + */ + public function modelEquals(\Phalcon\Mvc\ModelInterface $first, \Phalcon\Mvc\ModelInterface $other): bool + { + } + /** * Reads metadata from the adapter * - * @param string $key + * @param mixed $key * @return array|null */ - public function read(string $key): array|null + public function read($key): array|null { } @@ -607,6 +653,16 @@ public function setAutomaticUpdateAttributes(\Phalcon\Mvc\ModelInterface $model, { } + /** + * Sets the DependencyInjector container + * + * @param \Phalcon\Di\DiInterface $container + * @return void + */ + public function setDI(\Phalcon\Di\DiInterface $container): void + { + } + /** * Set the attributes that allow empty string values * @@ -627,16 +683,6 @@ public function setEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model, arr { } - /** - * Sets the DependencyInjector container - * - * @param \Phalcon\Di\DiInterface $container - * @return void - */ - public function setDI(\Phalcon\Di\DiInterface $container): void - { - } - /** * Set the meta-data extraction strategy * @@ -682,6 +728,17 @@ final public function writeMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int { } + /** + * @todo Remove this when we get traits + * @param array $collection + * @param mixed $index + * @param mixed $defaultValue + * @return mixed + */ + protected function getArrVal(array $collection, $index, $defaultValue = null): mixed + { + } + /** * Initialize old behaviour for compatability * @@ -695,24 +752,24 @@ final protected function initialize(\Phalcon\Mvc\ModelInterface $model, $key, $t } /** - * Initialize the metadata for certain table + * Initialize ColumnMap for a certain table * * @param \Phalcon\Mvc\ModelInterface $model * @param mixed $key * @return bool */ - final protected function initializeMetaData(\Phalcon\Mvc\ModelInterface $model, $key): bool + final protected function initializeColumnMap(\Phalcon\Mvc\ModelInterface $model, $key): bool { } /** - * Initialize ColumnMap for a certain table + * Initialize the metadata for certain table * * @param \Phalcon\Mvc\ModelInterface $model * @param mixed $key * @return bool */ - final protected function initializeColumnMap(\Phalcon\Mvc\ModelInterface $model, $key): bool + final protected function initializeMetaData(\Phalcon\Mvc\ModelInterface $model, $key): bool { } @@ -725,35 +782,4 @@ final protected function initializeColumnMap(\Phalcon\Mvc\ModelInterface $model, private function throwWriteException($option): void { } - - /** - * @todo Remove this when we get traits - * @param array $collection - * @param mixed $index - * @param mixed $defaultValue - * @return mixed - */ - protected function getArrVal(array $collection, $index, $defaultValue = null): mixed - { - } - - /** - * Returns a MetaData Unique key for meta-data is created using className - * - * @return string - * @param \Phalcon\Mvc\ModelInterface $model - */ - final public function getMetaDataUniqueKey(\Phalcon\Mvc\ModelInterface $model): string|null - { - } - - /** - * Returns a ColumnMap Unique key for meta-data is created using className - * - * @return string - * @param \Phalcon\Mvc\ModelInterface $model - */ - final public function getColumnMapUniqueKey(\Phalcon\Mvc\ModelInterface $model): string|null - { - } } diff --git a/src/Mvc/Model/MetaData/Apcu.php b/src/Mvc/Model/MetaData/Apcu.php index 71930afd..b689ac6d 100644 --- a/src/Mvc/Model/MetaData/Apcu.php +++ b/src/Mvc/Model/MetaData/Apcu.php @@ -9,9 +9,8 @@ */ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\Exception; use Phalcon\Cache\AdapterFactory; +use Phalcon\Mvc\Model\MetaData; /** * Phalcon\Mvc\Model\MetaData\Apcu @@ -39,7 +38,7 @@ class Apcu extends MetaData * @param array $options * @param \Phalcon\Cache\AdapterFactory $factory */ - public function __construct(\Phalcon\Cache\AdapterFactory $factory, array $options = null) + public function __construct(\Phalcon\Cache\AdapterFactory $factory, ?array $options = null) { } } diff --git a/src/Mvc/Model/MetaData/Exceptions/CannotObtainTableColumns.php b/src/Mvc/Model/MetaData/Exceptions/CannotObtainTableColumns.php new file mode 100644 index 00000000..c76632b9 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/CannotObtainTableColumns.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotObtainTableColumns extends Exception +{ + /** + * @param string $completeTable + * @param string $className + */ + public function __construct(string $completeTable, string $className) + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/ColumnMapNotArray.php b/src/Mvc/Model/MetaData/Exceptions/ColumnMapNotArray.php new file mode 100644 index 00000000..1dc31b96 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/ColumnMapNotArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnMapNotArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/ContainerRequired.php b/src/Mvc/Model/MetaData/Exceptions/ContainerRequired.php new file mode 100644 index 00000000..18377254 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/ContainerRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ContainerRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/CorruptedMetaData.php b/src/Mvc/Model/MetaData/Exceptions/CorruptedMetaData.php new file mode 100644 index 00000000..1aeb7138 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/CorruptedMetaData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedMetaData extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/InvalidContainer.php b/src/Mvc/Model/MetaData/Exceptions/InvalidContainer.php new file mode 100644 index 00000000..70f0daf0 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/InvalidContainer.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidContainer extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/InvalidMetaDataForModel.php b/src/Mvc/Model/MetaData/Exceptions/InvalidMetaDataForModel.php new file mode 100644 index 00000000..132f2f74 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/InvalidMetaDataForModel.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidMetaDataForModel extends Exception +{ + /** + * @param string $modelName + */ + public function __construct(string $modelName) + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/MetaDataDirectoryNotWritable.php b/src/Mvc/Model/MetaData/Exceptions/MetaDataDirectoryNotWritable.php new file mode 100644 index 00000000..6e3c6d11 --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/MetaDataDirectoryNotWritable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MetaDataDirectoryNotWritable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/MetaDataStrategyFailed.php b/src/Mvc/Model/MetaData/Exceptions/MetaDataStrategyFailed.php new file mode 100644 index 00000000..0271153b --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/MetaDataStrategyFailed.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MetaDataStrategyFailed extends Exception +{ + /** + * @param string $message + */ + public function __construct(string $message) + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/NoAnnotationsForClass.php b/src/Mvc/Model/MetaData/Exceptions/NoAnnotationsForClass.php new file mode 100644 index 00000000..76ce2cde --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/NoAnnotationsForClass.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoAnnotationsForClass extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/NoPropertyAnnotationsForClass.php b/src/Mvc/Model/MetaData/Exceptions/NoPropertyAnnotationsForClass.php new file mode 100644 index 00000000..c778961f --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/NoPropertyAnnotationsForClass.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoPropertyAnnotationsForClass extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/MetaData/Exceptions/TableNotInDatabase.php b/src/Mvc/Model/MetaData/Exceptions/TableNotInDatabase.php new file mode 100644 index 00000000..af62b5ac --- /dev/null +++ b/src/Mvc/Model/MetaData/Exceptions/TableNotInDatabase.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\MetaData\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TableNotInDatabase extends Exception +{ + /** + * @param string $completeTable + * @param string $className + */ + public function __construct(string $completeTable, string $className) + { + } +} diff --git a/src/Mvc/Model/MetaData/Libmemcached.php b/src/Mvc/Model/MetaData/Libmemcached.php index b1baf574..b2752865 100644 --- a/src/Mvc/Model/MetaData/Libmemcached.php +++ b/src/Mvc/Model/MetaData/Libmemcached.php @@ -9,9 +9,8 @@ */ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\Exception; -use Phalcon\Mvc\Model\MetaData; use Phalcon\Cache\AdapterFactory; +use Phalcon\Mvc\Model\MetaData; /** * Phalcon\Mvc\Model\MetaData\Libmemcached diff --git a/src/Mvc/Model/MetaData/Memory.php b/src/Mvc/Model/MetaData/Memory.php index a67c3b74..4dbde773 100644 --- a/src/Mvc/Model/MetaData/Memory.php +++ b/src/Mvc/Model/MetaData/Memory.php @@ -10,7 +10,6 @@ namespace Phalcon\Mvc\Model\MetaData; use Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\Exception; /** * Phalcon\Mvc\Model\MetaData\Memory @@ -19,33 +18,24 @@ */ class Memory extends MetaData { - /** - * Phalcon\Mvc\Model\MetaData\Memory constructor - * - * @param array $options - */ - public function __construct($options = null) - { - } - /** * Reads the meta-data from temporal memory * - * @param string $key + * @param mixed $key * @return array|null */ - public function read(string $key): array|null + public function read($key): array|null { } /** * Writes the meta-data to temporal memory * - * @param string $key + * @param mixed $key * @param array $data * @return void */ - public function write(string $key, array $data): void + public function write($key, array $data): void { } } diff --git a/src/Mvc/Model/MetaData/Redis.php b/src/Mvc/Model/MetaData/Redis.php index 3a78b27c..360f7857 100644 --- a/src/Mvc/Model/MetaData/Redis.php +++ b/src/Mvc/Model/MetaData/Redis.php @@ -9,8 +9,8 @@ */ namespace Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\MetaData; use Phalcon\Cache\AdapterFactory; +use Phalcon\Mvc\Model\MetaData; /** * Phalcon\Mvc\Model\MetaData\Redis diff --git a/src/Mvc/Model/MetaData/Strategy/Annotations.php b/src/Mvc/Model/MetaData/Strategy/Annotations.php index b8a45a0d..27b2419d 100644 --- a/src/Mvc/Model/MetaData/Strategy/Annotations.php +++ b/src/Mvc/Model/MetaData/Strategy/Annotations.php @@ -9,11 +9,13 @@ */ namespace Phalcon\Mvc\Model\MetaData\Strategy; -use Phalcon\Di\DiInterface; use Phalcon\Db\Column; -use Phalcon\Mvc\ModelInterface; +use Phalcon\Di\DiInterface; use Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\MetaData\Exceptions\InvalidContainer; +use Phalcon\Mvc\Model\MetaData\Exceptions\NoAnnotationsForClass; +use Phalcon\Mvc\Model\MetaData\Exceptions\NoPropertyAnnotationsForClass; +use Phalcon\Mvc\ModelInterface; /** * This file is part of the Phalcon Framework. diff --git a/src/Mvc/Model/MetaData/Strategy/Introspection.php b/src/Mvc/Model/MetaData/Strategy/Introspection.php index b5edfecf..52ee44da 100644 --- a/src/Mvc/Model/MetaData/Strategy/Introspection.php +++ b/src/Mvc/Model/MetaData/Strategy/Introspection.php @@ -9,16 +9,15 @@ */ namespace Phalcon\Mvc\Model\MetaData\Strategy; -use Phalcon\Di\DiInterface; use Phalcon\Db\Adapter\AdapterInterface; -use Phalcon\Db\Column; -use Phalcon\Mvc\ModelInterface; -use Phalcon\Mvc\Model\Exception; +use Phalcon\Di\DiInterface; use Phalcon\Mvc\Model\MetaData; +use Phalcon\Mvc\Model\MetaData\Exceptions\CannotObtainTableColumns; +use Phalcon\Mvc\Model\MetaData\Exceptions\ColumnMapNotArray; +use Phalcon\Mvc\Model\MetaData\Exceptions\TableNotInDatabase; +use Phalcon\Mvc\ModelInterface; /** - * Phalcon\Mvc\Model\MetaData\Strategy\Introspection - * * Queries the table meta-data in order to introspect the model's metadata */ class Introspection implements \Phalcon\Mvc\Model\MetaData\Strategy\StrategyInterface diff --git a/src/Mvc/Model/MetaData/Strategy/StrategyInterface.php b/src/Mvc/Model/MetaData/Strategy/StrategyInterface.php index fe6a8b18..cbf18ae9 100644 --- a/src/Mvc/Model/MetaData/Strategy/StrategyInterface.php +++ b/src/Mvc/Model/MetaData/Strategy/StrategyInterface.php @@ -9,8 +9,8 @@ */ namespace Phalcon\Mvc\Model\MetaData\Strategy; -use Phalcon\Mvc\ModelInterface; use Phalcon\Di\DiInterface; +use Phalcon\Mvc\ModelInterface; /** * This file is part of the Phalcon Framework. diff --git a/src/Mvc/Model/MetaData/Stream.php b/src/Mvc/Model/MetaData/Stream.php index 23a4f0f8..d9891e6f 100644 --- a/src/Mvc/Model/MetaData/Stream.php +++ b/src/Mvc/Model/MetaData/Stream.php @@ -10,7 +10,7 @@ namespace Phalcon\Mvc\Model\MetaData; use Phalcon\Mvc\Model\MetaData; -use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\MetaData\Exceptions\MetaDataDirectoryNotWritable; use Phalcon\Support\Settings; /** @@ -45,21 +45,21 @@ public function __construct(array $options = []) /** * Reads meta-data from files * - * @param string $key + * @param mixed $key * @return array|null */ - public function read(string $key): array|null + public function read($key): array|null { } /** * Writes the meta-data to files * - * @param string $key + * @param mixed $key * @param array $data * @return void */ - public function write(string $key, array $data): void + public function write($key, array $data): void { } diff --git a/src/Mvc/Model/MetaDataInterface.php b/src/Mvc/Model/MetaDataInterface.php index 9e1731c2..c1f631aa 100644 --- a/src/Mvc/Model/MetaDataInterface.php +++ b/src/Mvc/Model/MetaDataInterface.php @@ -60,28 +60,28 @@ public function getBindTypes(\Phalcon\Mvc\ModelInterface $model): array; public function getColumnMap(\Phalcon\Mvc\ModelInterface $model): array|null; /** - * Returns attributes (which have default values) and their default values + * Returns attributes and their data types * * @param \Phalcon\Mvc\ModelInterface $model * @return array */ - public function getDefaultValues(\Phalcon\Mvc\ModelInterface $model): array; + public function getDataTypes(\Phalcon\Mvc\ModelInterface $model): array; /** - * Returns attributes and their data types + * Returns attributes which types are numerical * * @param \Phalcon\Mvc\ModelInterface $model * @return array */ - public function getDataTypes(\Phalcon\Mvc\ModelInterface $model): array; + public function getDataTypesNumeric(\Phalcon\Mvc\ModelInterface $model): array; /** - * Returns attributes which types are numerical + * Returns attributes (which have default values) and their default values * * @param \Phalcon\Mvc\ModelInterface $model * @return array */ - public function getDataTypesNumeric(\Phalcon\Mvc\ModelInterface $model): array; + public function getDefaultValues(\Phalcon\Mvc\ModelInterface $model): array; /** * Returns attributes allow empty strings @@ -95,9 +95,9 @@ public function getEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model): ar * Returns the name of identity field (if one is present) * * @param \Phalcon\Mvc\ModelInterface $model - * @return string|null + * @return bool|string|null */ - public function getIdentityField(\Phalcon\Mvc\ModelInterface $model): string|null; + public function getIdentityField(\Phalcon\Mvc\ModelInterface $model): bool|string|null; /** * Returns an array of fields which are not part of the primary key @@ -226,15 +226,6 @@ public function setAutomaticUpdateAttributes(\Phalcon\Mvc\ModelInterface $model, */ public function setEmptyStringAttributes(\Phalcon\Mvc\ModelInterface $model, array $attributes): void; - /** - * Writes meta-data for certain model using a MODEL_ constant - * - * @param \Phalcon\Mvc\ModelInterface $model - * @param int $index - * @param mixed $data - */ - public function writeMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index, $data); - /** * Set the meta-data extraction strategy * @@ -250,4 +241,13 @@ public function setStrategy(\Phalcon\Mvc\Model\MetaData\Strategy\StrategyInterfa * @return void */ public function write(string $key, array $data): void; + + /** + * Writes meta-data for certain model using a MODEL_ constant + * + * @param \Phalcon\Mvc\ModelInterface $model + * @param int $index + * @param mixed $data + */ + public function writeMetaDataIndex(\Phalcon\Mvc\ModelInterface $model, int $index, $data); } diff --git a/src/Mvc/Model/Query.php b/src/Mvc/Model/Query.php index b51b5892..520bdf3c 100644 --- a/src/Mvc/Model/Query.php +++ b/src/Mvc/Model/Query.php @@ -15,6 +15,54 @@ use Phalcon\Db\Adapter\AdapterInterface; use Phalcon\Di\DiInterface; use Phalcon\Mvc\ModelInterface; +use Phalcon\Mvc\Model\Query\Exceptions\AmbiguousColumn; +use Phalcon\Mvc\Model\Query\Exceptions\AmbiguousJoinRelation; +use Phalcon\Mvc\Model\Query\Exceptions\BindParameterNotInPlaceholders; +use Phalcon\Mvc\Model\Query\Exceptions\BindTypeRequiresArray; +use Phalcon\Mvc\Model\Query\Exceptions\BindValueRequired; +use Phalcon\Mvc\Model\Query\Exceptions\ColumnNotInDomain; +use Phalcon\Mvc\Model\Query\Exceptions\ColumnNotInSelectedModels; +use Phalcon\Mvc\Model\Query\Exceptions\CorruptedAst; +use Phalcon\Mvc\Model\Query\Exceptions\CorruptedDeleteAst; +use Phalcon\Mvc\Model\Query\Exceptions\CorruptedInsertAst; +use Phalcon\Mvc\Model\Query\Exceptions\CorruptedSelectAst; +use Phalcon\Mvc\Model\Query\Exceptions\CorruptedUpdateAst; +use Phalcon\Mvc\Model\Query\Exceptions\DeleteMultipleNotSupported; +use Phalcon\Mvc\Model\Query\Exceptions\DuplicateAlias; +use Phalcon\Mvc\Model\Query\Exceptions\EmptyArrayPlaceholderValue; +use Phalcon\Mvc\Model\Query\Exceptions\InsertColumnCountMismatch; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidCachedResultset; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidCachingOptions; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidColumnDefinition; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidInjectedManager; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidInjectedMetadata; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidQueryCacheService; +use Phalcon\Mvc\Model\Query\Exceptions\InvalidResultsetClass; +use Phalcon\Mvc\Model\Query\Exceptions\JoinAliasAlreadyUsed; +use Phalcon\Mvc\Model\Query\Exceptions\JoinFieldCountMismatch; +use Phalcon\Mvc\Model\Query\Exceptions\MissingCacheKey; +use Phalcon\Mvc\Model\Query\Exceptions\MissingMetaData; +use Phalcon\Mvc\Model\Query\Exceptions\MissingModelAttribute; +use Phalcon\Mvc\Model\Query\Exceptions\MissingModelsManager; +use Phalcon\Mvc\Model\Query\Exceptions\MixedDatabaseSystems; +use Phalcon\Mvc\Model\Query\Exceptions\ModelsListNotLoaded; +use Phalcon\Mvc\Model\Query\Exceptions\ModelSourceNotFound; +use Phalcon\Mvc\Model\Query\Exceptions\MultipleSqlStatementsNotSupported; +use Phalcon\Mvc\Model\Query\Exceptions\NoModelForAlias; +use Phalcon\Mvc\Model\Query\Exceptions\PhqlColumnNotInMap; +use Phalcon\Mvc\Model\Query\Exceptions\ReadConnectionMissing; +use Phalcon\Mvc\Model\Query\Exceptions\RelationshipNotFound; +use Phalcon\Mvc\Model\Query\Exceptions\ResultsetClassNotFound; +use Phalcon\Mvc\Model\Query\Exceptions\ResultsetNonCacheable; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownBindType; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownColumnType; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownJoinType; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownModelOrAlias; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownPhqlExpression; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownPhqlExpressionType; +use Phalcon\Mvc\Model\Query\Exceptions\UnknownPhqlStatement; +use Phalcon\Mvc\Model\Query\Exceptions\UpdateMultipleNotSupported; +use Phalcon\Mvc\Model\Query\Exceptions\WriteConnectionMissing; use Phalcon\Mvc\Model\Query\Status; use Phalcon\Mvc\Model\Resultset\Complex; use Phalcon\Mvc\Model\Query\StatusInterface; @@ -138,6 +186,11 @@ class Query implements \Phalcon\Mvc\Model\QueryInterface, \Phalcon\Di\InjectionA */ protected $intermediate; + /** + * @var array|null + */ + protected static $internalPhqlCache; + /** * @var \Phalcon\Mvc\Model\ManagerInterface|null */ @@ -198,16 +251,6 @@ class Query implements \Phalcon\Mvc\Model\QueryInterface, \Phalcon\Di\InjectionA */ protected $sqlModelsAliases = []; - /** - * @var int|null - */ - protected $type; - - /** - * @var bool - */ - protected $uniqueRow = false; - /** * TransactionInterface so that the query can wrap a transaction * around batch updates and intermediate selects within the transaction. @@ -219,9 +262,14 @@ class Query implements \Phalcon\Mvc\Model\QueryInterface, \Phalcon\Di\InjectionA protected $transaction = null; /** - * @var array|null + * @var int|null */ - protected static $internalPhqlCache; + protected $type; + + /** + * @var bool + */ + protected $uniqueRow = false; /** * Phalcon\Mvc\Model\Query constructor @@ -230,7 +278,7 @@ class Query implements \Phalcon\Mvc\Model\QueryInterface, \Phalcon\Di\InjectionA * @param DiInterface|null $container * @param array $options */ - public function __construct(string $phql = null, \Phalcon\Di\DiInterface $container = null, array $options = []) + public function __construct(?string $phql = null, ?\Phalcon\Di\DiInterface $container = null, array $options = []) { } @@ -265,38 +313,38 @@ public function execute(array $bindParams = [], array $bindTypes = []) } /** - * Returns the current cache backend instance + * Returns default bind params * - * @return AdapterInterface + * @return array */ - public function getCache(): AdapterInterface + public function getBindParams(): array { } /** - * Returns the current cache options + * Returns default bind types * * @return array */ - public function getCacheOptions(): array + public function getBindTypes(): array { } /** - * Returns default bind params + * Returns the current cache backend instance * - * @return array + * @return AdapterInterface */ - public function getBindParams(): array + public function getCache(): AdapterInterface { } /** - * Returns default bind types + * Returns the current cache options * * @return array */ - public function getBindTypes(): array + public function getCacheOptions(): array { } @@ -347,6 +395,13 @@ public function getSql(): array { } + /** + * @return TransactionInterface|null + */ + public function getTransaction(): TransactionInterface|null + { + } + /** * Gets the type of PHQL statement executed * @@ -366,13 +421,6 @@ public function getUniqueRow(): bool { } - /** - * @return TransactionInterface|null - */ - public function getTransaction(): TransactionInterface|null - { - } - /** * Parses the intermediate code produced by Phalcon\Mvc\Model\Query\Lang * generating another intermediate representation that could be executed by @@ -571,16 +619,6 @@ final protected function getGroupClause(array $group): array { } - /** - * Returns a processed limit clause for a SELECT statement - * - * @param array $limitClause - * @return array - */ - final protected function getLimitClause(array $limitClause): array - { - } - /** * Resolves a JOIN clause checking if the associated models exist * @@ -613,6 +651,16 @@ final protected function getJoins(array $select): array { } + /** + * Returns a processed limit clause for a SELECT statement + * + * @param array $limitClause + * @return array + */ + final protected function getLimitClause(array $limitClause): array + { + } + /** * Resolves joins involving many-to-many relations * @@ -653,12 +701,12 @@ final protected function getQualified(array $expr): array * inside the query object * * @param \Phalcon\Mvc\ModelInterface $model - * @param array $intermediate + * @param array|null $intermediate * @param array $bindParams * @param array $bindTypes * @return AdapterInterface */ - protected function getReadConnection(\Phalcon\Mvc\ModelInterface $model, array $intermediate = null, array $bindParams = [], array $bindTypes = []): AdapterInterface + protected function getReadConnection(\Phalcon\Mvc\ModelInterface $model, ?array $intermediate = null, array $bindParams = [], array $bindTypes = []): AdapterInterface { } @@ -716,26 +764,12 @@ final protected function getTable(ManagerInterface $manager, array $qualifiedNam * inside the query object * * @param \Phalcon\Mvc\ModelInterface $model - * @param array $intermediate + * @param array|null $intermediate * @param array $bindParams * @param array $bindTypes * @return AdapterInterface */ - protected function getWriteConnection(\Phalcon\Mvc\ModelInterface $model, array $intermediate = null, array $bindParams = [], array $bindTypes = []): AdapterInterface - { - } - - /** - * Refreshes the schema/source of every model referenced in a cached - * intermediate representation. The PHQL cache is keyed by the PHQL - * string only, so a model that switches its schema or source at - * runtime (for instance via setSchema()/setSource() in initialize()) - * would otherwise see the value frozen at first parse. See #17020. - * - * @param array $irPhql - * @return array - */ - final protected function refreshSchemasInIntermediate(array $irPhql): array + protected function getWriteConnection(\Phalcon\Mvc\ModelInterface $model, ?array $intermediate = null, array $bindParams = [], array $bindTypes = []): AdapterInterface { } @@ -745,7 +779,7 @@ final protected function refreshSchemasInIntermediate(array $irPhql): array * * @return array */ - final protected function _prepareDelete(): array + final protected function prepareDelete(): array { } @@ -755,7 +789,7 @@ final protected function _prepareDelete(): array * * @return array */ - final protected function _prepareInsert(): array + final protected function prepareInsert(): array { } @@ -766,7 +800,7 @@ final protected function _prepareInsert(): array * @param bool $merge * @return array */ - final protected function _prepareSelect($ast = null, bool $merge = false): array + final protected function prepareSelect($ast = null, bool $merge = false): array { } @@ -776,7 +810,21 @@ final protected function _prepareSelect($ast = null, bool $merge = false): array * * @return array */ - final protected function _prepareUpdate(): array + final protected function prepareUpdate(): array + { + } + + /** + * Refreshes the schema/source of every model referenced in a cached + * intermediate representation. The PHQL cache is keyed by the PHQL + * string only, so a model that switches its schema or source at + * runtime (for instance via setSchema()/setSource() in initialize()) + * would otherwise see the value frozen at first parse. See #17020. + * + * @param array $irPhql + * @return array + */ + final protected function refreshSchemasInIntermediate(array $irPhql): array { } } diff --git a/src/Mvc/Model/Query/Builder.php b/src/Mvc/Model/Query/Builder.php index bcb7f509..79aa5421 100644 --- a/src/Mvc/Model/Query/Builder.php +++ b/src/Mvc/Model/Query/Builder.php @@ -9,17 +9,21 @@ */ namespace Phalcon\Mvc\Model\Query; -use Phalcon\Di\Di; use Phalcon\Db\Column; +use Phalcon\Di\Di; use Phalcon\Di\DiInterface; -use Phalcon\Mvc\Model\Exception; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\Exceptions\ManagerOrmServicesUnavailable; +use Phalcon\Mvc\Model\Query\Exceptions\Builder\BuilderColumnNotInMap; +use Phalcon\Mvc\Model\Query\Exceptions\Builder\BuilderConditionInvalid; +use Phalcon\Mvc\Model\Query\Exceptions\Builder\ModelRequired; +use Phalcon\Mvc\Model\Query\Exceptions\Builder\NoPrimaryKey; +use Phalcon\Mvc\Model\Query\Exceptions\Builder\OperatorNotAvailable; use Phalcon\Mvc\Model\QueryInterface; use Phalcon\Support\Settings; /** - * Phalcon\Mvc\Model\Query\Builder - * * Helps to create PHQL queries using an OO interface * * ```php @@ -141,7 +145,7 @@ class Builder implements \Phalcon\Mvc\Model\Query\BuilderInterface, \Phalcon\Di\ * @param array|string|null $params * @param DiInterface|null $container */ - public function __construct($params = null, \Phalcon\Di\DiInterface $container = null) + public function __construct($params = null, ?\Phalcon\Di\DiInterface $container = null) { } @@ -162,10 +166,10 @@ public function __construct($params = null, \Phalcon\Di\DiInterface $container = * ``` * * @param string $model - * @param string $alias + * @param string|null $alias * @return BuilderInterface */ - public function addFrom(string $model, string $alias = null): BuilderInterface + public function addFrom(string $model, ?string $alias = null): BuilderInterface { } @@ -572,6 +576,25 @@ public function inHaving(string $expr, array $values, string $operator = Builder { } + /** + * Appends an IN condition to the current WHERE conditions + * + * ```php + * $builder->inWhere( + * "id", + * [1, 2, 3] + * ); + * ``` + * + * @param string $expr + * @param array $values + * @param string $operator + * @return BuilderInterface + */ + public function inWhere(string $expr, array $values, string $operator = BuilderInterface::OPERATOR_AND): BuilderInterface + { + } + /** * Adds an INNER join to the query * @@ -596,30 +619,11 @@ public function inHaving(string $expr, array $values, string $operator = Builder * ``` * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function innerJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface - { - } - - /** - * Appends an IN condition to the current WHERE conditions - * - * ```php - * $builder->inWhere( - * "id", - * [1, 2, 3] - * ); - * ``` - * - * @param string $expr - * @param array $values - * @param string $operator - * @return BuilderInterface - */ - public function inWhere(string $expr, array $values, string $operator = BuilderInterface::OPERATOR_AND): BuilderInterface + public function innerJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface { } @@ -655,12 +659,12 @@ public function inWhere(string $expr, array $values, string $operator = BuilderI * ``` * * @param string $model - * @param string $conditions - * @param string $alias - * @param string $type + * @param string|null $conditions + * @param string|null $alias + * @param string|null $type * @return BuilderInterface */ - public function join(string $model, string $conditions = null, string $alias = null, string $type = null): BuilderInterface + public function join(string $model, ?string $conditions = null, ?string $alias = null, ?string $type = null): BuilderInterface { } @@ -676,11 +680,11 @@ public function join(string $model, string $conditions = null, string $alias = n * ``` * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function leftJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface + public function leftJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface { } @@ -781,22 +785,6 @@ public function offset(int $offset): BuilderInterface { } - /** - * Sets an ORDER BY condition clause - * - * ```php - * $builder->orderBy("Robots.name"); - * $builder->orderBy(["1", "Robots.name"]); - * $builder->orderBy(["Robots.name DESC"]); - * ``` - * - * @param array|string $orderBy - * @return BuilderInterface - */ - public function orderBy($orderBy): BuilderInterface - { - } - /** * Appends a condition to the current HAVING conditions clause using an OR operator * @@ -844,6 +832,22 @@ public function orWhere(string $conditions, array $bindParams = [], array $bindT { } + /** + * Sets an ORDER BY condition clause + * + * ```php + * $builder->orderBy("Robots.name"); + * $builder->orderBy(["1", "Robots.name"]); + * $builder->orderBy(["Robots.name DESC"]); + * ``` + * + * @param array|string $orderBy + * @return BuilderInterface + */ + public function orderBy($orderBy): BuilderInterface + { + } + /** * Adds a RIGHT join to the query * @@ -856,11 +860,11 @@ public function orWhere(string $conditions, array $bindParams = [], array $bindT * ``` * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function rightJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface + public function rightJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface { } diff --git a/src/Mvc/Model/Query/BuilderInterface.php b/src/Mvc/Model/Query/BuilderInterface.php index e7fbb8ee..7aa0e7c3 100644 --- a/src/Mvc/Model/Query/BuilderInterface.php +++ b/src/Mvc/Model/Query/BuilderInterface.php @@ -12,8 +12,6 @@ use Phalcon\Mvc\Model\QueryInterface; /** - * Phalcon\Mvc\Model\Query\BuilderInterface - * * Interface for Phalcon\Mvc\Model\Query\Builder */ interface BuilderInterface @@ -33,10 +31,10 @@ interface BuilderInterface * Add a model to take part of the query * * @param string $model - * @param string $alias + * @param string|null $alias * @return BuilderInterface */ - public function addFrom(string $model, string $alias = null): BuilderInterface; + public function addFrom(string $model, ?string $alias = null): BuilderInterface; /** * Appends a condition to the current conditions using a AND operator @@ -204,6 +202,13 @@ public function getJoins(): array; */ public function getLimit(); + /** + * Returns the models involved in the query + * + * @return string|array|null + */ + public function getModels(): string|array|null; + /** * Returns the current OFFSET clause * @@ -261,11 +266,11 @@ public function having(string $conditions, array $bindParams = [], array $bindTy * Adds an INNER join to the query * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function innerJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface; + public function innerJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface; /** * Appends an IN condition to the current conditions @@ -285,17 +290,17 @@ public function inWhere(string $expr, array $values, string $operator = BuilderI * @param string $alias * @return BuilderInterface */ - public function join(string $model, string $conditions = null, string $alias = null): BuilderInterface; + public function join(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface; /** * Adds a LEFT join to the query * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function leftJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface; + public function leftJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface; /** * Sets a LIMIT clause @@ -306,13 +311,6 @@ public function leftJoin(string $model, string $conditions = null, string $alias */ public function limit(int $limit, $offset = null): BuilderInterface; - /** - * Returns the models involved in the query - * - * @return string|array|null - */ - public function getModels(): string|array|null; - /** * Appends a NOT BETWEEN condition to the current conditions * @@ -342,14 +340,6 @@ public function notInWhere(string $expr, array $values, string $operator = Build */ public function offset(int $offset): BuilderInterface; - /** - * Sets an ORDER BY condition clause - * - * @param array|string $orderBy - * @return BuilderInterface - */ - public function orderBy($orderBy): BuilderInterface; - /** * Appends a condition to the current conditions using an OR operator * @@ -360,15 +350,23 @@ public function orderBy($orderBy): BuilderInterface; */ public function orWhere(string $conditions, array $bindParams = [], array $bindTypes = []): BuilderInterface; + /** + * Sets an ORDER BY condition clause + * + * @param array|string $orderBy + * @return BuilderInterface + */ + public function orderBy($orderBy): BuilderInterface; + /** * Adds a RIGHT join to the query * * @param string $model - * @param string $conditions - * @param string $alias + * @param string|null $conditions + * @param string|null $alias * @return BuilderInterface */ - public function rightJoin(string $model, string $conditions = null, string $alias = null): BuilderInterface; + public function rightJoin(string $model, ?string $conditions = null, ?string $alias = null): BuilderInterface; /** * Set default bind parameters diff --git a/src/Mvc/Model/Query/Exceptions/AmbiguousColumn.php b/src/Mvc/Model/Query/Exceptions/AmbiguousColumn.php new file mode 100644 index 00000000..4b1c2e2a --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/AmbiguousColumn.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AmbiguousColumn extends Exception +{ + /** + * @param string $name + * @param string $phql + */ + public function __construct(string $name, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/AmbiguousJoinRelation.php b/src/Mvc/Model/Query/Exceptions/AmbiguousJoinRelation.php new file mode 100644 index 00000000..8319720a --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/AmbiguousJoinRelation.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AmbiguousJoinRelation extends Exception +{ + /** + * @param string $from + * @param string $join + * @param string $phql + */ + public function __construct(string $from, string $join, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/BindParameterNotInPlaceholders.php b/src/Mvc/Model/Query/Exceptions/BindParameterNotInPlaceholders.php new file mode 100644 index 00000000..1f0e1b2f --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/BindParameterNotInPlaceholders.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BindParameterNotInPlaceholders extends Exception +{ + /** + * @param string $wildcard + */ + public function __construct(string $wildcard) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/BindTypeRequiresArray.php b/src/Mvc/Model/Query/Exceptions/BindTypeRequiresArray.php new file mode 100644 index 00000000..38d7cec9 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/BindTypeRequiresArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BindTypeRequiresArray extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/BindValueRequired.php b/src/Mvc/Model/Query/Exceptions/BindValueRequired.php new file mode 100644 index 00000000..6b4b8c3d --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/BindValueRequired.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BindValueRequired extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/Builder/BuilderColumnNotInMap.php b/src/Mvc/Model/Query/Exceptions/Builder/BuilderColumnNotInMap.php new file mode 100644 index 00000000..af2e570f --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/Builder/BuilderColumnNotInMap.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions\Builder; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BuilderColumnNotInMap extends Exception +{ + /** + * @param string $column + */ + public function __construct(string $column) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/Builder/BuilderConditionInvalid.php b/src/Mvc/Model/Query/Exceptions/Builder/BuilderConditionInvalid.php new file mode 100644 index 00000000..337b2837 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/Builder/BuilderConditionInvalid.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions\Builder; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BuilderConditionInvalid extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/Builder/ModelRequired.php b/src/Mvc/Model/Query/Exceptions/Builder/ModelRequired.php new file mode 100644 index 00000000..b51e3a46 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/Builder/ModelRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions\Builder; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModelRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/Builder/NoPrimaryKey.php b/src/Mvc/Model/Query/Exceptions/Builder/NoPrimaryKey.php new file mode 100644 index 00000000..c312e4fa --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/Builder/NoPrimaryKey.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions\Builder; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoPrimaryKey extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/Builder/OperatorNotAvailable.php b/src/Mvc/Model/Query/Exceptions/Builder/OperatorNotAvailable.php new file mode 100644 index 00000000..6f2167d4 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/Builder/OperatorNotAvailable.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions\Builder; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class OperatorNotAvailable extends Exception +{ + /** + * @param string $operator + */ + public function __construct(string $operator) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ColumnNotInDomain.php b/src/Mvc/Model/Query/Exceptions/ColumnNotInDomain.php new file mode 100644 index 00000000..d85720a5 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ColumnNotInDomain.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnNotInDomain extends Exception +{ + /** + * @param string $name + * @param string $model + * @param string $phql + */ + public function __construct(string $name, string $model, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ColumnNotInSelectedModels.php b/src/Mvc/Model/Query/Exceptions/ColumnNotInSelectedModels.php new file mode 100644 index 00000000..674c9e8c --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ColumnNotInSelectedModels.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ColumnNotInSelectedModels extends Exception +{ + /** + * @param string $name + * @param string $tag + * @param string $phql + */ + public function __construct(string $name, string $tag, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/CorruptedAst.php b/src/Mvc/Model/Query/Exceptions/CorruptedAst.php new file mode 100644 index 00000000..55925828 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/CorruptedAst.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedAst extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/CorruptedDeleteAst.php b/src/Mvc/Model/Query/Exceptions/CorruptedDeleteAst.php new file mode 100644 index 00000000..9f492d80 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/CorruptedDeleteAst.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedDeleteAst extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/CorruptedInsertAst.php b/src/Mvc/Model/Query/Exceptions/CorruptedInsertAst.php new file mode 100644 index 00000000..64acd7d1 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/CorruptedInsertAst.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedInsertAst extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/CorruptedSelectAst.php b/src/Mvc/Model/Query/Exceptions/CorruptedSelectAst.php new file mode 100644 index 00000000..a0843e59 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/CorruptedSelectAst.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedSelectAst extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/CorruptedUpdateAst.php b/src/Mvc/Model/Query/Exceptions/CorruptedUpdateAst.php new file mode 100644 index 00000000..b751c43e --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/CorruptedUpdateAst.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedUpdateAst extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/DeleteMultipleNotSupported.php b/src/Mvc/Model/Query/Exceptions/DeleteMultipleNotSupported.php new file mode 100644 index 00000000..230a03fa --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/DeleteMultipleNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DeleteMultipleNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/DuplicateAlias.php b/src/Mvc/Model/Query/Exceptions/DuplicateAlias.php new file mode 100644 index 00000000..97483383 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/DuplicateAlias.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DuplicateAlias extends Exception +{ + /** + * @param string $name + * @param string $phql + */ + public function __construct(string $name, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/EmptyArrayPlaceholderValue.php b/src/Mvc/Model/Query/Exceptions/EmptyArrayPlaceholderValue.php new file mode 100644 index 00000000..4c610ff7 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/EmptyArrayPlaceholderValue.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EmptyArrayPlaceholderValue extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InsertColumnCountMismatch.php b/src/Mvc/Model/Query/Exceptions/InsertColumnCountMismatch.php new file mode 100644 index 00000000..2f7b009d --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InsertColumnCountMismatch.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InsertColumnCountMismatch extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidCachedResultset.php b/src/Mvc/Model/Query/Exceptions/InvalidCachedResultset.php new file mode 100644 index 00000000..7eb359f7 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidCachedResultset.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCachedResultset extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidCachingOptions.php b/src/Mvc/Model/Query/Exceptions/InvalidCachingOptions.php new file mode 100644 index 00000000..74eb54ff --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidCachingOptions.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCachingOptions extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidColumnDefinition.php b/src/Mvc/Model/Query/Exceptions/InvalidColumnDefinition.php new file mode 100644 index 00000000..de84f4db --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidColumnDefinition.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidColumnDefinition extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidInjectedManager.php b/src/Mvc/Model/Query/Exceptions/InvalidInjectedManager.php new file mode 100644 index 00000000..8133e937 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidInjectedManager.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidInjectedManager extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidInjectedMetadata.php b/src/Mvc/Model/Query/Exceptions/InvalidInjectedMetadata.php new file mode 100644 index 00000000..c74b284b --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidInjectedMetadata.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidInjectedMetadata extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidQueryCacheService.php b/src/Mvc/Model/Query/Exceptions/InvalidQueryCacheService.php new file mode 100644 index 00000000..16c7b9ad --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidQueryCacheService.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidQueryCacheService extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/InvalidResultsetClass.php b/src/Mvc/Model/Query/Exceptions/InvalidResultsetClass.php new file mode 100644 index 00000000..84fb984c --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/InvalidResultsetClass.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidResultsetClass extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/JoinAliasAlreadyUsed.php b/src/Mvc/Model/Query/Exceptions/JoinAliasAlreadyUsed.php new file mode 100644 index 00000000..51bba79e --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/JoinAliasAlreadyUsed.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class JoinAliasAlreadyUsed extends Exception +{ + /** + * @param string $alias + * @param string $phql + */ + public function __construct(string $alias, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/JoinFieldCountMismatch.php b/src/Mvc/Model/Query/Exceptions/JoinFieldCountMismatch.php new file mode 100644 index 00000000..a73c5253 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/JoinFieldCountMismatch.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class JoinFieldCountMismatch extends Exception +{ + /** + * @param string $model + * @param string $join + * @param string $phql + */ + public function __construct(string $model, string $join, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MissingCacheKey.php b/src/Mvc/Model/Query/Exceptions/MissingCacheKey.php new file mode 100644 index 00000000..475f4de7 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MissingCacheKey.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingCacheKey extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MissingMetaData.php b/src/Mvc/Model/Query/Exceptions/MissingMetaData.php new file mode 100644 index 00000000..2f15f6c3 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MissingMetaData.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingMetaData extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MissingModelAttribute.php b/src/Mvc/Model/Query/Exceptions/MissingModelAttribute.php new file mode 100644 index 00000000..cd4ef844 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MissingModelAttribute.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingModelAttribute extends Exception +{ + /** + * @param string $model + * @param string $attribute + * @param string $phql + */ + public function __construct(string $model, string $attribute, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MissingModelsManager.php b/src/Mvc/Model/Query/Exceptions/MissingModelsManager.php new file mode 100644 index 00000000..c1155141 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MissingModelsManager.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingModelsManager extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MixedDatabaseSystems.php b/src/Mvc/Model/Query/Exceptions/MixedDatabaseSystems.php new file mode 100644 index 00000000..7e4a2db4 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MixedDatabaseSystems.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MixedDatabaseSystems extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ModelSourceNotFound.php b/src/Mvc/Model/Query/Exceptions/ModelSourceNotFound.php new file mode 100644 index 00000000..ac9607c6 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ModelSourceNotFound.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModelSourceNotFound extends Exception +{ + /** + * @param string $name + * @param string $phql + */ + public function __construct(string $name, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ModelsListNotLoaded.php b/src/Mvc/Model/Query/Exceptions/ModelsListNotLoaded.php new file mode 100644 index 00000000..5de5d452 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ModelsListNotLoaded.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ModelsListNotLoaded extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/MultipleSqlStatementsNotSupported.php b/src/Mvc/Model/Query/Exceptions/MultipleSqlStatementsNotSupported.php new file mode 100644 index 00000000..6eeb3e70 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/MultipleSqlStatementsNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MultipleSqlStatementsNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/NoModelForAlias.php b/src/Mvc/Model/Query/Exceptions/NoModelForAlias.php new file mode 100644 index 00000000..0c6414ed --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/NoModelForAlias.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class NoModelForAlias extends Exception +{ + /** + * @param string $model + * @param string $phql + */ + public function __construct(string $model, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/PhqlColumnNotInMap.php b/src/Mvc/Model/Query/Exceptions/PhqlColumnNotInMap.php new file mode 100644 index 00000000..b376af69 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/PhqlColumnNotInMap.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PhqlColumnNotInMap extends Exception +{ + /** + * @param string $fieldName + */ + public function __construct(string $fieldName) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ReadConnectionMissing.php b/src/Mvc/Model/Query/Exceptions/ReadConnectionMissing.php new file mode 100644 index 00000000..b813b7ed --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ReadConnectionMissing.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReadConnectionMissing extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/RelationshipNotFound.php b/src/Mvc/Model/Query/Exceptions/RelationshipNotFound.php new file mode 100644 index 00000000..e55c9a14 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/RelationshipNotFound.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RelationshipNotFound extends Exception +{ + /** + * @param string $model + * @param string $relationship + * @param string $phql + */ + public function __construct(string $model, string $relationship, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ResultsetClassNotFound.php b/src/Mvc/Model/Query/Exceptions/ResultsetClassNotFound.php new file mode 100644 index 00000000..cd7de539 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ResultsetClassNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResultsetClassNotFound extends Exception +{ + /** + * @param string $className + */ + public function __construct(string $className) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/ResultsetNonCacheable.php b/src/Mvc/Model/Query/Exceptions/ResultsetNonCacheable.php new file mode 100644 index 00000000..77608b85 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/ResultsetNonCacheable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ResultsetNonCacheable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownBindType.php b/src/Mvc/Model/Query/Exceptions/UnknownBindType.php new file mode 100644 index 00000000..62c5847e --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownBindType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownBindType extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownColumnType.php b/src/Mvc/Model/Query/Exceptions/UnknownColumnType.php new file mode 100644 index 00000000..6220f4f2 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownColumnType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownColumnType extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownJoinType.php b/src/Mvc/Model/Query/Exceptions/UnknownJoinType.php new file mode 100644 index 00000000..69d886b3 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownJoinType.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownJoinType extends Exception +{ + /** + * @param string $type + * @param string $phql + */ + public function __construct(string $type, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownModelOrAlias.php b/src/Mvc/Model/Query/Exceptions/UnknownModelOrAlias.php new file mode 100644 index 00000000..a38114cd --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownModelOrAlias.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownModelOrAlias extends Exception +{ + /** + * @param string $model + * @param string $tag + * @param string $phql + */ + public function __construct(string $model, string $tag, string $phql) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpression.php b/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpression.php new file mode 100644 index 00000000..14e3835d --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpression.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownPhqlExpression extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpressionType.php b/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpressionType.php new file mode 100644 index 00000000..043f85fe --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownPhqlExpressionType.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownPhqlExpressionType extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UnknownPhqlStatement.php b/src/Mvc/Model/Query/Exceptions/UnknownPhqlStatement.php new file mode 100644 index 00000000..726ac0e4 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UnknownPhqlStatement.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownPhqlStatement extends Exception +{ + /** + * @param string $type + */ + public function __construct(string $type) + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/UpdateMultipleNotSupported.php b/src/Mvc/Model/Query/Exceptions/UpdateMultipleNotSupported.php new file mode 100644 index 00000000..b0f1401a --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/UpdateMultipleNotSupported.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UpdateMultipleNotSupported extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Exceptions/WriteConnectionMissing.php b/src/Mvc/Model/Query/Exceptions/WriteConnectionMissing.php new file mode 100644 index 00000000..71ffd744 --- /dev/null +++ b/src/Mvc/Model/Query/Exceptions/WriteConnectionMissing.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Model\Query\Exceptions; + +use Phalcon\Mvc\Model\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class WriteConnectionMissing extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Model/Query/Status.php b/src/Mvc/Model/Query/Status.php index 353bd3ea..048855e7 100644 --- a/src/Mvc/Model/Query/Status.php +++ b/src/Mvc/Model/Query/Status.php @@ -13,8 +13,6 @@ use Phalcon\Mvc\ModelInterface; /** - * Phalcon\Mvc\Model\Query\Status - * * This class represents the status returned by a PHQL * statement like INSERT, UPDATE or DELETE. It offers context * information and the related messages produced by the @@ -55,9 +53,9 @@ class Status implements \Phalcon\Mvc\Model\Query\StatusInterface * Phalcon\Mvc\Model\Query\Status * * @param bool $success - * @param \Phalcon\Mvc\ModelInterface $model + * @param \Phalcon\Mvc\ModelInterface|null $model */ - public function __construct(bool $success, \Phalcon\Mvc\ModelInterface $model = null) + public function __construct(bool $success, ?\Phalcon\Mvc\ModelInterface $model = null) { } @@ -73,9 +71,9 @@ public function getMessages(): array /** * Returns the model that executed the action * - * @return ModelInterface + * @return ModelInterface|null */ - public function getModel(): ModelInterface + public function getModel(): ModelInterface|null { } diff --git a/src/Mvc/Model/Query/StatusInterface.php b/src/Mvc/Model/Query/StatusInterface.php index 2122784a..589f815c 100644 --- a/src/Mvc/Model/Query/StatusInterface.php +++ b/src/Mvc/Model/Query/StatusInterface.php @@ -13,8 +13,6 @@ use Phalcon\Mvc\ModelInterface; /** - * Phalcon\Mvc\Model\Query\StatusInterface - * * Interface for Phalcon\Mvc\Model\Query\Status */ interface StatusInterface @@ -29,9 +27,9 @@ public function getMessages(): array; /** * Returns the model which executed the action * - * @return ModelInterface + * @return ModelInterface|null */ - public function getModel(): ModelInterface; + public function getModel(): ModelInterface|null; /** * Allows to check if the executed operation was successful diff --git a/src/Mvc/Model/QueryInterface.php b/src/Mvc/Model/QueryInterface.php index 86ebca37..3e9884e0 100644 --- a/src/Mvc/Model/QueryInterface.php +++ b/src/Mvc/Model/QueryInterface.php @@ -42,13 +42,6 @@ public function execute(array $bindParams = [], array $bindTypes = []); */ public function getBindParams(): array; - /** - * Returns the current cache options - * - * @return array - */ - public function getCacheOptions(): array; - /** * Returns default bind types * @@ -57,11 +50,11 @@ public function getCacheOptions(): array; public function getBindTypes(): array; /** - * Returns the SQL to be generated by the internal PHQL (only works in SELECT statements) + * Returns the current cache options * * @return array */ - public function getSql(): array; + public function getCacheOptions(): array; /** * Executes the query returning the first result @@ -72,6 +65,13 @@ public function getSql(): array; */ public function getSingleResult(array $bindParams = [], array $bindTypes = []): ModelInterface; + /** + * Returns the SQL to be generated by the internal PHQL (only works in SELECT statements) + * + * @return array + */ + public function getSql(): array; + /** * Check if the query is programmed to get only the first row in the resultset * diff --git a/src/Mvc/Model/Resultset.php b/src/Mvc/Model/Resultset.php index 15e438c5..13b81ad6 100644 --- a/src/Mvc/Model/Resultset.php +++ b/src/Mvc/Model/Resultset.php @@ -18,6 +18,10 @@ use Phalcon\Db\Enum; use Phalcon\Messages\MessageInterface; use Phalcon\Mvc\Model; +use Phalcon\Mvc\Model\Exceptions\CursorIsImmutable; +use Phalcon\Mvc\Model\Exceptions\IndexNotInCursor; +use Phalcon\Mvc\Model\Exceptions\InvalidResultsetCacheService; +use Phalcon\Mvc\Model\Exceptions\InvalidReturnedRecord; use Phalcon\Mvc\ModelInterface; use Phalcon\Storage\Serializer\SerializerInterface; use Phalcon\Support\Settings; @@ -171,10 +175,10 @@ final public function count(): int /** * Deletes every record in the resultset * - * @param \Closure $conditionCallback + * @param \Closure|null $conditionCallback * @return bool */ - public function delete(\Closure $conditionCallback = null): bool + public function delete(?\Closure $conditionCallback = null): bool { } @@ -316,22 +320,22 @@ public function next(): void } /** - * Gets row in a specific position of the resultset + * Checks whether offset exists in the resultset * * @param mixed $index - * @return mixed + * @return bool */ - public function offsetGet($index): mixed + public function offsetExists($index): bool { } /** - * Checks whether offset exists in the resultset + * Gets row in a specific position of the resultset * * @param mixed $index - * @return bool + * @return mixed */ - public function offsetExists($index): bool + public function offsetGet($index): mixed { } @@ -400,10 +404,10 @@ public function setIsFresh(bool $isFresh): ResultsetInterface * Updates every record in the resultset * * @param array $data - * @param \Closure $conditionCallback + * @param \Closure|null $conditionCallback * @return bool */ - public function update($data, \Closure $conditionCallback = null): bool + public function update($data, ?\Closure $conditionCallback = null): bool { } diff --git a/src/Mvc/Model/Resultset/Complex.php b/src/Mvc/Model/Resultset/Complex.php index 54abef03..89994f2d 100644 --- a/src/Mvc/Model/Resultset/Complex.php +++ b/src/Mvc/Model/Resultset/Complex.php @@ -9,11 +9,14 @@ */ namespace Phalcon\Mvc\Model\Resultset; +use Phalcon\Db\ResultInterface; use Phalcon\Di\Di; use Phalcon\Di\DiInterface; -use Phalcon\Db\ResultInterface; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\Exceptions\CorruptColumnType; +use Phalcon\Mvc\Model\Exceptions\InvalidContainer; +use Phalcon\Mvc\Model\Exceptions\InvalidSerializationData; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; use Phalcon\Mvc\Model\Row; @@ -53,61 +56,61 @@ class Complex extends Resultset * @param ResultInterface|null $result * @param mixed|null $cache */ - public function __construct($columnTypes, \Phalcon\Db\ResultInterface $result = null, $cache = null) + public function __construct($columnTypes, ?\Phalcon\Db\ResultInterface $result = null, $cache = null) { } /** - * Returns current row in the resultset - * - * @return mixed + * @return array */ - final public function current(): mixed + public function __serialize(): array { } /** - * Returns a complete resultset as an array, if the resultset has a big - * number of rows it could consume more memory than currently it does. - * - * @return array + * @param array $data + * @return void */ - public function toArray(): array + public function __unserialize(array $data): void { } /** - * Serializing a resultset will dump all related rows into a big array, - * serialize it and return the resulting string + * Returns current row in the resultset * - * @return string + * @return mixed */ - public function serialize(): string + final public function current(): mixed { } /** - * Unserializing a resultset will allow to only works on the rows present in the saved state + * Serializing a resultset will dump all related rows into a big array, + * serialize it and return the resulting string * - * @param mixed $data - * @return void + * @return string */ - public function unserialize($data): void + public function serialize(): string { } /** + * Returns a complete resultset as an array, if the resultset has a big + * number of rows it could consume more memory than currently it does. + * * @return array */ - public function __serialize(): array + public function toArray(): array { } /** - * @param array $data + * Unserializing a resultset will allow to only works on the rows present in the saved state + * + * @param mixed $data * @return void */ - public function __unserialize(array $data): void + public function unserialize($data): void { } } diff --git a/src/Mvc/Model/Resultset/Simple.php b/src/Mvc/Model/Resultset/Simple.php index 6f594451..b6ddad62 100644 --- a/src/Mvc/Model/Resultset/Simple.php +++ b/src/Mvc/Model/Resultset/Simple.php @@ -13,6 +13,9 @@ use Phalcon\Di\DiInterface; use Phalcon\Mvc\Model; use Phalcon\Mvc\Model\Exception; +use Phalcon\Mvc\Model\Exceptions\InvalidContainer; +use Phalcon\Mvc\Model\Exceptions\InvalidSerializationData; +use Phalcon\Mvc\Model\Exceptions\ResultsetColumnNotInMap; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\Row; use Phalcon\Mvc\ModelInterface; @@ -59,59 +62,59 @@ public function __construct($columnMap, $model, $result, $cache = null, bool $ke } /** - * Returns current row in the resultset - * - * @return TValue + * @return array */ - final public function current(): ModelInterface|null + public function __serialize(): array { } /** - * Returns a complete resultset as an array, if the resultset has a big - * number of rows it could consume more memory than currently it does. - * Export the resultset to an array couldn't be faster with a large number - * of records - * - * @param bool $renameColumns - * @return array + * @param array $data + * @return void */ - public function toArray(bool $renameColumns = true): array + public function __unserialize(array $data): void { } /** - * Serializing a resultset will dump all related rows into a big array + * Returns current row in the resultset * - * @return string + * @return TValue */ - public function serialize(): string + final public function current(): ModelInterface|Row|null { } /** - * Unserializing a resultset will allow to only works on the rows present in - * the saved state + * Serializing a resultset will dump all related rows into a big array * - * @param mixed $data - * @return void + * @return string */ - public function unserialize($data): void + public function serialize(): string { } /** + * Returns a complete resultset as an array, if the resultset has a big + * number of rows it could consume more memory than currently it does. + * Export the resultset to an array couldn't be faster with a large number + * of records + * + * @param bool $renameColumns * @return array */ - public function __serialize(): array + public function toArray(bool $renameColumns = true): array { } /** - * @param array $data + * Unserializing a resultset will allow to only works on the rows present in + * the saved state + * + * @param mixed $data * @return void */ - public function __unserialize(array $data): void + public function unserialize($data): void { } } diff --git a/src/Mvc/Model/ResultsetInterface.php b/src/Mvc/Model/ResultsetInterface.php index 1c12957e..8be8d414 100644 --- a/src/Mvc/Model/ResultsetInterface.php +++ b/src/Mvc/Model/ResultsetInterface.php @@ -23,10 +23,10 @@ interface ResultsetInterface /** * Deletes every record in the resultset * - * @param \Closure $conditionCallback + * @param \Closure|null $conditionCallback * @return bool */ - public function delete(\Closure $conditionCallback = null): bool; + public function delete(?\Closure $conditionCallback = null): bool; /** * Filters a resultset returning only those the developer requires @@ -123,8 +123,8 @@ public function toArray(): array; * Updates every record in the resultset * * @param array $data - * @param \Closure $conditionCallback + * @param \Closure|null $conditionCallback * @return bool */ - public function update($data, \Closure $conditionCallback = null): bool; + public function update($data, ?\Closure $conditionCallback = null): bool; } diff --git a/src/Mvc/Model/Row.php b/src/Mvc/Model/Row.php index 0bb3dd44..ccbcf931 100644 --- a/src/Mvc/Model/Row.php +++ b/src/Mvc/Model/Row.php @@ -12,6 +12,8 @@ use ArrayAccess; use JsonSerializable; use Phalcon\Mvc\EntityInterface; +use Phalcon\Mvc\Model\Exceptions\IndexNotInRow; +use Phalcon\Mvc\Model\Exceptions\RowIsImmutable; use Phalcon\Mvc\ModelInterface; /** @@ -30,22 +32,24 @@ public function jsonSerialize(): array } /** - * Gets a record in a specific position of the row + * Checks whether offset exists in the row. Returns true when the property + * is present on the row, regardless of whether its value is null - column + * presence is the contract, not value truthiness. * - * @param string|int $index * - * @return string|ModelInterface + * @param string|int $index + * @return bool */ - public function offsetGet($index): mixed + public function offsetExists($index): bool { } /** - * Checks whether offset exists in the row + * Gets a record in a specific position of the row * - * @param string|int $index - * @return bool + * @param string|int $index * + * @return string|ModelInterface */ - public function offsetExists($index): bool + public function offsetGet($index): mixed { } diff --git a/src/Mvc/Model/Transaction.php b/src/Mvc/Model/Transaction.php index 2659a921..882ec620 100644 --- a/src/Mvc/Model/Transaction.php +++ b/src/Mvc/Model/Transaction.php @@ -17,8 +17,6 @@ use Phalcon\Mvc\Model\TransactionInterface; /** - * Phalcon\Mvc\Model\Transaction - * * Transactions are protective blocks where SQL statements are only permanent if * they can all succeed as one atomic action. Phalcon\Transaction is intended to * be used with Phalcon_Model_Base. Phalcon Transactions should be created using @@ -88,14 +86,14 @@ class Transaction implements \Phalcon\Mvc\Model\TransactionInterface protected $messages = []; /** - * @var ModelInterface|null + * @var bool */ - protected $rollbackRecord = null; + protected $rollbackOnAbort = false; /** - * @var bool + * @var ModelInterface|null */ - protected $rollbackOnAbort = false; + protected $rollbackRecord = null; /** * @var bool @@ -170,11 +168,11 @@ public function isValid(): bool /** * Rollbacks the transaction * - * @param string $rollbackMessage - * @param \Phalcon\Mvc\ModelInterface $rollbackRecord + * @param string|null $rollbackMessage + * @param \Phalcon\Mvc\ModelInterface|null $rollbackRecord * @return bool */ - public function rollback(string $rollbackMessage = null, \Phalcon\Mvc\ModelInterface $rollbackRecord = null): bool + public function rollback(?string $rollbackMessage = null, ?\Phalcon\Mvc\ModelInterface $rollbackRecord = null): bool { } diff --git a/src/Mvc/Model/Transaction/Failed.php b/src/Mvc/Model/Transaction/Failed.php index 4af00945..07ebb4c6 100644 --- a/src/Mvc/Model/Transaction/Failed.php +++ b/src/Mvc/Model/Transaction/Failed.php @@ -30,25 +30,25 @@ class Failed extends \Phalcon\Mvc\Model\Transaction\Exception * @param string $message * @param ModelInterface|null $record */ - public function __construct(string $message, \Phalcon\Mvc\ModelInterface $record = null) + public function __construct(string $message, ?\Phalcon\Mvc\ModelInterface $record = null) { } /** * Returns validation record messages which stop the transaction * - * @return ModelInterface + * @return ModelInterface|null */ - public function getRecord(): ModelInterface + public function getRecord(): ModelInterface|null { } /** * Returns validation record messages which stop the transaction * - * @return MessageInterface[] + * @return MessageInterface[]|string */ - public function getRecordMessages(): array + public function getRecordMessages(): string|array { } } diff --git a/src/Mvc/Model/Transaction/Manager.php b/src/Mvc/Model/Transaction/Manager.php index 5abfd737..53edb6fb 100644 --- a/src/Mvc/Model/Transaction/Manager.php +++ b/src/Mvc/Model/Transaction/Manager.php @@ -12,12 +12,11 @@ use Phalcon\Di\Di; use Phalcon\Di\DiInterface; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Mvc\Model\Exceptions\ManagerOrmServicesUnavailable; use Phalcon\Mvc\Model\Transaction; use Phalcon\Mvc\Model\TransactionInterface; /** - * Phalcon\Mvc\Model\Transaction\Manager - * * A transaction acts on a single database connection. If you have multiple * class-specific databases, the transaction will not protect interaction among * them. @@ -99,7 +98,7 @@ class Manager implements \Phalcon\Mvc\Model\Transaction\ManagerInterface, \Phalc * * @param DiInterface|null $container */ - public function __construct(\Phalcon\Di\DiInterface $container = null) + public function __construct(?\Phalcon\Di\DiInterface $container = null) { } diff --git a/src/Mvc/Model/TransactionInterface.php b/src/Mvc/Model/TransactionInterface.php index 70846b52..2926d641 100644 --- a/src/Mvc/Model/TransactionInterface.php +++ b/src/Mvc/Model/TransactionInterface.php @@ -13,8 +13,6 @@ use Phalcon\Mvc\Model\Transaction\ManagerInterface; /** - * Phalcon\Mvc\Model\TransactionInterface - * * Interface for Phalcon\Mvc\Model\Transaction */ interface TransactionInterface @@ -64,11 +62,11 @@ public function isValid(): bool; /** * Rollbacks the transaction * - * @param string $rollbackMessage - * @param \Phalcon\Mvc\ModelInterface $rollbackRecord + * @param string|null $rollbackMessage + * @param \Phalcon\Mvc\ModelInterface|null $rollbackRecord * @return bool */ - public function rollback(string $rollbackMessage = null, \Phalcon\Mvc\ModelInterface $rollbackRecord = null): bool; + public function rollback(?string $rollbackMessage = null, ?\Phalcon\Mvc\ModelInterface $rollbackRecord = null): bool; /** * Sets if is a reused transaction or new once diff --git a/src/Mvc/Model/ValidationFailed.php b/src/Mvc/Model/ValidationFailed.php index b1248909..46653d54 100644 --- a/src/Mvc/Model/ValidationFailed.php +++ b/src/Mvc/Model/ValidationFailed.php @@ -21,14 +21,14 @@ class ValidationFailed extends \Phalcon\Mvc\Model\Exception { /** - * @var array + * @var ModelInterface */ - protected $messages = []; + protected $model; /** - * @var ModelInterface + * @var array */ - protected $model; + protected $validationMessages = []; /** * Phalcon\Mvc\Model\ValidationFailed constructor diff --git a/src/Mvc/ModelInterface.php b/src/Mvc/ModelInterface.php index a9ab037e..a99b6291 100644 --- a/src/Mvc/ModelInterface.php +++ b/src/Mvc/ModelInterface.php @@ -14,6 +14,7 @@ use Phalcon\Messages\MessageInterface; use Phalcon\Mvc\Model\CriteriaInterface; use Phalcon\Mvc\Model\MetaDataInterface; +use Phalcon\Mvc\Model\ResultInterface; use Phalcon\Mvc\Model\Resultset; use Phalcon\Mvc\Model\ResultsetInterface; use Phalcon\Mvc\Model\TransactionInterface; @@ -255,10 +256,10 @@ public static function minimum($parameters = null): mixed; /** * Create a criteria for a specific model * - * @param \Phalcon\Di\DiInterface $container + * @param \Phalcon\Di\DiInterface|null $container * @return CriteriaInterface */ - public static function query(\Phalcon\Di\DiInterface $container = null): CriteriaInterface; + public static function query(?\Phalcon\Di\DiInterface $container = null): CriteriaInterface; /** * Refreshes the model attributes re-querying the record from the database @@ -343,18 +344,18 @@ public function skipOperation(bool $skip): void; public static function sum($parameters = null): ResultsetInterface|float; /** - * Check whether validation process has generated any messages + * Updates a model instance. If the instance does not exist in the + * persistence it will throw an exception. Returning true on success or + * false otherwise. * * @return bool */ - public function validationHasFailed(): bool; + public function update(): bool; /** - * Updates a model instance. If the instance does not exist in the - * persistence it will throw an exception. Returning true on success or - * false otherwise. + * Check whether validation process has generated any messages * * @return bool */ - public function update(): bool; + public function validationHasFailed(): bool; } diff --git a/src/Mvc/ModuleDefinitionInterface.php b/src/Mvc/ModuleDefinitionInterface.php index 3ce81b33..fc18af05 100644 --- a/src/Mvc/ModuleDefinitionInterface.php +++ b/src/Mvc/ModuleDefinitionInterface.php @@ -12,8 +12,6 @@ use Phalcon\Di\DiInterface; /** - * Phalcon\Mvc\ModuleDefinitionInterface - * * This interface must be implemented by class module definitions */ interface ModuleDefinitionInterface @@ -21,9 +19,9 @@ interface ModuleDefinitionInterface /** * Registers an autoloader related to the module * - * @param \Phalcon\Di\DiInterface $container + * @param \Phalcon\Di\DiInterface|null $container */ - public function registerAutoloaders(\Phalcon\Di\DiInterface $container = null); + public function registerAutoloaders(?\Phalcon\Di\DiInterface $container = null); /** * Registers services related to the module diff --git a/src/Mvc/Router.php b/src/Mvc/Router.php index eca0c378..b5cc6dee 100644 --- a/src/Mvc/Router.php +++ b/src/Mvc/Router.php @@ -9,13 +9,26 @@ */ namespace Phalcon\Mvc; +use Phalcon\Cache\Adapter\AdapterInterface as CacheAdapterInterface; use Phalcon\Config\ConfigInterface; -use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; +use Phalcon\Di\DiInterface; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface; use Phalcon\Http\RequestInterface; use Phalcon\Mvc\Router\Exception; +use Phalcon\Mvc\Router\Exceptions\BeforeMatchNotCallable; +use Phalcon\Mvc\Router\Exceptions\ConfigKeyMustBeArray; +use Phalcon\Mvc\Router\Exceptions\EmptyGroupOfRoutes; +use Phalcon\Mvc\Router\Exceptions\GroupRoutesMustBeArray; +use Phalcon\Mvc\Router\Exceptions\InvalidConfigSource; +use Phalcon\Mvc\Router\Exceptions\InvalidNotFoundPaths; +use Phalcon\Mvc\Router\Exceptions\InvalidRoutePosition; +use Phalcon\Mvc\Router\Exceptions\MissingGroupRouteKey; +use Phalcon\Mvc\Router\Exceptions\MissingRouteConfigKey; +use Phalcon\Mvc\Router\Exceptions\RequestServiceUnavailable; +use Phalcon\Mvc\Router\Exceptions\UnknownHttpMethod; +use Phalcon\Mvc\Router\Exceptions\WrongPathsKey; use Phalcon\Mvc\Router\Group; use Phalcon\Mvc\Router\GroupInterface; use Phalcon\Mvc\Router\Route; @@ -61,6 +74,14 @@ class Router extends AbstractInjectionAware implements \Phalcon\Mvc\RouterInterf */ const POSITION_LAST = 1; + /** + * Number of alternatives per combined-regex chunk. Empirically derived + * (FastRoute uses ~10) — keeps each chunk below PCRE's optimizer cliff. + * + * @var int + */ + const REGEX_CHUNK_SIZE = 10; + /** * @var int */ @@ -76,6 +97,64 @@ class Router extends AbstractInjectionAware implements \Phalcon\Mvc\RouterInterf */ protected $action = ''; + /** + * Pre-merged per-method candidate buckets in attach order. For each HTTP + * method seen on any registered route, the bucket contains the + * method-specific routes followed by the "" (no-constraint) routes. + * The "" key itself holds only the no-constraint routes — used when the + * request method has no specific bucket. + * + * Built in rebuildMethodIndex(); consumed by handle() in reverse. + * + * @var array + */ + protected $candidatesByMethod = []; + + /** + * Single-source per-route metadata cache. One entry per route, keyed + * by the route's intrinsic id. Replaces the previous per-method-bucket + * replication of metadata arrays. Built once in rebuildMethodIndex(). + * + * Shape: routeMeta[routeId] = [ + * "pattern": string, // compiled pattern + * "isRegex": bool, + * "hostname": string|null, + * "hostRegex": string|null, + * "beforeMatch": callable|null + * ] + * + * @var array + */ + protected $routeMeta = []; + + /** + * Combined PCRE pattern per method bucket (chunked list of strings). + * Each chunk uses (?|...) branch reset and (:N) mark labels. Built + * only when the bucket meets gating: no hostname routes; standard + * pattern shape. + * + * @var array + */ + protected $combinedRegexByMethod = []; + + /** + * Boolean per method bucket: true when the combined regex cannot be + * built (hostname route present, exotic pattern shape, etc.). + * + * @var array + */ + protected $combinedRegexDisabled = []; + + /** + * Map from MARK label back to the route index in + * candidatesByMethod[method]. One per chunk. + * + * combinedRegexMarkMap[method][chunkIdx][markLabel] = routeIdx + * + * @var array + */ + protected $combinedRegexMarkMap = []; + /** * @var string */ @@ -111,6 +190,28 @@ class Router extends AbstractInjectionAware implements \Phalcon\Mvc\RouterInterf */ protected $eventsManager; + /** + * Per-method buckets of routes with hostname constraints, grouped by + * raw hostname string. Routes are referenced by their index into + * candidatesByMethod[method]. Built in rebuildMethodIndex(). + * + * Shape: hostnameByMethod[method][hostname] = list of route indices. + * + * @var array + */ + protected $hostnameByMethod = []; + + /** + * Per-method indices of routes without a hostname constraint, in + * attach order. + * + * Shape: hostnameLessByMethod[method] = list of route indices into + * candidatesByMethod[method]. + * + * @var array + */ + protected $hostnameLessByMethod = []; + /** * @var array */ @@ -161,6 +262,21 @@ class Router extends AbstractInjectionAware implements \Phalcon\Mvc\RouterInterf */ protected $params = []; + /** + * Lazy-write cache target set by useCache(). When non-null, handle() + * writes buildDispatcherDump() to this cache after a successful + * rebuild on cache miss, then clears the property to skip subsequent + * writes. + * + * @var CacheAdapterInterface|null + */ + protected $pendingCache = null; + + /** + * @var string + */ + protected $pendingCacheKey = ''; + /** * @var bool */ @@ -171,6 +287,25 @@ class Router extends AbstractInjectionAware implements \Phalcon\Mvc\RouterInterf */ protected $routes = []; + /** + * Static-route hash, populated by rebuildMethodIndex(). For each method + * bucket (including ""), maps URI => list of routes whose compiled + * pattern is a literal string equal to that URI. + * + * @var array + */ + protected $staticByMethod = []; + + /** + * Shadow-detection map. If staticShadowedByMethod[method][uri] is set, + * the static URI in that bucket is shadowed by a later-attached regex + * route — the fast path MUST NOT be used; fall through to the dynamic + * loop so the regex wins (reverse-iteration semantics). + * + * @var array + */ + protected $staticShadowedByMethod = []; + /** * @var int */ @@ -431,9 +566,9 @@ public function addTrace(string $pattern, $paths = null, int $position = Router: * @param RouteInterface $route * @param int $position * - * @return RouterInterface + * @return static */ - public function attach(\Phalcon\Mvc\Router\RouteInterface $route, int $position = Router::POSITION_LAST): RouterInterface + public function attach(\Phalcon\Mvc\Router\RouteInterface $route, int $position = Router::POSITION_LAST): static { } @@ -446,6 +581,75 @@ public function clear(): void { } + /** + * Produces a pure-data array describing every piece of state needed + * to reconstruct this router. The returned array is var_export-able + * (no objects, no closures). Used by dumpDispatcher() and by + * Phalcon\Cache integration via useCache(). + * + * Throws when a route has a Closure beforeMatch or converter — those + * cannot be cached. + * + * @throws \Phalcon\Mvc\Router\Exception + * @return array + */ + public function buildDispatcherDump(): array + { + } + + /** + * Inverse of buildDispatcherDump(). Reconstructs every Route from the + * scalar `routes` entries (preserving subclass and routeId), restores + * every index, and marks the indexes clean so handle() skips rebuild. + * + * @throws \Phalcon\Mvc\Router\Exception + * @param array $dump + * @return void + */ + public function loadDispatcherFromArray(array $dump): void + { + } + + /** + * File-shaped helper around buildDispatcherDump(). Writes the dump as + * a ` + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AnnotationsServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/BeforeMatchNotCallable.php b/src/Mvc/Router/Exceptions/BeforeMatchNotCallable.php new file mode 100644 index 00000000..8e824734 --- /dev/null +++ b/src/Mvc/Router/Exceptions/BeforeMatchNotCallable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BeforeMatchNotCallable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/ConfigKeyMustBeArray.php b/src/Mvc/Router/Exceptions/ConfigKeyMustBeArray.php new file mode 100644 index 00000000..89963de0 --- /dev/null +++ b/src/Mvc/Router/Exceptions/ConfigKeyMustBeArray.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConfigKeyMustBeArray extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Mvc/Router/Exceptions/EmptyGroupOfRoutes.php b/src/Mvc/Router/Exceptions/EmptyGroupOfRoutes.php new file mode 100644 index 00000000..70e96a5c --- /dev/null +++ b/src/Mvc/Router/Exceptions/EmptyGroupOfRoutes.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class EmptyGroupOfRoutes extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/GroupRoutesMustBeArray.php b/src/Mvc/Router/Exceptions/GroupRoutesMustBeArray.php new file mode 100644 index 00000000..c069418c --- /dev/null +++ b/src/Mvc/Router/Exceptions/GroupRoutesMustBeArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class GroupRoutesMustBeArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidCallbackParameter.php b/src/Mvc/Router/Exceptions/InvalidCallbackParameter.php new file mode 100644 index 00000000..d0d24c96 --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidCallbackParameter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCallbackParameter extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidConfigSource.php b/src/Mvc/Router/Exceptions/InvalidConfigSource.php new file mode 100644 index 00000000..0d79b5bd --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidConfigSource.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidConfigSource extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidNotFoundPaths.php b/src/Mvc/Router/Exceptions/InvalidNotFoundPaths.php new file mode 100644 index 00000000..a062d939 --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidNotFoundPaths.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidNotFoundPaths extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidRoutePaths.php b/src/Mvc/Router/Exceptions/InvalidRoutePaths.php new file mode 100644 index 00000000..e8266e54 --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidRoutePaths.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRoutePaths extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidRoutePosition.php b/src/Mvc/Router/Exceptions/InvalidRoutePosition.php new file mode 100644 index 00000000..74707ccb --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidRoutePosition.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRoutePosition extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/InvalidRouterFactoryConfig.php b/src/Mvc/Router/Exceptions/InvalidRouterFactoryConfig.php new file mode 100644 index 00000000..d97f88ac --- /dev/null +++ b/src/Mvc/Router/Exceptions/InvalidRouterFactoryConfig.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidRouterFactoryConfig extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/MissingGroupRouteKey.php b/src/Mvc/Router/Exceptions/MissingGroupRouteKey.php new file mode 100644 index 00000000..15202fa7 --- /dev/null +++ b/src/Mvc/Router/Exceptions/MissingGroupRouteKey.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingGroupRouteKey extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Mvc/Router/Exceptions/MissingRouteConfigKey.php b/src/Mvc/Router/Exceptions/MissingRouteConfigKey.php new file mode 100644 index 00000000..8a40684d --- /dev/null +++ b/src/Mvc/Router/Exceptions/MissingRouteConfigKey.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingRouteConfigKey extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Mvc/Router/Exceptions/RequestServiceUnavailable.php b/src/Mvc/Router/Exceptions/RequestServiceUnavailable.php new file mode 100644 index 00000000..b4413e63 --- /dev/null +++ b/src/Mvc/Router/Exceptions/RequestServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RequestServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Router/Exceptions/UnknownHttpMethod.php b/src/Mvc/Router/Exceptions/UnknownHttpMethod.php new file mode 100644 index 00000000..582a06aa --- /dev/null +++ b/src/Mvc/Router/Exceptions/UnknownHttpMethod.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownHttpMethod extends Exception +{ + /** + * @param string $method + */ + public function __construct(string $method) + { + } +} diff --git a/src/Mvc/Router/Exceptions/WrongPathsKey.php b/src/Mvc/Router/Exceptions/WrongPathsKey.php new file mode 100644 index 00000000..8a97e35c --- /dev/null +++ b/src/Mvc/Router/Exceptions/WrongPathsKey.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Router\Exceptions; + +use Phalcon\Mvc\Router\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class WrongPathsKey extends Exception +{ + /** + * @param string $part + */ + public function __construct(string $part) + { + } +} diff --git a/src/Mvc/Router/Group.php b/src/Mvc/Router/Group.php index 4daa380e..01140fde 100644 --- a/src/Mvc/Router/Group.php +++ b/src/Mvc/Router/Group.php @@ -10,8 +10,6 @@ namespace Phalcon\Mvc\Router; /** - * Phalcon\Mvc\Router\Group - * * Helper class to create a group of routes with common attributes * * ```php @@ -100,18 +98,15 @@ public function __construct($paths = null) * $router->add("/about", "About::index"); * ``` * - * @param string $pattenr + * @param string $pattern * @param string|array $paths = [ * 'module => '', * 'controller' => '', * 'action' => '', * 'namespace' => '' * ] - * @param httpMethods $array |string|null - * + * @param array|string|null $httpMethods * * @return RouteInterface - * @param string $pattern - * @param mixed $httpMethods */ public function add(string $pattern, $paths = null, $httpMethods = null): RouteInterface { @@ -292,10 +287,8 @@ public function addTrace(string $pattern, $paths = null): RouteInterface * The developer can implement any arbitrary conditions here * If the callback returns false the route is treated as not matched * - * @paramm callable beforeMatch - * + * @param callable $beforeMatch * * @return GroupInterface - * @param callable $beforeMatch */ public function beforeMatch($beforeMatch): GroupInterface { @@ -313,9 +306,9 @@ public function clear(): void /** * Returns the 'before match' callback if any * - * @return mixed + * @return mixed|null */ - public function getBeforeMatch() + public function getBeforeMatch(): null { } @@ -331,9 +324,9 @@ public function getHostname(): string|null /** * Returns the common paths defined for this group * - * @return array|string + * @return array|string|null */ - public function getPaths(): string|array + public function getPaths(): string|array|null { } diff --git a/src/Mvc/Router/GroupInterface.php b/src/Mvc/Router/GroupInterface.php index 82453a43..87eab0f7 100644 --- a/src/Mvc/Router/GroupInterface.php +++ b/src/Mvc/Router/GroupInterface.php @@ -10,8 +10,6 @@ namespace Phalcon\Mvc\Router; /** - * Phalcon\Mvc\Router\GroupInterface - * * ```php * $router = new \Phalcon\Mvc\Router(); * @@ -181,9 +179,9 @@ public function clear(): void; /** * Returns the 'before match' callback if any * - * @return mixed + * @return mixed|null */ - public function getBeforeMatch(); + public function getBeforeMatch(): null; /** * Returns the hostname restriction @@ -195,9 +193,9 @@ public function getHostname(): string|null; /** * Returns the common paths defined for this group * - * @return array|string + * @return array|string|null */ - public function getPaths(): string|array; + public function getPaths(): string|array|null; /** * Returns the common prefix for all the routes diff --git a/src/Mvc/Router/Route.php b/src/Mvc/Router/Route.php index 09052eba..2641c839 100644 --- a/src/Mvc/Router/Route.php +++ b/src/Mvc/Router/Route.php @@ -9,9 +9,9 @@ */ namespace Phalcon\Mvc\Router; +use Phalcon\Mvc\Router\Exceptions\InvalidRoutePaths; + /** - * Phalcon\Mvc\Router\Route - * * This class represents every route added to the router */ class Route implements \Phalcon\Mvc\Router\RouteInterface @@ -21,6 +21,15 @@ class Route implements \Phalcon\Mvc\Router\RouteInterface */ protected $beforeMatch = null; + /** + * Cached compiled hostname regex. `false` means "not yet computed"; + * `null` means "hostname is literal — use string equality"; any string + * means "use this as the PCRE pattern." + * + * @var string|null|false + */ + protected $compiledHostName = false; + /** * @var string|null */ @@ -42,20 +51,15 @@ class Route implements \Phalcon\Mvc\Router\RouteInterface protected $hostname = null; /** - * @var string + * @var callable|null */ - protected $id = ''; + protected $match = null; /** - * @var array|string + * @var array|string|null */ protected $methods = []; - /** - * @var callable|null - */ - protected $match = null; - /** * @var string|null */ @@ -71,6 +75,11 @@ class Route implements \Phalcon\Mvc\Router\RouteInterface */ protected $pattern; + /** + * @var string + */ + protected $routeId = ''; + /** * @var int */ @@ -152,9 +161,22 @@ public function extractNamedParams(string $pattern): bool|array /** * Returns the 'before match' callback if any * - * @return mixed + * @return mixed|null */ - public function getBeforeMatch() + public function getBeforeMatch(): null + { + } + + /** + * Returns the compiled hostname regex, or null when the hostname is + * literal and a string-equality comparison should be used. + * + * The result is cached after first computation; setHostname() clears + * the cache. + * + * @return string|null + */ + public function getCompiledHostName(): string|null { } @@ -185,15 +207,6 @@ public function getGroup(): GroupInterface|null { } - /** - * Returns the HTTP methods that constraint matching the route - * - * @return array|string - */ - public function getHttpMethods(): string|array - { - } - /** * Returns the hostname restriction if any * @@ -204,18 +217,20 @@ public function getHostname(): string|null } /** - * @return string + * Returns the HTTP methods that constraint matching the route + * + * @return array|string|null */ - public function getId(): string + public function getHttpMethods(): string|array|null { } /** * Returns the 'match' callback if any * - * @return mixed + * @return mixed|null */ - public function getMatch() + public function getMatch(): null { } @@ -325,6 +340,20 @@ public function setGroup(GroupInterface $group): RouteInterface { } + /** + * Sets a hostname restriction to the route + * + * ```php + * $route->setHostname("localhost"); + * ``` + * + * @param string $hostname + * @return RouteInterface + */ + public function setHostname(string $hostname): RouteInterface + { + } + /** * Sets a set of HTTP methods that constraint the matching of the route (alias of via) * @@ -346,20 +375,6 @@ public function setHttpMethods($httpMethods): RouteInterface { } - /** - * Sets a hostname restriction to the route - * - * ```php - * $route->setHostname("localhost"); - * ``` - * - * @param string $hostname - * @return RouteInterface - */ - public function setHostname(string $hostname): RouteInterface - { - } - /** * Sets the route's name * @@ -379,6 +394,18 @@ public function setName(string $name): RouteInterface { } + /** + * Sets the route's id. Intended for restoring cached routes — most + * applications should rely on the auto-incrementing id assigned by + * the constructor. + * + * @param string $routeId + * @return RouteInterface + */ + public function setRouteId(string $routeId): RouteInterface + { + } + /** * Set one or more HTTP methods that constraint the matching of the route * diff --git a/src/Mvc/Router/RouteInterface.php b/src/Mvc/Router/RouteInterface.php index c86190f7..e1ba2249 100644 --- a/src/Mvc/Router/RouteInterface.php +++ b/src/Mvc/Router/RouteInterface.php @@ -10,8 +10,6 @@ namespace Phalcon\Mvc\Router; /** - * Phalcon\Mvc\Router\RouteInterface - * * Interface for Phalcon\Mvc\Router\Route */ interface RouteInterface @@ -50,9 +48,9 @@ public function getHostname(): string|null; /** * Returns the HTTP methods that constraint matching the route * - * @return string|array + * @return array|string|null */ - public function getHttpMethods(): string|array; + public function getHttpMethods(): string|array|null; /** * Returns the route's name @@ -89,6 +87,22 @@ public function getReversedPaths(): array; */ public function getRouteId(): string; + /** + * Reconfigure the route adding a new pattern and a set of paths + * + * @param string $pattern + * @param mixed $paths + * @return void + */ + public function reConfigure(string $pattern, $paths = null): void; + + /** + * Resets the internal route id generator + * + * @return void + */ + public static function reset(): void; + /** * Sets a hostname restriction to the route * @@ -114,20 +128,12 @@ public function setHttpMethods($httpMethods): RouteInterface; public function setName(string $name): RouteInterface; /** - * Reconfigure the route adding a new pattern and a set of paths + * Sets the route's id (intended for restoring cached routes) * - * @param string $pattern - * @param mixed $paths - * @return void - */ - public function reConfigure(string $pattern, $paths = null): void; - - /** - * Resets the internal route id generator - * - * @return void + * @param string $routeId + * @return RouteInterface */ - public static function reset(): void; + public function setRouteId(string $routeId): RouteInterface; /** * Set one or more HTTP methods that constraint the matching of the route diff --git a/src/Mvc/Router/RouterFactory.php b/src/Mvc/Router/RouterFactory.php index 9eafd1ad..79e0a171 100644 --- a/src/Mvc/Router/RouterFactory.php +++ b/src/Mvc/Router/RouterFactory.php @@ -11,6 +11,7 @@ use Phalcon\Config\ConfigInterface; use Phalcon\Mvc\Router; +use Phalcon\Mvc\Router\Exceptions\InvalidRouterFactoryConfig; use Phalcon\Mvc\RouterInterface; /** diff --git a/src/Mvc/RouterInterface.php b/src/Mvc/RouterInterface.php index 6ccc12e9..14dd39a2 100644 --- a/src/Mvc/RouterInterface.php +++ b/src/Mvc/RouterInterface.php @@ -9,8 +9,8 @@ */ namespace Phalcon\Mvc; -use Phalcon\Mvc\Router\RouteInterface; use Phalcon\Mvc\Router\GroupInterface; +use Phalcon\Mvc\Router\RouteInterface; /** * Interface for Phalcon\Mvc\Router @@ -49,24 +49,24 @@ public function addConnect(string $pattern, $paths = null, int $position = Route public function addDelete(string $pattern, $paths = null, int $position = Router::POSITION_LAST): RouteInterface; /** - * Adds a route to the router that only match if the HTTP method is HEAD + * Adds a route to the router that only match if the HTTP method is GET * * @param string $pattern * @param array|string|null $paths * * @return RouteInterface * @param int $position */ - public function addHead(string $pattern, $paths = null, int $position = Router::POSITION_LAST): RouteInterface; + public function addGet(string $pattern, $paths = null, int $position = Router::POSITION_LAST): RouteInterface; /** - * Adds a route to the router that only match if the HTTP method is GET + * Adds a route to the router that only match if the HTTP method is HEAD * * @param string $pattern * @param array|string|null $paths * * @return RouteInterface * @param int $position */ - public function addGet(string $pattern, $paths = null, int $position = Router::POSITION_LAST): RouteInterface; + public function addHead(string $pattern, $paths = null, int $position = Router::POSITION_LAST): RouteInterface; /** * Add a route to the router that only match if the HTTP method is OPTIONS @@ -194,20 +194,13 @@ public function getNamespaceName(): string; */ public function getParams(): array; - /** - * Return all the routes defined in the router - * - * @return array|\Phalcon\Mvc\Router\RouteInterface[] - */ - public function getRoutes(): array; - /** * Returns a route object by its id * * @return RouteInterface|bool - * @param mixed $id + * @param mixed $routeId */ - public function getRouteById($id): RouteInterface|bool; + public function getRouteById($routeId): RouteInterface|bool; /** * Returns a route object by its name @@ -217,6 +210,13 @@ public function getRouteById($id): RouteInterface|bool; */ public function getRouteByName(string $name): RouteInterface|bool; + /** + * Return all the routes defined in the router + * + * @return array|\Phalcon\Mvc\Router\RouteInterface[] + */ + public function getRoutes(): array; + /** * Handles routing information received from the rewrite engine * diff --git a/src/Mvc/Url.php b/src/Mvc/Url.php index 4e29adba..4b5ab1d9 100644 --- a/src/Mvc/Url.php +++ b/src/Mvc/Url.php @@ -9,15 +9,18 @@ */ namespace Phalcon\Mvc; -use Phalcon\Di\DiInterface; use Phalcon\Di\AbstractInjectionAware; -use Phalcon\Mvc\RouterInterface; +use Phalcon\Di\DiInterface; use Phalcon\Mvc\Router\RouteInterface; +use Phalcon\Mvc\RouterInterface; use Phalcon\Mvc\Url\Exception; +use Phalcon\Mvc\Url\Exceptions\MissingRouteName; +use Phalcon\Mvc\Url\Exceptions\RouteNotFound; +use Phalcon\Mvc\Url\Exceptions\RouterServiceUnavailable; use Phalcon\Mvc\Url\UrlInterface; /** - * This components helps in the generation of: URIs, URLs and Paths + * This component helps in the generation of: URIs, URLs and Paths * * ```php * // Generate a URL appending the URI to the base URI @@ -38,12 +41,12 @@ class Url extends AbstractInjectionAware implements \Phalcon\Mvc\Url\UrlInterfac /** * @var null | string */ - protected $baseUri = null; + protected $basePath = null; /** * @var null | string */ - protected $basePath = null; + protected $baseUri = null; /** * @var RouterInterface | null @@ -56,9 +59,9 @@ class Url extends AbstractInjectionAware implements \Phalcon\Mvc\Url\UrlInterfac protected $staticBaseUri = null; /** - * @param \Phalcon\Mvc\RouterInterface $router + * @param \Phalcon\Mvc\RouterInterface|null $router */ - public function __construct(\Phalcon\Mvc\RouterInterface $router = null) + public function __construct(?\Phalcon\Mvc\RouterInterface $router = null) { } @@ -109,22 +112,22 @@ public function __construct(\Phalcon\Mvc\RouterInterface $router = null) * @param array|string $uri = [ * 'for' => '', * ] - * @param mixed $args - * @param bool $local + * @param mixed $arguments + * @param bool|null $local * @param mixed $baseUri * @param bool $replaceArgs * @return string */ - public function get($uri = null, $args = null, bool $local = null, $baseUri = null, bool $replaceArgs = false): string + public function get($uri = null, $arguments = null, ?bool $local = null, $baseUri = null, bool $replaceArgs = false): string { } /** * Returns the base path * - * @return string + * @return string|null */ - public function getBasePath(): string + public function getBasePath(): string|null { } @@ -170,6 +173,16 @@ public function getStaticBaseUri(): string { } + /** + * Generates a local path + * + * @param string|null $path + * @return string + */ + public function path(?string $path = null): string + { + } + /** * Sets a base path for all the generated paths * @@ -213,14 +226,4 @@ public function setBaseUri(string $baseUri): UrlInterface public function setStaticBaseUri(string $staticBaseUri): UrlInterface { } - - /** - * Generates a local path - * - * @param string $path - * @return string - */ - public function path(string $path = null): string - { - } } diff --git a/src/Mvc/Url/Exceptions/MissingRouteName.php b/src/Mvc/Url/Exceptions/MissingRouteName.php new file mode 100644 index 00000000..974380f0 --- /dev/null +++ b/src/Mvc/Url/Exceptions/MissingRouteName.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Url\Exceptions; + +use Phalcon\Mvc\Url\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingRouteName extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Url/Exceptions/RouteNotFound.php b/src/Mvc/Url/Exceptions/RouteNotFound.php new file mode 100644 index 00000000..e305adfa --- /dev/null +++ b/src/Mvc/Url/Exceptions/RouteNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Url\Exceptions; + +use Phalcon\Mvc\Url\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RouteNotFound extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/Url/Exceptions/RouterServiceUnavailable.php b/src/Mvc/Url/Exceptions/RouterServiceUnavailable.php new file mode 100644 index 00000000..ce55c950 --- /dev/null +++ b/src/Mvc/Url/Exceptions/RouterServiceUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\Url\Exceptions; + +use Phalcon\Mvc\Url\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RouterServiceUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/Url/UrlInterface.php b/src/Mvc/Url/UrlInterface.php index 236b1cf1..816266ee 100644 --- a/src/Mvc/Url/UrlInterface.php +++ b/src/Mvc/Url/UrlInterface.php @@ -18,20 +18,20 @@ interface UrlInterface * Generates a URL * * @param string|array $uri - * @param array|object $args Optional arguments to be appended to the query string - * @param bool $local + * @param array|object $arguments Optional arguments to be appended to the query string + * @param bool|null $local * @param mixed $baseUri * @param bool $replaceArgs * @return string */ - public function get($uri = null, $args = null, bool $local = null, $baseUri = null, bool $replaceArgs = false): string; + public function get($uri = null, $arguments = null, ?bool $local = null, $baseUri = null, bool $replaceArgs = false): string; /** * Returns a base path * - * @return string + * @return string|null */ - public function getBasePath(): string; + public function getBasePath(): string|null; /** * Returns the prefix for all the generated urls. By default / @@ -40,6 +40,14 @@ public function getBasePath(): string; */ public function getBaseUri(): string; + /** + * Generates a local path + * + * @param string|null $path + * @return string + */ + public function path(?string $path = null): string; + /** * Sets a base paths for all the generated paths * @@ -55,12 +63,4 @@ public function setBasePath(string $basePath): UrlInterface; * @return UrlInterface */ public function setBaseUri(string $baseUri): UrlInterface; - - /** - * Generates a local path - * - * @param string $path - * @return string - */ - public function path(string $path = null): string; } diff --git a/src/Mvc/View.php b/src/Mvc/View.php index 395c1b9b..1473c136 100644 --- a/src/Mvc/View.php +++ b/src/Mvc/View.php @@ -12,14 +12,17 @@ use Closure; use Phalcon\Di\DiInterface; use Phalcon\Di\Injectable; -use Phalcon\Events\ManagerInterface; -use Phalcon\Mvc\View\Exception; use Phalcon\Events\EventsAwareInterface; +use Phalcon\Events\ManagerInterface; use Phalcon\Mvc\View\Engine\Php as PhpEngine; +use Phalcon\Mvc\View\Exception; +use Phalcon\Mvc\View\Exceptions\InvalidEngineRegistration; +use Phalcon\Mvc\View\Exceptions\InvalidViewsDirType; +use Phalcon\Mvc\View\Exceptions\ViewNotFound; +use Phalcon\Mvc\View\Exceptions\ViewServicesUnavailable; +use Phalcon\Mvc\View\Exceptions\ViewsDirItemMustBeString; /** - * Phalcon\Mvc\View - * * Phalcon\Mvc\View is a class for working with the "view" portion of the * model-view-controller pattern. That is, it exists to help keep the view * script separate from the model and controller scripts. It provides a system @@ -256,18 +259,27 @@ public function __set(string $key, $value) /** * Resets any template before layouts * - * @return View + * @return static */ - public function cleanTemplateAfter(): View + public function cleanTemplateAfter(): static { } /** * Resets any "template before" layouts * - * @return View + * @return static + */ + public function cleanTemplateBefore(): static + { + } + + /** + * Disables the auto-rendering process + * + * @return static */ - public function cleanTemplateBefore(): View + public function disable(): static { } @@ -282,27 +294,18 @@ public function cleanTemplateBefore(): View * ``` * * @param mixed $level - * @return ViewInterface - */ - public function disableLevel($level): ViewInterface - { - } - - /** - * Disables the auto-rendering process - * - * @return View + * @return static */ - public function disable(): View + public function disableLevel($level): static { } /** * Enables the auto-rendering process * - * @return View + * @return static */ - public function enable(): View + public function enable(): static { } @@ -320,9 +323,9 @@ public function exists(string $view): bool /** * Finishes the render process by stopping the output buffering * - * @return View + * @return static */ - public function finish(): View + public function finish(): static { } @@ -378,20 +381,6 @@ public function getCurrentRenderLevel(): int { } - /** - * @return array - */ - public function getRegisteredEngines(): array - { - } - - /** - * @return int - */ - public function getRenderLevel(): int - { - } - /** * Returns the internal event manager * @@ -404,9 +393,9 @@ public function getEventsManager(): ManagerInterface|null /** * Returns the name of the main view * - * @return string + * @return string|null */ - public function getLayout(): string + public function getLayout(): string|null { } @@ -472,6 +461,13 @@ public function getPartialsDir(): string { } + /** + * @return array + */ + public function getRegisteredEngines(): array + { + } + /** * Perform the automatic rendering returning the output as a string * @@ -495,6 +491,13 @@ public function getRender(string $controllerName, string $actionName, array $par { } + /** + * @return int + */ + public function getRenderLevel(): int + { + } + /** * Returns a parameter previously set in the view * @@ -514,15 +517,6 @@ public function getViewsDir(): string|array { } - /** - * Gets views directories - * - * @return array - */ - protected function getViewsDirs(): array - { - } - /** * Checks whether view exists * @@ -586,9 +580,22 @@ public function partial(string $partialPath, $params = null) * ``` * * @param mixed $renderView - * @return View + * @return static + */ + public function pick($renderView): static + { + } + + /** + * Processes the view and templates; Fires events if needed + * + * @param string $controllerName + * @param string $actionName + * @param array $params + * @param bool $fireEvents + * @return bool */ - public function pick($renderView): View + public function processRender(string $controllerName, string $actionName, array $params = [], bool $fireEvents = true): bool { } @@ -606,9 +613,9 @@ public function pick($renderView): View * ``` * * @param array $engines - * @return View + * @return static */ - public function registerEngines(array $engines): View + public function registerEngines(array $engines): static { } @@ -623,18 +630,18 @@ public function registerEngines(array $engines): View * @param string $controllerName * @param string $actionName * @param array $params - * @return false|View + * @return false|static */ - public function render(string $controllerName, string $actionName, array $params = []): View|false + public function render(string $controllerName, string $actionName, array $params = []): static|false { } /** * Resets the view component to its factory default values * - * @return View + * @return static */ - public function reset(): View + public function reset(): static { } @@ -647,9 +654,9 @@ public function reset(): View * ``` * * @param string $basePath - * @return View + * @return static */ - public function setBasePath(string $basePath): View + public function setBasePath(string $basePath): static { } @@ -661,9 +668,9 @@ public function setBasePath(string $basePath): View * ``` * * @param string $content - * @return View + * @return static */ - public function setContent(string $content): View + public function setContent(string $content): static { } @@ -686,9 +693,9 @@ public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager * ``` * * @param string $layout - * @return View + * @return static */ - public function setLayout(string $layout): View + public function setLayout(string $layout): static { } @@ -702,9 +709,9 @@ public function setLayout(string $layout): View * ``` * * @param string $layoutsDir - * @return View + * @return static */ - public function setLayoutsDir(string $layoutsDir): View + public function setLayoutsDir(string $layoutsDir): static { } @@ -718,40 +725,40 @@ public function setLayoutsDir(string $layoutsDir): View * ``` * * @param string $viewPath - * @return View + * @return static */ - public function setMainView(string $viewPath): View + public function setMainView(string $viewPath): static { } /** - * Sets a partials sub-directory. Must be a directory under the views - * directory. Depending of your platform, always add a trailing slash or - * backslash + * Adds parameters to views (alias of setVar) * * ```php - * $view->setPartialsDir("../common/partials/"); + * $this->view->setParamToView("products", $products); * ``` * - * @param string $partialsDir - * @return View + * @param string $key + * @param mixed $value + * @return static */ - public function setPartialsDir(string $partialsDir): View + public function setParamToView(string $key, $value): static { } /** - * Adds parameters to views (alias of setVar) + * Sets a partials sub-directory. Must be a directory under the views + * directory. Depending of your platform, always add a trailing slash or + * backslash * * ```php - * $this->view->setParamToView("products", $products); + * $view->setPartialsDir("../common/partials/"); * ``` * - * @param string $key - * @param mixed $value - * @return View + * @param string $partialsDir + * @return static */ - public function setParamToView(string $key, $value): View + public function setPartialsDir(string $partialsDir): static { } @@ -766,9 +773,9 @@ public function setParamToView(string $key, $value): View * ``` * * @param int $level - * @return ViewInterface + * @return static */ - public function setRenderLevel(int $level): ViewInterface + public function setRenderLevel(int $level): static { } @@ -776,9 +783,9 @@ public function setRenderLevel(int $level): ViewInterface * Sets a "template after" controller layout * * @param mixed $templateAfter - * @return View + * @return static */ - public function setTemplateAfter($templateAfter): View + public function setTemplateAfter($templateAfter): static { } @@ -786,9 +793,9 @@ public function setTemplateAfter($templateAfter): View * Sets a template before the controller layout * * @param mixed $templateBefore - * @return View + * @return static */ - public function setTemplateBefore($templateBefore): View + public function setTemplateBefore($templateBefore): static { } @@ -801,9 +808,9 @@ public function setTemplateBefore($templateBefore): View * * @param string $key * @param mixed $value - * @return View + * @return static */ - public function setVar(string $key, $value): View + public function setVar(string $key, $value): static { } @@ -820,9 +827,9 @@ public function setVar(string $key, $value): View * * @param array $params * @param bool $merge - * @return View + * @return static */ - public function setVars(array $params, bool $merge = true): View + public function setVars(array $params, bool $merge = true): static { } @@ -831,18 +838,18 @@ public function setVars(array $params, bool $merge = true): View * always add a trailing slash or backslash * * @param mixed $viewsDir - * @return View + * @return static */ - public function setViewsDir($viewsDir): View + public function setViewsDir($viewsDir): static { } /** * Starts rendering process enabling the output buffering * - * @return View + * @return static */ - public function start(): View + public function start(): static { } @@ -870,6 +877,15 @@ protected function engineRender(array $engines, string $viewPath, bool $silence, { } + /** + * Gets views directories + * + * @return array + */ + protected function getViewsDirs(): array + { + } + /** * Checks if a path is absolute or not * @@ -889,19 +905,6 @@ protected function loadTemplateEngines(): array { } - /** - * Processes the view and templates; Fires events if needed - * - * @param string $controllerName - * @param string $actionName - * @param array $params - * @param bool $fireEvents - * @return bool - */ - public function processRender(string $controllerName, string $actionName, array $params = [], bool $fireEvents = true): bool - { - } - /** * @todo Remove this when we get traits * @param string $directory diff --git a/src/Mvc/View/Engine/AbstractEngine.php b/src/Mvc/View/Engine/AbstractEngine.php index 3d6b7c3e..48663df6 100644 --- a/src/Mvc/View/Engine/AbstractEngine.php +++ b/src/Mvc/View/Engine/AbstractEngine.php @@ -37,7 +37,7 @@ abstract class AbstractEngine extends Injectable implements \Phalcon\Mvc\View\En * @param ViewBaseInterface $view * @param DiInterface|null $container */ - public function __construct(\Phalcon\Mvc\ViewBaseInterface $view, \Phalcon\Di\DiInterface $container = null) + public function __construct(\Phalcon\Mvc\ViewBaseInterface $view, ?\Phalcon\Di\DiInterface $container = null) { } diff --git a/src/Mvc/View/Engine/Volt.php b/src/Mvc/View/Engine/Volt.php index dd16dd12..85571ba8 100644 --- a/src/Mvc/View/Engine/Volt.php +++ b/src/Mvc/View/Engine/Volt.php @@ -15,6 +15,9 @@ use Phalcon\Html\Link\Link; use Phalcon\Html\Link\Serializer\Header; use Phalcon\Mvc\View\Engine\Volt\Compiler; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidHaystack; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\MacroNotFound; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\MbstringRequired; use Phalcon\Mvc\View\Exception; /** diff --git a/src/Mvc/View/Engine/Volt/Compiler.php b/src/Mvc/View/Engine/Volt/Compiler.php index 504981eb..8b36486c 100644 --- a/src/Mvc/View/Engine/Volt/Compiler.php +++ b/src/Mvc/View/Engine/Volt/Compiler.php @@ -11,8 +11,29 @@ use Closure; use Phalcon\Di\DiInterface; -use Phalcon\Mvc\ViewBaseInterface; use Phalcon\Di\InjectionAwareInterface; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\CannotOpenCompiledFile; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\CorruptedStatement; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\CorruptedStatementWithData; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidCompilationPrefix; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidExtension; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidIntermediateRepresentation; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidOptionType; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidPathClosureReturn; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidPathType; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidStatement; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidUserFilterDefinition; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\InvalidUserFunctionDefinition; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\MacroAlreadyDefined; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\TemplateFileNotFound; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\TemplateFileNotOpenable; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\TemplatePathCollision; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\UnknownVoltExpression; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\UnknownVoltFilter; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\UnknownVoltFilterType; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\UnknownVoltStatement; +use Phalcon\Mvc\View\Engine\Volt\Exceptions\VoltDirectoryNotWritable; +use Phalcon\Mvc\ViewBaseInterface; /** * This class reads and compiles Volt templates into PHP plain code @@ -141,7 +162,7 @@ class Compiler implements \Phalcon\Di\InjectionAwareInterface * * @param ViewBaseInterface|null $view */ - public function __construct(\Phalcon\Mvc\ViewBaseInterface $view = null) + public function __construct(?\Phalcon\Mvc\ViewBaseInterface $view = null) { } @@ -149,9 +170,9 @@ public function __construct(\Phalcon\Mvc\ViewBaseInterface $view = null) * Registers a Volt's extension * * @param mixed $extension * - * @return Compiler + * @return static */ - public function addExtension($extension): Compiler + public function addExtension($extension): static { } @@ -160,9 +181,9 @@ public function addExtension($extension): Compiler * * @param string $name * @param mixed $definition * - * @return Compiler + * @return static */ - public function addFilter(string $name, $definition): Compiler + public function addFilter(string $name, $definition): static { } @@ -171,9 +192,9 @@ public function addFilter(string $name, $definition): Compiler * * @param string $name * @param mixed $definition * - * @return Compiler + * @return static */ - public function addFunction(string $name, $definition): Compiler + public function addFunction(string $name, $definition): static { } @@ -222,8 +243,9 @@ public function compileAutoEscape(array $statement, bool $extendsMode): string * * @param array $statement * @param bool $extendsMode + * @return string */ - public function compileCall(array $statement, bool $extendsMode) + public function compileCall(array $statement, bool $extendsMode): string { } @@ -605,8 +627,9 @@ public function setDI(\Phalcon\Di\DiInterface $container): void * * @param mixed $value * @param string $option + * @return static */ - public function setOption(string $option, $value) + public function setOption(string $option, $value): static { } @@ -614,9 +637,9 @@ public function setOption(string $option, $value) * Sets the compiler options * * @param array $options - * @return Compiler + * @return static */ - public function setOptions(array $options): Compiler + public function setOptions(array $options): static { } @@ -624,9 +647,9 @@ public function setOptions(array $options): Compiler * Set a unique prefix to be used as prefix for compiled variables * * @param string $prefix - * @return Compiler + * @return static */ - public function setUniquePrefix(string $prefix): Compiler + public function setUniquePrefix(string $prefix): static { } diff --git a/src/Mvc/View/Engine/Volt/Exception.php b/src/Mvc/View/Engine/Volt/Exception.php index 95fd8bbe..9b605c03 100644 --- a/src/Mvc/View/Engine/Volt/Exception.php +++ b/src/Mvc/View/Engine/Volt/Exception.php @@ -27,7 +27,7 @@ class Exception extends \Phalcon\Mvc\View\Exception * @param int $code * @param \Exception|null $previous */ - public function __construct(string $message = '', array $statement = [], int $code = 0, \Exception $previous = null) + public function __construct(string $message = '', array $statement = [], int $code = 0, ?\Exception $previous = null) { } diff --git a/src/Mvc/View/Engine/Volt/Exceptions/CannotOpenCompiledFile.php b/src/Mvc/View/Engine/Volt/Exceptions/CannotOpenCompiledFile.php new file mode 100644 index 00000000..6632a6a8 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/CannotOpenCompiledFile.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CannotOpenCompiledFile extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatement.php b/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatement.php new file mode 100644 index 00000000..b1ea9aef --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatement.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedStatement extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatementWithData.php b/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatementWithData.php new file mode 100644 index 00000000..97225432 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/CorruptedStatementWithData.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class CorruptedStatementWithData extends Exception +{ + /** + * @param array $statement + */ + public function __construct(array $statement) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidCompilationPrefix.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidCompilationPrefix.php new file mode 100644 index 00000000..1a87c351 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidCompilationPrefix.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCompilationPrefix extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidExtension.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidExtension.php new file mode 100644 index 00000000..c742f85e --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidExtension.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidExtension extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidHaystack.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidHaystack.php new file mode 100644 index 00000000..7ccb5425 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidHaystack.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidHaystack extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidIntermediateRepresentation.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidIntermediateRepresentation.php new file mode 100644 index 00000000..ae031fab --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidIntermediateRepresentation.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidIntermediateRepresentation extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidOptionType.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidOptionType.php new file mode 100644 index 00000000..b30be55a --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidOptionType.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidOptionType extends Exception +{ + /** + * @param string $option + * @param string $type + */ + public function __construct(string $option, string $type) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathClosureReturn.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathClosureReturn.php new file mode 100644 index 00000000..0b1d030b --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathClosureReturn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidPathClosureReturn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathType.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathType.php new file mode 100644 index 00000000..a8a06f49 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidPathType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidPathType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidStatement.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidStatement.php new file mode 100644 index 00000000..f61aeef7 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidStatement.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidStatement extends Exception +{ + /** + * @param string $file + * @param int $line + * @param array $statement + */ + public function __construct(string $file, int $line, array $statement) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFilterDefinition.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFilterDefinition.php new file mode 100644 index 00000000..bb9e67a7 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFilterDefinition.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidUserFilterDefinition extends Exception +{ + /** + * @param string $name + * @param string $file + * @param int $line + */ + public function __construct(string $name, string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFunctionDefinition.php b/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFunctionDefinition.php new file mode 100644 index 00000000..334d46c4 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/InvalidUserFunctionDefinition.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidUserFunctionDefinition extends Exception +{ + /** + * @param string $name + * @param string $file + * @param int $line + */ + public function __construct(string $name, string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/MacroAlreadyDefined.php b/src/Mvc/View/Engine/Volt/Exceptions/MacroAlreadyDefined.php new file mode 100644 index 00000000..6944b1d0 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/MacroAlreadyDefined.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MacroAlreadyDefined extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/MacroNotFound.php b/src/Mvc/View/Engine/Volt/Exceptions/MacroNotFound.php new file mode 100644 index 00000000..6eeaf901 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/MacroNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MacroNotFound extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/MbstringRequired.php b/src/Mvc/View/Engine/Volt/Exceptions/MbstringRequired.php new file mode 100644 index 00000000..60c856b5 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/MbstringRequired.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MbstringRequired extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotFound.php b/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotFound.php new file mode 100644 index 00000000..45d49b57 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TemplateFileNotFound extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotOpenable.php b/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotOpenable.php new file mode 100644 index 00000000..cc7d9ee9 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/TemplateFileNotOpenable.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TemplateFileNotOpenable extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/TemplatePathCollision.php b/src/Mvc/View/Engine/Volt/Exceptions/TemplatePathCollision.php new file mode 100644 index 00000000..4e056da4 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/TemplatePathCollision.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TemplatePathCollision extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltExpression.php b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltExpression.php new file mode 100644 index 00000000..8bee2204 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltExpression.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownVoltExpression extends Exception +{ + /** + * @param int $type + * @param string $file + * @param int $line + */ + public function __construct(int $type, string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilter.php b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilter.php new file mode 100644 index 00000000..425f809d --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilter.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownVoltFilter extends Exception +{ + /** + * @param string $name + * @param string $file + * @param int $line + */ + public function __construct(string $name, string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilterType.php b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilterType.php new file mode 100644 index 00000000..9ffbff2f --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltFilterType.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownVoltFilterType extends Exception +{ + /** + * @param string $file + * @param int $line + */ + public function __construct(string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltStatement.php b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltStatement.php new file mode 100644 index 00000000..1586846c --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/UnknownVoltStatement.php @@ -0,0 +1,32 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class UnknownVoltStatement extends Exception +{ + /** + * @param int $type + * @param string $file + * @param int $line + */ + public function __construct(int $type, string $file, int $line) + { + } +} diff --git a/src/Mvc/View/Engine/Volt/Exceptions/VoltDirectoryNotWritable.php b/src/Mvc/View/Engine/Volt/Exceptions/VoltDirectoryNotWritable.php new file mode 100644 index 00000000..c4126d00 --- /dev/null +++ b/src/Mvc/View/Engine/Volt/Exceptions/VoltDirectoryNotWritable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Engine\Volt\Exceptions; + +use Phalcon\Mvc\View\Engine\Volt\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class VoltDirectoryNotWritable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Exceptions/InvalidEngineRegistration.php b/src/Mvc/View/Exceptions/InvalidEngineRegistration.php new file mode 100644 index 00000000..c1419471 --- /dev/null +++ b/src/Mvc/View/Exceptions/InvalidEngineRegistration.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidEngineRegistration extends Exception +{ + /** + * @param string $extension + */ + public function __construct(string $extension) + { + } +} diff --git a/src/Mvc/View/Exceptions/InvalidViewsDirType.php b/src/Mvc/View/Exceptions/InvalidViewsDirType.php new file mode 100644 index 00000000..22c3ac16 --- /dev/null +++ b/src/Mvc/View/Exceptions/InvalidViewsDirType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidViewsDirType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Exceptions/SimpleViewNotFound.php b/src/Mvc/View/Exceptions/SimpleViewNotFound.php new file mode 100644 index 00000000..cd9f4769 --- /dev/null +++ b/src/Mvc/View/Exceptions/SimpleViewNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SimpleViewNotFound extends Exception +{ + /** + * @param string $viewsDirPath + */ + public function __construct(string $viewsDirPath) + { + } +} diff --git a/src/Mvc/View/Exceptions/SimpleViewServicesUnavailable.php b/src/Mvc/View/Exceptions/SimpleViewServicesUnavailable.php new file mode 100644 index 00000000..40240993 --- /dev/null +++ b/src/Mvc/View/Exceptions/SimpleViewServicesUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SimpleViewServicesUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Exceptions/ViewNotFound.php b/src/Mvc/View/Exceptions/ViewNotFound.php new file mode 100644 index 00000000..14e4fe9c --- /dev/null +++ b/src/Mvc/View/Exceptions/ViewNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ViewNotFound extends Exception +{ + /** + * @param string $viewPath + */ + public function __construct(string $viewPath) + { + } +} diff --git a/src/Mvc/View/Exceptions/ViewServicesUnavailable.php b/src/Mvc/View/Exceptions/ViewServicesUnavailable.php new file mode 100644 index 00000000..cc79ac79 --- /dev/null +++ b/src/Mvc/View/Exceptions/ViewServicesUnavailable.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ViewServicesUnavailable extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Exceptions/ViewsDirItemMustBeString.php b/src/Mvc/View/Exceptions/ViewsDirItemMustBeString.php new file mode 100644 index 00000000..8b194ca8 --- /dev/null +++ b/src/Mvc/View/Exceptions/ViewsDirItemMustBeString.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Mvc\View\Exceptions; + +use Phalcon\Mvc\View\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ViewsDirItemMustBeString extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Mvc/View/Simple.php b/src/Mvc/View/Simple.php index 87c3ce26..cb55778c 100644 --- a/src/Mvc/View/Simple.php +++ b/src/Mvc/View/Simple.php @@ -14,13 +14,14 @@ use Phalcon\Di\Injectable; use Phalcon\Events\EventsAwareInterface; use Phalcon\Events\ManagerInterface; -use Phalcon\Mvc\ViewBaseInterface; use Phalcon\Mvc\View\Engine\EngineInterface; use Phalcon\Mvc\View\Engine\Php as PhpEngine; +use Phalcon\Mvc\View\Exceptions\InvalidEngineRegistration; +use Phalcon\Mvc\View\Exceptions\SimpleViewNotFound; +use Phalcon\Mvc\View\Exceptions\SimpleViewServicesUnavailable; +use Phalcon\Mvc\ViewBaseInterface; /** - * Phalcon\Mvc\View\Simple - * * This component allows to render views without hierarchical levels * * ```php @@ -78,14 +79,14 @@ class Simple extends Injectable implements \Phalcon\Mvc\ViewBaseInterface, \Phal protected $registeredEngines = []; /** - * @var string + * @var array */ - protected $viewsDir; + protected $viewParams = []; /** - * @var array + * @var string */ - protected $viewParams = []; + protected $viewsDir; /** * Phalcon\Mvc\View\Simple constructor @@ -251,10 +252,10 @@ public function render(string $path, array $params = []): string * $this->view->setContent("

hello

"); * ``` * - * @return Simple + * @return static * @param string $content */ - public function setContent(string $content): Simple + public function setContent(string $content): static { } @@ -275,11 +276,11 @@ public function setEventsManager(\Phalcon\Events\ManagerInterface $eventsManager * $this->view->setParamToView("products", $products); * ``` * - * @return Simple + * @return static * @param string $key * @param mixed $value */ - public function setParamToView(string $key, $value): Simple + public function setParamToView(string $key, $value): static { } @@ -290,11 +291,11 @@ public function setParamToView(string $key, $value): Simple * $this->view->setVar("products", $products); * ``` * - * @return Simple + * @return static * @param string $key * @param mixed $value */ - public function setVar(string $key, $value): Simple + public function setVar(string $key, $value): static { } @@ -309,11 +310,11 @@ public function setVar(string $key, $value): Simple * ); * ``` * - * @return Simple + * @return static * @param array $params * @param bool $merge */ - public function setVars(array $params, bool $merge = true): Simple + public function setVars(array $params, bool $merge = true): static { } diff --git a/src/Mvc/ViewBaseInterface.php b/src/Mvc/ViewBaseInterface.php index ddb5a697..9a21a1c6 100644 --- a/src/Mvc/ViewBaseInterface.php +++ b/src/Mvc/ViewBaseInterface.php @@ -12,8 +12,6 @@ use Phalcon\Cache\Adapter\AdapterInterface; /** - * Phalcon\Mvc\ViewInterface - * * Interface for Phalcon\Mvc\View and Phalcon\Mvc\View\Simple */ interface ViewBaseInterface diff --git a/src/Mvc/ViewInterface.php b/src/Mvc/ViewInterface.php index 735b6a30..b2c503e8 100644 --- a/src/Mvc/ViewInterface.php +++ b/src/Mvc/ViewInterface.php @@ -10,8 +10,6 @@ namespace Phalcon\Mvc; /** - * Phalcon\Mvc\ViewInterface - * * Interface for Phalcon\Mvc\View */ interface ViewInterface extends \Phalcon\Mvc\ViewBaseInterface @@ -72,9 +70,9 @@ public function getControllerName(): string; /** * Returns the name of the main view * - * @return string + * @return string|null */ - public function getLayout(): string; + public function getLayout(): string|null; /** * Gets the current layouts sub-directory diff --git a/src/Paginator/Adapter/AbstractAdapter.php b/src/Paginator/Adapter/AbstractAdapter.php index f1204269..a5c4084e 100644 --- a/src/Paginator/Adapter/AbstractAdapter.php +++ b/src/Paginator/Adapter/AbstractAdapter.php @@ -10,6 +10,7 @@ namespace Phalcon\Paginator\Adapter; use Phalcon\Paginator\Exception; +use Phalcon\Paginator\Exceptions\InvalidLimit; use Phalcon\Paginator\Repository; use Phalcon\Paginator\RepositoryInterface; @@ -97,10 +98,10 @@ public function setRepository(\Phalcon\Paginator\RepositoryInterface $repository /** * Gets current repository for pagination * - * @param array $properties + * @param array|null $properties * @return RepositoryInterface */ - protected function getRepository(array $properties = null): RepositoryInterface + protected function getRepository(?array $properties = null): RepositoryInterface { } } diff --git a/src/Paginator/Adapter/NativeArray.php b/src/Paginator/Adapter/NativeArray.php index dee9f357..230cdb28 100644 --- a/src/Paginator/Adapter/NativeArray.php +++ b/src/Paginator/Adapter/NativeArray.php @@ -10,6 +10,7 @@ namespace Phalcon\Paginator\Adapter; use Phalcon\Paginator\Exception; +use Phalcon\Paginator\Exceptions\PaginatorDataNotArray; use Phalcon\Paginator\RepositoryInterface; /** diff --git a/src/Paginator/Adapter/QueryBuilder.php b/src/Paginator/Adapter/QueryBuilder.php index 284fd9c1..3a22f362 100644 --- a/src/Paginator/Adapter/QueryBuilder.php +++ b/src/Paginator/Adapter/QueryBuilder.php @@ -11,8 +11,12 @@ use Phalcon\Db\Enum; use Phalcon\Mvc\Model\Query\Builder; -use Phalcon\Paginator\RepositoryInterface; use Phalcon\Paginator\Exception; +use Phalcon\Paginator\Exceptions\BuilderModelNotDefined; +use Phalcon\Paginator\Exceptions\InvalidBuilderInstance; +use Phalcon\Paginator\Exceptions\MissingColumnsForHaving; +use Phalcon\Paginator\Exceptions\MissingRequiredParameter; +use Phalcon\Paginator\RepositoryInterface; /** * Phalcon\Paginator\Adapter\QueryBuilder @@ -96,9 +100,9 @@ public function paginate(): RepositoryInterface * Set query builder object * * @param \Phalcon\Mvc\Model\Query\Builder $builder - * @return QueryBuilder + * @return static */ - public function setQueryBuilder(\Phalcon\Mvc\Model\Query\Builder $builder): QueryBuilder + public function setQueryBuilder(\Phalcon\Mvc\Model\Query\Builder $builder): static { } } diff --git a/src/Paginator/Adapter/QueryBuilderCursor.php b/src/Paginator/Adapter/QueryBuilderCursor.php index e9e8d87c..b026549b 100644 --- a/src/Paginator/Adapter/QueryBuilderCursor.php +++ b/src/Paginator/Adapter/QueryBuilderCursor.php @@ -11,6 +11,9 @@ use Phalcon\Mvc\Model\Query\Builder; use Phalcon\Paginator\Exception; +use Phalcon\Paginator\Exceptions\InvalidBuilderInstance; +use Phalcon\Paginator\Exceptions\InvalidCursorColumn; +use Phalcon\Paginator\Exceptions\MissingRequiredParameter; use Phalcon\Paginator\RepositoryInterface; /** @@ -152,9 +155,9 @@ public function paginate(): RepositoryInterface * next page, or null to restart from the first page. * * @param mixed $cursor - * @return QueryBuilderCursor + * @return static */ - public function setCursor($cursor): QueryBuilderCursor + public function setCursor($cursor): static { } @@ -162,9 +165,9 @@ public function setCursor($cursor): QueryBuilderCursor * Set query builder object * * @param \Phalcon\Mvc\Model\Query\Builder $builder - * @return QueryBuilderCursor + * @return static */ - public function setQueryBuilder(\Phalcon\Mvc\Model\Query\Builder $builder): QueryBuilderCursor + public function setQueryBuilder(\Phalcon\Mvc\Model\Query\Builder $builder): static { } } diff --git a/src/Paginator/Exceptions/BuilderModelNotDefined.php b/src/Paginator/Exceptions/BuilderModelNotDefined.php new file mode 100644 index 00000000..db030494 --- /dev/null +++ b/src/Paginator/Exceptions/BuilderModelNotDefined.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class BuilderModelNotDefined extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Paginator/Exceptions/InvalidBuilderInstance.php b/src/Paginator/Exceptions/InvalidBuilderInstance.php new file mode 100644 index 00000000..de9b0094 --- /dev/null +++ b/src/Paginator/Exceptions/InvalidBuilderInstance.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidBuilderInstance extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Paginator/Exceptions/InvalidCursorColumn.php b/src/Paginator/Exceptions/InvalidCursorColumn.php new file mode 100644 index 00000000..08311416 --- /dev/null +++ b/src/Paginator/Exceptions/InvalidCursorColumn.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidCursorColumn extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Paginator/Exceptions/InvalidLimit.php b/src/Paginator/Exceptions/InvalidLimit.php new file mode 100644 index 00000000..598a6c56 --- /dev/null +++ b/src/Paginator/Exceptions/InvalidLimit.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidLimit extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Paginator/Exceptions/MissingColumnsForHaving.php b/src/Paginator/Exceptions/MissingColumnsForHaving.php new file mode 100644 index 00000000..168a8e1d --- /dev/null +++ b/src/Paginator/Exceptions/MissingColumnsForHaving.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingColumnsForHaving extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Paginator/Exceptions/MissingRequiredParameter.php b/src/Paginator/Exceptions/MissingRequiredParameter.php new file mode 100644 index 00000000..a5028d20 --- /dev/null +++ b/src/Paginator/Exceptions/MissingRequiredParameter.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingRequiredParameter extends Exception +{ + /** + * @var string + */ + private $parameter; + + /** + * @param string $parameter + */ + public function __construct(string $parameter) + { + } + + /** + * @return string + */ + public function getParameter(): string + { + } +} diff --git a/src/Paginator/Exceptions/PaginatorDataNotArray.php b/src/Paginator/Exceptions/PaginatorDataNotArray.php new file mode 100644 index 00000000..2050f768 --- /dev/null +++ b/src/Paginator/Exceptions/PaginatorDataNotArray.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Paginator\Exceptions; + +use Phalcon\Paginator\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class PaginatorDataNotArray extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Adapter/AbstractAdapter.php b/src/Session/Adapter/AbstractAdapter.php index 8ae9425b..e79822da 100644 --- a/src/Session/Adapter/AbstractAdapter.php +++ b/src/Session/Adapter/AbstractAdapter.php @@ -57,23 +57,23 @@ public function gc(int $max_lifetime): int|false } /** - * Read + * Open * - * @param mixed $id - * @return string + * @param mixed $path + * @param mixed $name + * @return bool */ - public function read($id): string + public function open($path, $name): bool { } /** - * Open + * Read * - * @param mixed $path - * @param mixed $name - * @return bool + * @param mixed $id + * @return string */ - public function open($path, $name): bool + public function read($id): string { } diff --git a/src/Session/Adapter/Exceptions/AdapterRuntimeError.php b/src/Session/Adapter/Exceptions/AdapterRuntimeError.php new file mode 100644 index 00000000..7a76674f --- /dev/null +++ b/src/Session/Adapter/Exceptions/AdapterRuntimeError.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Adapter\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class AdapterRuntimeError extends Exception +{ +} diff --git a/src/Session/Adapter/Exceptions/InvalidSavePath.php b/src/Session/Adapter/Exceptions/InvalidSavePath.php new file mode 100644 index 00000000..d4d9abd4 --- /dev/null +++ b/src/Session/Adapter/Exceptions/InvalidSavePath.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Adapter\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class InvalidSavePath extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Adapter/Exceptions/SavePathUnavailable.php b/src/Session/Adapter/Exceptions/SavePathUnavailable.php new file mode 100644 index 00000000..435c221d --- /dev/null +++ b/src/Session/Adapter/Exceptions/SavePathUnavailable.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Adapter\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class SavePathUnavailable extends Exception +{ + /** + * @param string $path + */ + public function __construct(string $path) + { + } +} diff --git a/src/Session/Adapter/Noop.php b/src/Session/Adapter/Noop.php index 3ab1ccd5..ce29cc01 100644 --- a/src/Session/Adapter/Noop.php +++ b/src/Session/Adapter/Noop.php @@ -29,45 +29,6 @@ */ class Noop implements \SessionHandlerInterface { - /** - * The connection of some adapters - * - * @var null - */ - protected $connection = null; - - /** - * Session options - * - * @var array - */ - protected $options = []; - - /** - * Session prefix - * - * @var string - */ - protected $prefix = ''; - - /** - * Time To Live - * - * @var int - */ - protected $ttl = 8600; - - /** - * Constructor - * - * @param array $options = [ - * 'prefix' => '' - * ] - */ - public function __construct(array $options = []) - { - } - /** * Close * @@ -97,16 +58,6 @@ public function gc(int $max_lifetime): int|false { } - /** - * Read - * - * @param mixed $id - * @return string - */ - public function read($id): string - { - } - /** * Open * @@ -119,23 +70,23 @@ public function open($path, $name): bool } /** - * Write + * Read * * @param mixed $id - * @param mixed $data - * @return bool + * @return string */ - public function write($id, $data): bool + public function read($id): string { } /** - * Helper method to get the name prefixed + * Write * - * @param mixed $name - * @return string + * @param mixed $id + * @param mixed $data + * @return bool */ - protected function getPrefixedName($name): string + public function write($id, $data): bool { } } diff --git a/src/Session/Adapter/Stream.php b/src/Session/Adapter/Stream.php index bac09b37..bd04b178 100644 --- a/src/Session/Adapter/Stream.php +++ b/src/Session/Adapter/Stream.php @@ -9,7 +9,9 @@ */ namespace Phalcon\Session\Adapter; -use Phalcon\Session\Exception; +use Phalcon\Session\Adapter\Exceptions\AdapterRuntimeError; +use Phalcon\Session\Adapter\Exceptions\InvalidSavePath; +use Phalcon\Session\Adapter\Exceptions\SavePathUnavailable; /** * Phalcon\Session\Adapter\Stream @@ -37,6 +39,20 @@ */ class Stream extends \Phalcon\Session\Adapter\Noop { + /** + * Session options + * + * @var array + */ + protected $options = []; + + /** + * Session prefix + * + * @var string + */ + protected $prefix = ''; + /** * @var string */ @@ -107,10 +123,10 @@ public function write($id, $data): bool * @param array $collection * @param mixed $index * @param mixed $defaultValue - * @param string $cast + * @param string|null $cast * @return mixed */ - protected function getArrVal(array $collection, $index, $defaultValue = null, string $cast = null): mixed + protected function getArrVal(array $collection, $index, $defaultValue = null, ?string $cast = null): mixed { } @@ -133,6 +149,16 @@ protected function getGlobFiles(string $pattern): false|array { } + /** + * Helper method to get the name prefixed + * + * @param mixed $name + * @return string + */ + protected function getPrefixedName($name): string + { + } + /** * @param string $filename * diff --git a/src/Session/BagInterface.php b/src/Session/BagInterface.php index ac0047da..1b357c95 100644 --- a/src/Session/BagInterface.php +++ b/src/Session/BagInterface.php @@ -50,10 +50,10 @@ public function init(array $data = []): void; /** * @param string $element * @param mixed $defaultValue - * @param string $cast + * @param string|null $cast * @return mixed */ - public function get(string $element, $defaultValue = null, string $cast = null): mixed; + public function get(string $element, $defaultValue = null, ?string $cast = null): mixed; /** * @param string $element diff --git a/src/Session/Exceptions/InvalidSessionAdapter.php b/src/Session/Exceptions/InvalidSessionAdapter.php new file mode 100644 index 00000000..e753a9c3 --- /dev/null +++ b/src/Session/Exceptions/InvalidSessionAdapter.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class InvalidSessionAdapter extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Exceptions/InvalidSessionName.php b/src/Session/Exceptions/InvalidSessionName.php new file mode 100644 index 00000000..05425d55 --- /dev/null +++ b/src/Session/Exceptions/InvalidSessionName.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class InvalidSessionName extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Exceptions/SessionAlreadyStarted.php b/src/Session/Exceptions/SessionAlreadyStarted.php new file mode 100644 index 00000000..f4919b65 --- /dev/null +++ b/src/Session/Exceptions/SessionAlreadyStarted.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class SessionAlreadyStarted extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Exceptions/SessionModificationDenied.php b/src/Session/Exceptions/SessionModificationDenied.php new file mode 100644 index 00000000..26cf51fb --- /dev/null +++ b/src/Session/Exceptions/SessionModificationDenied.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Session\Exceptions; + +use Phalcon\Session\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ +class SessionModificationDenied extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Session/Manager.php b/src/Session/Manager.php index d080f84c..9f3076a3 100644 --- a/src/Session/Manager.php +++ b/src/Session/Manager.php @@ -10,11 +10,13 @@ namespace Phalcon\Session; use InvalidArgumentException; -use RuntimeException; use SessionHandlerInterface; use Phalcon\Di\AbstractInjectionAware; use Phalcon\Di\DiInterface; -use Phalcon\Support\Helper\Arr\Get; +use Phalcon\Session\Exceptions\InvalidSessionAdapter; +use Phalcon\Session\Exceptions\InvalidSessionName; +use Phalcon\Session\Exceptions\SessionAlreadyStarted; +use Phalcon\Session\Exceptions\SessionModificationDenied; /** * @property SessionHandlerInterface|null $adapter @@ -132,9 +134,9 @@ public function get(string $key, $defaultValue = null, bool $remove = false): mi /** * Returns the stored session adapter * - * @return SessionHandlerInterface + * @return SessionHandlerInterface|null */ - public function getAdapter(): SessionHandlerInterface + public function getAdapter(): SessionHandlerInterface|null { } @@ -157,21 +159,21 @@ public function getName(): string } /** - * Check whether a session variable is set in an application context + * Get internal options * - * @param string $key - * @return bool + * @return array */ - public function has(string $key): bool + public function getOptions(): array { } /** - * Get internal options + * Check whether a session variable is set in an application context * - * @return array + * @param string $key + * @return bool */ - public function getOptions(): array + public function has(string $key): bool { } @@ -280,17 +282,6 @@ protected function phpHeadersSent(): bool { } - /** - * Returns the key prefixed - * - * @param string $key - * - * @return string - */ - private function getUniqueKey(string $key): string - { - } - /** * @todo Remove this when we get traits * @param array $collection @@ -301,4 +292,15 @@ private function getUniqueKey(string $key): string private function getArrVal(array $collection, $index, $defaultValue = null): mixed { } + + /** + * Returns the key prefixed + * + * @param string $key + * + * @return string + */ + private function getUniqueKey(string $key): string + { + } } diff --git a/src/Session/ManagerInterface.php b/src/Session/ManagerInterface.php index 596790cf..f7d72729 100644 --- a/src/Session/ManagerInterface.php +++ b/src/Session/ManagerInterface.php @@ -10,7 +10,6 @@ namespace Phalcon\Session; use InvalidArgumentException; -use RuntimeException; use SessionHandlerInterface; /** @@ -70,18 +69,18 @@ public function __set(string $key, $value): void; public function __unset(string $key): void; /** - * Check whether the session has been started + * Destroy/end a session * - * @return bool + * @return void */ - public function exists(): bool; + public function destroy(): void; /** - * Destroy/end a session + * Check whether the session has been started * - * @return void + * @return bool */ - public function destroy(): void; + public function exists(): bool; /** * Gets a session variable from an application context @@ -94,18 +93,18 @@ public function destroy(): void; public function get(string $key, $defaultValue = null, bool $remove = false): mixed; /** - * Returns the session id + * Returns the stored session adapter * - * @return string + * @return SessionHandlerInterface|null */ - public function getId(): string; + public function getAdapter(): SessionHandlerInterface|null; /** - * Returns the stored session adapter + * Returns the session id * - * @return SessionHandlerInterface + * @return string */ - public function getAdapter(): SessionHandlerInterface; + public function getId(): string; /** * Returns the name of the session @@ -129,6 +128,14 @@ public function getOptions(): array; */ public function has(string $key): bool; + /** + * Regenerates the session id using the adapter. + * + * @param bool $deleteOldSession + * @return ManagerInterface + */ + public function regenerateId(bool $deleteOldSession = true): ManagerInterface; + /** * Removes a session variable from an application context * @@ -180,13 +187,6 @@ public function setName(string $name): ManagerInterface; */ public function setOptions(array $options): void; - /** - * Returns the status of the current session. - * - * @return int - */ - public function status(): int; - /** * Starts the session (if headers are already sent the session will not be * started) @@ -196,10 +196,9 @@ public function status(): int; public function start(): bool; /** - * Regenerates the session id using the adapter. + * Returns the status of the current session. * - * @param bool $deleteOldSession - * @return ManagerInterface + * @return int */ - public function regenerateId(bool $deleteOldSession = true): ManagerInterface; + public function status(): int; } diff --git a/src/Storage/Adapter/AbstractAdapter.php b/src/Storage/Adapter/AbstractAdapter.php index 13037055..aa5166d6 100644 --- a/src/Storage/Adapter/AbstractAdapter.php +++ b/src/Storage/Adapter/AbstractAdapter.php @@ -411,10 +411,10 @@ protected function initSerializer(): void * @param array $collection * @param mixed $index * @param mixed $defaultValue - * @param string $cast + * @param string|null $cast * @return mixed */ - protected function getArrVal(array $collection, $index, $defaultValue = null, string $cast = null): mixed + protected function getArrVal(array $collection, $index, $defaultValue = null, ?string $cast = null): mixed { } diff --git a/src/Storage/Adapter/Libmemcached.php b/src/Storage/Adapter/Libmemcached.php index 40f0660b..c8f4b6ce 100644 --- a/src/Storage/Adapter/Libmemcached.php +++ b/src/Storage/Adapter/Libmemcached.php @@ -12,6 +12,8 @@ use DateInterval; use Exception as BaseException; use Phalcon\Storage\Exception as StorageException; +use Phalcon\Storage\Exceptions\ConnectionFailed; +use Phalcon\Storage\Exceptions\InvalidConfiguration; use Phalcon\Storage\SerializerFactory; use Phalcon\Support\Exception as SupportException; @@ -166,10 +168,10 @@ protected function doSet(string $key, $value, $ttl = null): bool * @param \Memcached $connection * @param array $client * - * @return Libmemcached - * @throws StorageException + * @return static + * @throws InvalidConfiguration */ - private function setOptions(\Memcached $connection, array $client): Libmemcached + private function setOptions(\Memcached $connection, array $client): static { } @@ -178,9 +180,9 @@ private function setOptions(\Memcached $connection, array $client): Libmemcached * @param string $saslUser * @param string $saslPass * - * @return Libmemcached + * @return static */ - private function setSasl(\Memcached $connection, string $saslUser, string $saslPass): Libmemcached + private function setSasl(\Memcached $connection, string $saslUser, string $saslPass): static { } @@ -199,10 +201,10 @@ private function setSerializer(\Memcached $connection): void * @param \Memcached $connection * @param array $servers * - * @return Libmemcached - * @throws StorageException + * @return static + * @throws ConnectionFailed */ - private function setServers(\Memcached $connection, array $servers): Libmemcached + private function setServers(\Memcached $connection, array $servers): static { } } diff --git a/src/Storage/Adapter/Memory.php b/src/Storage/Adapter/Memory.php index 13d06fd0..240615c2 100644 --- a/src/Storage/Adapter/Memory.php +++ b/src/Storage/Adapter/Memory.php @@ -27,6 +27,15 @@ class Memory extends \Phalcon\Storage\Adapter\AbstractAdapter */ protected $data = []; + /** + * Maximum number of items retained in the in-memory store. + * 0 (default) keeps the original unbounded behavior; a positive + * value drops the oldest entry FIFO before a new key is stored. + * + * @var int + */ + protected $maxItems = 0; + /** * Memory constructor. * @@ -59,6 +68,28 @@ public function getKeys(string $prefix = ''): array { } + /** + * Returns the configured store cap (0 = unlimited). See setMaxItems(). + * + * @return int + */ + public function getMaxItems(): int + { + } + + /** + * Caps the number of items retained in the in-memory store. + * 0 disables the cap (the default; preserves the original + * unbounded behavior). When the cap is exceeded, the oldest + * entry is evicted FIFO before a new key is stored. + * + * @param int $maxItems + * @return static + */ + public function setMaxItems(int $maxItems): static + { + } + /** * Stores data in the adapter forever. The key needs to manually deleted * from the adapter. diff --git a/src/Storage/Adapter/Redis.php b/src/Storage/Adapter/Redis.php index a5ee5e33..e7289dbd 100644 --- a/src/Storage/Adapter/Redis.php +++ b/src/Storage/Adapter/Redis.php @@ -12,6 +12,9 @@ use DateInterval; use Exception as BaseException; use Phalcon\Storage\Exception as StorageException; +use Phalcon\Storage\Exceptions\AuthenticationFailed; +use Phalcon\Storage\Exceptions\ConnectionFailed; +use Phalcon\Storage\Exceptions\DatabaseSelectionFailed; use Phalcon\Storage\SerializerFactory; use Phalcon\Support\Exception as SupportException; @@ -179,30 +182,30 @@ protected function doSet(string $key, $value, $ttl = null): bool /** * @param \Redis $connection * - * @return Redis - * @throws StorageException + * @return static + * @throws AuthenticationFailed */ - private function checkAuth(\Redis $connection): Redis + private function checkAuth(\Redis $connection): static { } /** * @param \Redis $connection * - * @return Redis - * @throws StorageException + * @return static + * @throws ConnectionFailed */ - private function checkConnect(\Redis $connection): Redis + private function checkConnect(\Redis $connection): static { } /** * @param \Redis $connection * - * @return Redis - * @throws StorageException + * @return static + * @throws DatabaseSelectionFailed */ - private function checkIndex(\Redis $connection): Redis + private function checkIndex(\Redis $connection): static { } diff --git a/src/Storage/Adapter/RedisCluster.php b/src/Storage/Adapter/RedisCluster.php index 4514ca7e..4b8c2cda 100644 --- a/src/Storage/Adapter/RedisCluster.php +++ b/src/Storage/Adapter/RedisCluster.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Storage\Adapter; -use Phalcon\Storage\Exception as StorageException; +use Phalcon\Storage\Exceptions\ClusterConnectionFailed; use Phalcon\Storage\SerializerFactory; /** @@ -75,7 +75,7 @@ public function __construct(\Phalcon\Storage\SerializerFactory $factory, array $ * Flushes/clears the cache * * @return bool - * @throws StorageException + * @throws ClusterConnectionFailed */ public function clear(): bool { @@ -86,7 +86,7 @@ public function clear(): bool * Cluster server(s) * * @return mixed|\RedisCluster - * @throws StorageException + * @throws ClusterConnectionFailed */ public function getAdapter(): mixed { diff --git a/src/Storage/Adapter/Stream.php b/src/Storage/Adapter/Stream.php index fc3cde4f..1b266fb5 100644 --- a/src/Storage/Adapter/Stream.php +++ b/src/Storage/Adapter/Stream.php @@ -12,9 +12,8 @@ use DateInterval; use FilesystemIterator; use Iterator; -use Phalcon\Storage\Exception; +use Phalcon\Storage\Exceptions\InvalidConfiguration; use Phalcon\Storage\SerializerFactory; -use Phalcon\Storage\Traits\StorageErrorHandlerTrait; use Phalcon\Support\Exception as SupportException; use RecursiveDirectoryIterator; use RecursiveIteratorIterator; @@ -48,7 +47,7 @@ class Stream extends \Phalcon\Storage\Adapter\AbstractAdapter * 'prefix' => '' * ] * - * @throws Exception + * @throws InvalidConfiguration */ public function __construct(\Phalcon\Storage\SerializerFactory $factory, array $options = []) { diff --git a/src/Storage/Exceptions/AuthenticationFailed.php b/src/Storage/Exceptions/AuthenticationFailed.php new file mode 100644 index 00000000..5cef7cec --- /dev/null +++ b/src/Storage/Exceptions/AuthenticationFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class AuthenticationFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Storage/Exceptions/ClusterConnectionFailed.php b/src/Storage/Exceptions/ClusterConnectionFailed.php new file mode 100644 index 00000000..45a700ed --- /dev/null +++ b/src/Storage/Exceptions/ClusterConnectionFailed.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ClusterConnectionFailed extends Exception +{ +} diff --git a/src/Storage/Exceptions/ConnectionFailed.php b/src/Storage/Exceptions/ConnectionFailed.php new file mode 100644 index 00000000..4d149b0f --- /dev/null +++ b/src/Storage/Exceptions/ConnectionFailed.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ConnectionFailed extends Exception +{ +} diff --git a/src/Storage/Exceptions/DatabaseSelectionFailed.php b/src/Storage/Exceptions/DatabaseSelectionFailed.php new file mode 100644 index 00000000..e4cdeb46 --- /dev/null +++ b/src/Storage/Exceptions/DatabaseSelectionFailed.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class DatabaseSelectionFailed extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Storage/Exceptions/InvalidConfiguration.php b/src/Storage/Exceptions/InvalidConfiguration.php new file mode 100644 index 00000000..a640ed49 --- /dev/null +++ b/src/Storage/Exceptions/InvalidConfiguration.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidConfiguration extends Exception +{ +} diff --git a/src/Storage/Exceptions/StorageError.php b/src/Storage/Exceptions/StorageError.php new file mode 100644 index 00000000..1980f3a1 --- /dev/null +++ b/src/Storage/Exceptions/StorageError.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Exceptions; + +use Phalcon\Storage\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class StorageError extends Exception +{ +} diff --git a/src/Storage/Serializer/Base64.php b/src/Storage/Serializer/Base64.php index d363a5e0..4e076a15 100644 --- a/src/Storage/Serializer/Base64.php +++ b/src/Storage/Serializer/Base64.php @@ -9,7 +9,8 @@ */ namespace Phalcon\Storage\Serializer; -use InvalidArgumentException; +use Phalcon\Storage\Serializer\Exceptions\InvalidSerializationInput; +use Phalcon\Storage\Serializer\Exceptions\InvalidUnserializationInput; /** * This file is part of the Phalcon Framework. diff --git a/src/Storage/Serializer/Exceptions/InvalidSerializationInput.php b/src/Storage/Serializer/Exceptions/InvalidSerializationInput.php new file mode 100644 index 00000000..eae90318 --- /dev/null +++ b/src/Storage/Serializer/Exceptions/InvalidSerializationInput.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Serializer\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidSerializationInput extends \InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Storage/Serializer/Exceptions/InvalidUnserializationInput.php b/src/Storage/Serializer/Exceptions/InvalidUnserializationInput.php new file mode 100644 index 00000000..5b658913 --- /dev/null +++ b/src/Storage/Serializer/Exceptions/InvalidUnserializationInput.php @@ -0,0 +1,25 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Storage\Serializer\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidUnserializationInput extends \InvalidArgumentException +{ + public function __construct() + { + } +} diff --git a/src/Storage/Serializer/Igbinary.php b/src/Storage/Serializer/Igbinary.php index f85c2c84..0ba0fa6a 100644 --- a/src/Storage/Serializer/Igbinary.php +++ b/src/Storage/Serializer/Igbinary.php @@ -40,35 +40,35 @@ public function unserialize($data): void } /** - * Wrapper for `igbinary_serialize` + * Serialize * * @param mixed $value * * @return string|null */ - protected function phpIgbinarySerialize($value): string|null + protected function doSerialize($value): string|null { } /** - * Serialize + * Unserialize * - * @param mixed $value + * @param string $value * - * @return string|null + * @return mixed|false */ - protected function doSerialize($value): string|null + protected function doUnserialize($value) { } /** - * Unserialize + * Wrapper for `igbinary_serialize` * - * @param string $value + * @param mixed $value * - * @return mixed|false + * @return string|null */ - protected function doUnserialize($value) + protected function phpIgbinarySerialize($value): string|null { } } diff --git a/src/Storage/Serializer/Php.php b/src/Storage/Serializer/Php.php index baffee03..6d19bb99 100644 --- a/src/Storage/Serializer/Php.php +++ b/src/Storage/Serializer/Php.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Storage\Serializer; -use InvalidArgumentException; +use Phalcon\Storage\Serializer\Exceptions\InvalidUnserializationInput; /** * This file is part of the Phalcon Framework. diff --git a/src/Storage/Serializer/SerializerInterface.php b/src/Storage/Serializer/SerializerInterface.php index b1246f95..9b776f61 100644 --- a/src/Storage/Serializer/SerializerInterface.php +++ b/src/Storage/Serializer/SerializerInterface.php @@ -9,8 +9,6 @@ */ namespace Phalcon\Storage\Serializer; -use Serializable; - /** * This file is part of the Phalcon Framework. * @@ -19,16 +17,31 @@ * For the full copyright and license information, please view the LICENSE.txt * file that was distributed with this source code. */ -interface SerializerInterface extends \Serializable +interface SerializerInterface { /** * @return mixed */ public function getData(): mixed; + /** + * Serializes data + * + * @return mixed + */ + public function serialize(): mixed; + /** * @param mixed $data * @return void */ public function setData($data): void; + + /** + * Unserializes data + * + * @param mixed $data + * @return void + */ + public function unserialize($data): void; } diff --git a/src/Support/AbstractLocator.php b/src/Support/AbstractLocator.php new file mode 100644 index 00000000..a3cdcb7b --- /dev/null +++ b/src/Support/AbstractLocator.php @@ -0,0 +1,135 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support; + +use Phalcon\Contracts\Container\Service\Collection; +use Phalcon\Di\DiInterface; +use Throwable; + +/** + * Abstract base class for service locators. + * + * Provides a unified way to register, validate, and resolve services + * from a DI container, with support for both legacy Di and new Container. + * + * @template T of object + */ +abstract class AbstractLocator +{ + /** + * @var Collection|DiInterface + */ + protected $container; + + /** + * @phpstan-var array> + * @var array + */ + protected $services = []; + + /** + * @phpstan-param array> $services + * @param mixed $container + * @param array $services + */ + public function __construct($container, array $services = []) + { + } + + /** + * Returns the full registered service map (defaults plus any added via + * register()). + * + * @return array> + */ + public function getAll(): array + { + } + + /** + * Returns the class-string registered under the given name. + * + * @return class-string + * + * @throws Exception + * @param string $name + */ + public function getClass(string $name): string + { + } + + /** + * Whether a service with the given name is registered. + * + * @param string $name + * @return bool + */ + public function has(string $name): bool + { + } + + /** + * Retrieve a shared service instance from the container. + * + * @return T + * @param string $name + */ + public function newInstance(string $name): object + { + } + + /** + * Register a service or override an existing one. + * + * @phpstan-param class-string $definition + * + * @throws Exception + * @param string $name + * @param string $definition + * @return static + */ + public function register(string $name, string $definition): static + { + } + + /** + * Get the exception class to throw on errors. + * + * @return class-string + */ + abstract protected function getExceptionClass(): string; + + /** + * Get the interface/class that all registered services must implement. + * This allows different locators to enforce different contracts. + * + * @return class-string + */ + abstract protected function getInterfaceClass(): string; + + /** + * Get the service class name for a given name. + * + * @return class-string + * + * @throws Exception + * @param string $name + */ + protected function getService(string $name): string + { + } + + /** + * Get the default services for this locator. + * + * @return array> + */ + abstract protected function getServices(): array; +} diff --git a/src/Support/Collection.php b/src/Support/Collection.php index f848bdba..8b22c480 100644 --- a/src/Support/Collection.php +++ b/src/Support/Collection.php @@ -13,10 +13,9 @@ use ArrayIterator; use Countable; use IteratorAggregate; -use InvalidArgumentException; use JsonSerializable; -use Phalcon\Contracts\Support\Collection as CollectionContract; use Phalcon\Support\Collection\CollectionInterface; +use Phalcon\Support\Collection\Exceptions\InvalidValueType; use Phalcon\Support\Helper\Json\Encode; use Traversable; @@ -73,9 +72,9 @@ class Collection implements \Phalcon\Support\Collection\CollectionInterface, \Co * @param array $data * @param bool $insensitive * @param bool $strictNull - * @param string $type + * @param string|null $type */ - public function __construct(array $data = [], bool $insensitive = true, bool $strictNull = false, string $type = null) + public function __construct(array $data = [], bool $insensitive = true, bool $strictNull = false, ?string $type = null) { } @@ -185,7 +184,7 @@ public function count(): int * * @return static */ - public function each($callback): CollectionInterface + public function each($callback): static { } @@ -200,7 +199,7 @@ public function each($callback): CollectionInterface * * @return static */ - public function filter($callback): CollectionInterface + public function filter($callback): static { } @@ -226,7 +225,7 @@ public function first(): mixed * * @return mixed */ - public function get(string $element, $defaultValue = null, string $cast = null): mixed + public function get(string $element, $defaultValue = null, ?string $cast = null): mixed { } @@ -347,7 +346,7 @@ public function last(): mixed * * @return static */ - public function map($callback): CollectionInterface + public function map($callback): static { } @@ -471,7 +470,7 @@ public function set(string $element, $value): void * * @return static */ - public function sort($callback = null, int $order = 4): CollectionInterface + public function sort($callback = null, int $order = 4): static { } @@ -535,7 +534,7 @@ public function values(): array * * @return static */ - public function where(string $propertyOrMethod, $value): CollectionInterface + public function where(string $propertyOrMethod, $value): static { } @@ -547,7 +546,7 @@ public function where(string $propertyOrMethod, $value): CollectionInterface * * @return static */ - protected function cloneEmpty(array $data = []): CollectionContract + protected function cloneEmpty(array $data = []): static { } @@ -597,7 +596,7 @@ protected function setData(string $element, $value): void * * @param mixed $value * - * @throws InvalidArgumentException + * @throws InvalidValueType * @return void */ protected function validateType($value): void diff --git a/src/Support/Collection/Exception.php b/src/Support/Collection/Exception.php index 44f0f8ea..51a7e700 100644 --- a/src/Support/Collection/Exception.php +++ b/src/Support/Collection/Exception.php @@ -9,11 +9,11 @@ */ namespace Phalcon\Support\Collection; -use Throwable; +use Phalcon\Support\Exception as SupportException; /** * Exceptions for the Collection object */ -class Exception extends \Exception +class Exception extends \Phalcon\Support\Exception { } diff --git a/src/Support/Collection/Exceptions/InvalidValueType.php b/src/Support/Collection/Exceptions/InvalidValueType.php new file mode 100644 index 00000000..99cd1f83 --- /dev/null +++ b/src/Support/Collection/Exceptions/InvalidValueType.php @@ -0,0 +1,31 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Collection\Exceptions; + +use InvalidArgumentException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidValueType extends InvalidArgumentException +{ + /** + * @param string $type + * @param mixed $value + */ + public function __construct(string $type, $value) + { + } +} diff --git a/src/Support/Collection/Exceptions/ReadOnlyViolation.php b/src/Support/Collection/Exceptions/ReadOnlyViolation.php new file mode 100644 index 00000000..bcf04d27 --- /dev/null +++ b/src/Support/Collection/Exceptions/ReadOnlyViolation.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Collection\Exceptions; + +use Phalcon\Support\Collection\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ReadOnlyViolation extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Support/Collection/ReadOnlyCollection.php b/src/Support/Collection/ReadOnlyCollection.php index be0f0179..0fd2d10f 100644 --- a/src/Support/Collection/ReadOnlyCollection.php +++ b/src/Support/Collection/ReadOnlyCollection.php @@ -10,6 +10,7 @@ namespace Phalcon\Support\Collection; use Phalcon\Support\Collection; +use Phalcon\Support\Collection\Exceptions\ReadOnlyViolation; /** * A read only Collection object @@ -29,7 +30,7 @@ class ReadOnlyCollection extends Collection * @param bool $strictNull * @param string|null $type */ - public function __construct(array $data = [], bool $insensitive = true, bool $strictNull = false, string $type = null) + public function __construct(array $data = [], bool $insensitive = true, bool $strictNull = false, ?string $type = null) { } @@ -47,7 +48,7 @@ public function __unserialize(array $data): void } /** - * @throws Exception + * @throws ReadOnlyViolation * @return void */ public function clear(): void @@ -55,7 +56,7 @@ public function clear(): void } /** - * @throws Exception + * @throws ReadOnlyViolation * @param array $data * @return void */ @@ -68,7 +69,7 @@ public function init(array $data = []): void * * @param string $element Name of the element * - * @throws Exception + * @throws ReadOnlyViolation * @return void */ public function remove(string $element): void @@ -80,7 +81,7 @@ public function remove(string $element): void * * @param array $data * - * @throws Exception + * @throws ReadOnlyViolation * @return void */ public function replace(array $data): void @@ -93,7 +94,7 @@ public function replace(array $data): void * @param string $element Name of the element * @param mixed $value Value to store for the element * - * @throws Exception + * @throws ReadOnlyViolation * @return void */ public function set(string $element, $value): void diff --git a/src/Support/Debug.php b/src/Support/Debug.php index 62774677..089522ff 100644 --- a/src/Support/Debug.php +++ b/src/Support/Debug.php @@ -9,8 +9,8 @@ */ namespace Phalcon\Support; -use ErrorException; -use Phalcon\Support\Debug\Exception; +use Phalcon\Support\Debug\Exceptions\RequestHalted; +use Phalcon\Support\Debug\Exceptions\RuntimeWarning; use ReflectionClass; use ReflectionException; use ReflectionFunction; @@ -64,9 +64,9 @@ class Debug /** * Clears are variables added previously * - * @return Debug + * @return static */ - public function clearVars(): Debug + public function clearVars(): static { } @@ -75,9 +75,9 @@ public function clearVars(): Debug * * @param mixed $variable * @param mixed $varz - * @return Debug + * @return static */ - public function debugVar($varz): Debug + public function debugVar($varz): static { } @@ -111,7 +111,7 @@ public function getVersion(): string /** * Halts the request showing a backtrace * - * @throws Exception + * @throws RequestHalted * @return void */ public function halt(): void @@ -123,27 +123,27 @@ public function halt(): void * * @param bool $exceptions * @param bool $lowSeverity - * @return Debug + * @return static */ - public function listen(bool $exceptions = true, bool $lowSeverity = false): Debug + public function listen(bool $exceptions = true, bool $lowSeverity = false): static { } /** * Listen for uncaught exceptions * - * @return Debug + * @return static */ - public function listenExceptions(): Debug + public function listenExceptions(): static { } /** * Listen for non silent notices or warnings * - * @return Debug + * @return static */ - public function listenLowSeverity(): Debug + public function listenLowSeverity(): static { } @@ -186,9 +186,9 @@ public function renderHtml(\Throwable $exception): string * Sets if files the exception's backtrace must be showed * * @param array $blacklist - * @return Debug + * @return static */ - public function setBlacklist(array $blacklist): Debug + public function setBlacklist(array $blacklist): static { } @@ -196,9 +196,9 @@ public function setBlacklist(array $blacklist): Debug * Sets if files the exception's backtrace must be showed * * @param bool $showBackTrace - * @return Debug + * @return static */ - public function setShowBackTrace(bool $showBackTrace): Debug + public function setShowBackTrace(bool $showBackTrace): static { } @@ -207,9 +207,9 @@ public function setShowBackTrace(bool $showBackTrace): Debug * or just the fragment related to the exception * * @param bool $showFileFragment - * @return Debug + * @return static */ - public function setShowFileFragment(bool $showFileFragment): Debug + public function setShowFileFragment(bool $showFileFragment): static { } @@ -217,9 +217,9 @@ public function setShowFileFragment(bool $showFileFragment): Debug * Set if files part of the backtrace must be shown in the output * * @param bool $showFiles - * @return Debug + * @return static */ - public function setShowFiles(bool $showFiles): Debug + public function setShowFiles(bool $showFiles): static { } @@ -227,9 +227,9 @@ public function setShowFiles(bool $showFiles): Debug * Change the base URI for static resources * * @param string $uri - * @return Debug + * @return static */ - public function setUri(string $uri): Debug + public function setUri(string $uri): static { } diff --git a/src/Support/Debug/Dump.php b/src/Support/Debug/Dump.php index dcaeff0b..fcc81f31 100644 --- a/src/Support/Debug/Dump.php +++ b/src/Support/Debug/Dump.php @@ -85,10 +85,10 @@ public function getDetailed(): bool * Alias of variable() method * * @param mixed $variable - * @param string $name + * @param string|null $name * @return string */ - public function one($variable, string $name = null): string + public function one($variable, ?string $name = null): string { } @@ -141,10 +141,10 @@ public function toJson($variable): string * ``` * * @param mixed $variable - * @param string $name + * @param string|null $name * @return string */ - public function variable($variable, string $name = null): string + public function variable($variable, ?string $name = null): string { } @@ -180,11 +180,11 @@ protected function getStyle(string $type): string * Prepare an HTML string of information about a single variable. * * @param mixed $variable - * @param string $name + * @param string|null $name * @param int $tab * @return string */ - protected function output($variable, string $name = null, int $tab = 1): string + protected function output($variable, ?string $name = null, int $tab = 1): string { } } diff --git a/src/Support/Debug/Exceptions/RequestHalted.php b/src/Support/Debug/Exceptions/RequestHalted.php new file mode 100644 index 00000000..5dfff864 --- /dev/null +++ b/src/Support/Debug/Exceptions/RequestHalted.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Debug\Exceptions; + +use Phalcon\Support\Debug\Exception as DebugException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RequestHalted extends \Phalcon\Support\Debug\Exception +{ + public function __construct() + { + } +} diff --git a/src/Support/Debug/Exceptions/RuntimeWarning.php b/src/Support/Debug/Exceptions/RuntimeWarning.php new file mode 100644 index 00000000..8be51f2b --- /dev/null +++ b/src/Support/Debug/Exceptions/RuntimeWarning.php @@ -0,0 +1,22 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Debug\Exceptions; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class RuntimeWarning extends \ErrorException +{ +} diff --git a/src/Support/Exception.php b/src/Support/Exception.php index d8b9260a..8739fb6d 100644 --- a/src/Support/Exception.php +++ b/src/Support/Exception.php @@ -10,7 +10,7 @@ namespace Phalcon\Support; /** - * Phalcon\Support\Exception + * Exceptions thrown in Phalcon\Support will use this class */ class Exception extends \Exception { diff --git a/src/Support/Helper/Arr/Flatten.php b/src/Support/Helper/Arr/Flatten.php index 8a4c19d9..0fb0b178 100644 --- a/src/Support/Helper/Arr/Flatten.php +++ b/src/Support/Helper/Arr/Flatten.php @@ -30,8 +30,9 @@ public function __invoke(array $collection, bool $deep = false): array * @param mixed $item * * @return array + * @param bool $deep */ - private function processNotArray(array $data, $item): array + private function processArray(array $data, $item, bool $deep): array { } @@ -42,18 +43,17 @@ private function processNotArray(array $data, $item): array * * @return array */ - private function processArray(array $data, $item, bool $deep): array + private function processArrayDeep(array $data, $item, bool $deep): array { } /** * @param array $data * @param mixed $item - * @param bool $deep * * @return array */ - private function processArrayDeep(array $data, $item, bool $deep): array + private function processNotArray(array $data, $item): array { } } diff --git a/src/Support/Helper/Arr/Get.php b/src/Support/Helper/Arr/Get.php index 0099f4cd..876e5fa0 100644 --- a/src/Support/Helper/Arr/Get.php +++ b/src/Support/Helper/Arr/Get.php @@ -24,7 +24,7 @@ class Get * * @return mixed|null */ - public function __invoke(array $collection, $index, $defaultValue = null, string $cast = null): mixed + public function __invoke(array $collection, $index, $defaultValue = null, ?string $cast = null): mixed { } } diff --git a/src/Support/Helper/Arr/Order.php b/src/Support/Helper/Arr/Order.php index 513162c7..0d91bd44 100644 --- a/src/Support/Helper/Arr/Order.php +++ b/src/Support/Helper/Arr/Order.php @@ -46,7 +46,7 @@ public function __invoke(array $collection, $attribute, int $order = self::ORDER * * @return array */ - private function checkObject(array $sorted, $attribute, $item): array + private function checkNonObject(array $sorted, $attribute, $item): array { } @@ -57,7 +57,7 @@ private function checkObject(array $sorted, $attribute, $item): array * * @return array */ - private function checkNonObject(array $sorted, $attribute, $item): array + private function checkObject(array $sorted, $attribute, $item): array { } } diff --git a/src/Support/Helper/Arr/Set.php b/src/Support/Helper/Arr/Set.php index c73512e3..9af30516 100644 --- a/src/Support/Helper/Arr/Set.php +++ b/src/Support/Helper/Arr/Set.php @@ -32,7 +32,7 @@ public function __invoke(array $collection, $value, $index = null): array * * @return array */ - private function checkNull(array $collection, $value, $index): array + private function checkNotNull(array $collection, $value, $index): array { } @@ -41,9 +41,9 @@ private function checkNull(array $collection, $value, $index): array * @param mixed $value * @param mixed $index * - * @return array + * @return array */ - private function checkNotNull(array $collection, $value, $index): array + private function checkNull(array $collection, $value, $index): array { } } diff --git a/src/Support/Helper/Exception.php b/src/Support/Helper/Exception.php index 8ac78eaf..916753b6 100644 --- a/src/Support/Helper/Exception.php +++ b/src/Support/Helper/Exception.php @@ -9,9 +9,11 @@ */ namespace Phalcon\Support\Helper; +use Phalcon\Support\Exception as SupportException; + /** - * Phalcon\Support\Exception + * Exceptions thrown in Phalcon\Support\Helper will use this class */ -class Exception extends \Exception +class Exception extends \Phalcon\Support\Exception { } diff --git a/src/Support/Helper/File/Basename.php b/src/Support/Helper/File/Basename.php index 655df323..cdc365a5 100644 --- a/src/Support/Helper/File/Basename.php +++ b/src/Support/Helper/File/Basename.php @@ -24,7 +24,7 @@ class Basename * * @return string */ - public function __invoke(string $uri, string $suffix = null): string + public function __invoke(string $uri, ?string $suffix = null): string { } } diff --git a/src/Support/Helper/Json/Decode.php b/src/Support/Helper/Json/Decode.php index 5f3da458..bb6ae07a 100644 --- a/src/Support/Helper/Json/Decode.php +++ b/src/Support/Helper/Json/Decode.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Support\Helper\Json; -use InvalidArgumentException; +use Phalcon\Support\Helper\Json\Exceptions\JsonDecodeError; /** * Decodes a string using `json_decode` and throws an exception if the @@ -20,8 +20,9 @@ * JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, * JSON_UNESCAPED_SLASHES * - * Any error will throw InvalidArgumentException, regardless of whether - * JSON_THROW_ON_ERROR is specified in the options. + * If JSON_THROW_ON_ERROR is defined in the options a JsonException will be + * thrown in the case of an error. Otherwise, any error will throw + * JsonDecodeError */ class Decode { @@ -33,7 +34,7 @@ class Decode * * @return mixed * - * @throws InvalidArgumentException if the JSON cannot be decoded. + * @throws JsonDecodeError if the JSON cannot be decoded. * @link https://www.php.net/manual/en/function.json-decode.php */ public function __invoke(string $data, bool $associative = false, int $depth = 512, int $options = 79) diff --git a/src/Support/Helper/Json/Encode.php b/src/Support/Helper/Json/Encode.php index eee8c856..6c6b3410 100644 --- a/src/Support/Helper/Json/Encode.php +++ b/src/Support/Helper/Json/Encode.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Support\Helper\Json; -use InvalidArgumentException; +use Phalcon\Support\Helper\Json\Exceptions\JsonEncodeError; /** * Encodes a string using `json_encode` and throws an exception if the @@ -20,8 +20,9 @@ * JSON_HEX_TAG, JSON_HEX_APOS, JSON_HEX_AMP, JSON_HEX_QUOT, * JSON_UNESCAPED_SLASHES * - * Any error will throw InvalidArgumentException, regardless of whether - * JSON_THROW_ON_ERROR is specified in the options. + * If JSON_THROW_ON_ERROR is defined in the options a JsonException will be + * thrown in the case of an error. Otherwise, any error will throw + * JsonEncodeError * * @see https://www.ietf.org/rfc/rfc4627.txt */ @@ -34,7 +35,7 @@ class Encode * * @return string * - * @throws InvalidArgumentException if the JSON cannot be encoded. + * @throws JsonEncodeError if the JSON cannot be encoded. * @link https://www.php.net/manual/en/function.json-encode.php */ public function __invoke($data, int $options = 79, int $depth = 512): string diff --git a/src/Support/Helper/Json/Exceptions/JsonDecodeError.php b/src/Support/Helper/Json/Exceptions/JsonDecodeError.php new file mode 100644 index 00000000..3025e57e --- /dev/null +++ b/src/Support/Helper/Json/Exceptions/JsonDecodeError.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Helper\Json\Exceptions; + +use InvalidArgumentException; +use Throwable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class JsonDecodeError extends InvalidArgumentException +{ + /** + * @param string $message + * @param int $code + * @param \Throwable|null $previous + */ + public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) + { + } +} diff --git a/src/Support/Helper/Json/Exceptions/JsonEncodeError.php b/src/Support/Helper/Json/Exceptions/JsonEncodeError.php new file mode 100644 index 00000000..71ea3a53 --- /dev/null +++ b/src/Support/Helper/Json/Exceptions/JsonEncodeError.php @@ -0,0 +1,33 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Helper\Json\Exceptions; + +use InvalidArgumentException; +use Throwable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class JsonEncodeError extends InvalidArgumentException +{ + /** + * @param string $message + * @param int $code + * @param \Throwable|null $previous + */ + public function __construct(string $message = '', int $code = 0, ?\Throwable $previous = null) + { + } +} diff --git a/src/Support/Helper/Str/Camelize.php b/src/Support/Helper/Str/Camelize.php index bcaec735..f14d6a29 100644 --- a/src/Support/Helper/Str/Camelize.php +++ b/src/Support/Helper/Str/Camelize.php @@ -21,7 +21,7 @@ class Camelize extends \Phalcon\Support\Helper\Str\PascalCase * * @return string */ - public function __invoke(string $text, string $delimiters = null, bool $lowerFirst = false): string + public function __invoke(string $text, ?string $delimiters = null, bool $lowerFirst = false): string { } } diff --git a/src/Support/Helper/Str/Concat.php b/src/Support/Helper/Str/Concat.php index a006ef7c..f206d08c 100644 --- a/src/Support/Helper/Str/Concat.php +++ b/src/Support/Helper/Str/Concat.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Support\Helper\Str; -use Phalcon\Support\Helper\Exception; +use Phalcon\Support\Helper\Str\Exceptions\InsufficientArguments; /** * Concatenates strings using the separator only once without duplication in diff --git a/src/Support/Helper/Str/Dynamic.php b/src/Support/Helper/Str/Dynamic.php index 344db16b..37092089 100644 --- a/src/Support/Helper/Str/Dynamic.php +++ b/src/Support/Helper/Str/Dynamic.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Support\Helper\Str; -use RuntimeException; +use Phalcon\Support\Helper\Str\Exceptions\SyntaxError; /** * Generates random text in accordance with the template. The template is diff --git a/src/Support/Helper/Str/Exceptions/InsufficientArguments.php b/src/Support/Helper/Str/Exceptions/InsufficientArguments.php new file mode 100644 index 00000000..cde88c24 --- /dev/null +++ b/src/Support/Helper/Str/Exceptions/InsufficientArguments.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Helper\Str\Exceptions; + +use Phalcon\Support\Helper\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InsufficientArguments extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Support/Helper/Str/Exceptions/InvalidReplaceFormat.php b/src/Support/Helper/Str/Exceptions/InvalidReplaceFormat.php new file mode 100644 index 00000000..8a0bd611 --- /dev/null +++ b/src/Support/Helper/Str/Exceptions/InvalidReplaceFormat.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Helper\Str\Exceptions; + +use Phalcon\Support\Helper\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidReplaceFormat extends Exception +{ +} diff --git a/src/Support/Helper/Str/Exceptions/SyntaxError.php b/src/Support/Helper/Str/Exceptions/SyntaxError.php new file mode 100644 index 00000000..21fa6039 --- /dev/null +++ b/src/Support/Helper/Str/Exceptions/SyntaxError.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Support\Helper\Str\Exceptions; + +use RuntimeException; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class SyntaxError extends RuntimeException +{ + /** + * @param string $text + */ + public function __construct(string $text) + { + } +} diff --git a/src/Support/Helper/Str/Friendly.php b/src/Support/Helper/Str/Friendly.php index b8cec776..9acbcde3 100644 --- a/src/Support/Helper/Str/Friendly.php +++ b/src/Support/Helper/Str/Friendly.php @@ -9,7 +9,7 @@ */ namespace Phalcon\Support\Helper\Str; -use Phalcon\Support\Helper\Exception; +use Phalcon\Support\Helper\Str\Exceptions\InvalidReplaceFormat; /** * Changes a text to a URL friendly one. Replaces commonly known accented @@ -25,7 +25,7 @@ class Friendly extends \Phalcon\Support\Helper\Str\AbstractStr * @param mixed|null $replace * * @return string - * @throws Exception + * @throws InvalidReplaceFormat */ public function __invoke(string $text, string $separator = '-', bool $lowercase = true, $replace = null): string { @@ -35,7 +35,7 @@ public function __invoke(string $text, string $separator = '-', bool $lowercase * @param mixed $replace * * @return array - * @throws Exception + * @throws InvalidReplaceFormat */ private function checkReplace($replace): array { @@ -45,7 +45,6 @@ private function checkReplace($replace): array * @param mixed $replace * * @return array - * @throws Exception */ private function getMatrix(array $replace): array { diff --git a/src/Support/Helper/Str/KebabCase.php b/src/Support/Helper/Str/KebabCase.php index c5ac1cd7..0c91b2ac 100644 --- a/src/Support/Helper/Str/KebabCase.php +++ b/src/Support/Helper/Str/KebabCase.php @@ -20,7 +20,7 @@ class KebabCase extends \Phalcon\Support\Helper\Str\PascalCase * * @return string */ - public function __invoke(string $text, string $delimiters = null): string + public function __invoke(string $text, ?string $delimiters = null): string { } } diff --git a/src/Support/Helper/Str/PascalCase.php b/src/Support/Helper/Str/PascalCase.php index 7bfee165..cf96c4b2 100644 --- a/src/Support/Helper/Str/PascalCase.php +++ b/src/Support/Helper/Str/PascalCase.php @@ -20,7 +20,7 @@ class PascalCase * * @return string */ - public function __invoke(string $text, string $delimiters = null): string + public function __invoke(string $text, ?string $delimiters = null): string { } @@ -30,7 +30,7 @@ public function __invoke(string $text, string $delimiters = null): string * * @return array */ - protected function processArray(string $text, string $delimiters = null): array + protected function processArray(string $text, ?string $delimiters = null): array { } } diff --git a/src/Support/Helper/Str/SnakeCase.php b/src/Support/Helper/Str/SnakeCase.php index 8b35afce..96e2e5ff 100644 --- a/src/Support/Helper/Str/SnakeCase.php +++ b/src/Support/Helper/Str/SnakeCase.php @@ -20,7 +20,7 @@ class SnakeCase extends \Phalcon\Support\Helper\Str\PascalCase * * @return string */ - public function __invoke(string $text, string $delimiters = null): string + public function __invoke(string $text, ?string $delimiters = null): string { } } diff --git a/src/Support/HelperFactory.php b/src/Support/HelperFactory.php index be027f68..0530181e 100644 --- a/src/Support/HelperFactory.php +++ b/src/Support/HelperFactory.php @@ -25,7 +25,7 @@ * @method string decrement(string $text, string $separator = '_') * @method string dirFromFile(string $file) * @method string dirSeparator(string $directory) - * @method string dynamic(string $text, string $leftDelimiter = "{", string $rightDelimiter = "}", string $separator = "|") + * @method string dynamic(string $text, string $leftDel = "{", string $rightDel = "}", string $separator = "|") * @method string encode($data, int $options = 0, int $depth = 512) * @method bool endsWith(string $haystack, string $needle, bool $ignoreCase = true) * @method mixed filter(array $collection, callable|null $method) @@ -55,7 +55,7 @@ * @method array order(array $collection, $attribute, string $order = 'asc') * @method string pascalCase(string $text, string $delimiters = null) * @method array pluck(array $collection, string $element) - * @method string prefix($text, string $prefix) + * @method string prefix(string $text, string $prefix) * @method string random(int $type = 0, int $length = 8) * @method string reduceSlashes(string $text) * @method array set(array $collection, $value, $index = null) diff --git a/src/Support/Registry.php b/src/Support/Registry.php index 0af1e43e..21689436 100644 --- a/src/Support/Registry.php +++ b/src/Support/Registry.php @@ -13,8 +13,6 @@ use Traversable; /** - * Phalcon\Registry - * * A registry is a container for storing objects and values in the application * space. By storing the value in a registry, the same object is always * available throughout your application. @@ -138,10 +136,10 @@ final public function count(): int * * @param string $element * @param mixed $defaultValue - * @param string $cast + * @param string|null $cast * @return mixed */ - final public function get(string $element, $defaultValue = null, string $cast = null): mixed + final public function get(string $element, $defaultValue = null, ?string $cast = null): mixed { } diff --git a/src/Support/Version.php b/src/Support/Version.php index 416c353e..e026c89b 100644 --- a/src/Support/Version.php +++ b/src/Support/Version.php @@ -75,32 +75,6 @@ class Version const VERSION_SPECIAL_NUMBER = 4; - /** - * Area where the version number is set. The format is as follows: - * ABBCCDE - * - * A - Major version - * B - Med version (two digits) - * C - Min version (two digits) - * D - Special release: 1 = alpha, 2 = beta, 3 = RC, 4 = stable - * E - Special release version i.e. RC1, Beta2 etc. - * - * @return array - */ - protected function getVersion(): array - { - } - - /** - * Translates a number to a special release. - * - * @param int $special - * @return string - */ - final protected function getSpecial(int $special): string - { - } - /** * Returns the active version (string) * @@ -136,9 +110,37 @@ public function getId(): string * ``` * * @param int $part + * * @return string */ public function getPart(int $part): string { } + + /** + * Translates a number to a special release. + * + * @param int $special + * + * @return string + */ + final protected function getSpecial(int $special): string + { + } + + /** + * Area where the version number is set. The format is as follows: + * ABBCCDE + * + * A - Major version + * B - Med version (two digits) + * C - Min version (two digits) + * D - Special release: 1 = alpha, 2 = beta, 3 = RC, 4 = stable + * E - Special release version i.e. RC1, Beta2 etc. + * + * @return int[] + */ + protected function getVersion(): array + { + } } diff --git a/src/Tag.php b/src/Tag.php index 43f2819f..2bfe26df 100644 --- a/src/Tag.php +++ b/src/Tag.php @@ -26,26 +26,59 @@ */ class Tag { + /** + * @var int + */ const HTML32 = 1; + /** + * @var int + */ const HTML401_STRICT = 2; + /** + * @var int + */ const HTML401_TRANSITIONAL = 3; + /** + * @var int + */ const HTML401_FRAMESET = 4; + /** + * @var int + */ const HTML5 = 5; + /** + * @var int + */ const XHTML10_STRICT = 6; + /** + * @var int + */ const XHTML10_TRANSITIONAL = 7; + /** + * @var int + */ const XHTML10_FRAMESET = 8; + /** + * @var int + */ const XHTML11 = 9; + /** + * @var int + */ const XHTML20 = 10; + /** + * @var int + */ const XHTML5 = 11; /** diff --git a/src/Time/Clock/Exception.php b/src/Time/Clock/Exception.php index 99871e1b..164d552b 100644 --- a/src/Time/Clock/Exception.php +++ b/src/Time/Clock/Exception.php @@ -9,8 +9,6 @@ */ namespace Phalcon\Time\Clock; -use Throwable; - /** * This file is part of the Phalcon Framework. * @@ -26,12 +24,4 @@ */ class Exception extends \Exception { - /** - * @param string $message - * @param \Throwable $ex - * @return Exception - */ - public static function invalidModifier(string $message, \Throwable $ex = null): Exception - { - } } diff --git a/src/Time/Clock/Exceptions/InvalidModifier.php b/src/Time/Clock/Exceptions/InvalidModifier.php new file mode 100644 index 00000000..2acebdc9 --- /dev/null +++ b/src/Time/Clock/Exceptions/InvalidModifier.php @@ -0,0 +1,37 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Time\Clock\Exceptions; + +use Phalcon\Time\Clock\Exception; +use Throwable; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + * + * Implementation of this file has been influenced by lcobucci/clock + * + * @link https://github.com/lcobucci/clock + * @license https://github.com/lcobucci/clock/blob/3.7.x/LICENSE + */ +class InvalidModifier extends Exception +{ + /** + * @param string $message + * @param \Throwable|null $ex + */ + public function __construct(string $message, ?\Throwable $ex = null) + { + } +} diff --git a/src/Time/Clock/FrozenClock.php b/src/Time/Clock/FrozenClock.php index 3fd0b863..150b3747 100644 --- a/src/Time/Clock/FrozenClock.php +++ b/src/Time/Clock/FrozenClock.php @@ -11,6 +11,7 @@ use DateTimeImmutable; use DateTimeZone; +use Phalcon\Time\Clock\Exceptions\InvalidModifier; use Throwable; /** @@ -43,11 +44,11 @@ public function __construct(\DateTimeImmutable $now) /** * Mutates the clock to a new value. All consumers receive the same modification * - * @throws Exception When the modifier string cannot be parsed + * @throws InvalidModifier * @param string $modifier - * @return FrozenClock + * @return static */ - public function adjust(string $modifier): FrozenClock + public function adjust(string $modifier): static { } @@ -82,9 +83,9 @@ public function now(): DateTimeImmutable * Sets the clock to a new value. All consumers receive the same modification * * @param \DateTimeImmutable $now - * @return FrozenClock + * @return static */ - public function set(\DateTimeImmutable $now): FrozenClock + public function set(\DateTimeImmutable $now): static { } } diff --git a/src/Translate/Adapter/AbstractAdapter.php b/src/Translate/Adapter/AbstractAdapter.php index 0f298b4d..ab64ca4b 100644 --- a/src/Translate/Adapter/AbstractAdapter.php +++ b/src/Translate/Adapter/AbstractAdapter.php @@ -9,19 +9,20 @@ */ namespace Phalcon\Translate\Adapter; -use Phalcon\Support\Helper\Arr\Get; -use Phalcon\Translate\Exception; +use ArrayAccess; +use Phalcon\Translate\Exceptions\ImmutableObject; use Phalcon\Translate\InterpolatorFactory; /** - * Class AbstractAdapter + * @psalm-type TOptions array{ + * defaultInterpolator?: string + * } * - * @package Phalcon\Translate\Adapter - * - * @property string $defaultInterpolator - * @property InterpolatorFactory $interpolatorFactory + * @template TKey of string + * @template TValue of string + * @implements ArrayAccess */ -abstract class AbstractAdapter implements \Phalcon\Translate\Adapter\AdapterInterface +abstract class AbstractAdapter implements \Phalcon\Translate\Adapter\AdapterInterface, \ArrayAccess { /** * @var string @@ -36,8 +37,8 @@ abstract class AbstractAdapter implements \Phalcon\Translate\Adapter\AdapterInte /** * AbstractAdapter constructor. * - * @param InterpolatorFactory $interpolator - * @param array $options + * @param TOptions $options + * @param \Phalcon\Translate\InterpolatorFactory $interpolator */ public function __construct(\Phalcon\Translate\InterpolatorFactory $interpolator, array $options = []) { @@ -46,10 +47,11 @@ public function __construct(\Phalcon\Translate\InterpolatorFactory $interpolator /** * Returns the translation string of the given key (alias of method 't') * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function _(string $translateKey, array $placeholders = []): string { @@ -69,11 +71,11 @@ public function offsetExists($translateKey): bool /** * Returns the translation related to the given key * - * @param mixed $translateKey + * @param TKey $translateKey * - * @return mixed + * @return TValue|null */ - public function offsetGet($translateKey): mixed + public function offsetGet($translateKey): string|null { } @@ -83,8 +85,8 @@ public function offsetGet($translateKey): mixed * @param mixed $offset * @param mixed $value * - * @throws Exception * @return void + * @throws ImmutableObject */ public function offsetSet($offset, $value): void { @@ -95,8 +97,8 @@ public function offsetSet($offset, $value): void * * @param mixed $offset * - * @throws Exception * @return void + * @throws ImmutableObject */ public function offsetUnset($offset): void { @@ -105,10 +107,11 @@ public function offsetUnset($offset): void /** * Returns the translation string of the given key * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function t(string $translateKey, array $placeholders = []): string { @@ -117,10 +120,11 @@ public function t(string $translateKey, array $placeholders = []): string /** * Replaces placeholders by the values passed * - * @param string $translation - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translation + * @param array $placeholders */ protected function replacePlaceholders(string $translation, array $placeholders = []): string { diff --git a/src/Translate/Adapter/AdapterInterface.php b/src/Translate/Adapter/AdapterInterface.php index c410de3a..ac833ef9 100644 --- a/src/Translate/Adapter/AdapterInterface.php +++ b/src/Translate/Adapter/AdapterInterface.php @@ -28,20 +28,22 @@ public function has(string $index): bool; /** * Returns the translation related to the given key * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function query(string $translateKey, array $placeholders = []): string; /** * Returns the translation string of the given key * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function t(string $translateKey, array $placeholders = []): string; } diff --git a/src/Translate/Adapter/Csv.php b/src/Translate/Adapter/Csv.php index 522ce688..94badb17 100644 --- a/src/Translate/Adapter/Csv.php +++ b/src/Translate/Adapter/Csv.php @@ -9,14 +9,20 @@ */ namespace Phalcon\Translate\Adapter; -use ArrayAccess; use Phalcon\Translate\Exception; +use Phalcon\Translate\Exceptions\MissingRequiredParameter; +use Phalcon\Translate\Exceptions\FileOpenError; use Phalcon\Translate\InterpolatorFactory; /** - * @property array $translate + * @phpstan-type TOptions array{ + * content?: string, + * delimiter?: string, + * enclosure?: string, + * escape?: string + * } */ -class Csv extends \Phalcon\Translate\Adapter\AbstractAdapter implements \ArrayAccess +class Csv extends \Phalcon\Translate\Adapter\AbstractAdapter { /** * @var array @@ -26,15 +32,11 @@ class Csv extends \Phalcon\Translate\Adapter\AbstractAdapter implements \ArrayAc /** * Csv constructor. * - * @param InterpolatorFactory $interpolator - * @param array $options = [ - * 'content' => '', - * 'delimiter' => ';', - * 'enclosure' => '"', - * 'escape' => '\\' - * ] + * @phpstan-param TOptions $options * * @throws Exception + * @param \Phalcon\Translate\InterpolatorFactory $interpolator + * @param array $options */ public function __construct(\Phalcon\Translate\InterpolatorFactory $interpolator, array $options) { @@ -66,32 +68,16 @@ public function has(string $index): bool /** * Returns the translation related to the given key * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function query(string $translateKey, array $placeholders = []): string { } - /** - * Load translations from file - * - * @param string $file - * @param int $length - * @param string $separator - * @param string $enclosure - * @param string $escape - * - * @throws Exception - * @param string $delimiter - * @return void - */ - private function load(string $file, int $length, string $delimiter, string $enclosure, string $escape): void - { - } - /** * Returns the internal array * @@ -109,4 +95,21 @@ public function toArray(): array protected function phpFopen(string $filename, string $mode) { } + + /** + * Load translations from file + * + * @param string $file + * @param int $length + * @param string $separator + * @param string $enclosure + * @param string $escape + * + * @return void + * @throws FileOpenError + * @param string $delimiter + */ + private function load(string $file, int $length, string $delimiter, string $enclosure, string $escape): void + { + } } diff --git a/src/Translate/Adapter/Gettext.php b/src/Translate/Adapter/Gettext.php index 1c8f8201..9b36c3f6 100644 --- a/src/Translate/Adapter/Gettext.php +++ b/src/Translate/Adapter/Gettext.php @@ -9,8 +9,9 @@ */ namespace Phalcon\Translate\Adapter; -use ArrayAccess; use Phalcon\Translate\Exception; +use Phalcon\Translate\Exceptions\MissingGettextExtension; +use Phalcon\Translate\Exceptions\MissingRequiredParameter; use Phalcon\Translate\InterpolatorFactory; /** @@ -29,14 +30,16 @@ * ); * ``` * - * Allows translate using gettext + * Allows translations using gettext * - * @property int $category - * @property string $defaultDomain - * @property string|array $directory - * @property string|false $locale + * @phpstan-type TOptions array{ + * locale?: string, + * defaultDomain?: string, + * directory?: string, + * category?: string + * } */ -class Gettext extends \Phalcon\Translate\Adapter\AbstractAdapter implements \ArrayAccess +class Gettext extends \Phalcon\Translate\Adapter\AbstractAdapter { /** * @var int @@ -62,14 +65,11 @@ class Gettext extends \Phalcon\Translate\Adapter\AbstractAdapter implements \Arr * Gettext constructor. * * @param InterpolatorFactory $interpolator - * @param array $options = [ - * 'locale' => '', - * 'defaultDomain' => '', - * 'directory' => '', - * 'category' => '' - * ] + * @param TOptions $options * * @throws Exception + * @throws MissingGettextExtension + * @throws MissingRequiredParameter */ public function __construct(\Phalcon\Translate\InterpolatorFactory $interpolator, array $options) { @@ -102,7 +102,8 @@ public function getDefaultDomain(): string } /** - * @return string|array + * @phpstan-return array|string + * @return array|string */ public function getDirectory(): string|array { @@ -131,15 +132,16 @@ public function has(string $index): bool * Some languages have more than one form for plural messages dependent on * the count. * - * @param string $msgid1 - * @param string $msgid2 - * @param int $count - * @param array $placeholders - * @param string|null $domain + * @phpstan-param array $placeholders * * @return string + * @param string $msgid1 + * @param string $msgid2 + * @param int $count + * @param array $placeholders + * @param string|null $domain */ - public function nquery(string $msgid1, string $msgid2, int $count, array $placeholders = [], string $domain = null): string + public function nquery(string $msgid1, string $msgid2, int $count, array $placeholders = [], ?string $domain = null): string { } @@ -150,10 +152,11 @@ public function nquery(string $msgid1, string $msgid2, int $count, array $placeh * $translator->query("你好 %name%!", ["name" => "Phalcon"]); * ``` * - * @param string $translateKey - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translateKey + * @param array $placeholders */ public function query(string $translateKey, array $placeholders = []): string { @@ -208,7 +211,7 @@ public function setDirectory($directory): void * * @return string */ - public function setDomain(string $domain = null): string + public function setDomain(?string $domain = null): string { } @@ -223,10 +226,11 @@ public function setDomain(string $domain = null): string * $gettext->setLocale(LC_ALL, ["de_DE@euro", "de_DE", "de", "ge"]); * ``` * - * @param int $category - * @param array $localeArray + * @phpstan-param array $localeArray * * @return false|string + * @param int $category + * @param array $localeArray */ public function setLocale(int $category, array $localeArray = []): bool|string { @@ -235,6 +239,7 @@ public function setLocale(int $category, array $localeArray = []): bool|string /** * Gets default options * + * @phpstan-return array * @return array */ protected function getOptionsDefault(): array @@ -244,10 +249,11 @@ protected function getOptionsDefault(): array /** * Validator for constructor * - * @param array $options + * @phpstan-param TOptions $options * - * @throws Exception * @return void + * @throws MissingRequiredParameter + * @param array $options */ protected function prepareOptions(array $options): void { diff --git a/src/Translate/Adapter/NativeArray.php b/src/Translate/Adapter/NativeArray.php index 3e70aeb0..0ef7afb4 100644 --- a/src/Translate/Adapter/NativeArray.php +++ b/src/Translate/Adapter/NativeArray.php @@ -9,21 +9,21 @@ */ namespace Phalcon\Translate\Adapter; -use ArrayAccess; use Phalcon\Translate\Exception; +use Phalcon\Translate\Exceptions\InvalidDataType; +use Phalcon\Translate\Exceptions\MissingContent; +use Phalcon\Translate\Exceptions\KeyNotFound; use Phalcon\Translate\InterpolatorFactory; /** - * Class NativeArray - * * Defines translation lists using PHP arrays * - * @package Phalcon\Translate\Adapter - * - * @property array $translate - * @property bool $triggerError + * @phpstan-type TOptions array{ + * content?: array, + * triggerError?: bool + * } */ -class NativeArray extends \Phalcon\Translate\Adapter\AbstractAdapter implements \ArrayAccess +class NativeArray extends \Phalcon\Translate\Adapter\AbstractAdapter { /** * @var array @@ -39,10 +39,7 @@ class NativeArray extends \Phalcon\Translate\Adapter\AbstractAdapter implements * NativeArray constructor. * * @param InterpolatorFactory $interpolator - * @param array $options = [ - * 'content' => '', - * 'triggerError' => false - * ] + * @param TOptions $options * * @throws Exception */ @@ -88,12 +85,12 @@ public function notFound(string $index): string /** * Returns the translation related to the given key * - * @param string $index - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string * @throws Exception * @param string $translateKey + * @param array $placeholders */ public function query(string $translateKey, array $placeholders = []): string { @@ -102,6 +99,7 @@ public function query(string $translateKey, array $placeholders = []): string /** * Returns the internal array * + * @phpstan-return array * @return array */ public function toArray(): array diff --git a/src/Translate/Exception.php b/src/Translate/Exception.php index 1edf5bfa..01f25ad0 100644 --- a/src/Translate/Exception.php +++ b/src/Translate/Exception.php @@ -10,8 +10,6 @@ namespace Phalcon\Translate; /** - * Phalcon\Translate\Exception - * * Class for exceptions thrown by Phalcon\Translate */ class Exception extends \Exception diff --git a/src/Translate/Exceptions/FileOpenError.php b/src/Translate/Exceptions/FileOpenError.php new file mode 100644 index 00000000..ead8675e --- /dev/null +++ b/src/Translate/Exceptions/FileOpenError.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class FileOpenError extends Exception +{ + /** + * @param string $name + */ + public function __construct(string $name) + { + } +} diff --git a/src/Translate/Exceptions/ImmutableObject.php b/src/Translate/Exceptions/ImmutableObject.php new file mode 100644 index 00000000..5da3b1fd --- /dev/null +++ b/src/Translate/Exceptions/ImmutableObject.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class ImmutableObject extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Translate/Exceptions/InterpolatorNotRegistered.php b/src/Translate/Exceptions/InterpolatorNotRegistered.php new file mode 100644 index 00000000..bf3be257 --- /dev/null +++ b/src/Translate/Exceptions/InterpolatorNotRegistered.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InterpolatorNotRegistered extends Exception +{ +} diff --git a/src/Translate/Exceptions/InvalidDataType.php b/src/Translate/Exceptions/InvalidDataType.php new file mode 100644 index 00000000..b8031a26 --- /dev/null +++ b/src/Translate/Exceptions/InvalidDataType.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class InvalidDataType extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Translate/Exceptions/KeyNotFound.php b/src/Translate/Exceptions/KeyNotFound.php new file mode 100644 index 00000000..87ef2d61 --- /dev/null +++ b/src/Translate/Exceptions/KeyNotFound.php @@ -0,0 +1,30 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class KeyNotFound extends Exception +{ + /** + * @param string $key + */ + public function __construct(string $key) + { + } +} diff --git a/src/Translate/Exceptions/MissingContent.php b/src/Translate/Exceptions/MissingContent.php new file mode 100644 index 00000000..3ac708d6 --- /dev/null +++ b/src/Translate/Exceptions/MissingContent.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingContent extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Translate/Exceptions/MissingGettextExtension.php b/src/Translate/Exceptions/MissingGettextExtension.php new file mode 100644 index 00000000..d033d5cc --- /dev/null +++ b/src/Translate/Exceptions/MissingGettextExtension.php @@ -0,0 +1,27 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingGettextExtension extends Exception +{ + public function __construct() + { + } +} diff --git a/src/Translate/Exceptions/MissingRequiredParameter.php b/src/Translate/Exceptions/MissingRequiredParameter.php new file mode 100644 index 00000000..ddd0e12b --- /dev/null +++ b/src/Translate/Exceptions/MissingRequiredParameter.php @@ -0,0 +1,42 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class MissingRequiredParameter extends Exception +{ + /** + * @var string + */ + private $parameter; + + /** + * @param string $parameter + */ + public function __construct(string $parameter) + { + } + + /** + * @return string + */ + public function getParameter(): string + { + } +} diff --git a/src/Translate/Exceptions/TranslatorNotRegistered.php b/src/Translate/Exceptions/TranslatorNotRegistered.php new file mode 100644 index 00000000..d3c506ac --- /dev/null +++ b/src/Translate/Exceptions/TranslatorNotRegistered.php @@ -0,0 +1,24 @@ + + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +namespace Phalcon\Translate\Exceptions; + +use Phalcon\Translate\Exception; + +/** + * This file is part of the Phalcon Framework. + * + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. + */ +class TranslatorNotRegistered extends Exception +{ +} diff --git a/src/Translate/Interpolator/AssociativeArray.php b/src/Translate/Interpolator/AssociativeArray.php index 22f7d66a..a26cb4a8 100644 --- a/src/Translate/Interpolator/AssociativeArray.php +++ b/src/Translate/Interpolator/AssociativeArray.php @@ -13,18 +13,17 @@ /** * Class AssociativeArray - * - * @package Phalcon\Translate\Interpolator */ class AssociativeArray implements \Phalcon\Translate\Interpolator\InterpolatorInterface { /** * Replaces placeholders by the values passed * - * @param string $translation - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translation + * @param array $placeholders */ public function replacePlaceholders(string $translation, array $placeholders = []): string { diff --git a/src/Translate/Interpolator/IndexedArray.php b/src/Translate/Interpolator/IndexedArray.php index 92bedfb7..eb370c6a 100644 --- a/src/Translate/Interpolator/IndexedArray.php +++ b/src/Translate/Interpolator/IndexedArray.php @@ -10,19 +10,23 @@ namespace Phalcon\Translate\Interpolator; /** - * Class IndexedArray + * This file is part of the Phalcon Framework. * - * @package Phalcon\Translate\Interpolator + * (c) Phalcon Team + * + * For the full copyright and license information, please view the LICENSE.txt + * file that was distributed with this source code. */ class IndexedArray implements \Phalcon\Translate\Interpolator\InterpolatorInterface { /** * Replaces placeholders by the values passed * - * @param string $translation - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translation + * @param array $placeholders */ public function replacePlaceholders(string $translation, array $placeholders = []): string { diff --git a/src/Translate/Interpolator/InterpolatorInterface.php b/src/Translate/Interpolator/InterpolatorInterface.php index 22c4f57e..db606777 100644 --- a/src/Translate/Interpolator/InterpolatorInterface.php +++ b/src/Translate/Interpolator/InterpolatorInterface.php @@ -19,10 +19,11 @@ interface InterpolatorInterface /** * Replaces placeholders by the values passed * - * @param string $translation - * @param array $placeholders + * @phpstan-param array $placeholders * * @return string + * @param string $translation + * @param array $placeholders */ public function replacePlaceholders(string $translation, array $placeholders = []): string; } diff --git a/src/Translate/InterpolatorFactory.php b/src/Translate/InterpolatorFactory.php index 8c2735b1..a2e38680 100644 --- a/src/Translate/InterpolatorFactory.php +++ b/src/Translate/InterpolatorFactory.php @@ -23,8 +23,7 @@ class InterpolatorFactory extends AbstractFactory { /** - * InterpolatorFactor constructor. - * + * @phpstan-param array $services * @param array $services */ public function __construct(array $services = []) diff --git a/src/Translate/TranslateFactory.php b/src/Translate/TranslateFactory.php index ee7c8be4..35746af8 100644 --- a/src/Translate/TranslateFactory.php +++ b/src/Translate/TranslateFactory.php @@ -14,11 +14,21 @@ use Phalcon\Translate\Adapter\AdapterInterface; /** - * Class TranslateFactory - * - * @package Phalcon\Translate - * * @property InterpolatorFactory $interpolator + * + * @psalm-type TConfig array{ + * adapter: string, + * options?: array{ + * content: string, + * delimiter: string, + * enclosure: string, + * locale: string, + * defaultDomain: string, + * directory: string, + * category: string, + * triggerError: bool, + * } + * } */ class TranslateFactory extends AbstractFactory { @@ -28,10 +38,9 @@ class TranslateFactory extends AbstractFactory private $interpolator; /** - * AdapterFactory constructor. - * + * @phpstan-param array $services * @param InterpolatorFactory $interpolator - * @param array $services + * @param array $services */ public function __construct(InterpolatorFactory $interpolator, array $services = []) { @@ -40,19 +49,7 @@ public function __construct(InterpolatorFactory $interpolator, array $services = /** * Factory to create an instance from a Config object * - * @param array|ConfigInterface $config = [ - * 'adapter' => 'ini, - * 'options' => [ - * 'content' => '', - * 'delimiter' => ';', - * 'enclosure' => '"', - * 'locale' => '', - * 'defaultDomain' => '', - * 'directory' => '', - * 'category' => '' - * 'triggerError' => false - * ] - * ] + * @param ConfigInterface|TConfig $config * * @return AdapterInterface * @throws Exception @@ -64,11 +61,11 @@ public function load($config): AdapterInterface /** * Create a new instance of the adapter * - * @param string $name - * @param array $options + * @phpstan-param array $options * * @return AdapterInterface - * @throws Exception + * @param string $name + * @param array $options */ public function newInstance(string $name, array $options = []): AdapterInterface {