diff --git a/.php-cs-fixer.dist.php b/.php-cs-fixer.dist.php index d5b6a57f1..5f47f8766 100644 --- a/.php-cs-fixer.dist.php +++ b/.php-cs-fixer.dist.php @@ -14,6 +14,7 @@ ->getFinder() ->ignoreVCSIgnored(true) ->notPath('build') + ->notPath('tests/stubs') ->notPath('l10n') ->notPath('src') ->notPath('vendor') diff --git a/LICENSES/AGPL-3.0-only.txt b/LICENSES/AGPL-3.0-only.txt new file mode 100644 index 000000000..0c97efd25 --- /dev/null +++ b/LICENSES/AGPL-3.0-only.txt @@ -0,0 +1,235 @@ +GNU AFFERO GENERAL PUBLIC LICENSE +Version 3, 19 November 2007 + +Copyright (C) 2007 Free Software Foundation, Inc. + +Everyone is permitted to copy and distribute verbatim copies of this license document, but changing it is not allowed. + + Preamble + +The GNU Affero General Public License is a free, copyleft license for software and other kinds of works, specifically designed to ensure cooperation with the community in the case of network server software. + +The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, our General Public Licenses are intended to guarantee your freedom to share and change all versions of a program--to make sure it remains free software for all its users. + +When we speak of free software, we are referring to freedom, not price. Our General Public Licenses are designed to make sure that you have the freedom to distribute copies of free software (and charge for them if you wish), that you receive source code or can get it if you want it, that you can change the software or use pieces of it in new free programs, and that you know you can do these things. + +Developers that use our General Public Licenses protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License which gives you legal permission to copy, distribute and/or modify the software. + +A secondary benefit of defending all users' freedom is that improvements made in alternate versions of the program, if they receive widespread use, become available for other developers to incorporate. Many developers of free software are heartened and encouraged by the resulting cooperation. However, in the case of software used on network servers, this result may fail to come about. The GNU General Public License permits making a modified version and letting the public access it on a server without ever releasing its source code to the public. + +The GNU Affero General Public License is designed specifically to ensure that, in such cases, the modified source code becomes available to the community. It requires the operator of a network server to provide the source code of the modified version running there to the users of that server. Therefore, public use of a modified version, on a publicly accessible server, gives the public access to the source code of the modified version. + +An older license, called the Affero General Public License and published by Affero, was designed to accomplish similar goals. This is a different license, not a version of the Affero GPL, but Affero has released a new version of the Affero GPL which permits relicensing under this license. + +The precise terms and conditions for copying, distribution and modification follow. + + TERMS AND CONDITIONS + +0. Definitions. + +"This License" refers to version 3 of the GNU Affero General Public License. + +"Copyright" also means copyright-like laws that apply to other kinds of works, such as semiconductor masks. + +"The Program" refers to any copyrightable work licensed under this License. Each licensee is addressed as "you". "Licensees" and "recipients" may be individuals or organizations. + +To "modify" a work means to copy from or adapt all or part of the work in a fashion requiring copyright permission, other than the making of an exact copy. The resulting work is called a "modified version" of the earlier work or a work "based on" the earlier work. + +A "covered work" means either the unmodified Program or a work based on the Program. + +To "propagate" a work means to do anything with it that, without permission, would make you directly or secondarily liable for infringement under applicable copyright law, except executing it on a computer or modifying a private copy. Propagation includes copying, distribution (with or without modification), making available to the public, and in some countries other activities as well. + +To "convey" a work means any kind of propagation that enables other parties to make or receive copies. Mere interaction with a user through a computer network, with no transfer of a copy, is not conveying. + +An interactive user interface displays "Appropriate Legal Notices" to the extent that it includes a convenient and prominently visible feature that (1) displays an appropriate copyright notice, and (2) tells the user that there is no warranty for the work (except to the extent that warranties are provided), that licensees may convey the work under this License, and how to view a copy of this License. If the interface presents a list of user commands or options, such as a menu, a prominent item in the list meets this criterion. + +1. Source Code. +The "source code" for a work means the preferred form of the work for making modifications to it. "Object code" means any non-source form of a work. + +A "Standard Interface" means an interface that either is an official standard defined by a recognized standards body, or, in the case of interfaces specified for a particular programming language, one that is widely used among developers working in that language. + +The "System Libraries" of an executable work include anything, other than the work as a whole, that (a) is included in the normal form of packaging a Major Component, but which is not part of that Major Component, and (b) serves only to enable use of the work with that Major Component, or to implement a Standard Interface for which an implementation is available to the public in source code form. A "Major Component", in this context, means a major essential component (kernel, window system, and so on) of the specific operating system (if any) on which the executable work runs, or a compiler used to produce the work, or an object code interpreter used to run it. + +The "Corresponding Source" for a work in object code form means all the source code needed to generate, install, and (for an executable work) run the object code and to modify the work, including scripts to control those activities. However, it does not include the work's System Libraries, or general-purpose tools or generally available free programs which are used unmodified in performing those activities but which are not part of the work. For example, Corresponding Source includes interface definition files associated with source files for the work, and the source code for shared libraries and dynamically linked subprograms that the work is specifically designed to require, such as by intimate data communication or control flow between those +subprograms and other parts of the work. + +The Corresponding Source need not include anything that users can regenerate automatically from other parts of the Corresponding Source. + +The Corresponding Source for a work in source code form is that same work. + +2. Basic Permissions. +All rights granted under this License are granted for the term of copyright on the Program, and are irrevocable provided the stated conditions are met. This License explicitly affirms your unlimited permission to run the unmodified Program. The output from running a covered work is covered by this License only if the output, given its content, constitutes a covered work. This License acknowledges your rights of fair use or other equivalent, as provided by copyright law. + +You may make, run and propagate covered works that you do not convey, without conditions so long as your license otherwise remains in force. You may convey covered works to others for the sole purpose of having them make modifications exclusively for you, or provide you with facilities for running those works, provided that you comply with the terms of this License in conveying all material for which you do not control copyright. Those thus making or running the covered works for you must do so exclusively on your behalf, under your direction and control, on terms that prohibit them from making any copies of your copyrighted material outside their relationship with you. + +Conveying under any other circumstances is permitted solely under the conditions stated below. Sublicensing is not allowed; section 10 makes it unnecessary. + +3. Protecting Users' Legal Rights From Anti-Circumvention Law. +No covered work shall be deemed part of an effective technological measure under any applicable law fulfilling obligations under article 11 of the WIPO copyright treaty adopted on 20 December 1996, or similar laws prohibiting or restricting circumvention of such measures. + +When you convey a covered work, you waive any legal power to forbid circumvention of technological measures to the extent such circumvention is effected by exercising rights under this License with respect to the covered work, and you disclaim any intention to limit operation or modification of the work as a means of enforcing, against the work's users, your or third parties' legal rights to forbid circumvention of technological measures. + +4. Conveying Verbatim Copies. +You may convey verbatim copies of the Program's source code as you receive it, in any medium, provided that you conspicuously and appropriately publish on each copy an appropriate copyright notice; keep intact all notices stating that this License and any non-permissive terms added in accord with section 7 apply to the code; keep intact all notices of the absence of any warranty; and give all recipients a copy of this License along with the Program. + +You may charge any price or no price for each copy that you convey, and you may offer support or warranty protection for a fee. + +5. Conveying Modified Source Versions. +You may convey a work based on the Program, or the modifications to produce it from the Program, in the form of source code under the terms of section 4, provided that you also meet all of these conditions: + + a) The work must carry prominent notices stating that you modified it, and giving a relevant date. + + b) The work must carry prominent notices stating that it is released under this License and any conditions added under section 7. This requirement modifies the requirement in section 4 to "keep intact all notices". + + c) You must license the entire work, as a whole, under this License to anyone who comes into possession of a copy. This License will therefore apply, along with any applicable section 7 additional terms, to the whole of the work, and all its parts, regardless of how they are packaged. This License gives no permission to license the work in any other way, but it does not invalidate such permission if you have separately received it. + + d) If the work has interactive user interfaces, each must display Appropriate Legal Notices; however, if the Program has interactive interfaces that do not display Appropriate Legal Notices, your work need not make them do so. + +A compilation of a covered work with other separate and independent works, which are not by their nature extensions of the covered work, and which are not combined with it such as to form a larger program, in or on a volume of a storage or distribution medium, is called an "aggregate" if the compilation and its resulting copyright are not used to limit the access or legal rights of the compilation's users beyond what the individual works permit. Inclusion of a covered work in an aggregate does not cause this License to apply to the other parts of the aggregate. + +6. Conveying Non-Source Forms. +You may convey a covered work in object code form under the terms of sections 4 and 5, provided that you also convey the machine-readable Corresponding Source under the terms of this License, in one of these ways: + + a) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by the Corresponding Source fixed on a durable physical medium customarily used for software interchange. + + b) Convey the object code in, or embodied in, a physical product (including a physical distribution medium), accompanied by a written offer, valid for at least three years and valid for as long as you offer spare parts or customer support for that product model, to give anyone who possesses the object code either (1) a copy of the Corresponding Source for all the software in the product that is covered by this License, on a durable physical medium customarily used for software interchange, for a price no more than your reasonable cost of physically performing this conveying of source, or (2) access to copy the Corresponding Source from a network server at no charge. + + c) Convey individual copies of the object code with a copy of the written offer to provide the Corresponding Source. This alternative is allowed only occasionally and noncommercially, and only if you received the object code with such an offer, in accord with subsection 6b. + + d) Convey the object code by offering access from a designated place (gratis or for a charge), and offer equivalent access to the Corresponding Source in the same way through the same place at no further charge. You need not require recipients to copy the Corresponding Source along with the object code. If the place to copy the object code is a network server, the Corresponding Source may be on a different server (operated by you or a third party) that supports equivalent copying facilities, provided you maintain clear directions next to the object code saying where to find the Corresponding Source. Regardless of what server hosts the Corresponding Source, you remain obligated to ensure that it is available for as long as needed to satisfy these requirements. + + e) Convey the object code using peer-to-peer transmission, provided you inform other peers where the object code and Corresponding Source of the work are being offered to the general public at no charge under subsection 6d. + +A separable portion of the object code, whose source code is excluded from the Corresponding Source as a System Library, need not be included in conveying the object code work. + +A "User Product" is either (1) a "consumer product", which means any tangible personal property which is normally used for personal, family, or household purposes, or (2) anything designed or sold for incorporation into a dwelling. In determining whether a product is a consumer product, doubtful cases shall be resolved in favor of coverage. For a particular product received by a particular user, "normally used" refers to a typical or common use of that class of product, regardless of the status of the particular user or of the way in which the particular user actually uses, or expects or is expected to use, the product. A product is a consumer product regardless of whether the product has substantial commercial, industrial or non-consumer uses, unless such uses represent the only significant mode of use of the product. + +"Installation Information" for a User Product means any methods, procedures, authorization keys, or other information required to install and execute modified versions of a covered work in that User Product from a modified version of its Corresponding Source. The information must suffice to ensure that the continued functioning of the modified object code is in no case prevented or interfered with solely because modification has been made. + +If you convey an object code work under this section in, or with, or specifically for use in, a User Product, and the conveying occurs as part of a transaction in which the right of possession and use of the User Product is transferred to the recipient in perpetuity or for a fixed term (regardless of how the transaction is characterized), the Corresponding Source conveyed under this section must be accompanied by the Installation Information. But this requirement does not apply if neither you nor any third party retains the ability to install modified object code on the User Product (for example, the work has been installed in ROM). + +The requirement to provide Installation Information does not include a requirement to continue to provide support service, warranty, or updates for a work that has been modified or installed by the recipient, or for the User Product in which it has been modified or installed. Access to a network may be denied when the modification itself materially and adversely affects the operation of the network or violates the rules and protocols for communication across the network. + +Corresponding Source conveyed, and Installation Information provided, in accord with this section must be in a format that is publicly documented (and with an implementation available to the public in source code form), and must require no special password or key for unpacking, reading or copying. + +7. Additional Terms. +"Additional permissions" are terms that supplement the terms of this License by making exceptions from one or more of its conditions. Additional permissions that are applicable to the entire Program shall be treated as though they were included in this License, to the extent that they are valid under applicable law. If additional permissions apply only to part of the Program, that part may be used separately under those permissions, but the entire Program remains governed by this License without regard to the additional permissions. + +When you convey a copy of a covered work, you may at your option remove any additional permissions from that copy, or from any part of it. (Additional permissions may be written to require their own removal in certain cases when you modify the work.) You may place additional permissions on material, added by you to a covered work, for which you have or can give appropriate copyright permission. + +Notwithstanding any other provision of this License, for material you add to a covered work, you may (if authorized by the copyright holders of that material) supplement the terms of this License with terms: + + a) Disclaiming warranty or limiting liability differently from the terms of sections 15 and 16 of this License; or + + b) Requiring preservation of specified reasonable legal notices or author attributions in that material or in the Appropriate Legal Notices displayed by works containing it; or + + c) Prohibiting misrepresentation of the origin of that material, or requiring that modified versions of such material be marked in reasonable ways as different from the original version; or + + d) Limiting the use for publicity purposes of names of licensors or authors of the material; or + + e) Declining to grant rights under trademark law for use of some trade names, trademarks, or service marks; or + + f) Requiring indemnification of licensors and authors of that material by anyone who conveys the material (or modified versions of it) with contractual assumptions of liability to the recipient, for any liability that these contractual assumptions directly impose on those licensors and authors. + +All other non-permissive additional terms are considered "further restrictions" within the meaning of section 10. If the Program as you received it, or any part of it, contains a notice stating that it is governed by this License along with a term that is a further restriction, you may remove that term. If a license document contains a further restriction but permits relicensing or conveying under this License, you may add to a covered work material governed by the terms of that license document, provided that the further restriction does not survive such relicensing or conveying. + +If you add terms to a covered work in accord with this section, you must place, in the relevant source files, a statement of the additional terms that apply to those files, or a notice indicating where to find the applicable terms. + +Additional terms, permissive or non-permissive, may be stated in the form of a separately written license, or stated as exceptions; the above requirements apply either way. + +8. Termination. + +You may not propagate or modify a covered work except as expressly provided under this License. Any attempt otherwise to propagate or modify it is void, and will automatically terminate your rights under this License (including any patent licenses granted under the third paragraph of section 11). + +However, if you cease all violation of this License, then your license from a particular copyright holder is reinstated (a) provisionally, unless and until the copyright holder explicitly and finally terminates your license, and (b) permanently, if the copyright holder fails to notify you of the violation by some reasonable means prior to 60 days after the cessation. + +Moreover, your license from a particular copyright holder is reinstated permanently if the copyright holder notifies you of the violation by some reasonable means, this is the first time you have received notice of violation of this License (for any work) from that copyright holder, and you cure the violation prior to 30 days after your receipt of the notice. + +Termination of your rights under this section does not terminate the licenses of parties who have received copies or rights from you under this License. If your rights have been terminated and not permanently reinstated, you do not qualify to receive new licenses for the same material under section 10. + +9. Acceptance Not Required for Having Copies. + +You are not required to accept this License in order to receive or run a copy of the Program. Ancillary propagation of a covered work occurring solely as a consequence of using peer-to-peer transmission to receive a copy likewise does not require acceptance. However, nothing other than this License grants you permission to propagate or modify any covered work. These actions infringe copyright if you do not accept this License. Therefore, by modifying or propagating a covered work, you indicate your acceptance of this License to do so. + +10. Automatic Licensing of Downstream Recipients. + +Each time you convey a covered work, the recipient automatically receives a license from the original licensors, to run, modify and propagate that work, subject to this License. You are not responsible for enforcing compliance by third parties with this License. + +An "entity transaction" is a transaction transferring control of an organization, or substantially all assets of one, or subdividing an organization, or merging organizations. If propagation of a covered work results from an entity transaction, each party to that transaction who receives a copy of the work also receives whatever licenses to the work the party's predecessor in interest had or could give under the previous paragraph, plus a right to possession of the Corresponding Source of the work from the predecessor in interest, if the predecessor has it or can get it with reasonable efforts. + +You may not impose any further restrictions on the exercise of the rights granted or affirmed under this License. For example, you may not impose a license fee, royalty, or other charge for exercise of rights granted under this License, and you may not initiate litigation (including a cross-claim or counterclaim in a lawsuit) alleging that any patent claim is infringed by making, using, selling, offering for sale, or importing the Program or any portion of it. + +11. Patents. + +A "contributor" is a copyright holder who authorizes use under this License of the Program or a work on which the Program is based. The work thus licensed is called the contributor's "contributor version". + +A contributor's "essential patent claims" are all patent claims owned or controlled by the contributor, whether already acquired or hereafter acquired, that would be infringed by some manner, permitted by this License, of making, using, or selling its contributor version, but do not include claims that would be infringed only as a consequence of further modification of the contributor version. For purposes of this definition, "control" includes the right to grant patent sublicenses in a manner consistent with the requirements of this License. + +Each contributor grants you a non-exclusive, worldwide, royalty-free patent license under the contributor's essential patent claims, to make, use, sell, offer for sale, import and otherwise run, modify and propagate the contents of its contributor version. + +In the following three paragraphs, a "patent license" is any express agreement or commitment, however denominated, not to enforce a patent (such as an express permission to practice a patent or covenant not to sue for patent infringement). To "grant" such a patent license to a party means to make such an agreement or commitment not to enforce a patent against the party. + +If you convey a covered work, knowingly relying on a patent license, and the Corresponding Source of the work is not available for anyone to copy, free of charge and under the terms of this License, through a publicly available network server or other readily accessible means, then you must either (1) cause the Corresponding Source to be so available, or (2) arrange to deprive yourself of the benefit of the patent license for this particular work, or (3) arrange, in a manner consistent with the requirements of this License, to extend the patent +license to downstream recipients. "Knowingly relying" means you have actual knowledge that, but for the patent license, your conveying the covered work in a country, or your recipient's use of the covered work in a country, would infringe one or more identifiable patents in that country that you have reason to believe are valid. + +If, pursuant to or in connection with a single transaction or arrangement, you convey, or propagate by procuring conveyance of, a covered work, and grant a patent license to some of the parties receiving the covered work authorizing them to use, propagate, modify or convey a specific copy of the covered work, then the patent license you grant is automatically extended to all recipients of the covered work and works based on it. + +A patent license is "discriminatory" if it does not include within the scope of its coverage, prohibits the exercise of, or is conditioned on the non-exercise of one or more of the rights that are specifically granted under this License. You may not convey a covered work if you are a party to an arrangement with a third party that is in the business of distributing software, under which you make payment to the third party based on the extent of your activity of conveying the work, and under which the third party grants, to any of the parties who would receive the covered work from you, a discriminatory patent license (a) in connection with copies of the covered work conveyed by you (or copies made from those copies), or (b) primarily for and in connection with specific products or compilations that contain the covered work, unless you entered into that arrangement, or that patent license was granted, prior to 28 March 2007. + +Nothing in this License shall be construed as excluding or limiting any implied license or other defenses to infringement that may otherwise be available to you under applicable patent law. + +12. No Surrender of Others' Freedom. + +If conditions are imposed on you (whether by court order, agreement or otherwise) that contradict the conditions of this License, they do not excuse you from the conditions of this License. If you cannot convey a covered work so as to satisfy simultaneously your obligations under this License and any other pertinent obligations, then as a consequence you may +not convey it at all. For example, if you agree to terms that obligate you to collect a royalty for further conveying from those to whom you convey the Program, the only way you could satisfy both those terms and this License would be to refrain entirely from conveying the Program. + +13. Remote Network Interaction; Use with the GNU General Public License. + +Notwithstanding any other provision of this License, if you modify the Program, your modified version must prominently offer all users interacting with it remotely through a computer network (if your version supports such interaction) an opportunity to receive the Corresponding Source of your version by providing access to the Corresponding Source from a network server at no charge, through some standard or customary means of facilitating copying of software. This Corresponding Source shall include the Corresponding Source for any work covered by version 3 of the GNU General Public License that is incorporated pursuant to the following paragraph. + +Notwithstanding any other provision of this License, you have permission to link or combine any covered work with a work licensed under version 3 of the GNU General Public License into a single combined work, and to convey the resulting work. The terms of this License will continue to apply to the part which is the covered work, but the work with which it is combined will remain governed by version 3 of the GNU General Public License. + +14. Revised Versions of this License. + +The Free Software Foundation may publish revised and/or new versions of the GNU Affero General Public License from time to time. Such new versions will be similar in spirit to the present version, but may differ in detail to address new problems or concerns. + +Each version is given a distinguishing version number. If the Program specifies that a certain numbered version of the GNU Affero General Public License "or any later version" applies to it, you have the option of following the terms and conditions either of that numbered version or of any later version published by the Free Software Foundation. If the Program does not specify a version number of the GNU Affero General Public License, you may choose any version ever published by the Free Software Foundation. + +If the Program specifies that a proxy can decide which future versions of the GNU Affero General Public License can be used, that proxy's public statement of acceptance of a version permanently authorizes you to choose that version for the Program. + +Later license versions may give you additional or different permissions. However, no additional obligations are imposed on any author or copyright holder as a result of your choosing to follow a later version. + +15. Disclaimer of Warranty. + +THERE IS NO WARRANTY FOR THE PROGRAM, TO THE EXTENT PERMITTED BY APPLICABLE LAW. EXCEPT WHEN OTHERWISE STATED IN WRITING THE COPYRIGHT HOLDERS AND/OR OTHER PARTIES PROVIDE THE PROGRAM "AS IS" WITHOUT WARRANTY OF ANY KIND, EITHER EXPRESSED OR IMPLIED, INCLUDING, BUT NOT LIMITED TO, THE IMPLIED WARRANTIES OF MERCHANTABILITY AND FITNESS FOR A PARTICULAR PURPOSE. THE ENTIRE RISK AS TO THE QUALITY AND PERFORMANCE OF THE PROGRAM IS WITH YOU. SHOULD THE PROGRAM PROVE DEFECTIVE, YOU ASSUME THE COST OF ALL NECESSARY SERVICING, REPAIR OR CORRECTION. + +16. Limitation of Liability. + +IN NO EVENT UNLESS REQUIRED BY APPLICABLE LAW OR AGREED TO IN WRITING WILL ANY COPYRIGHT HOLDER, OR ANY OTHER PARTY WHO MODIFIES AND/OR CONVEYS THE PROGRAM AS PERMITTED ABOVE, BE LIABLE TO YOU FOR DAMAGES, INCLUDING ANY GENERAL, SPECIAL, INCIDENTAL OR CONSEQUENTIAL DAMAGES ARISING OUT OF THE USE OR INABILITY TO USE THE PROGRAM (INCLUDING BUT NOT LIMITED TO LOSS OF DATA OR DATA BEING RENDERED INACCURATE OR LOSSES SUSTAINED BY YOU OR THIRD PARTIES OR A FAILURE OF THE PROGRAM TO OPERATE WITH ANY OTHER PROGRAMS), EVEN IF SUCH HOLDER OR OTHER PARTY HAS BEEN ADVISED OF THE POSSIBILITY OF SUCH DAMAGES. + +17. Interpretation of Sections 15 and 16. + +If the disclaimer of warranty and limitation of liability provided above cannot be given local legal effect according to their terms, reviewing courts shall apply local law that most closely approximates an absolute waiver of all civil liability in connection with the Program, unless a warranty or assumption of liability accompanies a copy of the Program in return for a fee. + +END OF TERMS AND CONDITIONS + + How to Apply These Terms to Your New Programs + +If you develop a new program, and you want it to be of the greatest possible use to the public, the best way to achieve this is to make it free software which everyone can redistribute and change under these terms. + +To do so, attach the following notices to the program. It is safest to attach them to the start of each source file to most effectively state the exclusion of warranty; and each file should have at least the "copyright" line and a pointer to where the full notice is found. + + + Copyright (C) + + This program is free software: you can redistribute it and/or modify it under the terms of the GNU Affero General Public License as published by the Free Software Foundation, either version 3 of the License, or (at your option) any later version. + + This program is distributed in the hope that it will be useful, but WITHOUT ANY WARRANTY; without even the implied warranty of MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the GNU Affero General Public License for more details. + + You should have received a copy of the GNU Affero General Public License along with this program. If not, see . + +Also add information on how to contact you by electronic and paper mail. + +If your software can interact with users remotely through a computer network, you should also make sure that it provides a way for users to get its source. For example, if your program is a web application, its interface could display a "Source" link that leads users to an archive of the code. There are many ways you could offer source, and different solutions will be better for different programs; see section 13 for the specific requirements. + +You should also get your employer (if you work as a programmer) or school, if any, to sign a "copyright disclaimer" for the program, if necessary. For more information on this, and how to apply and follow the GNU AGPL, see . diff --git a/REUSE.toml b/REUSE.toml index 98565f1ca..2c6e6ff3c 100644 --- a/REUSE.toml +++ b/REUSE.toml @@ -46,3 +46,27 @@ path = ["img/app-dark.svg", "img/app.svg", "img/deny.svg", "img/folder-group.svg precedence = "aggregate" SPDX-FileCopyrightText = "2018-2024 Google LLC" SPDX-License-Identifier = "Apache-2.0" + +[[annotations]] +path = ["tests/stubs/doctrine_dbal_**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "none" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = ["tests/stubs/symfony_component_**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "none" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = ["tests/stubs/stecman_component_**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "none" +SPDX-License-Identifier = "MIT" + +[[annotations]] +path = ["tests/stubs/icewind_streams_**"] +precedence = "aggregate" +SPDX-FileCopyrightText = "none" +SPDX-License-Identifier = "MIT" diff --git a/composer.json b/composer.json index 13ddc5d29..910190be2 100644 --- a/composer.json +++ b/composer.json @@ -9,7 +9,7 @@ "nextcloud/ocp": "dev-master" }, "scripts": { - "lint": "find . -name \\*.php -not -path './vendor/*' -print0 | xargs -0 -n1 php -l", + "lint": "find . -name \\*.php -not -path './vendor/*' -not -path './tests/stubs/*' -print0 | xargs -0 -n1 php -l", "cs:check": "php-cs-fixer fix --dry-run --diff", "cs:fix": "php-cs-fixer fix", "psalm": "psalm.phar --threads=$(nproc) --no-cache", diff --git a/lib/ACL/ACLCacheWrapper.php b/lib/ACL/ACLCacheWrapper.php index b844ba35c..5eca89701 100644 --- a/lib/ACL/ACLCacheWrapper.php +++ b/lib/ACL/ACLCacheWrapper.php @@ -64,19 +64,19 @@ public function getFolderContentsById($fileId) { public function search($pattern) { $results = $this->getCache()->search($pattern); $this->preloadEntries($results); - return array_map([$this, 'formatCacheEntry'], $results); + return array_filter(array_map([$this, 'formatCacheEntry'], $results)); } public function searchByMime($mimetype) { $results = $this->getCache()->searchByMime($mimetype); $this->preloadEntries($results); - return array_map([$this, 'formatCacheEntry'], $results); + return array_filter(array_map([$this, 'formatCacheEntry'], $results)); } public function searchQuery(ISearchQuery $query) { $results = $this->getCache()->searchQuery($query); $this->preloadEntries($results); - return array_map([$this, 'formatCacheEntry'], $results); + return array_filter(array_map([$this, 'formatCacheEntry'], $results)); } /** diff --git a/lib/AppInfo/Application.php b/lib/AppInfo/Application.php index 8834fdce1..89e6d64bc 100644 --- a/lib/AppInfo/Application.php +++ b/lib/AppInfo/Application.php @@ -7,6 +7,7 @@ namespace OCA\GroupFolders\AppInfo; use OC\Files\Node\LazyFolder; +use OC\Group; use OCA\Circles\Events\CircleDestroyedEvent; use OCA\DAV\Connector\Sabre\Principal; use OCA\Files\Event\LoadAdditionalScriptsEvent; @@ -228,7 +229,7 @@ public function register(IRegistrationContext $context): void { } public function boot(IBootContext $context): void { - $context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, IGroupManager $groupManager): void { + $context->injectFn(function (IMountProviderCollection $mountProviderCollection, CacheListener $cacheListener, Group\Manager $groupManager): void { $mountProviderCollection->registerProvider($this->getMountProvider()); $groupManager->listen('\OC\Group', 'postDelete', function (IGroup $group) { diff --git a/lib/Command/Scan.php b/lib/Command/Scan.php index 692a839a1..11f2ad0f7 100644 --- a/lib/Command/Scan.php +++ b/lib/Command/Scan.php @@ -46,7 +46,6 @@ protected function configure() { parent::configure(); } - /** @psalm-suppress UndefinedInterfaceMethod setUseTransactions is defined in private class */ protected function execute(InputInterface $input, OutputInterface $output) { $folderId = $input->getArgument('folder_id'); $all = $input->getOption('all'); diff --git a/lib/DAV/GroupFoldersHome.php b/lib/DAV/GroupFoldersHome.php index e72af6387..2e3c39559 100644 --- a/lib/DAV/GroupFoldersHome.php +++ b/lib/DAV/GroupFoldersHome.php @@ -77,7 +77,7 @@ private function getFolder(string $name): ?array { private function getDirectoryForFolder(array $folder): GroupFolderNode { $userHome = '/' . $this->user->getUID() . '/files'; $node = $this->rootFolder->get($userHome . '/' . $folder['mount_point']); - return new GroupFolderNode(Filesystem::getView($userHome), $node, $folder['folder_id']); + return new GroupFolderNode(Filesystem::getView(), $node, $folder['folder_id']); } public function getChild($name) { diff --git a/lib/Folder/FolderManager.php b/lib/Folder/FolderManager.php index a41b42353..7c7a7ab9b 100644 --- a/lib/Folder/FolderManager.php +++ b/lib/Folder/FolderManager.php @@ -7,6 +7,7 @@ namespace OCA\GroupFolders\Folder; use OC\Files\Cache\Cache; +use OC\Files\Cache\CacheEntry; use OC\Files\Node\Node; use OCA\Circles\CirclesManager; use OCA\Circles\CirclesQueryHelper; @@ -18,7 +19,6 @@ use OCP\DB\Exception; use OCP\DB\QueryBuilder\IQueryBuilder; use OCP\EventDispatcher\IEventDispatcher; -use OCP\Files\Cache\ICacheEntry; use OCP\Files\IMimeTypeLoader; use OCP\Files\IRootFolder; use OCP\IConfig; @@ -482,7 +482,7 @@ public function searchUsers(int $id, string $search = '', int $limit = 10, int $ /** * @param string $groupId * @param int $rootStorageId - * @return list + * @return list * @throws Exception */ public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): array { @@ -534,7 +534,7 @@ public function getFoldersForGroup(string $groupId, int $rootStorageId = 0): arr /** * @param string[] $groupIds * @param int $rootStorageId - * @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}[] + * @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}[] * @throws Exception */ public function getFoldersForGroups(array $groupIds, int $rootStorageId = 0): array { @@ -592,7 +592,7 @@ public function getFoldersForGroups(array $groupIds, int $rootStorageId = 0): ar /** * @param string[] $groupIds * @param int $rootStorageId - * @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?ICacheEntry}[] + * @return array{folder_id: int, mount_point: string, permissions: int, quota: int, acl: bool, rootCacheEntry: ?CacheEntry}[] * @throws Exception */ public function getFoldersFromCircleMemberships(IUser $user, int $rootStorageId = 0): array { @@ -877,7 +877,7 @@ public function setFolderACL(int $folderId, bool $acl): void { /** * @param IUser $user * @param int $rootStorageId - * @return list + * @return list * @throws Exception */ public function getFoldersForUser(IUser $user, int $rootStorageId = 0): array { diff --git a/lib/Mount/GroupFolderNoEncryptionStorage.php b/lib/Mount/GroupFolderNoEncryptionStorage.php index 9b1dbd18a..3cad1f7e6 100644 --- a/lib/Mount/GroupFolderNoEncryptionStorage.php +++ b/lib/Mount/GroupFolderNoEncryptionStorage.php @@ -10,5 +10,10 @@ use OCP\Files\Storage\IDisableEncryptionStorage; +/** + * @psalm-suppress UnimplementedInterfaceMethod + * Psalm gets confused about missing methods, but those are implemented in OC\Files\Storage\Wrapper\Wrapper, + * so this suppression is fine and necessary as there is nothing wrong. + */ class GroupFolderNoEncryptionStorage extends GroupFolderStorage implements IDisableEncryptionStorage { } diff --git a/lib/Mount/MountProvider.php b/lib/Mount/MountProvider.php index 5d34a1eb2..dff103d83 100644 --- a/lib/Mount/MountProvider.php +++ b/lib/Mount/MountProvider.php @@ -6,6 +6,7 @@ namespace OCA\GroupFolders\Mount; +use OC\Files\Cache\CacheEntry; use OC\Files\Storage\Wrapper\Jail; use OC\Files\Storage\Wrapper\PermissionsMask; use OCA\GroupFolders\ACL\ACLManager; @@ -102,7 +103,7 @@ private function getRootStorageId(): int { } /** - * @return list + * @return list */ public function getFoldersForUser(IUser $user): array { return $this->folderManager->getFoldersForUser($user, $this->getRootStorageId()); diff --git a/psalm.xml b/psalm.xml index dd2db04f9..d8f76d31e 100644 --- a/psalm.xml +++ b/psalm.xml @@ -14,7 +14,92 @@ findUnusedCode="false" > - + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + + @@ -30,39 +115,6 @@ - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - - diff --git a/tests/phpunit.xml b/tests/phpunit.xml index 6176d2ad1..9de3fd95d 100644 --- a/tests/phpunit.xml +++ b/tests/phpunit.xml @@ -19,6 +19,7 @@ . + ./stubs/ diff --git a/tests/psalm-baseline.xml b/tests/psalm-baseline.xml index 96f296ab5..5c064bb4b 100644 --- a/tests/psalm-baseline.xml +++ b/tests/psalm-baseline.xml @@ -1,8 +1,2 @@ - - - - - - - + diff --git a/tests/stub.phpstub b/tests/stub.phpstub deleted file mode 100644 index 7f68ac3eb..000000000 --- a/tests/stub.phpstub +++ /dev/null @@ -1,2324 +0,0 @@ - - * - * @license GNU AGPL version 3 or any later version - * - * This program is free software: you can redistribute it and/or modify - * it under the terms of the GNU Affero General Public License as - * published by the Free Software Foundation, either version 3 of the - * License, or (at your option) any later version. - * - * This program is distributed in the hope that it will be useful, - * but WITHOUT ANY WARRANTY; without even the implied warranty of - * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the - * GNU Affero General Public License for more details. - * - * You should have received a copy of the GNU Affero General Public License - * along with this program. If not, see . - * - */ - -namespace OCA\Files_Trashbin\Trash { - /** - * @since 15.0.0 - */ - interface ITrashBackend - { - /** - * List all trash items in the root of the trashbin - * - * @return ITrashItem[] - * @since 15.0.0 - */ - public function listTrashRoot(\OCP\IUser $user) : array; - /** - * List all trash items in a subfolder in the trashbin - * - * @return ITrashItem[] - * @since 15.0.0 - */ - public function listTrashFolder(\OCA\Files_Trashbin\Trash\ITrashItem $folder) : array; - /** - * Restore a trashbin item - * - * @since 15.0.0 - */ - public function restoreItem(\OCA\Files_Trashbin\Trash\ITrashItem $item); - /** - * Permanently remove an item from trash - * - * @param ITrashItem $item - * @since 15.0.0 - */ - public function removeItem(\OCA\Files_Trashbin\Trash\ITrashItem $item); - /** - * Move a file or folder to trash - * - * @param string $internalPath - * @return bool whether or not the file was moved to trash, if false then the file should be deleted normally - * @since 15.0.0 - */ - public function moveToTrash(\OCP\Files\Storage\IStorage $storage, string $internalPath) : bool; - /** - * @param int $fileId - * @return \OCP\Files\Node|null - */ - public function getTrashNodeById(\OCP\IUser $user, int $fileId); - } - interface ITrashManager extends \OCA\Files_Trashbin\Trash\ITrashBackend - { - /** - * Add a backend for the trashbin - * - * @param string $storageType - * @param ITrashBackend $backend - * @since 15.0.0 - */ - public function registerBackend(string $storageType, \OCA\Files_Trashbin\Trash\ITrashBackend $backend); - /** - * List all trash items in the root of the trashbin - * - * @return ITrashItem[] - * @since 15.0.0 - */ - public function listTrashRoot(\OCP\IUser $user) : array; - /** - * Temporally prevent files from being moved to the trash - * - * @since 15.0.0 - */ - public function pauseTrash(); - /** - * @since 15.0.0 - */ - public function resumeTrash(); - } - /** - * @since 15.0.0 - */ - interface ITrashItem extends \OCP\Files\FileInfo - { - /** - * Get the trash backend for this item - * - * @since 15.0.0 - */ - public function getTrashBackend() : \OCA\Files_Trashbin\Trash\ITrashBackend; - /** - * Get the original location for the trash item - * - * @since 15.0.0 - */ - public function getOriginalLocation() : string; - /** - * Get the timestamp that the file was moved to trash - * - * @since 15.0.0 - */ - public function getDeletedTime() : int; - /** - * Get the path of the item relative to the users trashbin - * - * @since 15.0.0 - */ - public function getTrashPath() : string; - /** - * Whether the item is a deleted item in the root of the trash, or a file in a subfolder - * - * @since 15.0.0 - */ - public function isRootItem() : bool; - /** - * Get the user for which this trash item applies - * - * @since 15.0.0 - */ - public function getUser() : \OCP\IUser; - /** - * @since 30.0.0 - */ - public function getDeletedBy() : ?\OCP\IUser; - public function getTitle() : string; - } - class TrashItem implements \OCA\Files_Trashbin\Trash\ITrashItem - { - public function __construct(private \OCA\Files_Trashbin\Trash\ITrashBackend $backend, private string $originalLocation, private int $deletedTime, private string $trashPath, private \OCP\Files\FileInfo $fileInfo, private \OCP\IUser $user, private ?\OCP\IUser $deletedBy) - { - } - public function getTrashBackend() : \OCA\Files_Trashbin\Trash\ITrashBackend - { - } - public function getOriginalLocation() : string - { - } - public function getDeletedTime() : int - { - } - public function getTrashPath() : string - { - } - public function isRootItem() : bool - { - } - public function getUser() : \OCP\IUser - { - } - public function getEtag() - { - } - public function getSize($includeMounts = true) - { - } - public function getMtime() - { - } - public function getName() - { - } - public function getInternalPath() - { - } - public function getPath() - { - } - public function getMimetype() - { - } - public function getMimePart() - { - } - public function getStorage() - { - } - public function getId() - { - } - public function isEncrypted() - { - } - public function getPermissions() - { - } - public function getType() - { - } - public function isReadable() - { - } - public function isUpdateable() - { - } - public function isCreatable() - { - } - public function isDeletable() - { - } - public function isShareable() - { - } - public function isShared() - { - } - public function isMounted() - { - } - public function getMountPoint() - { - } - public function getOwner() - { - } - public function getChecksum() - { - } - public function getExtension() : string - { - } - public function getTitle() : string - { - } - public function getCreationTime() : int - { - } - public function getUploadTime() : int - { - } - public function getParentId() : int - { - } - public function getDeletedBy() : ?\OCP\IUser - { - } - /** - * @inheritDoc - * @return array - */ - public function getMetadata() : array - { - } - } -} - -namespace OCA\Files\Event { - /** - * This event is triggered when the files app is rendered. - * It can be used to add additional scripts to the files app. - * - * @since 17.0.0 - */ - class LoadAdditionalScriptsEvent extends \OCP\EventDispatcher\Event - { - private $hiddenFields = []; - public function addHiddenField(string $name, string $value) : void - { - } - public function getHiddenFields() : array - { - } - } -} - -namespace OCA\Files_Sharing\Event { - /** - * Emitted before the rendering step of the public share page happens. The event - * holds a flag that specifies if it is the authentication page of a public share. - * - * @since 20.0.0 - */ - class BeforeTemplateRenderedEvent extends \OCP\EventDispatcher\Event - { - /** - * @since 20.0.0 - */ - public const SCOPE_PUBLIC_SHARE_AUTH = 'publicShareAuth'; - /** @var IShare */ - private $share; - /** @var string|null */ - private $scope; - /** - * @since 20.0.0 - */ - public function __construct(\OCP\Share\IShare $share, ?string $scope = null) - { - } - /** - * @since 20.0.0 - */ - public function getShare() : \OCP\Share\IShare - { - } - /** - * @since 20.0.0 - */ - public function getScope() : ?string - { - } - } -} - - -namespace OCA\Files_Trashbin { - class Expiration - { - // how long do we keep files in the trash bin if no other value is defined in the config file (unit: days) - public const DEFAULT_RETENTION_OBLIGATION = 30; - public const NO_OBLIGATION = -1; - public function __construct(\OCP\IConfig $config, \OCP\AppFramework\Utility\ITimeFactory $timeFactory) - { - } - public function setRetentionObligation(string $obligation) - { - } - /** - * Is trashbin expiration enabled - * @return bool - */ - public function isEnabled() - { - } - /** - * Check if given timestamp in expiration range - * @param int $timestamp - * @param bool $quotaExceeded - * @return bool - */ - public function isExpired($timestamp, $quotaExceeded = false) - { - } - /** - * @return bool|int - */ - public function getMaxAgeAsTimestamp() - { - } - private function parseRetentionObligation() - { - } - } -} - -namespace OCA\Files_Versions\Versions { - use OCP\Files\File; - use OCP\Files\FileInfo; - use OCP\Files\NotFoundException; - use OCP\Files\Storage\IStorage; - use OCP\IUser; - use OCP\Files\Node; - - - /** - * @since 15.0.0 - */ - interface IVersionBackend - { - /** - * Whether or not this version backend should be used for a storage - * - * If false is returned then the next applicable backend will be used - * - * @param IStorage $storage - * @return bool - * @since 17.0.0 - */ - public function useBackendForStorage(\OCP\Files\Storage\IStorage $storage) : bool; - /** - * Get all versions for a file - * - * @param IUser $user - * @param FileInfo $file - * @return IVersion[] - * @since 15.0.0 - */ - public function getVersionsForFile(\OCP\IUser $user, \OCP\Files\FileInfo $file) : array; - /** - * Create a new version for a file - * - * @param IUser $user - * @param FileInfo $file - * @since 15.0.0 - */ - public function createVersion(\OCP\IUser $user, \OCP\Files\FileInfo $file); - /** - * Restore this version - * - * @param IVersion $version - * @since 15.0.0 - */ - public function rollback(\OCA\Files_Versions\Versions\IVersion $version); - /** - * Open the file for reading - * - * @param IVersion $version - * @return resource|false - * @throws NotFoundException - * @since 15.0.0 - */ - public function read(\OCA\Files_Versions\Versions\IVersion $version); - /** - * Get the preview for a specific version of a file - * - * @param IUser $user - * @param FileInfo $sourceFile - * @param int|string $revision - * - * @return File - * - * @since 15.0.0 - */ - public function getVersionFile(\OCP\IUser $user, \OCP\Files\FileInfo $sourceFile, $revision) : \OCP\Files\File; - } - - interface IMetadataVersionBackend { - public function setMetadataValue(Node $node, int $revision, string $key, string $value): void; - } - - interface IDeletableVersionBackend { - public function deleteVersion(IVersion $version): void; - } - - interface INeedSyncVersionBackend { - public function createVersionEntity(File $file): void; - public function updateVersionEntity(File $sourceFile, int $revision, array $properties): void; - public function deleteVersionsEntity(File $file): void; - } - - interface IVersion { - public function getBackend(): IVersionBackend; - - public function getSourceFile(): FileInfo; - - /** - * @return int|string - */ - public function getRevisionId(); - - public function getTimestamp(): int; - - public function getSize(): int; - - public function getSourceFileName(): string; - - public function getMimeType(): string; - - public function getVersionPath(): string; - - public function getUser(): IUser; - } - - /** - * @since 29.0.0 - */ - interface IVersionsImporterBackend { - /** - * Import the given versions for the target file. - * - * @param Node $target - The target is not yet created. - * @param IVersion[] $versions - * @since 29.0.0 - */ - public function importVersionsForFile(IUser $user, Node $source, Node $target, array $versions): void; - - /** - * Clear all versions for a file - * - * @since 29.0.0 - */ - public function clearVersionsForFile(IUser $user, Node $source, Node $target): void; - } - - /** - * This interface allows for just direct accessing of the metadata column JSON - * @since 29.0.0 - */ - interface IMetadataVersion { - /** - * retrieves the all the metadata - * - * @return string[] - * @since 29.0.0 - */ - public function getMetadata(): array; - - /** - * retrieves the metadata value from our $key param - * - * @param string $key the key for the json value of the metadata column - * @since 29.0.0 - */ - public function getMetadataValue(string $key): ?string; - } - - class Version implements IVersion { - public function __construct( - int $timestamp, - $revisionId, - string $name, - int $size, - string $mimetype, - string $path, - FileInfo $sourceFileInfo, - IVersionBackend $backend, - IUser $user, - array $metadata = [], - ) { - } - - public function getBackend(): IVersionBackend { - throw new \Exception('stub'); - } - - public function getSourceFile(): FileInfo { - throw new \Exception('stub'); - } - - public function getRevisionId() { - throw new \Exception('stub'); - } - - public function getTimestamp(): int { - throw new \Exception('stub'); - } - - public function getSize(): int { - throw new \Exception('stub'); - } - - public function getSourceFileName(): string { - throw new \Exception('stub'); - } - - public function getMimeType(): string { - throw new \Exception('stub'); - } - - public function getVersionPath(): string { - throw new \Exception('stub'); - } - - public function getUser(): IUser { - throw new \Exception('stub'); - } - - public function getMetadataValue(string $key): ?string { - return $this->metadata[$key] ?? null; - } - } -} - -namespace OCA\Files_Versions { - class Expiration { - // how long do we keep files a version if no other value is defined in the config file (unit: days) - public const NO_OBLIGATION = -1; - /** @return bool */ - public function isEnabled() {} - - public function shouldAutoExpire() { } - - /** - * @param int $timestamp - * @param bool $quotaExceeded - * @return bool - */ - public function isExpired($timestamp, $quotaExceeded = false) {} - - /** @return int */ - public function getMaxAgeAsTimestamp() {} - } -} - -namespace { - - use OCP\IServerContainer; - - class OC { - static $CLI = false; - /** @var IServerContainer */ - static $server; - } -} - -namespace OC\Files\Node { - use OCP\Files\FileInfo; - abstract class Node implements \OCP\Files\Node { - /** @return FileInfo|\ArrayAccess */ - public function getFileInfo() {} - - /** @return \OCP\Files\Mount\IMountPoint */ - public function getMountPoint() {} - } - - class LazyFolder implements \OCP\Files\Folder { - public function __construct(\OCP\Files\IRootFolder $rootFolder, \Closure $folderClosure, array $data = []) { - } - } -} - -namespace OC\Hooks { - class Emitter { - public function emit(string $class, string $value, array $option) {} - /** Closure $closure */ - public function listen(string $class, string $value, $closure) {} - } - class BasicEmitter extends Emitter { - } -} - -namespace OC\Cache { - class CappedMemoryCache { - public function get($key) {} - public function set($key, $value, $ttl = '') {} - } -} - -namespace OC\Core\Command { - use Symfony\Component\Console\Input\InputInterface; - use Symfony\Component\Console\Output\OutputInterface; - class Base { - public const OUTPUT_FORMAT_PLAIN = 'plain'; - public const OUTPUT_FORMAT_JSON = 'json'; - public const OUTPUT_FORMAT_JSON_PRETTY = 'json_pretty'; - - public function __construct() {} - protected function configure() {} - public function run(InputInterface $input, OutputInterface $output) {} - public function setName(string $name) {} - public function getHelper(string $name) {} - protected function writeArrayInOutputFormat(InputInterface $input, OutputInterface $output, $items, $prefix = ' - ') { - } - } -} - -namespace OC\Files\ObjectStore { - use OC\Files\Cache\Scanner; - class ObjectStoreScanner extends Scanner {} -} - -namespace Symfony\Component\Console\Helper { - use Symfony\Component\Console\Output\OutputInterface; - class Table { - public function __construct(OutputInterface $text) {} - public function setHeaders(array $header) {} - public function setRows(array $rows) {} - public function render() {} - } -} - -namespace Symfony\Component\Console\Input { - class InputInterface { - public function getOption(string $key) {} - public function getArgument(string $key) {} - } - class InputArgument { - const REQUIRED = 0; - const OPTIONAL = 1; - const IS_ARRAY = 1; - } - class InputOption { - const VALUE_NONE = 1; - const VALUE_REQUIRED = 1; - } -} - -namespace Symfony\Component\Console\Question { - class ConfirmationQuestion { - public function __construct(string $text, bool $default) {} - } -} - -namespace Symfony\Component\Console\Output { - class OutputInterface { - public const VERBOSITY_VERBOSE = 1; - public function writeln(string $text, int $flat = 0) {} - } -} - -namespace OC\Files\Cache { - use OCP\Files\Cache\ICache; - use OCP\Files\Cache\IScanner; - use OCP\Files\Cache\ICacheEntry; - use OCP\Files\Search\ISearchQuery; - use OCP\Files\Search\ISearchOperator; - use OCP\Files\Search\ISearchQuery; - use OCP\Files\IMimeTypeLoader; - use OCP\Files\Storage\IStorage; - - class Cache implements ICache { - /** - * @param \OCP\Files\Cache\ICache $cache - */ - public function __construct($cache) { - $this->cache = $cache; - } - public function getNumericStorageId() { } - public function get() { } - public function getIncomplete() {} - public function getPathById($id) {} - public function getAll() {} - public function get($file) {} - public function getFolderContents($folder) {} - public function getFolderContentsById($fileId) {} - public function put($file, array $data) {} - public function insert($file, array $data) {} - public function update($id, array $data) {} - public function getId($file) {} - public function getParentId($file) {} - public function inCache($file) {} - public function remove($file) {} - public function move($source, $target) {} - public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) {} - public function clear() {} - public function getStatus($file) {} - public function search($pattern) {} - public function searchByMime($mimetype) {} - public function searchQuery(ISearchQuery $query) {} - public function correctFolderSize($path, $data = null, $isBackgroundScan = false) {} - public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int {} - public function normalize($path) {} - public function getQueryFilterForStorage(): ISearchOperator {} - public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry {} - public static function cacheEntryFromData($data, IMimeTypeLoader $mimetypeLoader): ICacheEntry {} - } - - class Scanner implements IScanner { - public function __construct(IStorage $storage) {} - } -} - -namespace OC\Files\Cache\Wrapper { - use OC\Files\Cache\Cache; - use OCP\Files\Cache\ICache; - - class CacheWrapper extends Cache { - public function getCache(): Cache {} - } - - class CacheJail extends CacheWrapper { - public function __construct(?ICache $cache, string $root, ?CacheDependencies $dependencies = null) {} - } -} - -namespace OC\Files { - use OCP\Files\Cache\ICacheEntry; - use OCP\Files\Mount\IMountPoint; - use OCP\IUser; - - class Filesystem { - public static function addStorageWrapper(string $wrapperName, callable $wrapper, int $priority = 50) { - } - - public static function getView(string $root): View { - } - } - - class FileInfo implements \OCP\Files\FileInfo { - /** - * @param string|boolean $path - * @param \OCP\Files\Storage\IStorage $storage - * @param string $internalPath - * @param array|ICacheEntry $data - * @param \OCP\Files\Mount\IMountPoint $mount - * @param \OCP\IUser|null $owner - */ - public function __construct($path, $storage, $internalPath, $data, $mount, $owner = null) {} - } - class View { - public function __construct(string $path) {} - public function unlink($path) {} - } -} - -namespace OC\User { - use OCP\EventDispatcher\IEventDispatcher; - use OCP\IUser; - use OCP\UserInterface; - - class User implements IUser { - public function __construct(string $uid, ?UserInterface $backend, IEventDispatcher $dispatcher, $emitter = null, IConfig $config = null, $urlGenerator = null) {} - } -} - -namespace OCA\DAV\Upload { - - use Sabre\DAV\File; - - abstract class FutureFile extends File {} -} - -namespace OCA\DAV\Connector\Sabre { - - class Node { - public function getFileInfo(): \OCP\Files\FileInfo {} - } -} - -namespace OCA\DAV\Connector\Sabre { - - use OCP\Files\FileInfo; - - class Principal {} - - class Directory extends \Sabre\DAV\Node { - - - public function __construct(\OC\Files\View $view, FileInfo $info) { - } - - function getChild(string $name): \Sabre\DAV\Node { - } - public function delete() { - } - public function getLastModified() { - } - public function setName($name) { - } - public function getName() { - } - public function getFileInfo(): FileInfo { - } - } -} - -namespace OC\BackgroundJob { - - use OCP\BackgroundJob\IJob; - use OCP\BackgroundJob\IJobList; - use OCP\ILogger; - - abstract class TimedJob implements IJob { - public function execute(IJobList $jobList, ILogger $logger = null) { - } - - abstract protected function run($argument); - - public function setId(int $id) { - } - - public function setLastRun(int $lastRun) { - } - - public function setArgument($argument) { - } - - public function getId() { - } - - public function getLastRun() { - } - - public function getArgument() { - } - } -} - -namespace OC\Files\Mount { - use OC\Files\Filesystem; - use OC\Files\Storage\Storage; - use OC\Files\Storage\StorageFactory; - use OCP\Files\Mount\IMountPoint; - - class MountPoint implements IMountPoint { - /** - * @var \OCP\Files\Storage\IStorage $storage - */ - protected $storage = null; - protected $class; - protected $storageId; - protected $rootId = null; - - /** @var int|null */ - protected $mountId; - - /** - * @param string|\OCP\Files\Storage\IStorage $storage - * @param string $mountpoint - * @param array $arguments (optional) configuration for the storage backend - * @param \OCP\Files\Storage\IStorageFactory $loader - * @param array $mountOptions mount specific options - * @param int|null $mountId - * @throws \Exception - */ - public function __construct($storage, $mountpoint, $arguments = null, $loader = null, $mountOptions = null, $mountId = null, string $mountProvider = null) { - throw new \Exception('stub'); - } - - /** - * get complete path to the mount point, relative to data/ - * - * @return string - */ - public function getMountPoint() { - throw new \Exception('stub'); - } - - /** - * Sets the mount point path, relative to data/ - * - * @param string $mountPoint new mount point - */ - public function setMountPoint($mountPoint) { - throw new \Exception('stub'); - } - - /** - * @return \OCP\Files\Storage\IStorage - */ - public function getStorage() { - throw new \Exception('stub'); - } - - /** - * @return string - */ - public function getStorageId() { - throw new \Exception('stub'); - } - - /** - * @return int - */ - public function getNumericStorageId() { - throw new \Exception('stub'); - } - - /** - * @param string $path - * @return string - */ - public function getInternalPath($path) { - throw new \Exception('stub'); - } - - /** - * @param callable $wrapper - */ - public function wrapStorage($wrapper) { - throw new \Exception('stub'); - } - - /** - * Get a mount option - * - * @param string $name Name of the mount option to get - * @param mixed $default Default value for the mount option - * @return mixed - */ - public function getOption($name, $default) { - throw new \Exception('stub'); - } - - /** - * Get all options for the mount - * - * @return array - */ - public function getOptions() { - throw new \Exception('stub'); - } - - /** - * @return int - */ - public function getStorageRootId() { - throw new \Exception('stub'); - } - - public function getMountId() { - throw new \Exception('stub'); - } - - public function getMountType() { - throw new \Exception('stub'); - } - - public function getMountProvider(): string { - throw new \Exception('stub'); - } - } -} - -namespace OC\Files\Storage { - /** - * Provide a common interface to all different storage options - * - * All paths passed to the storage are relative to the storage and should NOT have a leading slash. - */ - interface Storage extends \OCP\Files\Storage - { - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ - public function getCache($path = '', $storage = null); - /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner - */ - public function getScanner($path = '', $storage = null); - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path); - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ - public function getWatcher($path = '', $storage = null); - /** - * get a propagator instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Propagator - */ - public function getPropagator($storage = null); - /** - * get a updater instance for the cache - * - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Updater - */ - public function getUpdater($storage = null); - /** - * @return \OC\Files\Cache\Storage - */ - public function getStorageCache(); - /** - * @param string $path - * @return array|null - */ - public function getMetaData($path); - /** - * @param string $path The path of the file to acquire the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function acquireLock($path, $type, \OCP\Lock\ILockingProvider $provider); - /** - * @param string $path The path of the file to release the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function releaseLock($path, $type, \OCP\Lock\ILockingProvider $provider); - /** - * @param string $path The path of the file to change the lock for - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function changeLock($path, $type, \OCP\Lock\ILockingProvider $provider); - /** - * Get the contents of a directory with metadata - * - * @param string $directory - * @return \Traversable an iterator, containing file metadata - * - * The metadata array will contain the following fields - * - * - name - * - mimetype - * - mtime - * - size - * - etag - * - storage_mtime - * - permissions - */ - public function getDirectoryContent($directory) : \Traversable; - } -} - -namespace OC\Files\Storage\Wrapper{ - use OCP\Files\Storage\IStorage; - - class Wrapper implements \OC\Files\Storage\Storage, \OCP\Files\Storage\ILockingStorage, \OCP\Files\Storage\IWriteStreamStorage - { - /** - * @var \OC\Files\Storage\Storage $storage - */ - protected $storage; - public $cache; - public $scanner; - public $watcher; - public $propagator; - public $updater; - /** - * @param array $parameters - */ - public function __construct($parameters) - { - } - /** - * @return \OC\Files\Storage\Storage - */ - public function getWrapperStorage() - { - } - /** - * Get the identifier for the storage, - * the returned id should be the same for every storage object that is created with the same parameters - * and two storage objects with the same id should refer to two storages that display the same files. - * - * @return string - */ - public function getId() - { - } - /** - * see https://www.php.net/manual/en/function.mkdir.php - * - * @param string $path - * @return bool - */ - public function mkdir($path) - { - } - /** - * see https://www.php.net/manual/en/function.rmdir.php - * - * @param string $path - * @return bool - */ - public function rmdir($path) - { - } - /** - * see https://www.php.net/manual/en/function.opendir.php - * - * @param string $path - * @return resource|false - */ - public function opendir($path) - { - } - /** - * see https://www.php.net/manual/en/function.is_dir.php - * - * @param string $path - * @return bool - */ - public function is_dir($path) - { - } - /** - * see https://www.php.net/manual/en/function.is_file.php - * - * @param string $path - * @return bool - */ - public function is_file($path) - { - } - /** - * see https://www.php.net/manual/en/function.stat.php - * only the following keys are required in the result: size and mtime - * - * @param string $path - * @return array|bool - */ - public function stat($path) - { - } - /** - * see https://www.php.net/manual/en/function.filetype.php - * - * @param string $path - * @return string|bool - */ - public function filetype($path) - { - } - /** - * see https://www.php.net/manual/en/function.filesize.php - * The result for filesize when called on a folder is required to be 0 - */ - public function filesize($path) : false|int|float - { - } - /** - * check if a file can be created in $path - * - * @param string $path - * @return bool - */ - public function isCreatable($path) - { - } - /** - * check if a file can be read - * - * @param string $path - * @return bool - */ - public function isReadable($path) - { - } - /** - * check if a file can be written to - * - * @param string $path - * @return bool - */ - public function isUpdatable($path) - { - } - /** - * check if a file can be deleted - * - * @param string $path - * @return bool - */ - public function isDeletable($path) - { - } - /** - * check if a file can be shared - * - * @param string $path - * @return bool - */ - public function isSharable($path) - { - } - /** - * get the full permissions of a path. - * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php - * - * @param string $path - * @return int - */ - public function getPermissions($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_exists.php - * - * @param string $path - * @return bool - */ - public function file_exists($path) - { - } - /** - * see https://www.php.net/manual/en/function.filemtime.php - * - * @param string $path - * @return int|bool - */ - public function filemtime($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_get_contents.php - * - * @param string $path - * @return string|false - */ - public function file_get_contents($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_put_contents.php - * - * @param string $path - * @param mixed $data - * @return int|float|false - */ - public function file_put_contents($path, $data) - { - } - /** - * see https://www.php.net/manual/en/function.unlink.php - * - * @param string $path - * @return bool - */ - public function unlink($path) - { - } - /** - * see https://www.php.net/manual/en/function.rename.php - * - * @param string $source - * @param string $target - * @return bool - */ - public function rename($source, $target) - { - } - /** - * see https://www.php.net/manual/en/function.copy.php - * - * @param string $source - * @param string $target - * @return bool - */ - public function copy($source, $target) - { - } - /** - * see https://www.php.net/manual/en/function.fopen.php - * - * @param string $path - * @param string $mode - * @return resource|bool - */ - public function fopen($path, $mode) - { - } - /** - * get the mimetype for a file or folder - * The mimetype for a folder is required to be "httpd/unix-directory" - * - * @param string $path - * @return string|bool - */ - public function getMimeType($path) - { - } - /** - * see https://www.php.net/manual/en/function.hash.php - * - * @param string $type - * @param string $path - * @param bool $raw - * @return string|bool - */ - public function hash($type, $path, $raw = false) - { - } - /** - * see https://www.php.net/manual/en/function.free_space.php - * - * @param string $path - * @return int|float|bool - */ - public function free_space($path) - { - } - /** - * search for occurrences of $query in file names - * - * @param string $query - * @return array|bool - */ - public function search($query) - { - } - /** - * see https://www.php.net/manual/en/function.touch.php - * If the backend does not support the operation, false should be returned - * - * @param string $path - * @param int $mtime - * @return bool - */ - public function touch($path, $mtime = null) - { - } - /** - * get the path to a local version of the file. - * The local version of the file can be temporary and doesn't have to be persistent across requests - * - * @param string $path - * @return string|false - */ - public function getLocalFile($path) - { - } - /** - * check if a file or folder has been updated since $time - * - * @param string $path - * @param int $time - * @return bool - * - * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. - * returning true for other changes in the folder is optional - */ - public function hasUpdated($path, $time) - { - } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ - public function getCache($path = '', $storage = null) - { - } - /** - * get a scanner instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the scanner - * @return \OC\Files\Cache\Scanner - */ - public function getScanner($path = '', $storage = null) - { - } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) - { - } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ - public function getWatcher($path = '', $storage = null) - { - } - public function getPropagator($storage = null) - { - } - public function getUpdater($storage = null) - { - } - /** - * @return \OC\Files\Cache\Storage - */ - public function getStorageCache() - { - } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ - public function getETag($path) - { - } - /** - * Returns true - * - * @return true - */ - public function test() - { - } - /** - * Returns the wrapped storage's value for isLocal() - * - * @return bool wrapped storage's isLocal() value - */ - public function isLocal() - { - } - /** - * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class - * - * @param class-string $class - * @return bool - */ - public function instanceOfStorage($class) - { - } - /** - * @psalm-template T of IStorage - * @psalm-param class-string $class - * @psalm-return T|null - */ - public function getInstanceOfStorage(string $class) - { - } - /** - * Pass any methods custom to specific storage implementations to the wrapped storage - * - * @param string $method - * @param array $args - * @return mixed - */ - public function __call($method, $args) - { - } - /** - * A custom storage implementation can return an url for direct download of a give file. - * - * For now the returned array can hold the parameter url - in future more attributes might follow. - * - * @param string $path - * @return array|bool - */ - public function getDirectDownload($path) - { - } - /** - * Get availability of the storage - * - * @return array [ available, last_checked ] - */ - public function getAvailability() - { - } - /** - * Set availability of the storage - * - * @param bool $isAvailable - */ - public function setAvailability($isAvailable) - { - } - /** - * @param string $path the path of the target folder - * @param string $fileName the name of the file itself - * @return void - * @throws InvalidPathException - */ - public function verifyPath($path, $fileName) - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function copyFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function moveFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - public function getMetaData($path) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function acquireLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ - public function releaseLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ - public function changeLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * @return bool - */ - public function needsPartFile() - { - } - public function writeStream(string $path, $stream, ?int $size = null) : int - { - } - public function getDirectoryContent($directory) : \Traversable - { - } - public function isWrapperOf(\OCP\Files\Storage\IStorage $storage) - { - } - public function setOwner(?string $user) : void - { - } - } - /** - * Jail to a subdirectory of the wrapped storage - * - * This restricts access to a subfolder of the wrapped storage with the subfolder becoming the root folder new storage - */ - class Jail extends \OC\Files\Storage\Wrapper\Wrapper - { - /** - * @var string - */ - protected $rootPath; - /** - * @param array $arguments ['storage' => $storage, 'root' => $root] - * - * $storage: The storage that will be wrapper - * $root: The folder in the wrapped storage that will become the root folder of the wrapped storage - */ - public function __construct($arguments) - { - } - public function getUnjailedPath($path) - { - } - /** - * This is separate from Wrapper::getWrapperStorage so we can get the jailed storage consistently even if the jail is inside another wrapper - */ - public function getUnjailedStorage() - { - } - public function getJailedPath($path) - { - } - public function getId() - { - } - /** - * see https://www.php.net/manual/en/function.mkdir.php - * - * @param string $path - * @return bool - */ - public function mkdir($path) - { - } - /** - * see https://www.php.net/manual/en/function.rmdir.php - * - * @param string $path - * @return bool - */ - public function rmdir($path) - { - } - /** - * see https://www.php.net/manual/en/function.opendir.php - * - * @param string $path - * @return resource|false - */ - public function opendir($path) - { - } - /** - * see https://www.php.net/manual/en/function.is_dir.php - * - * @param string $path - * @return bool - */ - public function is_dir($path) - { - } - /** - * see https://www.php.net/manual/en/function.is_file.php - * - * @param string $path - * @return bool - */ - public function is_file($path) - { - } - /** - * see https://www.php.net/manual/en/function.stat.php - * only the following keys are required in the result: size and mtime - * - * @param string $path - * @return array|bool - */ - public function stat($path) - { - } - /** - * see https://www.php.net/manual/en/function.filetype.php - * - * @param string $path - * @return bool - */ - public function filetype($path) - { - } - /** - * see https://www.php.net/manual/en/function.filesize.php - * The result for filesize when called on a folder is required to be 0 - */ - public function filesize($path) : false|int|float - { - } - /** - * check if a file can be created in $path - * - * @param string $path - * @return bool - */ - public function isCreatable($path) - { - } - /** - * check if a file can be read - * - * @param string $path - * @return bool - */ - public function isReadable($path) - { - } - /** - * check if a file can be written to - * - * @param string $path - * @return bool - */ - public function isUpdatable($path) - { - } - /** - * check if a file can be deleted - * - * @param string $path - * @return bool - */ - public function isDeletable($path) - { - } - /** - * check if a file can be shared - * - * @param string $path - * @return bool - */ - public function isSharable($path) - { - } - /** - * get the full permissions of a path. - * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php - * - * @param string $path - * @return int - */ - public function getPermissions($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_exists.php - * - * @param string $path - * @return bool - */ - public function file_exists($path) - { - } - /** - * see https://www.php.net/manual/en/function.filemtime.php - * - * @param string $path - * @return int|bool - */ - public function filemtime($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_get_contents.php - * - * @param string $path - * @return string|false - */ - public function file_get_contents($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_put_contents.php - * - * @param string $path - * @param mixed $data - * @return int|float|false - */ - public function file_put_contents($path, $data) - { - } - /** - * see https://www.php.net/manual/en/function.unlink.php - * - * @param string $path - * @return bool - */ - public function unlink($path) - { - } - /** - * see https://www.php.net/manual/en/function.rename.php - * - * @param string $source - * @param string $target - * @return bool - */ - public function rename($source, $target) - { - } - /** - * see https://www.php.net/manual/en/function.copy.php - * - * @param string $source - * @param string $target - * @return bool - */ - public function copy($source, $target) - { - } - /** - * see https://www.php.net/manual/en/function.fopen.php - * - * @param string $path - * @param string $mode - * @return resource|bool - */ - public function fopen($path, $mode) - { - } - /** - * get the mimetype for a file or folder - * The mimetype for a folder is required to be "httpd/unix-directory" - * - * @param string $path - * @return string|bool - */ - public function getMimeType($path) - { - } - /** - * see https://www.php.net/manual/en/function.hash.php - * - * @param string $type - * @param string $path - * @param bool $raw - * @return string|bool - */ - public function hash($type, $path, $raw = false) - { - } - /** - * see https://www.php.net/manual/en/function.free_space.php - * - * @param string $path - * @return int|float|bool - */ - public function free_space($path) - { - } - /** - * search for occurrences of $query in file names - * - * @param string $query - * @return array|bool - */ - public function search($query) - { - } - /** - * see https://www.php.net/manual/en/function.touch.php - * If the backend does not support the operation, false should be returned - * - * @param string $path - * @param int $mtime - * @return bool - */ - public function touch($path, $mtime = null) - { - } - /** - * get the path to a local version of the file. - * The local version of the file can be temporary and doesn't have to be persistent across requests - * - * @param string $path - * @return string|false - */ - public function getLocalFile($path) - { - } - /** - * check if a file or folder has been updated since $time - * - * @param string $path - * @param int $time - * @return bool - * - * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. - * returning true for other changes in the folder is optional - */ - public function hasUpdated($path, $time) - { - } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ - public function getCache($path = '', $storage = null) - { - } - /** - * get the user id of the owner of a file or folder - * - * @param string $path - * @return string - */ - public function getOwner($path) - { - } - /** - * get a watcher instance for the cache - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher - * @return \OC\Files\Cache\Watcher - */ - public function getWatcher($path = '', $storage = null) - { - } - /** - * get the ETag for a file or folder - * - * @param string $path - * @return string|false - */ - public function getETag($path) - { - } - public function getMetaData($path) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - * @throws \OCP\Lock\LockedException - */ - public function acquireLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ - public function releaseLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * @param string $path - * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE - * @param \OCP\Lock\ILockingProvider $provider - */ - public function changeLock($path, $type, \OCP\Lock\ILockingProvider $provider) - { - } - /** - * Resolve the path for the source of the share - * - * @param string $path - * @return array - */ - public function resolvePath($path) - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function copyFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function moveFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - public function getPropagator($storage = null) - { - } - public function writeStream(string $path, $stream, ?int $size = null) : int - { - } - public function getDirectoryContent($directory) : \Traversable - { - } - } - class Quota extends \OC\Files\Storage\Wrapper\Wrapper - { - /** @var callable|null */ - protected $quotaCallback; - /** @var int|float|null int on 64bits, float on 32bits for bigint */ - protected int|float|null $quota; - protected string $sizeRoot; - private \OC\SystemConfig $config; - private bool $quotaIncludeExternalStorage; - /** - * @param array $parameters - */ - public function __construct($parameters) - { - } - /** - * @return int|float quota value - */ - public function getQuota() : int|float - { - } - private function hasQuota() : bool - { - } - /** - * @param string $path - * @param IStorage $storage - * @return int|float - */ - protected function getSize($path, $storage = null) - { - } - /** - * Get free space as limited by the quota - * - * @param string $path - * @return int|float|bool - */ - public function free_space($path) - { - } - /** - * see https://www.php.net/manual/en/function.file_put_contents.php - * - * @param string $path - * @param mixed $data - * @return int|float|false - */ - public function file_put_contents($path, $data) - { - } - /** - * see https://www.php.net/manual/en/function.copy.php - * - * @param string $source - * @param string $target - * @return bool - */ - public function copy($source, $target) - { - } - /** - * see https://www.php.net/manual/en/function.fopen.php - * - * @param string $path - * @param string $mode - * @return resource|bool - */ - public function fopen($path, $mode) - { - } - /** - * Checks whether the given path is a part file - * - * @param string $path Path that may identify a .part file - * @return bool - * @note this is needed for reusing keys - */ - private function isPartFile($path) - { - } - /** - * Only apply quota for files, not metadata, trash or others - */ - private function shouldApplyQuota(string $path) : bool - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function copyFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - /** - * @param IStorage $sourceStorage - * @param string $sourceInternalPath - * @param string $targetInternalPath - * @return bool - */ - public function moveFromStorage(\OCP\Files\Storage\IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) - { - } - public function mkdir($path) - { - } - public function touch($path, $mtime = null) - { - } - } - /** - * Mask the permissions of a storage - * - * This can be used to restrict update, create, delete and/or share permissions of a storage - * - * Note that the read permissions can't be masked - */ - class PermissionsMask extends \OC\Files\Storage\Wrapper\Wrapper - { - /** - * @var int the permissions bits we want to keep - */ - private $mask; - /** - * @param array $arguments ['storage' => $storage, 'mask' => $mask] - * - * $storage: The storage the permissions mask should be applied on - * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants - */ - public function __construct($arguments) - { - } - private function checkMask($permissions) - { - } - public function isUpdatable($path) - { - } - public function isCreatable($path) - { - } - public function isDeletable($path) - { - } - public function isSharable($path) - { - } - public function getPermissions($path) - { - } - public function rename($source, $target) - { - } - public function copy($source, $target) - { - } - public function touch($path, $mtime = null) - { - } - public function mkdir($path) - { - } - public function rmdir($path) - { - } - public function unlink($path) - { - } - public function file_put_contents($path, $data) - { - } - public function fopen($path, $mode) - { - } - /** - * get a cache instance for the storage - * - * @param string $path - * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache - * @return \OC\Files\Cache\Cache - */ - public function getCache($path = '', $storage = null) - { - } - public function getMetaData($path) - { - } - public function getScanner($path = '', $storage = null) - { - } - public function getDirectoryContent($directory) : \Traversable - { - } - } -} - -namespace OC\Files\ObjectStore { - use OC\Files\Storage\Wrapper\Wrapper; - class ObjectStoreStorage extends Wrapper {} -} - -namespace OCA\Circles { - use OCA\Circles\Model\Circle; - use OCA\Circles\Model\FederatedUser; - use OCA\Circles\Model\Probes\CircleProbe; - use OCA\Circles\Model\Probes\DataProbe; - use OCP\DB\QueryBuilder\ICompositeExpression; - use OCP\DB\QueryBuilder\IQueryBuilder; - - interface IFederatedUser { - - } - - class CirclesManager { - public function startSession(?FederatedUser $federatedUser = null): void {} - public function probeCircles(?CircleProbe $circleProbe = null, ?DataProbe $dataProbe = null): array {} - public function getQueryHelper(): CirclesQueryHelper {} - public function getLocalFederatedUser(string $userId): FederatedUser {} - public function startSuperSession(): void {} - public function stopSession(): void {} - public function getCircle(string $singleId, ?CircleProbe $probe = null): Circle {} - } - - class CirclesQueryHelper{ - public function addCircleDetails(string $alias, string $field): void {} - public function getQueryBuilder(): IQueryBuilder {} - public function extractCircle(array $data): Circle {} - public function limitToInheritedMembers(string $alias, string $field, IFederatedUser $federatedUser, bool $fullDetails = false): ICompositeExpression {} - } -} - -namespace OCA\Circles\Exceptions { - class CircleNotFoundException extends \Exception { - } -} - -namespace OCA\Circles\Model { - use OCA\Circles\IFederatedUser; - - class FederatedUser implements IFederatedUser { - } - class CircleProbe { - } - class DataProbe { - } - class Circle { - public function getDisplayName(): string {} - public function getSingleId(): string {} - } -} - -namespace OCA\Circles\Model\Probes { - class CircleProbe { - public function includeSystemCircles(bool $include = true): self {} - public function includeSingleCircles(bool $include = true): self {} - } -} - -namespace OCA\Circles\Events { - use OCA\Circles\Model\Circle; - - class CircleDestroyedEvent extends \OCP\EventDispatcher\Event { - public function getCircle(): Circle {} - } -} - - -namespace OCA\DAV\Connector\Sabre\Exception { - class Forbidden extends \Sabre\DAV\Exception\Forbidden { - public const NS_OWNCLOUD = 'http://owncloud.org/ns'; - - /** - * @param string $message - * @param bool $retry - * @param \Exception $previous - */ - public function __construct($message, $retry = false, \Exception $previous = null) {} - - /** - * This method allows the exception to include additional information - * into the WebDAV error response - * - * @param \Sabre\DAV\Server $server - * @param \DOMElement $errorNode - * @return void - */ - public function serialize(\Sabre\DAV\Server $server, \DOMElement $errorNode) {} - } -} diff --git a/tests/stub.phpstub.license b/tests/stub.phpstub.license deleted file mode 100644 index f07cb622a..000000000 --- a/tests/stub.phpstub.license +++ /dev/null @@ -1,2 +0,0 @@ -SPDX-FileCopyrightText: 2021 Nextcloud GmbH and Nextcloud contributors -SPDX-License-Identifier: AGPL-3.0-or-later diff --git a/tests/stubs/doctrine_dbal_schema_abstractasset.php b/tests/stubs/doctrine_dbal_schema_abstractasset.php new file mode 100644 index 000000000..de9a86572 --- /dev/null +++ b/tests/stubs/doctrine_dbal_schema_abstractasset.php @@ -0,0 +1,170 @@ + Table($tableName)); if you want to rename the table, you have to make sure + */ +abstract class AbstractAsset +{ + /** @var string */ + protected $_name = ''; + + /** + * Namespace of the asset. If none isset the default namespace is assumed. + * + * @var string|null + */ + protected $_namespace; + + /** @var bool */ + protected $_quoted = false; + + /** + * Sets the name of this asset. + * + * @param string $name + * + * @return void + */ + protected function _setName($name) + { + } + + /** + * Is this asset in the default namespace? + * + * @param string $defaultNamespaceName + * + * @return bool + */ + public function isInDefaultNamespace($defaultNamespaceName) + { + } + + /** + * Gets the namespace name of this asset. + * + * If NULL is returned this means the default namespace is used. + * + * @return string|null + */ + public function getNamespaceName() + { + } + + /** + * The shortest name is stripped of the default namespace. All other + * namespaced elements are returned as full-qualified names. + * + * @param string|null $defaultNamespaceName + * + * @return string + */ + public function getShortestName($defaultNamespaceName) + { + } + + /** + * The normalized name is full-qualified and lower-cased. Lower-casing is + * actually wrong, but we have to do it to keep our sanity. If you are + * using database objects that only differentiate in the casing (FOO vs + * Foo) then you will NOT be able to use Doctrine Schema abstraction. + * + * Every non-namespaced element is prefixed with the default namespace + * name which is passed as argument to this method. + * + * @deprecated Use {@see getNamespaceName()} and {@see getName()} instead. + * + * @param string $defaultNamespaceName + * + * @return string + */ + public function getFullQualifiedName($defaultNamespaceName) + { + } + + /** + * Checks if this asset's name is quoted. + * + * @return bool + */ + public function isQuoted() + { + } + + /** + * Checks if this identifier is quoted. + * + * @param string $identifier + * + * @return bool + */ + protected function isIdentifierQuoted($identifier) + { + } + + /** + * Trim quotes from the identifier. + * + * @param string $identifier + * + * @return string + */ + protected function trimQuotes($identifier) + { + } + + /** + * Returns the name of this schema asset. + * + * @return string + */ + public function getName() + { + } + + /** + * Gets the quoted representation of this asset but only if it was defined with one. Otherwise + * return the plain unquoted value as inserted. + * + * @return string + */ + public function getQuotedName(AbstractPlatform $platform) + { + } + + /** + * Generates an identifier from a list of column names obeying a certain string length. + * + * This is especially important for Oracle, since it does not allow identifiers larger than 30 chars, + * however building idents automatically for foreign keys, composite keys or such can easily create + * very long names. + * + * @param string[] $columnNames + * @param string $prefix + * @param int $maxSize + * + * @return string + */ + protected function _generateIdentifierName($columnNames, $prefix = '', $maxSize = 30) + { + } +} diff --git a/tests/stubs/doctrine_dbal_schema_column.php b/tests/stubs/doctrine_dbal_schema_column.php new file mode 100644 index 000000000..425c83457 --- /dev/null +++ b/tests/stubs/doctrine_dbal_schema_column.php @@ -0,0 +1,334 @@ + + * + * @throws Exception + */ + public function toSql(AbstractPlatform $platform) + { + } + + /** + * Return an array of necessary SQL queries to drop the schema on the given platform. + * + * @return list + * + * @throws Exception + */ + public function toDropSql(AbstractPlatform $platform) + { + } + + /** + * @deprecated + * + * @return string[] + * + * @throws SchemaException + */ + public function getMigrateToSql(Schema $toSchema, AbstractPlatform $platform) + { + } + + /** + * @deprecated + * + * @return string[] + * + * @throws SchemaException + */ + public function getMigrateFromSql(Schema $fromSchema, AbstractPlatform $platform) + { + } + + /** + * @deprecated + * + * @return void + */ + public function visit(Visitor $visitor) + { + } + + /** + * Cloning a Schema triggers a deep clone of all related assets. + * + * @return void + */ + public function __clone() + { + } +} diff --git a/tests/stubs/doctrine_dbal_schema_table.php b/tests/stubs/doctrine_dbal_schema_table.php new file mode 100644 index 000000000..794175a43 --- /dev/null +++ b/tests/stubs/doctrine_dbal_schema_table.php @@ -0,0 +1,522 @@ + [], + ]; + + /** @var SchemaConfig|null */ + protected $_schemaConfig; + + /** + * @param Column[] $columns + * @param Index[] $indexes + * @param UniqueConstraint[] $uniqueConstraints + * @param ForeignKeyConstraint[] $fkConstraints + * @param mixed[] $options + * + * @throws SchemaException + * @throws Exception + */ + public function __construct(string $name, array $columns = [], array $indexes = [], array $uniqueConstraints = [], array $fkConstraints = [], array $options = []) + { + } + + /** @return void */ + public function setSchemaConfig(SchemaConfig $schemaConfig) + { + } + + /** @return int */ + protected function _getMaxIdentifierLength() + { + } + + /** + * Sets the Primary Key. + * + * @param string[] $columnNames + * @param string|false $indexName + * + * @return self + * + * @throws SchemaException + */ + public function setPrimaryKey(array $columnNames, $indexName = false) + { + } + + /** + * @param string[] $columnNames + * @param string[] $flags + * @param mixed[] $options + * + * @return self + * + * @throws SchemaException + */ + public function addIndex(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []) + { + } + + /** + * @param string[] $columnNames + * @param string[] $flags + * @param mixed[] $options + * + * @return self + */ + public function addUniqueConstraint(array $columnNames, ?string $indexName = null, array $flags = [], array $options = []): Table + { + } + + /** + * Drops the primary key from this table. + * + * @return void + * + * @throws SchemaException + */ + public function dropPrimaryKey() + { + } + + /** + * Drops an index from this table. + * + * @param string $name The index name. + * + * @return void + * + * @throws SchemaException If the index does not exist. + */ + public function dropIndex($name) + { + } + + /** + * @param string[] $columnNames + * @param string|null $indexName + * @param mixed[] $options + * + * @return self + * + * @throws SchemaException + */ + public function addUniqueIndex(array $columnNames, $indexName = null, array $options = []) + { + } + + /** + * Renames an index. + * + * @param string $oldName The name of the index to rename from. + * @param string|null $newName The name of the index to rename to. + * If null is given, the index name will be auto-generated. + * + * @return self This table instance. + * + * @throws SchemaException If no index exists for the given current name + * or if an index with the given new name already exists on this table. + */ + public function renameIndex($oldName, $newName = null) + { + } + + /** + * Checks if an index begins in the order of the given columns. + * + * @param string[] $columnNames + * + * @return bool + */ + public function columnsAreIndexed(array $columnNames) + { + } + + /** + * @param string $name + * @param string $typeName + * @param mixed[] $options + * + * @return Column + * + * @throws SchemaException + */ + public function addColumn($name, $typeName, array $options = []) + { + } + + /** + * Change Column Details. + * + * @deprecated Use {@link modifyColumn()} instead. + * + * @param string $name + * @param mixed[] $options + * + * @return self + * + * @throws SchemaException + */ + public function changeColumn($name, array $options) + { + } + + /** + * @param string $name + * @param mixed[] $options + * + * @return self + * + * @throws SchemaException + */ + public function modifyColumn($name, array $options) + { + } + + /** + * Drops a Column from the Table. + * + * @param string $name + * + * @return self + */ + public function dropColumn($name) + { + } + + /** + * Adds a foreign key constraint. + * + * Name is inferred from the local columns. + * + * @param Table|string $foreignTable Table schema instance or table name + * @param string[] $localColumnNames + * @param string[] $foreignColumnNames + * @param mixed[] $options + * @param string|null $name + * + * @return self + * + * @throws SchemaException + */ + public function addForeignKeyConstraint($foreignTable, array $localColumnNames, array $foreignColumnNames, array $options = [], $name = null) + { + } + + /** + * @param string $name + * @param mixed $value + * + * @return self + */ + public function addOption($name, $value) + { + } + + /** + * @return void + * + * @throws SchemaException + */ + protected function _addColumn(Column $column) + { + } + + /** + * Adds an index to the table. + * + * @return self + * + * @throws SchemaException + */ + protected function _addIndex(Index $indexCandidate) + { + } + + /** @return self */ + protected function _addUniqueConstraint(UniqueConstraint $constraint): Table + { + } + + /** @return self */ + protected function _addForeignKeyConstraint(ForeignKeyConstraint $constraint) + { + } + + /** + * Returns whether this table has a foreign key constraint with the given name. + * + * @param string $name + * + * @return bool + */ + public function hasForeignKey($name) + { + } + + /** + * Returns the foreign key constraint with the given name. + * + * @param string $name The constraint name. + * + * @return ForeignKeyConstraint + * + * @throws SchemaException If the foreign key does not exist. + */ + public function getForeignKey($name) + { + } + + /** + * Removes the foreign key constraint with the given name. + * + * @param string $name The constraint name. + * + * @return void + * + * @throws SchemaException + */ + public function removeForeignKey($name) + { + } + + /** + * Returns whether this table has a unique constraint with the given name. + */ + public function hasUniqueConstraint(string $name): bool + { + } + + /** + * Returns the unique constraint with the given name. + * + * @throws SchemaException If the unique constraint does not exist. + */ + public function getUniqueConstraint(string $name): UniqueConstraint + { + } + + /** + * Removes the unique constraint with the given name. + * + * @throws SchemaException If the unique constraint does not exist. + */ + public function removeUniqueConstraint(string $name): void + { + } + + /** + * Returns ordered list of columns (primary keys are first, then foreign keys, then the rest) + * + * @return Column[] + */ + public function getColumns() + { + } + + /** + * Returns the foreign key columns + * + * @deprecated Use {@see getForeignKey()} and {@see ForeignKeyConstraint::getLocalColumns()} instead. + * + * @return Column[] + */ + public function getForeignKeyColumns() + { + } + + /** + * Returns whether this table has a Column with the given name. + * + * @param string $name The column name. + * + * @return bool + */ + public function hasColumn($name) + { + } + + /** + * Returns the Column with the given name. + * + * @param string $name The column name. + * + * @return Column + * + * @throws SchemaException If the column does not exist. + */ + public function getColumn($name) + { + } + + /** + * Returns the primary key. + * + * @return Index|null The primary key, or null if this Table has no primary key. + */ + public function getPrimaryKey() + { + } + + /** + * Returns the primary key columns. + * + * @deprecated Use {@see getPrimaryKey()} and {@see Index::getColumns()} instead. + * + * @return Column[] + * + * @throws Exception + */ + public function getPrimaryKeyColumns() + { + } + + /** + * Returns whether this table has a primary key. + * + * @deprecated Use {@see getPrimaryKey()} instead. + * + * @return bool + */ + public function hasPrimaryKey() + { + } + + /** + * Returns whether this table has an Index with the given name. + * + * @param string $name The index name. + * + * @return bool + */ + public function hasIndex($name) + { + } + + /** + * Returns the Index with the given name. + * + * @param string $name The index name. + * + * @return Index + * + * @throws SchemaException If the index does not exist. + */ + public function getIndex($name) + { + } + + /** @return Index[] */ + public function getIndexes() + { + } + + /** + * Returns the unique constraints. + * + * @return UniqueConstraint[] + */ + public function getUniqueConstraints(): array + { + } + + /** + * Returns the foreign key constraints. + * + * @return ForeignKeyConstraint[] + */ + public function getForeignKeys() + { + } + + /** + * @param string $name + * + * @return bool + */ + public function hasOption($name) + { + } + + /** + * @param string $name + * + * @return mixed + */ + public function getOption($name) + { + } + + /** @return mixed[] */ + public function getOptions() + { + } + + /** + * @deprecated + * + * @return void + * + * @throws SchemaException + */ + public function visit(Visitor $visitor) + { + } + + /** + * Clone of a Table triggers a deep clone of all affected assets. + * + * @return void + */ + public function __clone() + { + } + + public function setComment(?string $comment): self + { + } + + public function getComment(): ?string + { + } +} diff --git a/tests/stubs/icewind_streams_directory.php b/tests/stubs/icewind_streams_directory.php new file mode 100644 index 000000000..64c1e0618 --- /dev/null +++ b/tests/stubs/icewind_streams_directory.php @@ -0,0 +1,43 @@ + + * This file is licensed under the Licensed under the MIT license: + * http://opensource.org/licenses/MIT + */ + +namespace Icewind\Streams; + +/** + * Interface for stream wrappers that implements a directory + */ +interface Directory { + /** + * @param string $path + * @param array $options + * @return bool + */ + public function dir_opendir($path, $options) + { + } + + /** + * @return string|bool + */ + public function dir_readdir() + { + } + + /** + * @return bool + */ + public function dir_closedir() + { + } + + /** + * @return bool + */ + public function dir_rewinddir() + { + } +} diff --git a/tests/stubs/icewind_streams_iteratordirectory.php b/tests/stubs/icewind_streams_iteratordirectory.php new file mode 100644 index 000000000..9caf54cd3 --- /dev/null +++ b/tests/stubs/icewind_streams_iteratordirectory.php @@ -0,0 +1,86 @@ + + * This file is licensed under the Licensed under the MIT license: + * http://opensource.org/licenses/MIT + */ + +namespace Icewind\Streams; + +/** + * Create a directory handle from an iterator or array + * + * The following options should be passed in the context when opening the stream + * [ + * 'dir' => [ + * 'array' => string[] + * 'iterator' => \Iterator + * ] + * ] + * + * Either 'array' or 'iterator' need to be set, if both are set, 'iterator' takes preference + */ +class IteratorDirectory extends WrapperHandler implements Directory { + /** + * @var resource + */ + public $context; + + /** + * @var \Iterator + */ + protected $iterator; + + /** + * Load the source from the stream context and return the context options + * + * @param string $name + * @return array + * @throws \BadMethodCallException + */ + protected function loadContext($name = null) + { + } + + /** + * @param string $path + * @param array $options + * @return bool + */ + public function dir_opendir($path, $options) + { + } + + /** + * @return string|bool + */ + public function dir_readdir() + { + } + + /** + * @return bool + */ + public function dir_closedir() + { + } + + /** + * @return bool + */ + public function dir_rewinddir() + { + } + + /** + * Creates a directory handle from the provided array or iterator + * + * @param \Iterator | array $source + * @return resource|false + * + * @throws \BadMethodCallException + */ + public static function wrap($source) + { + } +} diff --git a/tests/stubs/icewind_streams_wrapperhandler.php b/tests/stubs/icewind_streams_wrapperhandler.php new file mode 100644 index 000000000..136805e27 --- /dev/null +++ b/tests/stubs/icewind_streams_wrapperhandler.php @@ -0,0 +1,64 @@ + + * + * @license GNU AGPL version 3 or any later version + * + * This program is free software: you can redistribute it and/or modify + * it under the terms of the GNU Affero General Public License as + * published by the Free Software Foundation, either version 3 of the + * License, or (at your option) any later version. + * + * This program is distributed in the hope that it will be useful, + * but WITHOUT ANY WARRANTY; without even the implied warranty of + * MERCHANTABILITY or FITNESS FOR A PARTICULAR PURPOSE. See the + * GNU Affero General Public License for more details. + * + * You should have received a copy of the GNU Affero General Public License + * along with this program. If not, see . + * + */ + +namespace Icewind\Streams; + +class WrapperHandler { + /** @var resource $context */ + protected $context; + + const NO_SOURCE_DIR = 1; + + /** + * get the protocol name that is generated for the class + * @param string|null $class + * @return string + */ + public static function getProtocol($class = null) + { + } + + /** + * @param resource|int $source + * @param resource|array $context + * @param string|null $protocol deprecated, protocol is now automatically generated + * @param string|null $class deprecated, class is now automatically generated + * @return resource|false + */ + protected static function wrapSource($source, $context = [], $protocol = null, $class = null, $mode = 'r+') + { + } + + protected static function isDirectoryHandle($resource) + { + } + + /** + * Load the source from the stream context and return the context options + * + * @param string|null $name if not set, the generated protocol name is used + * @return array + * @throws \BadMethodCallException + */ + protected function loadContext($name = null) + { + } +} diff --git a/tests/stubs/oc.php b/tests/stubs/oc.php new file mode 100644 index 000000000..e1c5b60c7 --- /dev/null +++ b/tests/stubs/oc.php @@ -0,0 +1,150 @@ + filename + */ + public static array $CLASSPATH = []; + /** + * The installation path for Nextcloud on the server (e.g. /srv/http/nextcloud) + */ + public static string $SERVERROOT = ''; + /** + * the Nextcloud root path for http requests (e.g. /nextcloud) + */ + public static string $WEBROOT = ''; + /** + * The installation path array of the apps folder on the server (e.g. /srv/http/nextcloud) 'path' and + * web path in 'url' + */ + public static array $APPSROOTS = []; + + public static string $configDir; + + /** + * requested app + */ + public static string $REQUESTEDAPP = ''; + + /** + * check if Nextcloud runs in cli mode + */ + public static bool $CLI = false; + + public static \OC\Autoloader $loader; + + public static \Composer\Autoload\ClassLoader $composerAutoloader; + + public static \OC\Server $server; + + /** + * @throws \RuntimeException when the 3rdparty directory is missing or + * the app path list is empty or contains an invalid path + */ + public static function initPaths(): void + { + } + + public static function checkConfig(): void + { + } + + public static function checkInstalled(\OC\SystemConfig $systemConfig): void + { + } + + public static function checkMaintenanceMode(\OC\SystemConfig $systemConfig): void + { + } + + public static function initSession(): void + { + } + + /** + * @return bool true if the session expiry should only be done by gc instead of an explicit timeout + */ + public static function hasSessionRelaxedExpiry(): bool + { + } + + /** + * Try to set some values to the required Nextcloud default + */ + public static function setRequiredIniValues(): void + { + } + + public static function init(): void + { + } + + /** + * register hooks for the cleanup of cache and bruteforce protection + */ + public static function registerCleanupHooks(\OC\SystemConfig $systemConfig): void + { + } + + /** + * register hooks for sharing + */ + public static function registerShareHooks(\OC\SystemConfig $systemConfig): void + { + } + + protected static function registerAutoloaderCache(\OC\SystemConfig $systemConfig): void + { + } + + /** + * Handle the request + */ + public static function handleRequest(): void + { + } + + /** + * Check login: apache auth, auth token, basic auth + */ + public static function handleLogin(OCP\IRequest $request): bool + { + } + + protected static function handleAuthHeaders(): void + { + } + + protected static function tryAppAPILogin(OCP\IRequest $request): bool + { + } +} + +OC::init(); diff --git a/tests/stubs/oc_appframework_ocs_baseresponse.php b/tests/stubs/oc_appframework_ocs_baseresponse.php new file mode 100644 index 000000000..b30d8ef3b --- /dev/null +++ b/tests/stubs/oc_appframework_ocs_baseresponse.php @@ -0,0 +1,63 @@ + + * @template-extends Response> + */ +abstract class BaseResponse extends Response { + /** @var array */ + protected $data; + + /** @var string */ + protected $format; + + /** @var ?string */ + protected $statusMessage; + + /** @var ?int */ + protected $itemsCount; + + /** @var ?int */ + protected $itemsPerPage; + + /** + * BaseResponse constructor. + * + * @param DataResponse $dataResponse + * @param string $format + * @param string|null $statusMessage + * @param int|null $itemsCount + * @param int|null $itemsPerPage + */ + public function __construct(DataResponse $dataResponse, $format = 'xml', $statusMessage = null, $itemsCount = null, $itemsPerPage = null) + { + } + + /** + * @param array $meta + * @return string + */ + protected function renderResult(array $meta): string + { + } + + protected function toXML(array $array, \XMLWriter $writer): void + { + } + + public function getOCSStatus() + { + } +} diff --git a/tests/stubs/oc_appframework_ocs_v1response.php b/tests/stubs/oc_appframework_ocs_v1response.php new file mode 100644 index 000000000..b0fd50b8b --- /dev/null +++ b/tests/stubs/oc_appframework_ocs_v1response.php @@ -0,0 +1,48 @@ + + * @template-extends BaseResponse> + */ +class V1Response extends BaseResponse { + /** + * The V1 endpoint has very limited http status codes basically everything + * is status 200 except 401 + * + * @return int + */ + public function getStatus() + { + } + + /** + * In v1 all OK is 100 + * + * @return int + */ + public function getOCSStatus() + { + } + + /** + * Construct the meta part of the response + * And then late the base class render + * + * @return string + */ + public function render() + { + } +} diff --git a/tests/stubs/oc_appframework_utility_simplecontainer.php b/tests/stubs/oc_appframework_utility_simplecontainer.php new file mode 100644 index 000000000..de7a44293 --- /dev/null +++ b/tests/stubs/oc_appframework_utility_simplecontainer.php @@ -0,0 +1,123 @@ +|string $id + * @return T|mixed + * @psalm-template S as class-string|string + * @psalm-param S $id + * @psalm-return (S is class-string ? T : mixed) + */ + public function get(string $id): mixed + { + } + + public function has(string $id): bool + { + } + + public function resolve($name) + { + } + + public function query(string $name, bool $autoload = true) + { + } + + /** + * @param string $name + * @param mixed $value + */ + public function registerParameter($name, $value) + { + } + + /** + * The given closure is call the first time the given service is queried. + * The closure has to return the instance for the given service. + * Created instance will be cached in case $shared is true. + * + * @param string $name name of the service to register another backend for + * @param Closure $closure the closure to be called on service creation + * @param bool $shared + */ + public function registerService($name, Closure $closure, $shared = true) + { + } + + /** + * Shortcut for returning a service from a service under a different key, + * e.g. to tell the container to return a class when queried for an + * interface + * @param string $alias the alias that should be registered + * @param string $target the target that should be resolved instead + */ + public function registerAlias($alias, $target) + { + } + + /* + * @param string $name + * @return string + */ + protected function sanitizeName($name) + { + } + + /** + * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::has + */ + public function offsetExists($id): bool + { + } + + /** + * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get + * @return mixed + */ + #[\ReturnTypeWillChange] + public function offsetGet($id) + { + } + + /** + * @deprecated 20.0.0 use \OCP\IContainer::registerService + */ + public function offsetSet($offset, $value): void + { + } + + /** + * @deprecated 20.0.0 + */ + public function offsetUnset($offset): void + { + } +} diff --git a/tests/stubs/oc_core_command_base.php b/tests/stubs/oc_core_command_base.php new file mode 100644 index 000000000..a6de76e63 --- /dev/null +++ b/tests/stubs/oc_core_command_base.php @@ -0,0 +1,89 @@ + $value] the metadata to update, only the fields provided in the array will be updated, non-provided values will remain unchanged + */ + public function update($id, array $data) + { + } + + /** + * extract query parts and params array from data array + * + * @param array $data + * @return array + */ + protected function normalizeData(array $data): array + { + } + + /** + * get the file id for a file + * + * A file id is a numeric id for a file or folder that's unique within an owncloud instance which stays the same for the lifetime of a file + * + * File ids are easiest way for apps to store references to a file since unlike paths they are not affected by renames or sharing + * + * @param string $file + * @return int + */ + public function getId($file) + { + } + + /** + * get the id of the parent folder of a file + * + * @param string $file + * @return int + */ + public function getParentId($file) + { + } + + /** + * check if a file is available in the cache + * + * @param string $file + * @return bool + */ + public function inCache($file) + { + } + + /** + * remove a file or folder from the cache + * + * when removing a folder from the cache all files and folders inside the folder will be removed as well + * + * @param string $file + */ + public function remove($file) + { + } + + /** + * Move a file or folder in the cache + * + * @param string $source + * @param string $target + */ + public function move($source, $target) + { + } + + /** + * Get the storage id and path needed for a move + * + * @param string $path + * @return array [$storageId, $internalPath] + */ + protected function getMoveInfo($path) + { + } + + protected function hasEncryptionWrapper(): bool + { + } + + /** + * Move a file or folder in the cache + * + * @param ICache $sourceCache + * @param string $sourcePath + * @param string $targetPath + * @throws \OC\DatabaseException + * @throws \Exception if the given storages have an invalid id + */ + public function moveFromCache(ICache $sourceCache, $sourcePath, $targetPath) + { + } + + /** + * remove all entries for files that are stored on the storage from the cache + */ + public function clear() + { + } + + /** + * Get the scan status of a file + * + * - Cache::NOT_FOUND: File is not in the cache + * - Cache::PARTIAL: File is not stored in the cache but some incomplete data is known + * - Cache::SHALLOW: The folder and it's direct children are in the cache but not all sub folders are fully scanned + * - Cache::COMPLETE: The file or folder, with all it's children) are fully scanned + * + * @param string $file + * + * @return int Cache::NOT_FOUND, Cache::PARTIAL, Cache::SHALLOW or Cache::COMPLETE + */ + public function getStatus($file) + { + } + + /** + * search for files matching $pattern + * + * @param string $pattern the search pattern using SQL search syntax (e.g. '%searchstring%') + * @return ICacheEntry[] an array of cache entries where the name matches the search pattern + */ + public function search($pattern) + { + } + + /** + * search for files by mimetype + * + * @param string $mimetype either a full mimetype to search ('text/plain') or only the first part of a mimetype ('image') + * where it will search for all mimetypes in the group ('image/*') + * @return ICacheEntry[] an array of cache entries where the mimetype matches the search + */ + public function searchByMime($mimetype) + { + } + + public function searchQuery(ISearchQuery $query) + { + } + + /** + * Re-calculate the folder size and the size of all parent folders + * + * @param string|boolean $path + * @param array $data (optional) meta data of the folder + */ + public function correctFolderSize($path, $data = null, $isBackgroundScan = false) + { + } + + /** + * get the incomplete count that shares parent $folder + * + * @param int $fileId the file id of the folder + * @return int + */ + public function getIncompleteChildrenCount($fileId) + { + } + + /** + * calculate the size of a folder and set it in the cache + * + * @param string $path + * @param array|null|ICacheEntry $entry (optional) meta data of the folder + * @return int|float + */ + public function calculateFolderSize($path, $entry = null) + { + } + + + /** + * inner function because we can't add new params to the public function without breaking any child classes + * + * @param string $path + * @param array|null|ICacheEntry $entry (optional) meta data of the folder + * @param bool $ignoreUnknown don't mark the folder size as unknown if any of it's children are unknown + * @return int|float + */ + protected function calculateFolderSizeInner(string $path, $entry = null, bool $ignoreUnknown = false) + { + } + + /** + * get all file ids on the files on the storage + * + * @return int[] + */ + public function getAll() + { + } + + /** + * find a folder in the cache which has not been fully scanned + * + * If multiple incomplete folders are in the cache, the one with the highest id will be returned, + * use the one with the highest id gives the best result with the background scanner, since that is most + * likely the folder where we stopped scanning previously + * + * @return string|false the path of the folder or false when no folder matched + */ + public function getIncomplete() + { + } + + /** + * get the path of a file on this storage by it's file id + * + * @param int $id the file id of the file or folder to search + * @return string|null the path of the file (relative to the storage) or null if a file with the given id does not exists within this cache + */ + public function getPathById($id) + { + } + + /** + * get the storage id of the storage for a file and the internal path of the file + * unlike getPathById this does not limit the search to files on this storage and + * instead does a global search in the cache table + * + * @param int $id + * @return array first element holding the storage id, second the path + * @deprecated use getPathById() instead + */ + public static function getById($id) + { + } + + /** + * normalize the given path + * + * @param string $path + * @return string + */ + public function normalize($path) + { + } + + /** + * Copy a file or folder in the cache + * + * @param ICache $sourceCache + * @param ICacheEntry $sourceEntry + * @param string $targetPath + * @return int fileId of copied entry + */ + public function copyFromCache(ICache $sourceCache, ICacheEntry $sourceEntry, string $targetPath): int + { + } + + public function getQueryFilterForStorage(): ISearchOperator + { + } + + public function getCacheEntryFromSearchResult(ICacheEntry $rawEntry): ?ICacheEntry + { + } +} diff --git a/tests/stubs/oc_files_cache_cacheentry.php b/tests/stubs/oc_files_cache_cacheentry.php new file mode 100644 index 000000000..a4351d98e --- /dev/null +++ b/tests/stubs/oc_files_cache_cacheentry.php @@ -0,0 +1,115 @@ + + */ + public function getMetadata(): array + { + } +} diff --git a/tests/stubs/oc_files_node_node.php b/tests/stubs/oc_files_node_node.php new file mode 100644 index 000000000..6f99111ae --- /dev/null +++ b/tests/stubs/oc_files_node_node.php @@ -0,0 +1,354 @@ + + */ + public function getMetadata(): array + { + } +} diff --git a/tests/stubs/oc_files_objectstore_objectstorescanner.php b/tests/stubs/oc_files_objectstore_objectstorescanner.php new file mode 100644 index 000000000..135e92445 --- /dev/null +++ b/tests/stubs/oc_files_objectstore_objectstorescanner.php @@ -0,0 +1,30 @@ +stat() . + */ +abstract class Common implements Storage, ILockingStorage, IWriteStreamStorage { + use LocalTempFileTrait; + + protected $cache; + protected $scanner; + protected $watcher; + protected $propagator; + protected $storageCache; + protected $updater; + + protected $mountOptions = []; + protected $owner = null; + + public function __construct($parameters) { + } + + /** + * Remove a file or folder + * + * @param string $path + * @return bool + */ + protected function remove($path) + { + } + + public function is_dir($path) + { + } + + public function is_file($path) + { + } + + public function filesize($path): false|int|float + { + } + + public function isReadable($path) + { + } + + public function isUpdatable($path) + { + } + + public function isCreatable($path) + { + } + + public function isDeletable($path) + { + } + + public function isSharable($path) + { + } + + public function getPermissions($path) + { + } + + public function filemtime($path) + { + } + + public function file_get_contents($path) + { + } + + public function file_put_contents($path, $data) + { + } + + public function rename($source, $target) + { + } + + public function copy($source, $target) + { + } + + public function getMimeType($path) + { + } + + public function hash($type, $path, $raw = false) + { + } + + public function search($query) + { + } + + public function getLocalFile($path) + { + } + + /** + * @param string $query + * @param string $dir + * @return array + */ + protected function searchInDir($query, $dir = '') + { + } + + /** + * Check if a file or folder has been updated since $time + * + * The method is only used to check if the cache needs to be updated. Storage backends that don't support checking + * the mtime should always return false here. As a result storage implementations that always return false expect + * exclusive access to the backend and will not pick up files that have been added in a way that circumvents + * Nextcloud filesystem. + * + * @param string $path + * @param int $time + * @return bool + */ + public function hasUpdated($path, $time) + { + } + + protected function getCacheDependencies(): CacheDependencies + { + } + + public function getCache($path = '', $storage = null) + { + } + + public function getScanner($path = '', $storage = null) + { + } + + public function getWatcher($path = '', $storage = null) + { + } + + /** + * get a propagator instance for the cache + * + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher + * @return \OC\Files\Cache\Propagator + */ + public function getPropagator($storage = null) + { + } + + public function getUpdater($storage = null) + { + } + + public function getStorageCache($storage = null) + { + } + + /** + * get the owner of a path + * + * @param string $path The path to get the owner + * @return string|false uid or false + */ + public function getOwner($path) + { + } + + /** + * get the ETag for a file or folder + * + * @param string $path + * @return string|false + */ + public function getETag($path) + { + } + + /** + * clean a path, i.e. remove all redundant '.' and '..' + * making sure that it can't point to higher than '/' + * + * @param string $path The path to clean + * @return string cleaned path + */ + public function cleanPath($path) + { + } + + /** + * Test a storage for availability + * + * @return bool + */ + public function test() + { + } + + /** + * get the free space in the storage + * + * @param string $path + * @return int|float|false + */ + public function free_space($path) + { + } + + /** + * {@inheritdoc} + */ + public function isLocal() + { + } + + /** + * Check if the storage is an instance of $class or is a wrapper for a storage that is an instance of $class + * + * @param string $class + * @return bool + */ + public function instanceOfStorage($class) + { + } + + /** + * A custom storage implementation can return an url for direct download of a give file. + * + * For now the returned array can hold the parameter url - in future more attributes might follow. + * + * @param string $path + * @return array|false + */ + public function getDirectDownload($path) + { + } + + /** + * @inheritdoc + * @throws InvalidPathException + */ + public function verifyPath($path, $fileName) + { + } + + /** + * Get the filename validator + * (cached for performance) + */ + protected function getFilenameValidator(): IFilenameValidator + { + } + + /** + * @param array $options + */ + public function setMountOptions(array $options) + { + } + + /** + * @param string $name + * @param mixed $default + * @return mixed + */ + public function getMountOption($name, $default = null) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @param bool $preserveMtime + * @return bool + */ + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath, $preserveMtime = false) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) + { + } + + /** + * @inheritdoc + */ + public function getMetaData($path) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + */ + public function acquireLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + */ + public function releaseLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + */ + public function changeLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @return array [ available, last_checked ] + */ + public function getAvailability() + { + } + + /** + * @param bool $isAvailable + */ + public function setAvailability($isAvailable) + { + } + + /** + * Allow setting the storage owner + * + * This can be used for storages that do not have a dedicated owner, where we want to + * pass the user that we setup the mountpoint for along to the storage layer + * + * @param string|null $user + * @return void + */ + public function setOwner(?string $user): void + { + } + + /** + * @return bool + */ + public function needsPartFile() + { + } + + /** + * fallback implementation + * + * @param string $path + * @param resource $stream + * @param int $size + * @return int + */ + public function writeStream(string $path, $stream, ?int $size = null): int + { + } + + public function getDirectoryContent($directory): \Traversable + { + } +} diff --git a/tests/stubs/oc_files_storage_storage.php b/tests/stubs/oc_files_storage_storage.php new file mode 100644 index 000000000..fb239aa84 --- /dev/null +++ b/tests/stubs/oc_files_storage_storage.php @@ -0,0 +1,146 @@ + $storage, 'root' => $root] + * + * $storage: The storage that will be wrapper + * $root: The folder in the wrapped storage that will become the root folder of the wrapped storage + */ + public function __construct($arguments) + { + } + + public function getUnjailedPath($path) + { + } + + /** + * This is separate from Wrapper::getWrapperStorage so we can get the jailed storage consistently even if the jail is inside another wrapper + */ + public function getUnjailedStorage() + { + } + + + public function getJailedPath($path) + { + } + + public function getId() + { + } + + /** + * see https://www.php.net/manual/en/function.mkdir.php + * + * @param string $path + * @return bool + */ + public function mkdir($path) + { + } + + /** + * see https://www.php.net/manual/en/function.rmdir.php + * + * @param string $path + * @return bool + */ + public function rmdir($path) + { + } + + /** + * see https://www.php.net/manual/en/function.opendir.php + * + * @param string $path + * @return resource|false + */ + public function opendir($path) + { + } + + /** + * see https://www.php.net/manual/en/function.is_dir.php + * + * @param string $path + * @return bool + */ + public function is_dir($path) + { + } + + /** + * see https://www.php.net/manual/en/function.is_file.php + * + * @param string $path + * @return bool + */ + public function is_file($path) + { + } + + /** + * see https://www.php.net/manual/en/function.stat.php + * only the following keys are required in the result: size and mtime + * + * @param string $path + * @return array|bool + */ + public function stat($path) + { + } + + /** + * see https://www.php.net/manual/en/function.filetype.php + * + * @param string $path + * @return bool + */ + public function filetype($path) + { + } + + /** + * see https://www.php.net/manual/en/function.filesize.php + * The result for filesize when called on a folder is required to be 0 + */ + public function filesize($path): false|int|float + { + } + + /** + * check if a file can be created in $path + * + * @param string $path + * @return bool + */ + public function isCreatable($path) + { + } + + /** + * check if a file can be read + * + * @param string $path + * @return bool + */ + public function isReadable($path) + { + } + + /** + * check if a file can be written to + * + * @param string $path + * @return bool + */ + public function isUpdatable($path) + { + } + + /** + * check if a file can be deleted + * + * @param string $path + * @return bool + */ + public function isDeletable($path) + { + } + + /** + * check if a file can be shared + * + * @param string $path + * @return bool + */ + public function isSharable($path) + { + } + + /** + * get the full permissions of a path. + * Should return a combination of the PERMISSION_ constants defined in lib/public/constants.php + * + * @param string $path + * @return int + */ + public function getPermissions($path) + { + } + + /** + * see https://www.php.net/manual/en/function.file_exists.php + * + * @param string $path + * @return bool + */ + public function file_exists($path) + { + } + + /** + * see https://www.php.net/manual/en/function.filemtime.php + * + * @param string $path + * @return int|bool + */ + public function filemtime($path) + { + } + + /** + * see https://www.php.net/manual/en/function.file_get_contents.php + * + * @param string $path + * @return string|false + */ + public function file_get_contents($path) + { + } + + /** + * see https://www.php.net/manual/en/function.file_put_contents.php + * + * @param string $path + * @param mixed $data + * @return int|float|false + */ + public function file_put_contents($path, $data) + { + } + + /** + * see https://www.php.net/manual/en/function.unlink.php + * + * @param string $path + * @return bool + */ + public function unlink($path) + { + } + + /** + * see https://www.php.net/manual/en/function.rename.php + * + * @param string $source + * @param string $target + * @return bool + */ + public function rename($source, $target) + { + } + + /** + * see https://www.php.net/manual/en/function.copy.php + * + * @param string $source + * @param string $target + * @return bool + */ + public function copy($source, $target) + { + } + + /** + * see https://www.php.net/manual/en/function.fopen.php + * + * @param string $path + * @param string $mode + * @return resource|bool + */ + public function fopen($path, $mode) + { + } + + /** + * get the mimetype for a file or folder + * The mimetype for a folder is required to be "httpd/unix-directory" + * + * @param string $path + * @return string|bool + */ + public function getMimeType($path) + { + } + + /** + * see https://www.php.net/manual/en/function.hash.php + * + * @param string $type + * @param string $path + * @param bool $raw + * @return string|bool + */ + public function hash($type, $path, $raw = false) + { + } + + /** + * see https://www.php.net/manual/en/function.free_space.php + * + * @param string $path + * @return int|float|bool + */ + public function free_space($path) + { + } + + /** + * search for occurrences of $query in file names + * + * @param string $query + * @return array|bool + */ + public function search($query) + { + } + + /** + * see https://www.php.net/manual/en/function.touch.php + * If the backend does not support the operation, false should be returned + * + * @param string $path + * @param int $mtime + * @return bool + */ + public function touch($path, $mtime = null) + { + } + + /** + * get the path to a local version of the file. + * The local version of the file can be temporary and doesn't have to be persistent across requests + * + * @param string $path + * @return string|false + */ + public function getLocalFile($path) + { + } + + /** + * check if a file or folder has been updated since $time + * + * @param string $path + * @param int $time + * @return bool + * + * hasUpdated for folders should return at least true if a file inside the folder is add, removed or renamed. + * returning true for other changes in the folder is optional + */ + public function hasUpdated($path, $time) + { + } + + /** + * get a cache instance for the storage + * + * @param string $path + * @param \OC\Files\Storage\Storage|null (optional) the storage to pass to the cache + * @return \OC\Files\Cache\Cache + */ + public function getCache($path = '', $storage = null) + { + } + + /** + * get the user id of the owner of a file or folder + * + * @param string $path + * @return string + */ + public function getOwner($path) + { + } + + /** + * get a watcher instance for the cache + * + * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the watcher + * @return \OC\Files\Cache\Watcher + */ + public function getWatcher($path = '', $storage = null) + { + } + + /** + * get the ETag for a file or folder + * + * @param string $path + * @return string|false + */ + public function getETag($path) + { + } + + public function getMetaData($path) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + */ + public function acquireLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + */ + public function releaseLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + */ + public function changeLock($path, $type, ILockingProvider $provider) + { + } + + /** + * Resolve the path for the source of the share + * + * @param string $path + * @return array + */ + public function resolvePath($path) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) + { + } + + public function getPropagator($storage = null) + { + } + + public function writeStream(string $path, $stream, ?int $size = null): int + { + } + + public function getDirectoryContent($directory): \Traversable + { + } +} diff --git a/tests/stubs/oc_files_storage_wrapper_permissionsmask.php b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php new file mode 100644 index 000000000..fb662e374 --- /dev/null +++ b/tests/stubs/oc_files_storage_wrapper_permissionsmask.php @@ -0,0 +1,105 @@ + $storage, 'mask' => $mask] + * + * $storage: The storage the permissions mask should be applied on + * $mask: The permission bits that should be kept, a combination of the \OCP\Constant::PERMISSION_ constants + */ + public function __construct($arguments) + { + } + + public function isUpdatable($path) + { + } + + public function isCreatable($path) + { + } + + public function isDeletable($path) + { + } + + public function isSharable($path) + { + } + + public function getPermissions($path) + { + } + + public function rename($source, $target) + { + } + + public function copy($source, $target) + { + } + + public function touch($path, $mtime = null) + { + } + + public function mkdir($path) + { + } + + public function rmdir($path) + { + } + + public function unlink($path) + { + } + + public function file_put_contents($path, $data) + { + } + + public function fopen($path, $mode) + { + } + + /** + * get a cache instance for the storage + * + * @param string $path + * @param \OC\Files\Storage\Storage (optional) the storage to pass to the cache + * @return \OC\Files\Cache\Cache + */ + public function getCache($path = '', $storage = null) + { + } + + public function getMetaData($path) + { + } + + public function getScanner($path = '', $storage = null) + { + } + + public function getDirectoryContent($directory): \Traversable + { + } +} diff --git a/tests/stubs/oc_files_storage_wrapper_quota.php b/tests/stubs/oc_files_storage_wrapper_quota.php new file mode 100644 index 000000000..08fcfcffe --- /dev/null +++ b/tests/stubs/oc_files_storage_wrapper_quota.php @@ -0,0 +1,116 @@ + $class + * @return bool + */ + public function instanceOfStorage($class) + { + } + + /** + * @psalm-template T of IStorage + * @psalm-param class-string $class + * @psalm-return T|null + */ + public function getInstanceOfStorage(string $class) + { + } + + /** + * Pass any methods custom to specific storage implementations to the wrapped storage + * + * @param string $method + * @param array $args + * @return mixed + */ + public function __call($method, $args) + { + } + + /** + * A custom storage implementation can return an url for direct download of a give file. + * + * For now the returned array can hold the parameter url - in future more attributes might follow. + * + * @param string $path + * @return array|bool + */ + public function getDirectDownload($path) + { + } + + /** + * Get availability of the storage + * + * @return array [ available, last_checked ] + */ + public function getAvailability() + { + } + + /** + * Set availability of the storage + * + * @param bool $isAvailable + */ + public function setAvailability($isAvailable) + { + } + + /** + * @param string $path the path of the target folder + * @param string $fileName the name of the file itself + * @return void + * @throws InvalidPathException + */ + public function verifyPath($path, $fileName) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function copyFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) + { + } + + /** + * @param IStorage $sourceStorage + * @param string $sourceInternalPath + * @param string $targetInternalPath + * @return bool + */ + public function moveFromStorage(IStorage $sourceStorage, $sourceInternalPath, $targetInternalPath) + { + } + + public function getMetaData($path) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + * @throws \OCP\Lock\LockedException + */ + public function acquireLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + */ + public function releaseLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @param string $path + * @param int $type \OCP\Lock\ILockingProvider::LOCK_SHARED or \OCP\Lock\ILockingProvider::LOCK_EXCLUSIVE + * @param \OCP\Lock\ILockingProvider $provider + */ + public function changeLock($path, $type, ILockingProvider $provider) + { + } + + /** + * @return bool + */ + public function needsPartFile() + { + } + + public function writeStream(string $path, $stream, ?int $size = null): int + { + } + + public function getDirectoryContent($directory): \Traversable + { + } + + public function isWrapperOf(IStorage $storage) + { + } + + public function setOwner(?string $user): void + { + } +} diff --git a/tests/stubs/oc_files_view.php b/tests/stubs/oc_files_view.php new file mode 100644 index 000000000..b1e91fd0f --- /dev/null +++ b/tests/stubs/oc_files_view.php @@ -0,0 +1,664 @@ + $gids List of groupIds for which we want to create a IGroup object + * @param array $displayNames Array containing already know display name for a groupId + * @return array + */ + protected function getGroupsObjects(array $gids, array $displayNames = []): array + { + } + + /** + * @param string $gid + * @return bool + */ + public function groupExists($gid) + { + } + + /** + * @param string $gid + * @return IGroup|null + */ + public function createGroup($gid) + { + } + + /** + * @param string $search + * @param ?int $limit + * @param ?int $offset + * @return \OC\Group\Group[] + */ + public function search(string $search, ?int $limit = null, ?int $offset = 0) + { + } + + /** + * @param IUser|null $user + * @return \OC\Group\Group[] + */ + public function getUserGroups(?IUser $user = null) + { + } + + /** + * @param string $uid the user id + * @return \OC\Group\Group[] + */ + public function getUserIdGroups(string $uid): array + { + } + + /** + * Checks if a userId is in the admin group + * + * @param string $userId + * @return bool if admin + */ + public function isAdmin($userId) + { + } + + public function isDelegatedAdmin(string $userId): bool + { + } + + /** + * Checks if a userId is in a group + * + * @param string $userId + * @param string $group + * @return bool if in group + */ + public function isInGroup($userId, $group) + { + } + + /** + * get a list of group ids for a user + * + * @param IUser $user + * @return string[] with group ids + */ + public function getUserGroupIds(IUser $user): array + { + } + + /** + * @param string $groupId + * @return ?string + */ + public function getDisplayName(string $groupId): ?string + { + } + + /** + * get an array of groupid and displayName for a user + * + * @param IUser $user + * @return array ['displayName' => displayname] + */ + public function getUserGroupNames(IUser $user) + { + } + + /** + * get a list of all display names in a group + * + * @param string $gid + * @param string $search + * @param int $limit + * @param int $offset + * @return array an array of display names (value) and user ids (key) + */ + public function displayNamesInGroup($gid, $search = '', $limit = -1, $offset = 0) + { + } + + /** + * @return \OC\SubAdmin + */ + public function getSubAdmin() + { + } +} diff --git a/tests/stubs/oc_hooks_basicemitter.php b/tests/stubs/oc_hooks_basicemitter.php new file mode 100644 index 000000000..c9444b404 --- /dev/null +++ b/tests/stubs/oc_hooks_basicemitter.php @@ -0,0 +1,14 @@ +get($app) instead + */ + public function getAppDataDir($app) + { + } + + /** + * @return \OCP\Lockdown\ILockdownManager + * @deprecated 20.0.0 + */ + public function getLockdownManager() + { + } + + /** + * @return \OCP\Federation\ICloudIdManager + * @deprecated 20.0.0 + */ + public function getCloudIdManager() + { + } + + /** + * @return \OCP\GlobalScale\IConfig + * @deprecated 20.0.0 + */ + public function getGlobalScaleConfig() + { + } + + /** + * @return \OCP\Federation\ICloudFederationProviderManager + * @deprecated 20.0.0 + */ + public function getCloudFederationProviderManager() + { + } + + /** + * @return \OCP\Remote\Api\IApiFactory + * @deprecated 20.0.0 + */ + public function getRemoteApiFactory() + { + } + + /** + * @return \OCP\Federation\ICloudFederationFactory + * @deprecated 20.0.0 + */ + public function getCloudFederationFactory() + { + } + + /** + * @return \OCP\Remote\IInstanceFactory + * @deprecated 20.0.0 + */ + public function getRemoteInstanceFactory() + { + } + + /** + * @return IStorageFactory + * @deprecated 20.0.0 + */ + public function getStorageFactory() + { + } + + /** + * Get the Preview GeneratorHelper + * + * @return GeneratorHelper + * @since 17.0.0 + * @deprecated 20.0.0 + */ + public function getGeneratorHelper() + { + } +} diff --git a/tests/stubs/oc_servercontainer.php b/tests/stubs/oc_servercontainer.php new file mode 100644 index 000000000..2c7c3cafb --- /dev/null +++ b/tests/stubs/oc_servercontainer.php @@ -0,0 +1,101 @@ +|string $name + * @return T|mixed + * @psalm-template S as class-string|string + * @psalm-param S $name + * @psalm-return (S is class-string ? T : mixed) + * @throws QueryException + * @deprecated 20.0.0 use \Psr\Container\ContainerInterface::get + */ + public function query(string $name, bool $autoload = true) + { + } + + /** + * @internal + * @param string $id + * @return DIContainer|null + */ + public function getAppContainerForService(string $id): ?DIContainer + { + } +} diff --git a/tests/stubs/oc_settings_authorizedgroupmapper.php b/tests/stubs/oc_settings_authorizedgroupmapper.php new file mode 100644 index 000000000..411448cc5 --- /dev/null +++ b/tests/stubs/oc_settings_authorizedgroupmapper.php @@ -0,0 +1,70 @@ + + */ +class AuthorizedGroupMapper extends QBMapper { + public function __construct(IDBConnection $db) + { + } + + /** + * @throws Exception + */ + public function findAllClassesForUser(IUser $user): array + { + } + + /** + * @throws \OCP\AppFramework\Db\DoesNotExistException + * @throws \OCP\AppFramework\Db\MultipleObjectsReturnedException + * @throws \OCP\DB\Exception + */ + public function find(int $id): AuthorizedGroup + { + } + + /** + * Get all the authorizations stored in the database. + * + * @return AuthorizedGroup[] + * @throws \OCP\DB\Exception + */ + public function findAll(): array + { + } + + public function findByGroupIdAndClass(string $groupId, string $class) + { + } + + /** + * @return Entity[] + * @throws \OCP\DB\Exception + */ + public function findExistingGroupsForClass(string $class): array + { + } + + /** + * @throws Exception + */ + public function removeGroup(string $gid) + { + } +} diff --git a/tests/stubs/oc_user_user.php b/tests/stubs/oc_user_user.php new file mode 100644 index 000000000..1eccb09aa --- /dev/null +++ b/tests/stubs/oc_user_user.php @@ -0,0 +1,295 @@ +federatedUserService->bypassCurrentUserCondition(true); + // $this->memberService->getMemberById($circleId, $singleId); + // } + + + /** + * WIP + * + * @param string $memberId + * + * @return Member + */ + // public function getMemberById(string $memberId): Member { +} diff --git a/tests/stubs/oca_circles_circlesqueryhelper.php b/tests/stubs/oca_circles_circlesqueryhelper.php new file mode 100644 index 000000000..b4b97da22 --- /dev/null +++ b/tests/stubs/oca_circles_circlesqueryhelper.php @@ -0,0 +1,98 @@ + everyone can enter. moderator can add members. + * - CFG_OPEN | CFG_REQUEST => anyone can initiate a request to join the circle, moderator can + * add members + * - CFG_OPEN | CFG_INVITE => every one can enter, moderator must send invitation. + * - CFG_OPEN | CFG_INVITE | CFG_REQUEST => every one send a request, moderator must send invitation. + * - CFG_OPEN | CFG_FRIEND => useless + * - CFG_OPEN | CFG_FRIEND | * => useless + * + * - CFG_CIRCLE => no one can enter, moderator can add members. + * default config, this is only for code readability. + * - CFG_INVITE => no one can enter, moderator must send invitation. + * - CFG_FRIEND => no one can enter, but all members can add new member. + * - CFG_REQUEST => useless (use CFG_OPEN | CFG_REQUEST) + * - CFG_FRIEND | CFG_REQUEST => no one can join the circle, but all members can request a + * moderator to accept new member + * - CFG_FRIEND | CFG_INVITE => no one can join the circle, but all members can add new member. + * An invitation will be generated + * - CFG_FRIEND | CFG_INVITE | CFG_REQUEST => no one can join the circle, but all members can request a + * moderator to accept new member. An invitation will be generated + * + * @package OCA\Circles\Model + */ +class Circle extends ManagedModel implements IEntity, IDeserializable, IQueryRow, JsonSerializable { + use TArrayTools; + use TDeserialize; + + public const FLAGS_SHORT = 1; + public const FLAGS_LONG = 2; + + // specific value + public const CFG_CIRCLE = 0; // only for code readability. Circle is locked by default. + public const CFG_SINGLE = 1; // Circle with only one single member. + public const CFG_PERSONAL = 2; // Personal circle, only the owner can see it. + + // bitwise + public const CFG_SYSTEM = 4; // System Circle (not managed by the official front-end). Meaning some config are limited + public const CFG_VISIBLE = 8; // Visible to everyone, if not visible, people have to know its name to be able to find it + public const CFG_OPEN = 16; // Circle is open, people can join + public const CFG_INVITE = 32; // Adding a member generate an invitation that needs to be accepted + public const CFG_REQUEST = 64; // Request to join Circles needs to be confirmed by a moderator + public const CFG_FRIEND = 128; // Members of the circle can invite their friends + public const CFG_PROTECTED = 256; // Password protected to join/request + public const CFG_NO_OWNER = 512; // no owner, only members + public const CFG_HIDDEN = 1024; // hidden from listing, but available as a share entity + public const CFG_BACKEND = 2048; // Fully hidden, only backend Circles + public const CFG_LOCAL = 4096; // Local even on GlobalScale + public const CFG_ROOT = 8192; // Circle cannot be inside another Circle + public const CFG_CIRCLE_INVITE = 16384; // Circle must confirm when invited in another circle + public const CFG_FEDERATED = 32768; // Federated + public const CFG_MOUNTPOINT = 65536; // Generate a Files folder for this Circle + public const CFG_APP = 131072; // Some features are not available to the OCS API (ie. destroying Circle) + public static $DEF_CFG_MAX = 262143; + + + /** + * Note: When editing those values, update lib/Application/Capabilities.php + * + * @see Capabilities::getCapabilitiesCircleConstants() + * @var array + */ + public static $DEF_CFG = [ + 1 => 'S|Single', + 2 => 'P|Personal', + 4 => 'Y|System', + 8 => 'V|Visible', + 16 => 'O|Open', + 32 => 'I|Invite', + 64 => 'JR|Join Request', + 128 => 'F|Friends', + 256 => 'PP|Password Protected', + 512 => 'NO|No Owner', + 1024 => 'H|Hidden', + 2048 => 'T|Backend', + 4096 => 'L|Local', + 8192 => 'T|Root', + 16384 => 'CI|Circle Invite', + 32768 => 'F|Federated', + 65536 => 'M|Nountpoint', + 131072 => 'A|App' + ]; + + + /** + * Note: When editing those values, update lib/Application/Capabilities.php + * + * @see Capabilities::getCapabilitiesCircleConstants() + * @var array + */ + public static $DEF_SOURCE = [ + 1 => 'Nextcloud Account', + 2 => 'Nextcloud Group', + 4 => 'Email Address', + 8 => 'Contact', + 16 => 'Circle', + 10000 => 'Nextcloud App', + 10001 => 'Circles App', + 10002 => 'Admin Command Line', + 11000 => '3rd party app', + 11010 => 'Collectives App' + ]; + + + public static $DEF_CFG_CORE_FILTER = [ + 1, + 2, + 4 + ]; + + public static $DEF_CFG_SYSTEM_FILTER = [ + 512, + 1024, + 2048 + ]; + + + /** + * Circle constructor. + */ + public function __construct() { + } + + /** + * @param string $singleId + * + * @return self + */ + public function setSingleId(string $singleId): self + { + } + + /** + * @return string + */ + public function getSingleId(): string + { + } + + /** + * @return string + * @deprecated - removed in NC23 + */ + public function getUniqueId(): string + { + } + + + /** + * @param int $config + * + * @return self + */ + public function setConfig(int $config): self + { + } + + /** + * @return int + */ + public function getConfig(): int + { + } + + /** + * @param int $flag + * @param int $test + * + * @return bool + */ + public function isConfig(int $flag, int $test = 0): bool + { + } + + /** + * @param int $flag + */ + public function addConfig(int $flag): void + { + } + + /** + * @param int $flag + */ + public function remConfig(int $flag): void + { + } + + + /** + * @param string $name + * + * @return self + */ + public function setName(string $name): self + { + } + + /** + * @return string + */ + public function getName(): string + { + } + + + /** + * @param string $displayName + * + * @return self + */ + public function setDisplayName(string $displayName): self + { + } + + /** + * @return string + */ + public function getDisplayName(): string + { + } + + + /** + * @param string $sanitizedName + * + * @return Circle + */ + public function setSanitizedName(string $sanitizedName): self + { + } + + /** + * @return string + */ + public function getSanitizedName(): string + { + } + + + /** + * @param int $source + * + * @return Circle + */ + public function setSource(int $source): self + { + } + + /** + * @return int + */ + public function getSource(): int + { + } + + + /** + * @param ?Member $owner + * + * @return self + */ + public function setOwner(?Member $owner): self + { + } + + /** + * @return Member + */ + public function getOwner(): Member + { + } + + /** + * @return bool + */ + public function hasOwner(): bool + { + } + + + /** + * @return bool + */ + public function hasMembers(): bool + { + } + + /** + * @param Member[] $members + * + * @return self + */ + public function setMembers(array $members): self + { + } + + /** + * @return Member[] + */ + public function getMembers(): array + { + } + + + /** + * @param array $members + * @param bool $detailed + * + * @return self + */ + public function setInheritedMembers(array $members, bool $detailed): self + { + } + + /** + * @param Member[] $members + * + * @return Circle + */ + public function addInheritedMembers(array $members): self + { + } + + + /** + * if $remote is true, it will returns also details on inherited members from remote+locals Circles. + * This should be used only if extra details are required (mail address ?) as it will send a request to + * the remote instance if the circleId is not locally known. + * because of the resource needed to retrieve this data, $remote=true should not be used on main process ! + * + * @param bool $detailed + * @param bool $remote + * + * @return Member[] + * @throws FederatedItemException + * @throws RemoteInstanceException + * @throws RemoteNotFoundException + * @throws RemoteResourceNotFoundException + * @throws RequestBuilderException + * @throws UnknownRemoteException + */ + public function getInheritedMembers(bool $detailed = false, bool $remote = false): array + { + } + + + /** + * @return bool + */ + public function hasMemberships(): bool + { + } + + /** + * @param array $memberships + * + * @return self + */ + public function setMemberships(array $memberships): IEntity + { + } + + /** + * @return Membership[] + */ + public function getMemberships(): array + { + } + + + /** + * @param string $singleId + * @param bool $detailed + * + * @return Membership + * @throws MembershipNotFoundException + * @throws RequestBuilderException + */ + public function getLink(string $singleId, bool $detailed = false): Membership + { + } + + + /** + * @param Member|null $initiator + * + * @return Circle + */ + public function setInitiator(?Member $initiator): self + { + } + + /** + * @return Member + */ + public function getInitiator(): Member + { + } + + /** + * @return bool + */ + public function hasInitiator(): bool + { + } + + /** + * @param Member|null $directInitiator + * + * @return $this + */ + public function setDirectInitiator(?Member $directInitiator): self + { + } + + + /** + * @param string $instance + * + * @return Circle + */ + public function setInstance(string $instance): self + { + } + + /** + * @return string + * @throws OwnerNotFoundException + */ + public function getInstance(): string + { + } + + + /** + * @return bool + * @throws OwnerNotFoundException + */ + public function isLocal(): bool + { + } + + + /** + * @param int $population + * + * @return Circle + */ + public function setPopulation(int $population): self + { + } + + /** + * @return int + */ + public function getPopulation(): int + { + } + + + /** + * @param int $population + * + * @return Circle + */ + public function setPopulationInherited(int $population): self + { + } + + /** + * @return int + */ + public function getPopulationInherited(): int + { + } + + + /** + * @param array $settings + * + * @return self + */ + public function setSettings(array $settings): self + { + } + + /** + * @return array + */ + public function getSettings(): array + { + } + + + /** + * @param string $description + * + * @return self + */ + public function setDescription(string $description): self + { + } + + /** + * @return string + */ + public function getDescription(): string + { + } + + + /** + * @return string + */ + public function getUrl(): string + { + } + + + /** + * @param int $contactAddressBook + * + * @return self + */ + public function setContactAddressBook(int $contactAddressBook): self + { + } + + /** + * @return int + */ + public function getContactAddressBook(): int + { + } + + + /** + * @param string $contactGroupName + * + * @return self + */ + public function setContactGroupName(string $contactGroupName): self + { + } + + /** + * @return string + */ + public function getContactGroupName(): string + { + } + + + /** + * @param int $creation + * + * @return self + */ + public function setCreation(int $creation): self + { + } + + /** + * @return int + */ + public function getCreation(): int + { + } + + + /** + * @param array $data + * + * @return $this + * @throws InvalidItemException + */ + public function import(array $data): IDeserializable + { + } + + + /** + * @return array + * @throws FederatedItemException + * @throws RemoteInstanceException + * @throws RemoteNotFoundException + * @throws RemoteResourceNotFoundException + * @throws RequestBuilderException + * @throws UnknownRemoteException + */ + public function jsonSerialize(): array + { + } + + + /** + * @param array $data + * @param string $prefix + * + * @return IQueryRow + * @throws CircleNotFoundException + */ + public function importFromDatabase(array $data, string $prefix = ''): IQueryRow + { + } + + + /** + * @param Circle $circle + * + * @return bool + * @throws OwnerNotFoundException + */ + public function compareWith(Circle $circle): bool + { + } + + + /** + * @param Circle $circle + * @param int $display + * + * @return array + */ + public static function getCircleFlags(Circle $circle, int $display = self::FLAGS_LONG): array + { + } +} diff --git a/tests/stubs/oca_circles_model_federateduser.php b/tests/stubs/oca_circles_model_federateduser.php new file mode 100644 index 000000000..f6a14876f --- /dev/null +++ b/tests/stubs/oca_circles_model_federateduser.php @@ -0,0 +1,309 @@ + + */ + public function getMetadata(): array + { + } +} diff --git a/tests/stubs/oca_files_versions_expiration.php b/tests/stubs/oca_files_versions_expiration.php new file mode 100644 index 000000000..61b84b813 --- /dev/null +++ b/tests/stubs/oca_files_versions_expiration.php @@ -0,0 +1,55 @@ + value mapping. + * @since 29.0.0 + */ +interface IMetadataVersionBackend { + /** + * Sets a key value pair in the metadata column corresponding to the node's version. + * + * @param Node $node the node that triggered the Metadata event listener, aka, the file version + * @param int $revision the key for the json value of the metadata column + * @param string $key the key for the json value of the metadata column + * @param string $value the value that corresponds to the key in the metadata column + * @since 29.0.0 + */ + public function setMetadataValue(Node $node, int $revision, string $key, string $value): void + { + } +} diff --git a/tests/stubs/oca_files_versions_versions_ineedsyncversionbackend.php b/tests/stubs/oca_files_versions_versions_ineedsyncversionbackend.php new file mode 100644 index 000000000..8dd0ff5f3 --- /dev/null +++ b/tests/stubs/oca_files_versions_versions_ineedsyncversionbackend.php @@ -0,0 +1,26 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Command; + +use Symfony\Component\Console\Application; +use Symfony\Component\Console\Attribute\AsCommand; +use Symfony\Component\Console\Completion\CompletionInput; +use Symfony\Component\Console\Completion\CompletionSuggestions; +use Symfony\Component\Console\Exception\ExceptionInterface; +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\LogicException; +use Symfony\Component\Console\Helper\HelperSet; +use Symfony\Component\Console\Input\InputArgument; +use Symfony\Component\Console\Input\InputDefinition; +use Symfony\Component\Console\Input\InputInterface; +use Symfony\Component\Console\Input\InputOption; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Base class for all commands. + * + * @author Fabien Potencier + */ +class Command +{ + // see https://tldp.org/LDP/abs/html/exitcodes.html + public const SUCCESS = 0; + public const FAILURE = 1; + public const INVALID = 2; + + /** + * @var string|null The default command name + */ + protected static $defaultName; + + /** + * @var string|null The default command description + */ + protected static $defaultDescription; + + /** + * @return string|null + */ + public static function getDefaultName() + { + } + + public static function getDefaultDescription(): ?string + { + } + + /** + * @param string|null $name The name of the command; passing null means it must be set in configure() + * + * @throws LogicException When the command name is empty + */ + public function __construct(?string $name = null) + { + } + + /** + * Ignores validation errors. + * + * This is mainly useful for the help command. + */ + public function ignoreValidationErrors() + { + } + + public function setApplication(?Application $application = null) + { + } + + public function setHelperSet(HelperSet $helperSet) + { + } + + /** + * Gets the helper set. + * + * @return HelperSet|null + */ + public function getHelperSet() + { + } + + /** + * Gets the application instance for this command. + * + * @return Application|null + */ + public function getApplication() + { + } + + /** + * Checks whether the command is enabled or not in the current environment. + * + * Override this to check for x or y and return false if the command cannot + * run properly under the current conditions. + * + * @return bool + */ + public function isEnabled() + { + } + + /** + * Configures the current command. + */ + protected function configure() + { + } + + /** + * Executes the current command. + * + * This method is not abstract because you can use this class + * as a concrete class. In this case, instead of defining the + * execute() method, you set the code to execute by passing + * a Closure to the setCode() method. + * + * @return int 0 if everything went fine, or an exit code + * + * @throws LogicException When this abstract method is not implemented + * + * @see setCode() + */ + protected function execute(InputInterface $input, OutputInterface $output) + { + } + + /** + * Interacts with the user. + * + * This method is executed before the InputDefinition is validated. + * This means that this is the only place where the command can + * interactively ask for values of missing required arguments. + */ + protected function interact(InputInterface $input, OutputInterface $output) + { + } + + /** + * Initializes the command after the input has been bound and before the input + * is validated. + * + * This is mainly useful when a lot of commands extends one main command + * where some things need to be initialized based on the input arguments and options. + * + * @see InputInterface::bind() + * @see InputInterface::validate() + */ + protected function initialize(InputInterface $input, OutputInterface $output) + { + } + + /** + * Runs the command. + * + * The code to execute is either defined directly with the + * setCode() method or by overriding the execute() method + * in a sub-class. + * + * @return int The command exit code + * + * @throws ExceptionInterface When input binding fails. Bypass this by calling {@link ignoreValidationErrors()}. + * + * @see setCode() + * @see execute() + */ + public function run(InputInterface $input, OutputInterface $output) + { + } + + /** + * Adds suggestions to $suggestions for the current completion input (e.g. option or argument). + */ + public function complete(CompletionInput $input, CompletionSuggestions $suggestions): void + { + } + + /** + * Sets the code to execute when running this command. + * + * If this method is used, it overrides the code defined + * in the execute() method. + * + * @param callable $code A callable(InputInterface $input, OutputInterface $output) + * + * @return $this + * + * @throws InvalidArgumentException + * + * @see execute() + */ + public function setCode(callable $code) + { + } + + /** + * Merges the application definition with the command definition. + * + * This method is not part of public API and should not be used directly. + * + * @param bool $mergeArgs Whether to merge or not the Application definition arguments to Command definition arguments + * + * @internal + */ + public function mergeApplicationDefinition(bool $mergeArgs = true) + { + } + + /** + * Sets an array of argument and option instances. + * + * @param array|InputDefinition $definition An array of argument and option instances or a definition instance + * + * @return $this + */ + public function setDefinition($definition) + { + } + + /** + * Gets the InputDefinition attached to this Command. + * + * @return InputDefinition + */ + public function getDefinition() + { + } + + /** + * Gets the InputDefinition to be used to create representations of this Command. + * + * Can be overridden to provide the original command representation when it would otherwise + * be changed by merging with the application InputDefinition. + * + * This method is not part of public API and should not be used directly. + * + * @return InputDefinition + */ + public function getNativeDefinition() + { + } + + /** + * Adds an argument. + * + * @param int|null $mode The argument mode: InputArgument::REQUIRED or InputArgument::OPTIONAL + * @param mixed $default The default value (for InputArgument::OPTIONAL mode only) + * + * @return $this + * + * @throws InvalidArgumentException When argument mode is not valid + */ + public function addArgument(string $name, ?int $mode = null, string $description = '', $default = null) + { + } + + /** + * Adds an option. + * + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the InputOption::VALUE_* constants + * @param mixed $default The default value (must be null for InputOption::VALUE_NONE) + * + * @return $this + * + * @throws InvalidArgumentException If option mode is invalid or incompatible + */ + public function addOption(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) + { + } + + /** + * Sets the name of the command. + * + * This method can set both the namespace and the name if + * you separate them by a colon (:) + * + * $command->setName('foo:bar'); + * + * @return $this + * + * @throws InvalidArgumentException When the name is invalid + */ + public function setName(string $name) + { + } + + /** + * Sets the process title of the command. + * + * This feature should be used only when creating a long process command, + * like a daemon. + * + * @return $this + */ + public function setProcessTitle(string $title) + { + } + + /** + * Returns the command name. + * + * @return string|null + */ + public function getName() + { + } + + /** + * @param bool $hidden Whether or not the command should be hidden from the list of commands + * The default value will be true in Symfony 6.0 + * + * @return $this + * + * @final since Symfony 5.1 + */ + public function setHidden(bool $hidden) + { + } + + /** + * @return bool whether the command should be publicly shown or not + */ + public function isHidden() + { + } + + /** + * Sets the description for the command. + * + * @return $this + */ + public function setDescription(string $description) + { + } + + /** + * Returns the description for the command. + * + * @return string + */ + public function getDescription() + { + } + + /** + * Sets the help for the command. + * + * @return $this + */ + public function setHelp(string $help) + { + } + + /** + * Returns the help for the command. + * + * @return string + */ + public function getHelp() + { + } + + /** + * Returns the processed help for the command replacing the %command.name% and + * %command.full_name% patterns with the real values dynamically. + * + * @return string + */ + public function getProcessedHelp() + { + } + + /** + * Sets the aliases for the command. + * + * @param string[] $aliases An array of aliases for the command + * + * @return $this + * + * @throws InvalidArgumentException When an alias is invalid + */ + public function setAliases(iterable $aliases) + { + } + + /** + * Returns the aliases for the command. + * + * @return array + */ + public function getAliases() + { + } + + /** + * Returns the synopsis for the command. + * + * @param bool $short Whether to show the short version of the synopsis (with options folded) or not + * + * @return string + */ + public function getSynopsis(bool $short = false) + { + } + + /** + * Add a command usage example, it'll be prefixed with the command name. + * + * @return $this + */ + public function addUsage(string $usage) + { + } + + /** + * Returns alternative usages of the command. + * + * @return array + */ + public function getUsages() + { + } + + /** + * Gets a helper instance by name. + * + * @return mixed + * + * @throws LogicException if no HelperSet is defined + * @throws InvalidArgumentException if the helper is not defined + */ + public function getHelper(string $name) + { + } +} diff --git a/tests/stubs/symfony_component_console_helper_table.php b/tests/stubs/symfony_component_console_helper_table.php new file mode 100644 index 000000000..5937ca7fc --- /dev/null +++ b/tests/stubs/symfony_component_console_helper_table.php @@ -0,0 +1,209 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Helper; + +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; +use Symfony\Component\Console\Formatter\OutputFormatter; +use Symfony\Component\Console\Formatter\WrappableOutputFormatterInterface; +use Symfony\Component\Console\Output\ConsoleSectionOutput; +use Symfony\Component\Console\Output\OutputInterface; + +/** + * Provides helpers to display a table. + * + * @author Fabien Potencier + * @author Саша Стаменковић + * @author Abdellatif Ait boudad + * @author Max Grigorian + * @author Dany Maillard + */ +class Table +{ + private const SEPARATOR_TOP = 0; + private const SEPARATOR_TOP_BOTTOM = 1; + private const SEPARATOR_MID = 2; + private const SEPARATOR_BOTTOM = 3; + private const BORDER_OUTSIDE = 0; + private const BORDER_INSIDE = 1; + + public function __construct(OutputInterface $output) + { + } + + /** + * Sets a style definition. + */ + public static function setStyleDefinition(string $name, TableStyle $style) + { + } + + /** + * Gets a style definition by name. + * + * @return TableStyle + */ + public static function getStyleDefinition(string $name) + { + } + + /** + * Sets table style. + * + * @param TableStyle|string $name The style name or a TableStyle instance + * + * @return $this + */ + public function setStyle($name) + { + } + + /** + * Gets the current table style. + * + * @return TableStyle + */ + public function getStyle() + { + } + + /** + * Sets table column style. + * + * @param TableStyle|string $name The style name or a TableStyle instance + * + * @return $this + */ + public function setColumnStyle(int $columnIndex, $name) + { + } + + /** + * Gets the current style for a column. + * + * If style was not set, it returns the global table style. + * + * @return TableStyle + */ + public function getColumnStyle(int $columnIndex) + { + } + + /** + * Sets the minimum width of a column. + * + * @return $this + */ + public function setColumnWidth(int $columnIndex, int $width) + { + } + + /** + * Sets the minimum width of all columns. + * + * @return $this + */ + public function setColumnWidths(array $widths) + { + } + + /** + * Sets the maximum width of a column. + * + * Any cell within this column which contents exceeds the specified width will be wrapped into multiple lines, while + * formatted strings are preserved. + * + * @return $this + */ + public function setColumnMaxWidth(int $columnIndex, int $width): self + { + } + + /** + * @return $this + */ + public function setHeaders(array $headers) + { + } + + public function setRows(array $rows) + { + } + + /** + * @return $this + */ + public function addRows(array $rows) + { + } + + /** + * @return $this + */ + public function addRow($row) + { + } + + /** + * Adds a row to the table, and re-renders the table. + * + * @return $this + */ + public function appendRow($row): self + { + } + + /** + * @return $this + */ + public function setRow($column, array $row) + { + } + + /** + * @return $this + */ + public function setHeaderTitle(?string $title): self + { + } + + /** + * @return $this + */ + public function setFooterTitle(?string $title): self + { + } + + /** + * @return $this + */ + public function setHorizontal(bool $horizontal = true): self + { + } + + /** + * Renders table to output. + * + * Example: + * + * +---------------+-----------------------+------------------+ + * | ISBN | Title | Author | + * +---------------+-----------------------+------------------+ + * | 99921-58-10-7 | Divine Comedy | Dante Alighieri | + * | 9971-5-0210-0 | A Tale of Two Cities | Charles Dickens | + * | 960-425-059-0 | The Lord of the Rings | J. R. R. Tolkien | + * +---------------+-----------------------+------------------+ + */ + public function render() + { + } +} diff --git a/tests/stubs/symfony_component_console_input_inputargument.php b/tests/stubs/symfony_component_console_input_inputargument.php new file mode 100644 index 000000000..883a94cb4 --- /dev/null +++ b/tests/stubs/symfony_component_console_input_inputargument.php @@ -0,0 +1,95 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Input; + +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\LogicException; + +/** + * Represents a command line argument. + * + * @author Fabien Potencier + */ +class InputArgument +{ + public const REQUIRED = 1; + public const OPTIONAL = 2; + public const IS_ARRAY = 4; + + /** + * @param string $name The argument name + * @param int|null $mode The argument mode: a bit mask of self::REQUIRED, self::OPTIONAL and self::IS_ARRAY + * @param string $description A description text + * @param string|bool|int|float|array|null $default The default value (for self::OPTIONAL mode only) + * + * @throws InvalidArgumentException When argument mode is not valid + */ + public function __construct(string $name, ?int $mode = null, string $description = '', $default = null) + { + } + + /** + * Returns the argument name. + * + * @return string + */ + public function getName() + { + } + + /** + * Returns true if the argument is required. + * + * @return bool true if parameter mode is self::REQUIRED, false otherwise + */ + public function isRequired() + { + } + + /** + * Returns true if the argument can take multiple values. + * + * @return bool true if mode is self::IS_ARRAY, false otherwise + */ + public function isArray() + { + } + + /** + * Sets the default value. + * + * @param string|bool|int|float|array|null $default + * + * @throws LogicException When incorrect default value is given + */ + public function setDefault($default = null) + { + } + + /** + * Returns the default value. + * + * @return string|bool|int|float|array|null + */ + public function getDefault() + { + } + + /** + * Returns the description text. + * + * @return string + */ + public function getDescription() + { + } +} diff --git a/tests/stubs/symfony_component_console_input_inputinterface.php b/tests/stubs/symfony_component_console_input_inputinterface.php new file mode 100644 index 000000000..8e693e352 --- /dev/null +++ b/tests/stubs/symfony_component_console_input_inputinterface.php @@ -0,0 +1,181 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Input; + +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\RuntimeException; + +/** + * InputInterface is the interface implemented by all input classes. + * + * @author Fabien Potencier + */ +interface InputInterface +{ + /** + * Returns the first argument from the raw parameters (not parsed). + * + * @return string|null + */ + public function getFirstArgument() + { + } + + /** + * Returns true if the raw parameters (not parsed) contain a value. + * + * This method is to be used to introspect the input parameters + * before they have been validated. It must be used carefully. + * Does not necessarily return the correct result for short options + * when multiple flags are combined in the same option. + * + * @param string|array $values The values to look for in the raw parameters (can be an array) + * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal + * + * @return bool + */ + public function hasParameterOption($values, bool $onlyParams = false) + { + } + + /** + * Returns the value of a raw option (not parsed). + * + * This method is to be used to introspect the input parameters + * before they have been validated. It must be used carefully. + * Does not necessarily return the correct result for short options + * when multiple flags are combined in the same option. + * + * @param string|array $values The value(s) to look for in the raw parameters (can be an array) + * @param string|bool|int|float|array|null $default The default value to return if no result is found + * @param bool $onlyParams Only check real parameters, skip those following an end of options (--) signal + * + * @return mixed + */ + public function getParameterOption($values, $default = false, bool $onlyParams = false) + { + } + + /** + * Binds the current Input instance with the given arguments and options. + * + * @throws RuntimeException + */ + public function bind(InputDefinition $definition) + { + } + + /** + * Validates the input. + * + * @throws RuntimeException When not enough arguments are given + */ + public function validate() + { + } + + /** + * Returns all the given arguments merged with the default values. + * + * @return array + */ + public function getArguments() + { + } + + /** + * Returns the argument value for a given argument name. + * + * @return mixed + * + * @throws InvalidArgumentException When argument given doesn't exist + */ + public function getArgument(string $name) + { + } + + /** + * Sets an argument value by name. + * + * @param mixed $value The argument value + * + * @throws InvalidArgumentException When argument given doesn't exist + */ + public function setArgument(string $name, $value) + { + } + + /** + * Returns true if an InputArgument object exists by name or position. + * + * @return bool + */ + public function hasArgument(string $name) + { + } + + /** + * Returns all the given options merged with the default values. + * + * @return array + */ + public function getOptions() + { + } + + /** + * Returns the option value for a given option name. + * + * @return mixed + * + * @throws InvalidArgumentException When option given doesn't exist + */ + public function getOption(string $name) + { + } + + /** + * Sets an option value by name. + * + * @param mixed $value The option value + * + * @throws InvalidArgumentException When option given doesn't exist + */ + public function setOption(string $name, $value) + { + } + + /** + * Returns true if an InputOption object exists by name. + * + * @return bool + */ + public function hasOption(string $name) + { + } + + /** + * Is this input means interactive? + * + * @return bool + */ + public function isInteractive() + { + } + + /** + * Sets the input interactivity. + */ + public function setInteractive(bool $interactive) + { + } +} diff --git a/tests/stubs/symfony_component_console_input_inputoption.php b/tests/stubs/symfony_component_console_input_inputoption.php new file mode 100644 index 000000000..0065acb51 --- /dev/null +++ b/tests/stubs/symfony_component_console_input_inputoption.php @@ -0,0 +1,151 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Input; + +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\LogicException; + +/** + * Represents a command line option. + * + * @author Fabien Potencier + */ +class InputOption +{ + /** + * Do not accept input for the option (e.g. --yell). This is the default behavior of options. + */ + public const VALUE_NONE = 1; + + /** + * A value must be passed when the option is used (e.g. --iterations=5 or -i5). + */ + public const VALUE_REQUIRED = 2; + + /** + * The option may or may not have a value (e.g. --yell or --yell=loud). + */ + public const VALUE_OPTIONAL = 4; + + /** + * The option accepts multiple values (e.g. --dir=/foo --dir=/bar). + */ + public const VALUE_IS_ARRAY = 8; + + /** + * The option may have either positive or negative value (e.g. --ansi or --no-ansi). + */ + public const VALUE_NEGATABLE = 16; + + /** + * @param string|array|null $shortcut The shortcuts, can be null, a string of shortcuts delimited by | or an array of shortcuts + * @param int|null $mode The option mode: One of the VALUE_* constants + * @param string|bool|int|float|array|null $default The default value (must be null for self::VALUE_NONE) + * + * @throws InvalidArgumentException If option mode is invalid or incompatible + */ + public function __construct(string $name, $shortcut = null, ?int $mode = null, string $description = '', $default = null) + { + } + + /** + * Returns the option shortcut. + * + * @return string|null + */ + public function getShortcut() + { + } + + /** + * Returns the option name. + * + * @return string + */ + public function getName() + { + } + + /** + * Returns true if the option accepts a value. + * + * @return bool true if value mode is not self::VALUE_NONE, false otherwise + */ + public function acceptValue() + { + } + + /** + * Returns true if the option requires a value. + * + * @return bool true if value mode is self::VALUE_REQUIRED, false otherwise + */ + public function isValueRequired() + { + } + + /** + * Returns true if the option takes an optional value. + * + * @return bool true if value mode is self::VALUE_OPTIONAL, false otherwise + */ + public function isValueOptional() + { + } + + /** + * Returns true if the option can take multiple values. + * + * @return bool true if mode is self::VALUE_IS_ARRAY, false otherwise + */ + public function isArray() + { + } + + public function isNegatable(): bool + { + } + + /** + * @param string|bool|int|float|array|null $default + */ + public function setDefault($default = null) + { + } + + /** + * Returns the default value. + * + * @return string|bool|int|float|array|null + */ + public function getDefault() + { + } + + /** + * Returns the description text. + * + * @return string + */ + public function getDescription() + { + } + + /** + * Checks whether the given option equals this one. + * + * @return bool + */ + public function equals(self $option) + { + } +} diff --git a/tests/stubs/symfony_component_console_output_outputinterface.php b/tests/stubs/symfony_component_console_output_outputinterface.php new file mode 100644 index 000000000..da0ffce37 --- /dev/null +++ b/tests/stubs/symfony_component_console_output_outputinterface.php @@ -0,0 +1,134 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Output; + +use Symfony\Component\Console\Formatter\OutputFormatterInterface; + +/** + * OutputInterface is the interface implemented by all Output classes. + * + * @author Fabien Potencier + */ +interface OutputInterface +{ + public const VERBOSITY_QUIET = 16; + public const VERBOSITY_NORMAL = 32; + public const VERBOSITY_VERBOSE = 64; + public const VERBOSITY_VERY_VERBOSE = 128; + public const VERBOSITY_DEBUG = 256; + + public const OUTPUT_NORMAL = 1; + public const OUTPUT_RAW = 2; + public const OUTPUT_PLAIN = 4; + + /** + * Writes a message to the output. + * + * @param string|iterable $messages The message as an iterable of strings or a single string + * @param bool $newline Whether to add a newline + * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + */ + public function write($messages, bool $newline = false, int $options = 0) + { + } + + /** + * Writes a message to the output and adds a newline at the end. + * + * @param string|iterable $messages The message as an iterable of strings or a single string + * @param int $options A bitmask of options (one of the OUTPUT or VERBOSITY constants), 0 is considered the same as self::OUTPUT_NORMAL | self::VERBOSITY_NORMAL + */ + public function writeln($messages, int $options = 0) + { + } + + /** + * Sets the verbosity of the output. + */ + public function setVerbosity(int $level) + { + } + + /** + * Gets the current verbosity of the output. + * + * @return int + */ + public function getVerbosity() + { + } + + /** + * Returns whether verbosity is quiet (-q). + * + * @return bool + */ + public function isQuiet() + { + } + + /** + * Returns whether verbosity is verbose (-v). + * + * @return bool + */ + public function isVerbose() + { + } + + /** + * Returns whether verbosity is very verbose (-vv). + * + * @return bool + */ + public function isVeryVerbose() + { + } + + /** + * Returns whether verbosity is debug (-vvv). + * + * @return bool + */ + public function isDebug() + { + } + + /** + * Sets the decorated flag. + */ + public function setDecorated(bool $decorated) + { + } + + /** + * Gets the decorated flag. + * + * @return bool + */ + public function isDecorated() + { + } + + public function setFormatter(OutputFormatterInterface $formatter) + { + } + + /** + * Returns current output formatter instance. + * + * @return OutputFormatterInterface + */ + public function getFormatter() + { + } +} diff --git a/tests/stubs/symfony_component_console_question_confirmationquestion.php b/tests/stubs/symfony_component_console_question_confirmationquestion.php new file mode 100644 index 000000000..0db6fe2fa --- /dev/null +++ b/tests/stubs/symfony_component_console_question_confirmationquestion.php @@ -0,0 +1,29 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Question; + +/** + * Represents a yes/no question. + * + * @author Fabien Potencier + */ +class ConfirmationQuestion extends Question +{ + /** + * @param string $question The question to ask to the user + * @param bool $default The default answer to return, true or false + * @param string $trueAnswerRegex A regex to match the "yes" answer + */ + public function __construct(string $question, bool $default = true, string $trueAnswerRegex = '/^y/i') + { + } +} diff --git a/tests/stubs/symfony_component_console_question_question.php b/tests/stubs/symfony_component_console_question_question.php new file mode 100644 index 000000000..b5f9a5168 --- /dev/null +++ b/tests/stubs/symfony_component_console_question_question.php @@ -0,0 +1,220 @@ + + * + * For the full copyright and license information, please view the LICENSE + * file that was distributed with this source code. + */ + +namespace Symfony\Component\Console\Question; + +use Symfony\Component\Console\Exception\InvalidArgumentException; +use Symfony\Component\Console\Exception\LogicException; + +/** + * Represents a Question. + * + * @author Fabien Potencier + */ +class Question +{ + /** + * @param string $question The question to ask to the user + * @param string|bool|int|float|null $default The default answer to return if the user enters nothing + */ + public function __construct(string $question, $default = null) + { + } + + /** + * Returns the question. + * + * @return string + */ + public function getQuestion() + { + } + + /** + * Returns the default answer. + * + * @return string|bool|int|float|null + */ + public function getDefault() + { + } + + /** + * Returns whether the user response accepts newline characters. + */ + public function isMultiline(): bool + { + } + + /** + * Sets whether the user response should accept newline characters. + * + * @return $this + */ + public function setMultiline(bool $multiline): self + { + } + + /** + * Returns whether the user response must be hidden. + * + * @return bool + */ + public function isHidden() + { + } + + /** + * Sets whether the user response must be hidden or not. + * + * @return $this + * + * @throws LogicException In case the autocompleter is also used + */ + public function setHidden(bool $hidden) + { + } + + /** + * In case the response cannot be hidden, whether to fallback on non-hidden question or not. + * + * @return bool + */ + public function isHiddenFallback() + { + } + + /** + * Sets whether to fallback on non-hidden question if the response cannot be hidden. + * + * @return $this + */ + public function setHiddenFallback(bool $fallback) + { + } + + /** + * Gets values for the autocompleter. + * + * @return iterable|null + */ + public function getAutocompleterValues() + { + } + + /** + * Sets values for the autocompleter. + * + * @return $this + * + * @throws LogicException + */ + public function setAutocompleterValues(?iterable $values) + { + } + + /** + * Gets the callback function used for the autocompleter. + */ + public function getAutocompleterCallback(): ?callable + { + } + + /** + * Sets the callback function used for the autocompleter. + * + * The callback is passed the user input as argument and should return an iterable of corresponding suggestions. + * + * @return $this + */ + public function setAutocompleterCallback(?callable $callback = null): self + { + } + + /** + * Sets a validator for the question. + * + * @return $this + */ + public function setValidator(?callable $validator = null) + { + } + + /** + * Gets the validator for the question. + * + * @return callable|null + */ + public function getValidator() + { + } + + /** + * Sets the maximum number of attempts. + * + * Null means an unlimited number of attempts. + * + * @return $this + * + * @throws InvalidArgumentException in case the number of attempts is invalid + */ + public function setMaxAttempts(?int $attempts) + { + } + + /** + * Gets the maximum number of attempts. + * + * Null means an unlimited number of attempts. + * + * @return int|null + */ + public function getMaxAttempts() + { + } + + /** + * Sets a normalizer for the response. + * + * The normalizer can be a callable (a string), a closure or a class implementing __invoke. + * + * @return $this + */ + public function setNormalizer(callable $normalizer) + { + } + + /** + * Gets the normalizer for the response. + * + * The normalizer can ba a callable (a string), a closure or a class implementing __invoke. + * + * @return callable|null + */ + public function getNormalizer() + { + } + + protected function isAssoc(array $array) + { + } + + public function isTrimmable(): bool + { + } + + /** + * @return $this + */ + public function setTrimmable(bool $trimmable): self + { + } +}