From 12dcde3fae764600fedcb1717cd600e82b7e77b8 Mon Sep 17 00:00:00 2001 From: Andrew Nicols Date: Wed, 6 Dec 2023 16:31:59 +0800 Subject: [PATCH] MDL-80072 core: Add PSR-11 interfaces --- lib/classes/component.php | 1 + lib/psr/container/.gitignore | 3 ++ lib/psr/container/LICENSE | 21 +++++++++++ lib/psr/container/README.md | 13 +++++++ lib/psr/container/composer.json | 27 ++++++++++++++ lib/psr/container/readme_moodle.txt | 10 ++++++ .../src/ContainerExceptionInterface.php | 12 +++++++ lib/psr/container/src/ContainerInterface.php | 36 +++++++++++++++++++ .../src/NotFoundExceptionInterface.php | 10 ++++++ lib/thirdpartylibs.xml | 8 +++++ 10 files changed, 141 insertions(+) create mode 100644 lib/psr/container/.gitignore create mode 100644 lib/psr/container/LICENSE create mode 100644 lib/psr/container/README.md create mode 100644 lib/psr/container/composer.json create mode 100644 lib/psr/container/readme_moodle.txt create mode 100644 lib/psr/container/src/ContainerExceptionInterface.php create mode 100644 lib/psr/container/src/ContainerInterface.php create mode 100644 lib/psr/container/src/NotFoundExceptionInterface.php diff --git a/lib/classes/component.php b/lib/classes/component.php index 0824dd39831..d6d5ed7b83d 100644 --- a/lib/classes/component.php +++ b/lib/classes/component.php @@ -117,6 +117,7 @@ class core_component { 'lib/psr/http-factory/src', ], 'Psr\\EventDispatcher' => 'lib/psr/event-dispatcher/src', + 'Psr\\Container' => 'lib/psr/container/src', 'GuzzleHttp\\Psr7' => 'lib/guzzlehttp/psr7/src', 'GuzzleHttp\\Promise' => 'lib/guzzlehttp/promises/src', 'GuzzleHttp' => 'lib/guzzlehttp/guzzle/src', diff --git a/lib/psr/container/.gitignore b/lib/psr/container/.gitignore new file mode 100644 index 00000000000..b2395aa0554 --- /dev/null +++ b/lib/psr/container/.gitignore @@ -0,0 +1,3 @@ +composer.lock +composer.phar +/vendor/ diff --git a/lib/psr/container/LICENSE b/lib/psr/container/LICENSE new file mode 100644 index 00000000000..2877a4894ee --- /dev/null +++ b/lib/psr/container/LICENSE @@ -0,0 +1,21 @@ +The MIT License (MIT) + +Copyright (c) 2013-2016 container-interop +Copyright (c) 2016 PHP Framework Interoperability Group + +Permission is hereby granted, free of charge, to any person obtaining a copy of +this software and associated documentation files (the "Software"), to deal in +the Software without restriction, including without limitation the rights to +use, copy, modify, merge, publish, distribute, sublicense, and/or sell copies of +the Software, and to permit persons to whom the Software is furnished to do so, +subject to the following conditions: + +The above copyright notice and this permission notice shall be included in all +copies or substantial portions of the Software. + +THE SOFTWARE IS PROVIDED "AS IS", WITHOUT WARRANTY OF ANY KIND, EXPRESS OR +IMPLIED, INCLUDING BUT NOT LIMITED TO THE WARRANTIES OF MERCHANTABILITY, FITNESS +FOR A PARTICULAR PURPOSE AND NONINFRINGEMENT. IN NO EVENT SHALL THE AUTHORS OR +COPYRIGHT HOLDERS BE LIABLE FOR ANY CLAIM, DAMAGES OR OTHER LIABILITY, WHETHER +IN AN ACTION OF CONTRACT, TORT OR OTHERWISE, ARISING FROM, OUT OF OR IN +CONNECTION WITH THE SOFTWARE OR THE USE OR OTHER DEALINGS IN THE SOFTWARE. diff --git a/lib/psr/container/README.md b/lib/psr/container/README.md new file mode 100644 index 00000000000..1b9d9e5708a --- /dev/null +++ b/lib/psr/container/README.md @@ -0,0 +1,13 @@ +Container interface +============== + +This repository holds all interfaces related to [PSR-11 (Container Interface)][psr-url]. + +Note that this is not a Container implementation of its own. It is merely abstractions that describe the components of a Dependency Injection Container. + +The installable [package][package-url] and [implementations][implementation-url] are listed on Packagist. + +[psr-url]: https://www.php-fig.org/psr/psr-11/ +[package-url]: https://packagist.org/packages/psr/container +[implementation-url]: https://packagist.org/providers/psr/container-implementation + diff --git a/lib/psr/container/composer.json b/lib/psr/container/composer.json new file mode 100644 index 00000000000..baf6cd1a03b --- /dev/null +++ b/lib/psr/container/composer.json @@ -0,0 +1,27 @@ +{ + "name": "psr/container", + "type": "library", + "description": "Common Container Interface (PHP FIG PSR-11)", + "keywords": ["psr", "psr-11", "container", "container-interop", "container-interface"], + "homepage": "https://github.com/php-fig/container", + "license": "MIT", + "authors": [ + { + "name": "PHP-FIG", + "homepage": "https://www.php-fig.org/" + } + ], + "require": { + "php": ">=7.4.0" + }, + "autoload": { + "psr-4": { + "Psr\\Container\\": "src/" + } + }, + "extra": { + "branch-alias": { + "dev-master": "2.0.x-dev" + } + } +} diff --git a/lib/psr/container/readme_moodle.txt b/lib/psr/container/readme_moodle.txt new file mode 100644 index 00000000000..a0a1dc7cb43 --- /dev/null +++ b/lib/psr/container/readme_moodle.txt @@ -0,0 +1,10 @@ +# PSR-11 Container Interfaces + +This is a description for the including the PSR-11 Interfaces into Moodle + +## Installation + +1. Visit https://github.com/php-fig/container +2. Download the latest release +3. Unzip in this folder +4. Update `thirdpartylibs.xml` diff --git a/lib/psr/container/src/ContainerExceptionInterface.php b/lib/psr/container/src/ContainerExceptionInterface.php new file mode 100644 index 00000000000..0f213f2fed5 --- /dev/null +++ b/lib/psr/container/src/ContainerExceptionInterface.php @@ -0,0 +1,12 @@ + 2015 My C-Labs + + psr/container + container + Common Container Interface (PHP FIG PSR-11). + 2.0.2 + MIT + https://github.com/php-fig/container + psr/http-client http-client