pax_global_header00006660000000000000000000000064123623006760014517gustar00rootroot0000000000000052 comment=e51c3792bc0b726649e8176aeb1b5e371dced947 php-mode-1.13.5/000077500000000000000000000000001236230067600133175ustar00rootroot00000000000000php-mode-1.13.5/.gitignore000066400000000000000000000000111236230067600152770ustar00rootroot00000000000000*~ *.elc php-mode-1.13.5/Changelog.md000066400000000000000000000275161236230067600155430ustar00rootroot00000000000000Changes for PHP Mode by Version =============================== **Note:** This document does not list every change from every version, because when I (Eric James Michael Ritz) took over the project I did not have a record of all changes available. 1.13 ---- * Update version to 1.13 * Merge branch 'ejmr/highlight-variables-in-strings' * Merge commit '38e1940e950d47737fed30a5bd5d4e75e0faf103' * Append file patterns to auto-mode-alist * Guard propertize functions for Emacs that don't support it. * Add more tests for highlighting variable interpolation * Create a unit test for highlighting interpolated variables * Avoid calling syntax-propertize-rules as may be unavailable. * README: Explicitly mention the oldest supported Emacs * Merge branch 'heredoc-support' * README: Replace mention of ‘run-tests.sh’ with ‘make tests’ * Explain the expected behavior of the test for GitHub issue 124 * Added unit test for GitHub issue 124 * Replaced run-tests.sh with a Makefile * Replaced `put-text-property' with macro `c-put-char-property' * Added initial support for propertizing a heredoc as a string * Merge branch 'fix-highlighting-final-keyword' * Update php-mode-modified * Add a simple script to test syntax highlighting for ‘final’ * Add a template script for creating test cases * Fix ‘final’ not highlighted as a keyword in some methods * Merge branch 'github/pr/127' * Update php-mode-modified * Removed unused defconst. * Added PREG constants to the list of predefined constants. * Fix byte compile error again; resurfaced in after a merge. * Add Andrei Chițu to the list of contributors * fix inclusion of `web-mode-extra-php-keywords` in `php-keywords` * Update Changelog for version 1.12 1.12 ---- * Automatically enable PHP Mode for Amaka scripts * Also enable PHP Mode for Amaka scripts using the ‘*.amk’ extension * Use mode-specific functions for defun movement * Treat `const` as a keyword instead of a type-hint * Add `enddeclare` to the list of keywords * Treat `eval` as a built-in keyword * Show links to the official site and wiki when customizing PHP Mode * Update php-mode-modified for changes made today * Add FILTER_SANITIZE_FULL_SPECIAL_CHARS to the list of constants * Fix an error about php-extra-constants being void * Use extra constants and keywords from Web Mode if available * README: Replace ‘php-mode’ with ‘PHP Mode’ for consistency * README: Update the ‘Status’ section * README: Use the spelling ‘GitHub’ consistently * README: Add installation instructions * Address the compiler warning regarding `c-syntactic-context` * GitHub-Issue: 102 (Unit Test) * Fix indentation error involving magic constants * Merge branch 'ejmr/issue-102' * Stop marching indentation for try-catch blocks * GitHub-Issue: 100 (Unit Test) * Fix two errors with the regex for matching namespace imports * GitHub-Issue: 115 (Unit Test) * Use the PEAR indentation style by default for unit tests * Align chained method calls inside of arrays * Update php-mode-modified * Merge branch 'ejmr/align-method-calls-in-arrays' * Update php-mode-modified for byte-compiler fixes * Merge branch 'github/pr/123' * README: Document use of Web Mode constants and keywords * Merge branch 'ejmr/web-mode-constants' * Change the test for Issue 100 to require correct indentation * Line-up multiple namespaces in a multi-line ‘use’ statement * Merge branch 'ejmr/multiline-use-statements' * Increase the version number to 1.12 * Fix the compiler warning about `add-log-current-defun-header-regexp` * Add (require 'speedbar) as functions are used. * Remove eval-when-compile. * Add (require 'etags) as etag functions are used. * Added newline at end of file restriction to Symfony2 style. * Fix regex for namespaces in function calls 1.11 ---- * Add STDOUT, STDIN, and STDERR to the php-constants list * Add Symfony2 coding style. * Add a full copy of the license * Add proper statement-case-intro indent for symfony2 * Added "function" as a PHP keyword. * Added function php-lineup-arglist * Added gitignore with *.elc * Associate file extensions when installing from an Elisp repository * Be nice to PSR standards (there should be 4 spaces) * Correct indentation for array arguments (tests/issues-14.php) * Correct syntax highlighting for ‘parent’ and ‘self’ * Describe php-extra-constants in the README * Describe php-template-compatibility in the README * Do not expect failure for test issue-19 * Do not trigger search error in php-mode-test-issue-19 * Document Subword Mode in the README * Document support for the Symfony2 style in the README * Fix chained method alignment * Fix indentation of statements after ‘foreach’ without braces * Highlight ‘static’ as a constant when it appears in a class context * Improve the docstring for php-create-regexp-for-method * Improve the plain-text formatting of the README * Introduce php-extra-constants * Introduce php-template-compatility * Introduce ‘C-c C-w’ to toggle Subword Mode * Issue #73, correct behavior of `delete-indentation`. * List all methods via Imenu regardless of their visibility * Make `with-php-mode-test` aware of the Symfony2 coding style * README: Change the absolute link to the Changelog to a relative link * README: Correct the documentation for chained-method call alignment * README: Document how chained method alignment may fail * README: Reword the mention of Web Mode for clarity * README: Use syntax highlighting for the method alignment example * Re-define C-M-h to mark-defun instead of c-mark-function * Remove the unnecessary &optional from the with-php-mode-test macro * Set brace-list-entry to offset of four * Tests: Remove executable permissions from the issue 27 test * Treat ‘abstract’ as a keyword * Use "magic" comments in PHP files to simplify indentation testing * Use magic for tests of issues #14, #19, #27, #29, #42 * Workaround "bug" in `load-theme` 1.10 ---- * Add `php-mode-coding-style` so users can customize their preferred coding style. * Fix a bug that messes up the indentation of some closures. * Update php-mode for Emacs 24 with regard to changes to the `cl` Elisp library. * Submit php-mode to the [MELPA](http://melpa.milkbox.net/) repository. * Fix indentation of `foreach` blocks that have only a single statement following them, without any braces. * Add all valid flags for `htmlspecialchars()` to the list of constants. * Improve indentation of chained method calls, although this still has an issue to iron out. * Provide a test suite for developers working on php-mode to help improve quality control. * Add all constants for errors. * Add all constants for the cURL module. * Fix a bug where some methods are not highlighted as functions. * Remove `then` as a PHP keyword, since it is not a valid keyword. * Fix annotation highlighting when using C-style `/*...*/` comments. * Redefine the php-mode coding styles using cc-mode. * Fix a bug that applies incorrect syntax highlighting to certain PHP keywords when they appear in block comments, e.g. `continue`. * Fix a bug where php-mode incorrectly highlights variables and methods inside of comments. * Treat acceptable directives to `declare()` as keywords. 1.9 --- * Add all new PHP 5.5 keywords. * Add new test cases for indentation and highlighting. * Add new PHP 5.5 `PASSWORD_*` constants. * Do not treat function-like language constructs as functions, e.g. `array()`. * Treat `callable` as a valid type hint. * Fix an error regarding the requirement of `flymake`. * Fix a syntax error in `php-unindent-closure`. * Add support Drupal and WordPress coding styles. * Document how to change the default coding style in the README. * Fix an issue with running hooks after loading `php-mode`. * Properly fontify function calls using one namespace qualifier. 1.7 and 1.8 ----------- * Line up cascaded method calls. * Add test cases for indentation features. * Fix syntax highlighting for multiline strings. * Fix compiler warnings for: - `font-lock-syntactic-keywords` - `c-vsemi-status-unknown-p` * Support highlighting in annotations in comments. * Fix the ‘#’ sign as a comment delimeter. * Improve indentation for anonymous functions. * Remove unused libraries. * Remove a corrupted character from a docstring. 1.6.6 ----- * Improve indentation of functions and arrays. * Fix bug displaying strings in back-ticks. * Add `php-function-call-face`. * Add IMAP related constants. * Fix fontification of function arguments to work across multiple lines, including type-hints. * Fix bug when trying to browse online documentation. * Allow sending code to PHP directly for execution. * Add `die` to the list of language constructs. * Use `font-lock-syntatic-keywords` to detect quoted strings. 1.6.5 ----- There was no version 1.6.5 release due to poor planning on my part (EJMR). 1.6.4 ----- * Make it possible to use namespaces in more places. * Fix Elisp warnings about `save-excursion` and `set-buffer`. * Properly fontify the ‘instanceof’ operator. * Add function to search local PHP documentation. * Try searching local documentation before searching the manual on PHP.net online. * Add PHP to `interpreter-mode-alist`. * Improve indentation of nested arrays. * Add `.phpt` to `auto-mode-alist`. 1.6.3 ----- * Fix bug with regular vs. static function highlighting. * Add all `FILTER_*` and `INPUT_*` constants. * Add `php-mode-warn-if-mumamo-off`. * Fix fontification for namespace imports. * Do not warn on constructs like `$foo->$bar`. * Fontify expressions like `const Foo = 1`. * Fix fontification for `return new Foo()`. 1.6.2 ----- * Add notes on Github for contributing to php-mode. * Highlight ‘use ’ in class definitions. * Add Flymake support. 1.6.1 ----- * Support as magic and pre-defined constants. * Add ‘default’ as a keyword. * Add ‘clone’ as a keyword. * Align cascading function calls. * List methods in Imenu. * Show variables assigned to anonymous functions in Imenu. * Show interfaces in Imenu. * Prevent methods from appearing under ‘Named Functions’ on Imenu. 1.6 --- * Fix most definitions in `php-font-lock-keywords-2`. * Fix highlighting of namespace imports. * Treat ‘as’ and ‘use’ as keywords. 1.5.1 ----- * Add `__NAMESPACE__` to the list of constants. * Fontify ‘use as ’ constructs. * Fix highlighting for namespaces, classes, and traits. * Allow backslashes in namespaces for Imenu. 1.5.0-nxhtml-1.88 ----------------- * Do not indent heredoc end mark. 1.5.0-nxhtml-1.61 ----------------- * Add `php-mode-to-use`. * Made underscore part of identifiers. * Remove `php-mode-to`. * Make the indentation check only the current line. * Warn only once per session about indentation. * Tell if cannot complete in `php-complete-function`. * Move back point after checking indentation in `php-check-html-for-indentation`. * Add `c-at-vsemi-p-fn`. 1.5 --- * Support function keywords like `public` and `private`. * Support the ampersand for function-based commands. * Add support for the follow keywords in Imenu: - `abstract` - `final` - `static` - `public` - `private` * Fix the reverse order of Imenu entries. * Use `font-lock-preprocessor-face` for PHP and ASP tags. * Make `php-mode-modified` a literal value instead of a computed string. * Add date and time constants from PHP. * Fix false syntax highlighting of keywords due to the underscore. * Change HTML indentation warning to match only HTML at the beginning of the line. * Fix byte-compiler warnings. * Clean-up whitespace and audit style consistency of code. * Remove conditional bindings and XEmacs code that likely does nothing. 1.4 --- * Update to GNU GPL Version 3. * Port to Emacs 22 (CC Mode 5.31). * `M-x php-mode-version` shows that version. * Provide `beginning-of-defun` and `end-of-defun`. * Support add-log library. * Fix `__CLASS__` constant. * Allow Imenu to see visibility declarations. 1,3 --- * Change the definition of `#` to correct highlighting and indentation. * Change the highlighting of HTML. php-mode-1.13.5/LICENSE000066400000000000000000001045131236230067600143300ustar00rootroot00000000000000 GNU GENERAL PUBLIC LICENSE Version 3, 29 June 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 General Public License is a free, copyleft license for software and other kinds of works. The licenses for most software and other practical works are designed to take away your freedom to share and change the works. By contrast, the GNU General Public License is 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. We, the Free Software Foundation, use the GNU General Public License for most of our software; it applies also to any other work released this way by its authors. You can apply it to your programs, too. 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. To protect your rights, we need to prevent others from denying you these rights or asking you to surrender the rights. Therefore, you have certain responsibilities if you distribute copies of the software, or if you modify it: responsibilities to respect the freedom of others. For example, if you distribute copies of such a program, whether gratis or for a fee, you must pass on to the recipients the same freedoms that you received. You must make sure that they, too, receive or can get the source code. And you must show them these terms so they know their rights. Developers that use the GNU GPL protect your rights with two steps: (1) assert copyright on the software, and (2) offer you this License giving you legal permission to copy, distribute and/or modify it. For the developers' and authors' protection, the GPL clearly explains that there is no warranty for this free software. For both users' and authors' sake, the GPL requires that modified versions be marked as changed, so that their problems will not be attributed erroneously to authors of previous versions. Some devices are designed to deny users access to install or run modified versions of the software inside them, although the manufacturer can do so. This is fundamentally incompatible with the aim of protecting users' freedom to change the software. The systematic pattern of such abuse occurs in the area of products for individuals to use, which is precisely where it is most unacceptable. Therefore, we have designed this version of the GPL to prohibit the practice for those products. If such problems arise substantially in other domains, we stand ready to extend this provision to those domains in future versions of the GPL, as needed to protect the freedom of users. Finally, every program is threatened constantly by software patents. States should not allow patents to restrict development and use of software on general-purpose computers, but in those that do, we wish to avoid the special danger that patents applied to a free program could make it effectively proprietary. To prevent this, the GPL assures that patents cannot be used to render the program non-free. 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 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. Use with the GNU Affero General Public License. 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 Affero 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 special requirements of the GNU Affero General Public License, section 13, concerning interaction through a network will apply to the combination as such. 14. Revised Versions of this License. The Free Software Foundation may publish revised and/or new versions of the GNU 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 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 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 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 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 General Public License for more details. You should have received a copy of the GNU General Public License along with this program. If not, see . Also add information on how to contact you by electronic and paper mail. If the program does terminal interaction, make it output a short notice like this when it starts in an interactive mode: Copyright (C) This program comes with ABSOLUTELY NO WARRANTY; for details type `show w'. This is free software, and you are welcome to redistribute it under certain conditions; type `show c' for details. The hypothetical commands `show w' and `show c' should show the appropriate parts of the General Public License. Of course, your program's commands might be different; for a GUI interface, you would use an "about box". 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 GPL, see . The GNU General Public License does not permit incorporating your program into proprietary programs. If your program is a subroutine library, you may consider it more useful to permit linking proprietary applications with the library. If this is what you want to do, use the GNU Lesser General Public License instead of this License. But first, please read . php-mode-1.13.5/Makefile000066400000000000000000000013321236230067600147560ustar00rootroot00000000000000EMACS = emacs -Q -batch -L . ELS = php-mode.el php-mode-test.el ELCS = $(ELS:.el=.elc) %.elc: %.el $(EMACS) -f batch-byte-compile $< all: $(ELCS) clean: rm -f $(ELCS) # Runs all unit tests from php-mode-test.el and shows the results. The # script will exit with the status code zero if all tests pass. If any # test fails the script exits with a non-zero status and shows # diagnostics on standard output. # # You can use this script with git-bisect. See the documentation at # # http://git-scm.com/book/en/Git-Tools-Debugging-with-Git # # for an example of using a script like this with the 'git bisect run' # command. test: $(ELCS) $(EMACS) -l php-mode-test.el -f ert-run-tests-batch-and-exit .PHONY: all clean test php-mode-1.13.5/README.md000066400000000000000000000322231236230067600146000ustar00rootroot00000000000000PHP Mode for GNU Emacs ====================== This updates PHP Mode with features to make it more friendly to use with PHP 5.4 and later. This fork builds on the work of: 1. Turadg Aleahmad (Original Author) 2. Aaron S. Hawley 3. Lennart Borgman All contributors listed below improved PHP Mode as well. Please email any bugs or feature requests to `ejmr at plutono dot com` or submit them as Issues on the [GitHub page](https://github.com/ejmr/php-mode). Also please include the output of `php-mode-version` in bug reports. [There is a changelog for previous versions.](./Changelog.md) Installation ------------ If you are using GNU Emacs 24 or later then you can use its [package][] feature to install PHP Mode from [MELPA][]. *The [Marmalade][] package repository only has the original PHP Mode from 2004.* If you are using an older version of Emacs, or if you simply do not wish to use the package manager, then all you need to do is download the `php-mode.el` file, place it inside your `load-path`, and optionally add `(require 'php-mode)` to your Emacs configuration to automatically enable PHP Mode whenever you open a PHP file. **Note:** PHP Mode requires Emacs 23.1 or later. Status ------ I am currently looking for someone willing to take over as the maintainer of PHP Mode, ideally before the end of 2014. Please see [this discussion](https://github.com/ejmr/php-mode/issues/109) for details. Features -------- ### New Keywords ### Now PHP Mode supports syntax highlighting for new keywords which PHP 5.4 introduced, e.g. those related to traits, such as `insteadof`. Also supported are the older keywords `clone` and `default`. ### Constants ### Syntax highlighting includes every magic constant and predefined constant listed on the official PHP site. However, some constants from specific extensions are not currently included. ### Traits, Interfaces, and Namespaces ### Traits, interfaces, and namespaces now appear under Imenu listings. Fontification behaves properly for namespaces as well, so that code like `namespace Foo\Bar\Baz` no longer looks like a warning. This is also true for namespace aliases, e.g. `use as `; currently the aliased name is not listed in Imenu, but future versions will address this. ### Treatment of Underscores ### PHP Mode treats underscores as ‘symbol constituents’ (in Emacs terminology) so that you can use keys like `M-f` and `M-b` to move through the individual parts of a variable name like `$foo_bar_baz`. ### Chained Method Calls ### PHP Mode will align method calls over multiple lines anchored around the `->` operator, e.g.: ```php $object->foo() ->bar() ->baz(); ``` **Note:** Alignment will only work if you use one of the coding styles described below. PHP Mode uses [CC mode][] for indentation. If you use any indentation style other than those described under the *Coding Styles* section then the method alignment above is not guaranteed to work. ### Nested Array Formatting ### Nested function calls and `array()` structures now look better by default (or at least in my opinion). Here is an example of the style: ```php $results = Post::model()->find( array( 'select' => 'title', 'condition' => 'postID=:postID', 'params' => array(':postID' => 10), ) ); ``` ### Anonymous Functions ### Anonymous functions such as ```php $greet = function($name) { ... }; ``` will now appear on Imenu; in this case the name will be `$greet`. ### Flymake Support ### By customizing the variable `php-executable` you can enable Flymake mode in order to see warnings and errors in real-time as you write code. ### Search Local Documentation ### The key command `C-c C-f` will search the PHP website for documentation on the word under the cursor. However, if you have a [local copy of the PHP documentation](http://us2.php.net/download-docs.php) then PHP Mode will try searching that documentation first. All you need to do is customize the variable `php-manual-path` and give it the path to your copy of the documentation. If PHP Mode cannot find something locally then it will still fallback on searching the PHP website. ### Executing Regions of PHP ### The command `php-send-region`, which is bound to `C-c C-r` by default, will execute the selected region of PHP code. In conjunction with the Emacs command `C-x h` you can use this to execute an entire file. Any output will appear in a buffer called `*PHP*`. ### Annotation Highlighting ### Projects like [Symfony](http://symfony.com/) use annotations in comments. For example, here is code from their website: ```php /** * @ORM\Entity * @ORM\Table(name="product") */ class Product { /** * @ORM\Id * @ORM\Column(type="integer") * @ORM\GeneratedValue(strategy="AUTO") */ protected $id; /** * @ORM\Column(type="string", length=100) */ protected $name; /** * @ORM\Column(type="decimal", scale=2) */ protected $price; /** * @ORM\Column(type="text") */ protected $description; } ``` The annotations are the lines that begin with the `@` character, and PHP Mode will give these special highlighting to help them stand out. ### Coding Styles ### By default PHP Mode tries to provide a reasonable style for indentation and formatting. However, it provides other options suited for particular projects which you may find useful. These coding styles are available through these functions: 1. `php-enable-pear-coding-style` 2. `php-enable-drupal-coding-style` 3. `php-enable-wordpress-coding-style` 4. `php-enable-symfony2-coding-style` They will help format your code for PEAR projects, or work on Drupal, WordPress, and Symfony2 software, respectively. You may enable any of them by default by running `M-x customize-group php` and looking for the ‘PHP Mode Coding Style’ option. #### Symfony2 Style #### With this style method call chains can be formatted with indented continuation and a hanging semi-colon: ```php $user1 ->setCreateDate(new \DateTime('2007-05-07 01:34:45')) ->setLastDate(new \DateTime('2012-08-18 19:03:02')) ->setUsername('jay') ; ``` This style is used widely throughout Symfony2 source code even if it is not explicitly mentioned in their conventions documents. ### Extra Constants ### If you commonly use a framework or library that defines a set of constants then you may wish to customize the value of `php-extra-constants`. It is a list of strings that PHP Mode will treat as additional constants, i.e. providing them the same level syntax highlighting that PHP Mode uses for built-in constants. ### Web Mode Constants and Keywords ### If you use [Web Mode][] then PHP Mode will attempt to use any additional PHP constants and keywords that Web Mode allows you to define. ### Avoid HTML Template Compatibility ### Many developers use PHP Mode to edit pure PHP scripts (e.g. files with only PHP and no HTML). A basic compatibility layer with HTML has historically been part of PHP Mode but it does not work perfectly and can cause some bad side effects such as slowness and incorrect font locking. Configuring the `php-template-compatibility` property with a `nil` will cancel any attempt of HTML compatibility. [Web Mode](http://web-mode.org/) is a great alternative to PHP Mode if you need to work with PHP scripts that do contain HTML and other markup. ### Subword Mode ### GNU Emacs comes with [Subword Mode][], a minor mode that allows you to navigate the parts of a [camelCase][] as if they were separate words. For example, PHP Mode treats the variable `$fooBarBaz` as a whole name by default. But if you enable Subword Mode then Emacs will treat the variable name as three separate words, and therefore word-related commands (e.g. `M-f`, `M-b`, `M-d`) will only affect the camelCase part of the name under the cursor. If you want to always use Subword Mode for PHP files then you can add this to your Emacs configuration: ```lisp (add-hook 'php-mode-hook (lambda () (subword-mode 1))) ``` The key-binding `C-c C-w` will also toggle Subword Mode on and off. ### Amaka Support ### Viewing and editing build scripts for [Amaka](http://trashofmasters.github.io/amaka/) will automatically enable PHP Mode. How to Contribute ----------------- All contributions to PHP Mode are welcome. But please try to do the following when sending improvements or bug fixes: 1. Add your name to the list of ‘Contributors’ in this `README.md` file if it is not there already. If you have a GitHub page then please link your name to it, so people can see your other work. 2. If your contribution addresses an issue on the GitHub project page then include a single line like `GitHub-Issue: 16` with the appropriate issue number. 3. Make sure to update the constant `php-mode-modified`. 4. However, please do not modify `php-mode-version-number`. I will decide what constitutes a bump in the version number. 5. Open the `php-mode-test.el` file and [run all of the tests](http://www.gnu.org/software/emacs/manual/html_node/ert/Running-Tests-Interactively.html#Running-Tests-Interactively) to ensure they still pass as expected. Sometimes we expect for a test to fail, and those unit tests have the appropriate configuration so their failure will not raise any warnings. You can use `make test` script to run all tests from a terminal, which is also useful in conjunction with [`git bisect run`](http://git-scm.com/book/en/Git-Tools-Debugging-with-Git). 6. Send me a pull request here on GitHub. Or if you do not have a GitHub account then email the patches to me at `lobbyjones at gmail dot com`. Please try to make sure the patches are acceptable input to the comand `git am`. Please note that even if you send a pull request it is very likely that I will *not* simply merge your branch through GitHub; I prefer to go through commits and cherry-pick them so I can review the commit messages and sign-off on them. You can see which commits I did or did not merge by using the [`git-cherry`](http://www.kernel.org/pub/software/scm/git/docs/git-cherry.html) command. If you are fixing a bug related to a GitHub issue, then first of all, thank you for the help improving PHP Mode. Second, there is a `tests/` directory which contains PHP scripts for issues (although not all of them). Please consider adding a test script to that directory that documents the expected behavior and provides code that allows others to see if said behavior works properly. Then create a unit test within `php-mode-test.el` using [ERT][]. Please try to follow the format of the existing tests. The Wiki -------- The GitHub project page has a [wiki][] that you should feel free to edit. The wiki lists the features and bugs that are on plan to include in upcoming versions of PHP Mode. It is also a place to add any tips to make the mode more useful. License ------- PHP Mode uses the [GNU General Public License 3](http://www.gnu.org/copyleft/gpl.html). Contributors ------------ In chronological order: 1. Juanjo 2. Torsten Martinsen 3. Vinai Kopp 4. Sean Champ 5. Doug Marcey 6. Kevin Blake 7. Rex McMaster 8. Mathias Meyer 9. Boris Folgmann 10. Roland 11. Rosenfeld 12. Fred Yankowski 13. Craig Andrews 14. John Keller 15. Ryan 16. Sammartino 17. ppercot 18. Valentin Funk 19. Stig Bakken 20. Gregory Stark 21. Chris Morris 22. Nils Rennebarth 23. Gerrit Riessen 24. Eric Mc Sween 25. Ville Skytta 26. Giacomo Tesio 27. Urban Müller 28. [Engelke Eschner](https://github.com/tekai) 29. Lennart Borgman 30. Stefan Monnier 31. Aaron S. Hawley 32. [Ian Eure](https://github.com/ieure) 33. [Bill Lovett](https://github.com/lovett) 34. Dias Badekas 35. David House 36. [Tom Willemse](https://github.com/ryuslash) 37. [Olaf the Viking](https://github.com/olavTHEviking) 38. [Maël Nison](https://github.com/arcanis) 39. [flack](https://github.com/flack) 40. [Michele Bini](https://github.com/rev22) 41. Emanuele Tomasi 42. [David Maus](https://github.com/dmj) 43. [Jakub Jankiewicz](https://github.com/jcubic) 44. [Marcin Antczak](https://github.com/marcinant) 45. [顾伟刚](https://github.com/guweigang) 46. [zapad](https://github.com/zargener) 47. [Carl Groner](https://github.com/cgroner) 48. [Michael Dwyer](https://github.com/kalifg) 49. [Daniel Hackney](https://github.com/haxney) 50. [Nate Eagleson](https://github.com/NateEag) 51. [Steve Purcell](https://github.com/purcell) 52. TatriX 53. [François-Xavier Bois](https://github.com/fxbois) 54. [James Laver](https://github.com/jjl) 55. [Jacek Wysocki](https://github.com/exu) 56. [Jon Dufrense](https://github.com/jdufresne) 57. [Andrei Chițu](https://github.com/achitu) 58. [phil-s](https://github.com/phil-s) 59. [Bence Kalmar](https://github.com/brkalmar) 60. [Elis Axelsson](https://github.com/etu) 61. [Alan Pearce](https://github.com/alanpearce) [wiki]: https://github.com/ejmr/php-mode/wiki [ert]: http://www.gnu.org/software/emacs/manual/html_node/ert/index.html [cc mode]: https://www.gnu.org/software/emacs/manual/html_mono/ccmode.html [Subword Mode]: https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html [camelCase]: http://en.wikipedia.org/wiki/Camel_case [package]: https://www.gnu.org/software/emacs/manual/html_node/emacs/Packages.html [MELPA]: http://melpa.milkbox.net/ [Marmalade]: http://marmalade-repo.org/ [Web Mode]: http://web-mode.org/ php-mode-1.13.5/php-mode-test.el000066400000000000000000000242371236230067600163370ustar00rootroot00000000000000;;; php-mode-test.el --- Tests for php-mode ;; Copyright (C) 2013 Daniel Hackney ;; 2014 Eric James Michael Ritz ;; Author: Daniel Hackney ;; URL: https://github.com/ejmr/php-mode ;;; License ;; This file is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 3 ;; of the License, or (at your option) any later version. ;; This file 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 General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this file; if not, write to the Free Software ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ;; 02110-1301, USA. ;;; Commentary: ;; Automate tests from the "tests" directory using `ert', which comes bundled ;; with Emacs >= 24.1. ;;; Code: (require 'php-mode) (require 'ert) (eval-when-compile (require 'cl)) ;; Work around bug #14325 ;; . (c-after-font-lock-init) (defvar php-mode-test-dir (expand-file-name "tests" (file-name-directory load-file-name)) "Directory containing the `php-mode' test files.") (defvar php-mode-test-valid-magics '(indent) "List of allowed \"magic\" directives which can appear in test cases.") (defvar php-mode-test-magic-regexp "###php-mode-test### \\((.+)\\)" "Regexp which identifies a magic comment.") (defun php-mode-test-process-magics () "Process the test directives in the current buffer. These are the ###php-mode-test### comments. Valid magics are listed in `php-mode-test-valid-magics'; no other directives will be processed." (flet ((indent (offset) (equal (current-indentation) offset))) (let (directives answers) (save-excursion (goto-char (point-min)) (while (re-search-forward php-mode-test-magic-regexp nil t) (setq directives (read (buffer-substring (match-beginning 1) (match-end 1)))) (setq answers (append (mapcar (lambda (curr) (let ((fn (car curr)) (args (mapcar 'eval (cdr-safe curr)))) (if (memq fn php-mode-test-valid-magics) (apply fn args)))) directives) answers)))) answers))) (defmacro* with-php-mode-test ((file &key style indent magic) &rest body) "Set up environment for testing `php-mode'. Execute BODY in a temporary buffer containing the contents of FILE, in `php-mode'. Optional keyword `:style' can be used to set the coding style to one of the following: 1. `pear' 2. `drupal' 3. `wordpress' 4. `symfony2' Using any other symbol for STYLE results in undefined behavior. The test will use the PEAR style by default." (declare (indent 1)) `(with-temp-buffer (insert-file-contents (expand-file-name ,file php-mode-test-dir)) (php-mode) (font-lock-fontify-buffer) ,(case style (pear '(php-enable-pear-coding-style)) (drupal '(php-enable-drupal-coding-style)) (wordpress '(php-enable-wordpress-coding-style)) (symfony2 '(php-enable-symfony2-coding-style)) (t '(php-enable-pear-coding-style))) ,(if indent '(indent-region (point-min) (point-max))) ,(if magic '(should (reduce (lambda (l r) (and l r)) (php-mode-test-process-magics)))) (goto-char (point-min)) ,@body)) (ert-deftest php-mode-test-issue-8 () "Annotation highlighting." (with-php-mode-test ("issue-8.php") (search-forward "@ORM") (should (eq (get-text-property (match-beginning 0) 'face) 'php-annotations-annotation-face)))) (ert-deftest php-mode-test-issue-9 () "Single quote in text in HTML misinterpreted. The next character after \">We\" is a single quote. It should not have a string face." :expected-result :failed (with-php-mode-test ("issue-9.php") (should-not (eq (get-text-property (search-forward ">We") 'face) 'font-lock-string-face)))) (ert-deftest php-mode-test-issue-14 () "Array indentation." (with-php-mode-test ("issue-14.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-16 () "Comma separated \"use\" (namespaces). Gets the face of the text after the comma." (with-php-mode-test ("issue-16.php") (re-search-forward "^use " nil nil 3) (should (eq (get-text-property (search-forward ", ") 'face) 'font-lock-type-face)))) (ert-deftest php-mode-test-issue-18 () "Indentation of strings which include \"//\"." (with-php-mode-test ("issue-18.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-19 () "Alignment of arrow operators." (with-php-mode-test ("issue-19.php" :indent t) (while (search-forward "$object->" (point-max) t) ;; Point is just after `->' (let ((col (current-column))) (search-forward "->") (should (= (current-column) col)))))) (ert-deftest php-mode-test-issue-21 () "Font locking multi-line string." (with-php-mode-test ("issue-21.php") (search-forward "\"") (while (not (looking-at "\"")) (should (eq (get-text-property (point) 'face) 'font-lock-string-face)) (forward-char)))) (ert-deftest php-mode-test-issue-22 () "Font lock quotes within comments as regular comments. This applies for both single and double quotes." (with-php-mode-test ("issue-21.php") (while (search-forward "#" nil t) (while (not (looking-at "\n")) (should (eq (get-text-property (point) 'face) 'font-lock-comment-face)) (forward-char))))) (ert-deftest php-mode-test-issue-27 () "Indentation in a file with a shebang." (with-php-mode-test ("issue-27.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-28 () "Slowdown when scrolling. No obvious way to test this. One possibility is to record time it takes to scroll down the whole buffer using `next-line'. This may not cause the desired fontification, and it could take different amounts of time on different machines, so an absolute time would not be very useful. This doesn't test anything, for now." (should t)) (ert-deftest php-mode-test-issue-29 () "Indentation of anonymous functions as arguments. The closing brace and parenthesis should be at column 0." (with-php-mode-test ("issue-29.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-42 () "Error while indenting closures. If the bug has been fixed, indenting the buffer should not cause an error." (with-php-mode-test ("issue-42.php" :indent t))) (ert-deftest php-mode-test-issue-53 () "Check if whitespace effects are undone when changing coding style from Drupal." (with-php-mode-test ("issue-53.php") (search-forward "return $this->bar;") ;; the file written to has no significance, only the buffer (let ((tmp-filename (make-temp-name temporary-file-directory))) (dolist (mode '(pear wordpress symfony2)) (php-mode-custom-coding-style-set 'php-mode-coding-style 'drupal) (php-mode-custom-coding-style-set 'php-mode-coding-style mode) (should-not show-trailing-whitespace) (write-file tmp-filename) (should (char-equal (char-after) ?\s)))))) (ert-deftest php-mode-test-issue-73 () "The `delete-indentation' function should work properly for PHP. This means modifying the logic of `fixup-whitespace' so that it eliminates spaces before ',', ';', '->' amd '::' and after '->' and '::'." (with-php-mode-test ("issue-73.php") (when (search-forward "# Correct" nil t) (forward-line 1) (let ((correct-line (thing-at-point 'line))) (while (search-forward "# Test" nil t) (forward-line 1) (let ((current-line (line-number-at-pos))) (catch 'eob (while (not (looking-at-p "$")) (unless (zerop (forward-line 1)) (throw 'eob t)))) (forward-line -1) (while (not (eq (line-number-at-pos) current-line)) (delete-indentation)) (beginning-of-line) (should (string= (thing-at-point 'line) correct-line)))))))) (ert-deftest php-mode-test-issue-99 () "Proper indentation for 'foreach' statements without braces." (with-php-mode-test ("issue-99.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-115 () "Proper alignment for chained method calls inside arrays." :expected-result :failed (with-php-mode-test ("issue-115.php" :indent t :magic t))) (ert-deftest php-mode-test-issue-124 () "Proper syntax propertizing when a quote appears in a heredoc." (with-php-mode-test ("issue-124.php" :indent t) (search-forward "Heredoc") ;; The heredoc should be recognized as a string. (dolist (syntax (c-guess-basic-syntax)) (should (eq (car syntax) 'string))) (search-forward "function bar") ;; After the heredoc should *not* be recognized as a string. (dolist (syntax (c-guess-basic-syntax)) (should (not (eq (car syntax) 'string)))))) (ert-deftest php-mode-test-issue-136 () "Proper highlighting for variable interpolation." (with-php-mode-test ("issue-136.php") (let ((variables '("$name" "${name}" "{$name}" "{$user->name}" "{$user->getName()}" "{$users[0]->name}" "{$users[$index]->name}" "{$users[$user->id]->name}" "{$users[$user->getID()]->name}"))) ;; All of the strings we want to test come after the call to ;; ob_start(), so we jump to there first. (search-forward "ob_start()") (dolist (variable variables) (search-forward variable) (should (eq 'font-lock-variable-name-face (get-text-property (point) 'face))))))) (ert-deftest php-mode-test-issue-145 () "Closure indentation." (with-php-mode-test ("issue-145.php" :indent t))) ;;; php-mode-test.el ends here php-mode-1.13.5/php-mode.el000066400000000000000000002011751236230067600153600ustar00rootroot00000000000000;;; php-mode.el --- Major mode for editing PHP code ;; Copyright (C) 1999, 2000, 2001, 2003, 2004 Turadg Aleahmad ;; 2008 Aaron S. Hawley ;; 2011, 2012, 2013, 2014 Eric James Michael Ritz ;;; Author: Eric James Michael Ritz ;;; URL: https://github.com/ejmr/php-mode ;;; Version: 1.13.5 (defconst php-mode-version-number "1.13.5" "PHP Mode version number.") (defconst php-mode-modified "2014-07-18" "PHP Mode build date.") ;;; License ;; This file is free software; you can redistribute it and/or ;; modify it under the terms of the GNU General Public License ;; as published by the Free Software Foundation; either version 3 ;; of the License, or (at your option) any later version. ;; This file 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 General Public License for more details. ;; You should have received a copy of the GNU General Public License ;; along with this file; if not, write to the Free Software ;; Foundation, Inc., 51 Franklin Street, Fifth Floor, Boston, MA ;; 02110-1301, USA. ;;; Usage ;; Put this file in your Emacs lisp path (eg. site-lisp) and add to ;; your .emacs file: ;; ;; (require 'php-mode) ;; To use abbrev-mode, add lines like this: ;; (add-hook 'php-mode-hook ;; '(lambda () (define-abbrev php-mode-abbrev-table "ex" "extends"))) ;; To make php-mode compatible with html-mode, see http://php-mode.sf.net ;; Many options available under Help:Customize ;; Options specific to php-mode are in ;; Programming/Languages/Php ;; Since it inherits much functionality from c-mode, look there too ;; Programming/Languages/C ;;; Commentary: ;; PHP mode is a major mode for editing PHP source code. It's an ;; extension of C mode; thus it inherits all C mode's navigation ;; functionality. But it colors according to the PHP grammar and ;; indents according to the PEAR coding guidelines. It also includes ;; a couple handy IDE-type features such as documentation search and a ;; source and class browser. ;;; Code: (require 'add-log) (require 'font-lock) (require 'cc-mode) (require 'cc-langs) (require 'custom) (require 'flymake) (require 'etags) (require 'speedbar) (eval-when-compile (unless (require 'cl-lib nil t) (require 'cl)) (require 'regexp-opt) (defvar c-vsemi-status-unknown-p) (defvar syntax-propertize-via-font-lock)) ;;; Emacs 24.3 obsoletes flet in favor of cl-flet. So if we are not ;;; using that version then we revert to using flet. (unless (fboundp 'cl-flet) (defalias 'cl-flet 'flet)) ;; Local variables ;;;###autoload (defgroup php nil "Major mode `php-mode' for editing PHP code." :prefix "php-" :group 'languages :link '(url-link :tag "Official Site" "https://github.com/ejmr/php-mode") :link '(url-link :tag "PHP Mode Wiki" "https://github.com/ejmr/php-mode/wiki")) (defcustom php-executable "/usr/bin/php" "The location of the PHP executable." :type 'string :group 'php) (defcustom php-default-face 'default "Default face in `php-mode' buffers." :type 'face :group 'php) (defcustom php-function-call-face 'default "Default face for function calls in `php-mode' buffers." :type 'face :group 'php) (defcustom php-speedbar-config t "When set to true automatically configures Speedbar to observe PHP files. Ignores php-file patterns option; fixed to expression \"\\.\\(inc\\|php[s345]?\\)\"" :type 'boolean :set (lambda (sym val) (set-default sym val) (when val (speedbar-add-supported-extension "\\.\\(inc\\|php[s345]?\\|phtml\\)"))) :group 'php) (defcustom php-mode-speedbar-open nil "Normally `php-mode' starts with the speedbar closed. Turning this on will open it whenever `php-mode' is loaded." :type 'boolean :set (lambda (sym val) (set-default sym val) (when val (speedbar 1))) :group 'php) (defcustom php-template-compatibility t "Should detect presence of html tags." :type 'boolean :group 'php) ;;;###autoload (defcustom php-extra-constants '() "A list of additional strings to treat as PHP constants." :type 'list :group 'php) (defun php-create-regexp-for-method (visibility) "Make a regular expression for methods with the given VISIBILITY. VISIBILITY must be a string that names the visibility for a PHP method, e.g. 'public'. The parameter VISIBILITY can itself also be a regular expression. The regular expression this function returns will check for other keywords that can appear in method signatures, e.g. 'final' and 'static'. The regular expression will have one capture group which will be the name of the method." (concat ;; Initial space with possible 'abstract' or 'final' keywords "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" ;; The function visilibity visibility ;; Is it static? "\\s-+\\(?:static\\s-+\\)?" ;; Make sure 'function' comes next with some space after "function\\s-+" ;; Capture the name as the first group and the regexp and make sure ;; by the end we see the opening parenthesis for the parameters. "\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(")) (defun php-create-regexp-for-classlike (type) "Accepts a `type' of a 'classlike' object as a string, such as 'class' or 'interface', and returns a regexp as a string which can be used to match against definitions for that classlike." (concat ;; First see if 'abstract' or 'final' appear, although really these ;; are not valid for all values of `type' that the function ;; accepts. "^\\s-*\\(?:\\(?:abstract\\|final\\)\\s-+\\)?" ;; The classlike type type ;; Its name, which is the first captured group in the regexp. We ;; allow backslashes in the name to handle namespaces, but again ;; this is not necessarily correct for all values of `type'. "\\s-+\\(\\(?:\\sw\\|\\\\\\|\\s_\\)+\\)")) (defvar php-imenu-generic-expression `(("Namespaces" ,(php-create-regexp-for-classlike "namespace") 1) ("Classes" ,(php-create-regexp-for-classlike "class") 1) ("Interfaces" ,(php-create-regexp-for-classlike "interface") 1) ("Traits" ,(php-create-regexp-for-classlike "trait") 1) ("All Methods" ,(php-create-regexp-for-method "\\(?:\\sw\\|\\s_\\)+") 1) ("Private Methods" ,(php-create-regexp-for-method "private") 1) ("Protected Methods" ,(php-create-regexp-for-method "protected") 1) ("Public Methods" ,(php-create-regexp-for-method "public") 1) ("Anonymous Functions" "\\<\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*=\\s-*function\\s-*(" 1) ("Named Functions" "^\\s-*function\\s-+\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" 1)) "Imenu generic expression for PHP Mode. See `imenu-generic-expression'.") (defcustom php-manual-url "http://www.php.net/manual/en/" "URL at which to find PHP manual. You can replace \"en\" with your ISO language code." :type 'string :group 'php) (defcustom php-search-url "http://www.php.net/" "URL at which to search for documentation on a word." :type 'string :group 'php) (defcustom php-completion-file "" "Path to the file which contains the function names known to PHP." :type 'string :group 'php) (defcustom php-manual-path "" "Path to the directory which contains the PHP manual." :type 'string :group 'php) ;;;###autoload (add-to-list 'interpreter-mode-alist (cons "php" 'php-mode)) (defcustom php-mode-hook nil "List of functions to be executed on entry to `php-mode'." :type 'hook :group 'php) (defcustom php-mode-pear-hook nil "Hook called when a PHP PEAR file is opened with `php-mode'." :type 'hook :group 'php) (defcustom php-mode-drupal-hook nil "Hook called when a Drupal file is opened with `php-mode'." :type 'hook :group 'php) (defcustom php-mode-wordpress-hook nil "Hook called when a WordPress file is opened with `php-mode'." :type 'hook :group 'php) (defcustom php-mode-symfony2-hook nil "Hook called when a Symfony2 file is opened with `php-mode'." :type 'hook :group 'php) (defcustom php-mode-psr2-hook nil "Hook called when a PSR-2 file is opened with `php-mode'." :type 'hook :group 'php) (defcustom php-mode-force-pear nil "Normally PEAR coding rules are enforced only when the filename contains \"PEAR.\" Turning this on will force PEAR rules on all PHP files." :type 'boolean :group 'php) (defcustom php-mode-warn-if-mumamo-off t "Warn once per buffer if you try to indent a buffer without mumamo-mode turned on. Detects if there are any HTML tags in the buffer before warning, but this is is not very smart; e.g. if you have any tags inside a PHP string, it will be fooled." :type '(choice (const :tag "Warg" t) (const "Don't warn" nil)) :group 'php) (defcustom php-mode-coding-style 'pear "Select default coding style to use with php-mode. This variable can take one of the following symbol values: `PEAR' - use coding styles preferred for PEAR code and modules. `Drupal' - use coding styles preferred for working with Drupal projects. `WordPress' - use coding styles preferred for working with WordPress projects. `Symfony2' - use coding styles preferred for working with Symfony2 projects. `PSR-2' - use coding styles preferred for working with projects using PSR-2 standards." :type '(choice (const :tag "PEAR" pear) (const :tag "Drupal" drupal) (const :tag "WordPress" wordpress) (const :tag "Symfony2" symfony2) (const :tag "PSR-2" psr2)) :group 'php :set 'php-mode-custom-coding-style-set :initialize 'custom-initialize-default) (defun php-mode-custom-coding-style-set (sym value) (when (eq major-mode 'php-mode) (set sym value) (set-default sym value) (cond ((eq value 'pear) (php-enable-pear-coding-style)) ((eq value 'drupal) (php-enable-drupal-coding-style)) ((eq value 'wordpress) (php-enable-wordpress-coding-style)) ((eq value 'symfony2) (php-enable-symfony2-coding-style)) ((eq value 'psr2) (php-enable-psr2-coding-style))))) (c-add-style "pear" '((c-basic-offset . 4) (c-offsets-alist . ((block-open . -) (block-close . 0) (topmost-intro-cont . (first c-lineup-cascaded-calls php-lineup-arglist-intro)) (brace-list-intro . +) (brace-list-entry . c-lineup-cascaded-calls) (arglist-close . php-lineup-arglist-close) (arglist-intro . php-lineup-arglist-intro) (knr-argdecl . [0]) (arglist-cont-nonempty . c-lineup-cascaded-calls) (statement-cont . (first c-lineup-cascaded-calls +)))))) (defun php-enable-pear-coding-style () "Sets up php-mode to use the coding styles preferred for PEAR code and modules." (interactive) (setq tab-width 4 indent-tabs-mode nil) (c-set-style "pear") ;; Undo drupal coding style whitespace effects (setq show-trailing-whitespace nil) (remove-hook 'before-save-hook 'delete-trailing-whitespace t)) (c-add-style "drupal" '((c-basic-offset . 2) (c-offsets-alist . ((case-label . +) (topmost-intro-cont . (first c-lineup-cascaded-calls php-lineup-arglist-intro)) (brace-list-intro . +) (brace-list-entry . c-lineup-cascaded-calls) (arglist-close . php-lineup-arglist-close) (arglist-intro . php-lineup-arglist-intro) (arglist-cont-nonempty . (first c-lineup-math c-lineup-cascaded-calls)) (knr-argdecl . [0]) (statement-cont . (first c-lineup-cascaded-calls +)))))) (defun php-enable-drupal-coding-style () "Makes php-mode use coding styles that are preferable for working with Drupal." (interactive) (setq tab-width 2 indent-tabs-mode nil fill-column 78 show-trailing-whitespace t) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t) (c-set-style "drupal")) (c-add-style "wordpress" '((c-basic-offset . 4) (c-offsets-alist . ((arglist-cont . 0) (arglist-intro . php-lineup-arglist-intro) (arglist-close . php-lineup-arglist-close) (topmost-intro-cont . (first c-lineup-cascaded-calls php-lineup-arglist-intro)) (brace-list-intro . +) (brace-list-entry . c-lineup-cascaded-calls) (case-label . 2) (arglist-close . 0) (defun-close . 0) (defun-block-intro . +) (knr-argdecl . [0]) (arglist-cont-nonempty . c-lineup-cascaded-calls) (statement-cont . (first c-lineup-cascaded-calls +)))))) (defun php-enable-wordpress-coding-style () "Makes php-mode use coding styles that are preferable for working with Wordpress." (interactive) (setq indent-tabs-mode t fill-column 78 tab-width 4 c-indent-comments-syntactically-p t) (c-set-style "wordpress") ;; Undo drupal coding style whitespace effects (setq show-trailing-whitespace nil) (remove-hook 'before-save-hook 'delete-trailing-whitespace t)) (c-add-style "symfony2" '((c-basic-offset . 4) (c-offsets-alist . ((arglist-cont . php-lineup-arglist) (arglist-intro . php-lineup-arglist-intro) (arglist-close . php-lineup-arglist-close) (topmost-intro-cont . (first c-lineup-cascaded-calls php-lineup-arglist-intro)) (brace-list-intro . +) (brace-list-entry . c-lineup-cascaded-calls) (case-label . 4) (statement-case-intro . 4) (defun-close . 0) (defun-block-intro . +) (knr-argdecl . [0]) (arglist-cont-nonempty . c-lineup-cascaded-calls) (statement-cont . php-lineup-hanging-semicolon))))) (defun php-enable-symfony2-coding-style () "Makes php-mode use coding styles that are preferable for working with Symfony2." (interactive) (setq indent-tabs-mode nil fill-column 78 tab-width 4 c-indent-comments-syntactically-p t require-final-newline t) (c-set-style "symfony2") ;; Undo drupal coding style whitespace effects (setq show-trailing-whitespace nil) (remove-hook 'before-save-hook 'delete-trailing-whitespace t)) (c-add-style "psr2" '((c-basic-offset . 4) (c-offsets-alist . ((block-open . -) (block-close . 0) (topmost-intro-cont . (first c-lineup-cascaded-calls php-lineup-arglist-intro)) (brace-list-intro . +) (brace-list-entry . c-lineup-cascaded-calls) (arglist-close . php-lineup-arglist-close) (arglist-intro . php-lineup-arglist-intro) (knr-argdecl . [0]) (arglist-cont-nonempty . c-lineup-cascaded-calls) (statement-cont . +) (substatement-open . 0) (case-label . +) (comment-intro . 0))))) (defun php-enable-psr2-coding-style () "Makes php-mode use coding styles defined by PSR-2" (interactive) (setq tab-width 4 indent-tabs-mode nil) (c-set-style "psr2") (set (make-local-variable 'require-final-newline) t) (set (make-local-variable 'show-trailing-whitespace) t) (add-hook 'before-save-hook 'delete-trailing-whitespace nil t)) (defun php-mode-version () "Display string describing the version of PHP mode." (interactive) (message "PHP mode %s of %s" php-mode-version-number php-mode-modified)) (defconst php-beginning-of-defun-regexp "^\\s-*\\(?:\\(?:abstract\\|final\\|private\\|protected\\|public\\|static\\)\\s-+\\)*function\\s-+&?\\(\\(?:\\sw\\|\\s_\\)+\\)\\s-*(" "Regular expression for a PHP function.") (defun php-beginning-of-defun (&optional arg) "Move to the beginning of the ARGth PHP function from point. Implements PHP version of `beginning-of-defun-function'." (interactive "p") (let ((arg (or arg 1))) (while (> arg 0) (re-search-backward php-beginning-of-defun-regexp nil 'noerror) (setq arg (1- arg))) (while (< arg 0) (end-of-line 1) (let ((opoint (point))) (beginning-of-defun 1) (forward-list 2) (forward-line 1) (if (eq opoint (point)) (re-search-forward php-beginning-of-defun-regexp nil 'noerror)) (setq arg (1+ arg)))))) (defun php-end-of-defun (&optional arg) "Move the end of the ARGth PHP function from point. Implements PHP befsion of `end-of-defun-function' See `php-beginning-of-defun'." (interactive "p") (php-beginning-of-defun (- (or arg 1)))) (defvar php-warned-bad-indent nil) ;; Do it but tell it is not good if html tags in buffer. (defun php-check-html-for-indentation () (let ((html-tag-re "^\\s-*") (here (point))) (goto-char (line-beginning-position)) (if (or (when (boundp 'mumamo-multi-major-mode) mumamo-multi-major-mode) ;; Fix-me: no idea how to check for mmm or multi-mode (save-match-data (not (or (re-search-forward html-tag-re (line-end-position) t) (re-search-backward html-tag-re (line-beginning-position) t))))) (progn (goto-char here) t) (goto-char here) (setq php-warned-bad-indent t) (let* ((known-multi-libs '(("mumamo" mumamo (lambda () (nxhtml-mumamo))) ("mmm-mode" mmm-mode (lambda () (mmm-mode 1))) ("multi-mode" multi-mode (lambda () (multi-mode 1))) ("web-mode" web-mode (lambda () (web-mode))))) (known-names (mapcar (lambda (lib) (car lib)) known-multi-libs)) (available-multi-libs (delq nil (mapcar (lambda (lib) (when (locate-library (car lib)) lib)) known-multi-libs))) (available-names (mapcar (lambda (lib) (car lib)) available-multi-libs)) (base-msg (concat "Indentation fails badly with mixed HTML/PHP in the HTML part in plain `php-mode'. To get indentation to work you must use an Emacs library that supports 'multiple major modes' in a buffer. Parts of the buffer will then be in `php-mode' and parts in for example `html-mode'. Known such libraries are:\n\t" (mapconcat 'identity known-names ", ") "\n" (if available-multi-libs (concat "You have these available in your `load-path':\n\t" (mapconcat 'identity available-names ", ") "\n\n" "Do you want to turn any of those on? ") "You do not have any of those in your `load-path'."))) (is-using-multi (catch 'is-using (dolist (lib available-multi-libs) (when (and (boundp (cadr lib)) (symbol-value (cadr lib))) (throw 'is-using t)))))) (unless is-using-multi (if available-multi-libs (if (not (y-or-n-p base-msg)) (message "Did not do indentation, but you can try again now if you want") (let* ((name (if (= 1 (length available-multi-libs)) (car available-names) ;; Minibuffer window is more than one line, fix that first: (message "") (completing-read "Choose multiple major mode support library: " available-names nil t (car available-names) '(available-names . 1) ))) (mode (when name (caddr (assoc name available-multi-libs))))) (when mode ;; Minibuffer window is more than one line, fix that first: (message "") (load name) (funcall mode)))) (lwarn 'php-indent :warning base-msg))) nil)))) (defun php-cautious-indent-region (start end &optional quiet) (if (or (not php-mode-warn-if-mumamo-off) php-warned-bad-indent (php-check-html-for-indentation)) (funcall 'c-indent-region start end quiet))) (defun php-cautious-indent-line () (if (or (not php-mode-warn-if-mumamo-off) php-warned-bad-indent (php-check-html-for-indentation)) (let ((here (point)) doit) (move-beginning-of-line nil) ;; Don't indent heredoc end mark (save-match-data (unless (looking-at "[a-zA-Z0-9_]+;\n") (setq doit t))) (goto-char here) (when doit (funcall 'c-indent-line))))) (defconst php-tags '("" "" (0+ space) eol)))))) (goto-char here) ret))) (defun php-c-vsemi-status-unknown-p () "See `php-c-at-vsemi-p'." ) (defun php-lineup-arglist-intro (langelem) (save-excursion (goto-char (cdr langelem)) (vector (+ (current-column) c-basic-offset)))) (defun php-lineup-arglist-close (langelem) (save-excursion (goto-char (cdr langelem)) (vector (current-column)))) (c-set-offset 'arglist-intro 'php-lineup-arglist-intro) (c-set-offset 'arglist-close 'php-lineup-arglist-close) (defun php-lineup-arglist (langelem) (save-excursion (beginning-of-line) (if (looking-at-p "\\s-*->") '+ 0))) (defun php-lineup-hanging-semicolon (langelem) (save-excursion (beginning-of-line) (if (looking-at-p "\\s-*;\\s-*$") 0 '+))) (defvar php-mode-map (let ((map (make-sparse-keymap))) (define-key map [menu-bar php] (cons "PHP" (make-sparse-keymap "PHP"))) (define-key map [menu-bar php complete-function] '("Complete function name" . php-complete-function)) (define-key map [menu-bar php browse-manual] '("Browse manual" . php-browse-manual)) (define-key map [menu-bar php search-documentation] '("Search documentation" . php-search-documentation)) ;; By default PHP mode binds C-M-h to c-mark-function, which it ;; inherits from cc-mode. But there are situations where ;; c-mark-function fails to properly mark a function. For ;; example, if we use c-mark-function within a method definition ;; then the region will expand beyond the method and into the ;; class definition itself. ;; ;; Changing the default to mark-defun provides behavior that users ;; are more likely to expect. (define-key map (kbd "C-M-h") 'mark-defun) ;; Many packages based on cc-mode provide the 'C-c C-w' binding ;; to toggle Subword Mode. See the page ;; ;; https://www.gnu.org/software/emacs/manual/html_node/ccmode/Subword-Movement.html ;; ;; for more information about Submode Word. (if (boundp 'subword-mode) (if subword-mode (subword-mode nil) (subword-mode t))) ;; We inherit c-beginning-of-defun and c-end-of-defun from CC Mode ;; but we have two replacement functions specifically for PHP. We ;; remap the commands themselves and not their default ;; key-bindings so that our PHP-specific versions will work even ;; if the user has reconfigured their keys, e.g. if they rebind ;; c-end-of-defun to something other than C-M-e. (define-key map [remap c-beginning-of-defun] 'php-beginning-of-defun) (define-key map [remap c-end-of-defun] 'php-end-of-defun) (define-key map [(control c) (control f)] 'php-search-documentation) (define-key map [(meta tab)] 'php-complete-function) (define-key map [(control c) (control m)] 'php-browse-manual) (define-key map [(control .)] 'php-show-arglist) (define-key map [(control c) (control r)] 'php-send-region) ;; Use the Emacs standard indentation binding. This may upset c-mode ;; which does not follow this at the moment, but I see no better ;; choice. (define-key map [tab] 'indent-for-tab-command) map) "Keymap for `php-mode'") (defconst php-heredoc-start-re "<<<\\(?:\\w+\\|'\\w+'\\)$" "Regular expression for the start of a PHP heredoc.") (defun php-heredoc-end-re (heredoc-start) "Build a regular expression for the end of a heredoc started by the string HEREDOC-START." ;; Extract just the identifier without <<< and quotes. (string-match "\\w+" heredoc-start) (concat "^\\(" (match-string 0 heredoc-start) "\\)\\W")) (defun php-syntax-propertize-function (start end) "Apply propertize rules from START to END." ;; (defconst php-syntax-propertize-function ;; (syntax-propertize-rules ;; (php-heredoc-start-re (0 (ignore (php-heredoc-syntax)))))) (goto-char start) (while (and (< (point) end) (re-search-forward php-heredoc-start-re end t)) (php-heredoc-syntax))) (defun php-heredoc-syntax () "Mark the boundaries of searched heredoc." (goto-char (match-beginning 0)) (c-put-char-property (point) 'syntax-table (string-to-syntax "|")) (if (re-search-forward (php-heredoc-end-re (match-string 0)) nil t) (goto-char (match-end 1)) ;; Did not find the delimiter so go to the end of the buffer. (goto-char (point-max))) (c-put-char-property (1- (point)) 'syntax-table (string-to-syntax "|"))) (defun php-syntax-propertize-extend-region (start end) "Extend the propertize region if START or END falls inside a PHP heredoc." (let ((new-start) (new-end)) (goto-char start) (when (re-search-backward php-heredoc-start-re nil t) (let ((maybe (point))) (when (and (re-search-forward (php-heredoc-end-re (match-string 0)) nil t) (> (point) start)) (setq new-start (maybe))))) (goto-char end) (when (re-search-backward php-heredoc-start-re nil t) (if (re-search-forward (php-heredoc-end-re (match-string 0)) nil t) (when (> (point) end) (setq new-end (point))) (setq new-end (point-max)))) (when (or new-start new-end) (cons (or new-start start) (or new-end end))))) ;;;###autoload (define-derived-mode php-mode c-mode "PHP" "Major mode for editing PHP code.\n\n\\{php-mode-map}" (c-add-language 'php-mode 'c-mode) ;; PHP doesn't have C-style macros. ;; HACK: Overwrite this syntax with rules to match b" php-mode-syntax-table) (set (make-local-variable 'syntax-propertize-via-font-lock) '(("\\(\"\\)\\(\\\\.\\|[^\"\n\\]\\)*\\(\"\\)" (1 "\"") (3 "\"")) ("\\(\'\\)\\(\\\\.\\|[^\'\n\\]\\)*\\(\'\\)" (1 "\"") (3 "\"")))) (when (boundp 'syntax-propertize-function) (add-to-list (make-local-variable 'syntax-propertize-extend-region-functions) #'php-syntax-propertize-extend-region) (set (make-local-variable 'syntax-propertize-function) #'php-syntax-propertize-function)) (setq font-lock-maximum-decoration t imenu-generic-expression php-imenu-generic-expression) ;; PHP vars are case-sensitive (setq case-fold-search t) ;; Do not force newline at end of file. Such newlines can cause ;; trouble if the PHP file is included in another file before calls ;; to header() or cookie(). (set (make-local-variable 'require-final-newline) nil) (set (make-local-variable 'next-line-add-newlines) nil) ;; PEAR coding standards (add-hook 'php-mode-pear-hook 'php-enable-pear-coding-style nil t) ;; ;; Drupal coding standards (add-hook 'php-mode-drupal-hook 'php-enable-drupal-coding-style nil t) ;; ;; WordPress coding standards (add-hook 'php-mode-wordpress-hook 'php-enable-wordpress-coding-style nil t) ;; ;; Symfony2 coding standards (add-hook 'php-mode-symfony2-hook 'php-enable-symfony2-coding-style nil t) ;; ;; PSR-2 coding standards (add-hook 'php-mode-psr2-hook 'php-enable-psr2-coding-style nil t) (cond ((eq php-mode-coding-style 'pear) (php-enable-pear-coding-style) (run-hooks 'php-mode-pear-hook)) ((eq php-mode-coding-style 'drupal) (php-enable-drupal-coding-style) (run-hooks 'php-mode-drupal-hook)) ((eq php-mode-coding-style 'wordpress) (php-enable-wordpress-coding-style) (run-hooks 'php-mode-wordpress-hook)) ((eq php-mode-coding-style 'symfony2) (php-enable-symfony2-coding-style) (run-hooks 'php-mode-symfony2-hook)) ((eq php-mode-coding-style 'psr2) (php-enable-psr2-coding-style) (run-hooks 'php-mode-psr2-hook))) (if (or php-mode-force-pear (and (stringp buffer-file-name) (string-match "PEAR\\|pear" (buffer-file-name)) (string-match "\\.php$" (buffer-file-name)))) (run-hooks 'php-mode-pear-hook)) (setq indent-line-function 'php-cautious-indent-line) (setq indent-region-function 'php-cautious-indent-region) (setq c-at-vsemi-p-fn 'php-c-at-vsemi-p) (setq c-vsemi-status-unknown-p 'php-c-vsemi-status-unknown-p) (set (make-local-variable 'syntax-begin-function) 'c-beginning-of-syntax) ;; We map the php-{beginning,end}-of-defun functions so that they ;; replace the similar commands that we inherit from CC Mode. ;; Because of our remapping we may not actually need to keep the ;; following two local variables, but we keep them for now until we ;; are completely sure their removal will not break any current ;; behavior or backwards compatibility. (set (make-local-variable 'beginning-of-defun-function) 'php-beginning-of-defun) (set (make-local-variable 'end-of-defun-function) 'php-end-of-defun) (set (make-local-variable 'open-paren-in-column-0-is-defun-start) nil) (set (make-local-variable 'defun-prompt-regexp) "^\\s-*function\\s-+&?\\s-*\\(\\(\\sw\\|\\s_\\)+\\)\\s-*") (set (make-local-variable 'add-log-current-defun-header-regexp) php-beginning-of-defun-regexp)) ;; Define function name completion function (defvar php-completion-table nil "Obarray of tag names defined in current tags table and functions known to PHP.") (defun php-complete-function () "Perform function completion on the text around point. Completes to the set of names listed in the current tags table and the standard php functions. The string to complete is chosen in the same way as the default for \\[find-tag] (which see)." (interactive) (let ((pattern (php-get-pattern)) beg completion (php-functions (php-completion-table))) (if (not pattern) (message "Nothing to complete") (if (not (search-backward pattern nil t)) (message "Can't complete here") (setq beg (point)) (forward-char (length pattern)) (setq completion (try-completion pattern php-functions nil)) (cond ((eq completion t)) ((null completion) (message "Can't find completion for \"%s\"" pattern) (ding)) ((not (string= pattern completion)) (delete-region beg (point)) (insert completion)) (t (message "Making completion list...") (with-output-to-temp-buffer "*Completions*" (display-completion-list (all-completions pattern php-functions))) (message "Making completion list...%s" "done"))))))) (defun php-completion-table () "Build variable `php-completion-table' on demand. The table includes the PHP functions and the tags from the current `tags-file-name'." (or (and tags-file-name (save-excursion (tags-verify-table tags-file-name)) php-completion-table) (let ((tags-table (when tags-file-name (with-current-buffer (get-file-buffer tags-file-name) (etags-tags-completion-table)))) (php-table (cond ((and (not (string= "" php-completion-file)) (file-readable-p php-completion-file)) (php-build-table-from-file php-completion-file)) (php-manual-path (php-build-table-from-path php-manual-path)) (t nil)))) (unless (or php-table tags-table) (error (concat "No TAGS file active nor are " "`php-completion-file' or `php-manual-path' set"))) (when tags-table ;; Combine the tables. (mapatoms (lambda (sym) (intern (symbol-name sym) php-table)) tags-table)) (setq php-completion-table php-table)))) (defun php-build-table-from-file (filename) (let ((table (make-vector 1022 0)) (buf (find-file-noselect filename))) (with-current-buffer buf (goto-char (point-min)) (while (re-search-forward "^\\([-a-zA-Z0-9_.]+\\)\n" nil t) (intern (buffer-substring (match-beginning 1) (match-end 1)) table))) (kill-buffer buf) table)) (defun php-build-table-from-path (path) (let ((table (make-vector 1022 0)) (files (directory-files path nil "^function\\..+\\.html$"))) (mapc (lambda (file) (string-match "\\.\\([-a-zA-Z_0-9]+\\)\\.html$" file) (intern (replace-regexp-in-string "-" "_" (substring file (match-beginning 1) (match-end 1)) t) table)) files) table)) ;; Find the pattern we want to complete ;; find-tag-default from GNU Emacs etags.el (defun php-get-pattern () (save-excursion (while (looking-at "\\sw\\|\\s_") (forward-char 1)) (if (or (re-search-backward "\\sw\\|\\s_" (save-excursion (beginning-of-line) (point)) t) (re-search-forward "\\(\\sw\\|\\s_\\)+" (save-excursion (end-of-line) (point)) t)) (progn (goto-char (match-end 0)) (buffer-substring-no-properties (point) (progn (forward-sexp -1) (while (looking-at "\\s'") (forward-char 1)) (point)))) nil))) (defun php-show-arglist () (interactive) (let* ((tagname (php-get-pattern)) (buf (find-tag-noselect tagname nil nil)) arglist) (with-current-buffer buf (goto-char (point-min)) (when (re-search-forward (format "function\\s-+%s\\s-*(\\([^{]*\\))" tagname) nil t) (setq arglist (buffer-substring-no-properties (match-beginning 1) (match-end 1))))) (if arglist (message "Arglist for %s: %s" tagname arglist) (message "Unknown function: %s" tagname)))) (defun php-search-local-documentation () "Search the local PHP documentation (i.e. in `php-manual-path') for the word at point. The function returns t if the requested documentation exists, and nil otherwise." (interactive) (cl-flet ((php-function-file-for (name) (expand-file-name (format "function.%s.html" (replace-regexp-in-string "_" "-" name)) php-manual-path))) (let ((doc-file (php-function-file-for (current-word)))) (and (file-exists-p doc-file) ;; Some browsers require the file:// prefix. Others do not ;; seem to care. But it should never be incorrect to use ;; the prefix. (browse-url (if (string-prefix-p "file://" doc-file) doc-file (concat "file://" doc-file))) t)))) ;; Define function documentation function (defun php-search-documentation () "Search PHP documentation for the word at point. If `php-manual-path' has a non-empty string value then the command will first try searching the local documentation. If the requested documentation does not exist it will fallback to searching the PHP website." (interactive) (cl-flet ((php-search-web-documentation () (browse-url (concat php-search-url (current-word))))) (if (and (stringp php-manual-path) (not (string= php-manual-path ""))) (or (php-search-local-documentation) (php-search-web-documentation)) (php-search-web-documentation)))) ;; Define function for browsing manual (defun php-browse-manual () "Bring up manual for PHP." (interactive) (browse-url php-manual-url)) (defconst php-constants (regexp-opt (append php-extra-constants (when (boundp 'web-mode-extra-php-constants) web-mode-extra-php-constants) '( ;; core constants "__LINE__" "__FILE__" "__DIR__" "__FUNCTION__" "__CLASS__" "__TRAIT__" "__METHOD__" "__NAMESPACE__" "__COMPILER_HALT_OFFSET__" "PHP_OS" "PHP_VERSION" "PHP_MINOR_VERSION" "PHP_MAJOR_VERSION" "PHP_RELEASE_VERSION" "PHP_VERSION_ID" "PHP_EXTRA_VERSION" "TRUE" "FALSE" "NULL" "E_ERROR" "E_NOTICE" "E_PARSE" "E_WARNING" "E_ALL" "E_STRICT" "E_USER_ERROR" "E_USER_WARNING" "E_USER_NOTICE" "E_CORE_ERROR" "E_CORE_WARNING" "E_COMPILE_ERROR" "E_COMPILE_WARNING" "E_DEPRECATED" "E_USER_DEPRECATED" "DEFAULT_INCLUDE_PATH" "PEAR_INSTALL_DIR" "PEAR_EXTENSION_DIR" "PHP_BINDIR" "PHP_LIBDIR" "PHP_DATADIR" "PHP_SYSCONFDIR" "PHP_LOCALSTATEDIR" "PHP_CONFIG_FILE_PATH" "PHP_EOL" "PHP_ZTS" "PHP_DEBUG" "PHP_MAXPATHLEN" "PHP_SAPI" "PHP_INT_MAX" "PHP_INT_SIZE" "PHP_EXTENSION_DIR" "PHP_PREFIX" "PHP_MANDIR" "PHP_CONFIG_FILE_SCAN_DIR" "PHP_WINDOWS_VERSION_MAJOR" "PHP_WINDOWS_VERSION_MINOR" "PHP_WINDOWS_VERSION_BUILD" "PHP_WINDOWS_VERSION_PLATFORM" "PHP_WINDOWS_VERSION_SP_MAJOR" "PHP_WINDOWS_VERSION_SP_MINOR" "PHP_WINDOWS_VERSION_SUITEMASK" "PHP_WINDOWS_VERSION_PRODUCTTYPE" "PHP_WINDOWS_NT_DOMAIN_CONTROLLER" "PHP_WINDOWS_NT_SERVER" "PHP_WINDOWS_NT_WORKSTATION" ;; CLI SAPI "STDIN" "STDOUT" "STDERR" ;; date and time constants "DATE_ATOM" "DATE_COOKIE" "DATE_ISO8601" "DATE_RFC822" "DATE_RFC850" "DATE_RFC1036" "DATE_RFC1123" "DATE_RFC2822" "DATE_RFC3339" "DATE_RSS" "DATE_W3C" ;; upload error message constants "UPLOAD_ERR_CANT_WRITE" "UPLOAD_ERR_EXTENSION" "UPLOAD_ERR_FORM_SIZE" "UPLOAD_ERR_INI_SIZE" "UPLOAD_ERR_NO_FILE" "UPLOAD_ERR_NO_TMP_DIR" "UPLOAD_ERR_OK" "UPLOAD_ERR_PARTIAL" ;; from ext/standard: "EXTR_OVERWRITE" "EXTR_PREFIX_SAME" "EXTR_PREFIX_INVALID" "EXTR_IF_EXISTS" "SORT_DESC" "SORT_NUMERIC" "CASE_LOWER" "COUNT_NORMAL" "ASSERT_ACTIVE" "ASSERT_BAIL" "ASSERT_QUIET_EVAL" "CONNECTION_NORMAL" "INI_USER" "INI_SYSTEM" "M_E" "M_LOG10E" "M_LN10" "M_PI_2" "M_1_PI" "M_2_SQRTPI" "M_SQRT1_2" "CRYPT_STD_DES" "CRYPT_MD5" "DIRECTORY_SEPARATOR" "SEEK_SET" "SEEK_CUR" "SEEK_END" "LOCK_SH" "LOCK_EX" "LOCK_UN" "LOCK_NB" "GLOB_BRACE" "GLOB_ONLYDIR" "GLOB_MARK" "GLOB_NOSORT" "GLOB_NOCHECK" "GLOB_NOESCAPE" "GLOB_AVAILABLE_FLAGS" "FILE_USE_INCLUDE_PATH" "FILE_NO_DEFAULT_CONTEXT" "FILE_APPEND" "FILE_IGNORE_NEW_LINES" "FILE_SKIP_EMPTY_LINES" "FILE_BINARY" "FILE_TEXT" "INI_SCANNER_NORMAL" "INI_SCANNER_RAW" "FNM_NOESCAPE" "FNM_PATHNAME" "FNM_PERIOD" "FNM_CASEFOLD" "HTML_SPECIALCHARS" "ENT_COMPAT" "ENT_QUOTES" "ENT_NOQUOTES" "ENT_IGNORE" "ENT_SUBSTITUTE" "ENT_DISALLOWED" "ENT_HTML401" "ENT_XML1" "ENT_XHTML" "ENT_HTML5" "INFO_CREDITS" "INFO_MODULES" "INFO_VARIABLES" "INFO_ALL" "CREDITS_GENERAL" "CREDITS_MODULES" "CREDITS_FULLPAGE" "CREDITS_ALL" "STR_PAD_RIGHT" "PATHINFO_DIRNAME" "PATHINFO_BASENAME" "PATHINFO_EXTENSION" "PATHINFO_FILENAME" "CHAR_MAX" "LC_NUMERIC" "LC_COLLATE" "LC_ALL" "ABDAY_1" "ABDAY_3" "ABDAY_5" "ABDAY_7" "DAY_2" "DAY_4" "DAY_6" "ABMON_1" "ABMON_3" "ABMON_5" "ABMON_7" "ABMON_9" "ABMON_11" "MON_1" "MON_3" "MON_5" "MON_7" "MON_9" "MON_11" "AM_STR" "D_T_FMT" "T_FMT" "ERA" "ERA_D_T_FMT" "ERA_T_FMT" "INT_CURR_SYMBOL" "CRNCYSTR" "MON_THOUSANDS_SEP" "POSITIVE_SIGN" "INT_FRAC_DIGITS" "P_CS_PRECEDES" "N_CS_PRECEDES" "P_SIGN_POSN" "DECIMAL_POINT" "THOUSANDS_SEP" "GROUPING" "NOEXPR" "NOSTR" "LOG_EMERG" "LOG_CRIT" "LOG_WARNING" "LOG_INFO" "LOG_KERN" "LOG_MAIL" "LOG_AUTH" "LOG_LPR" "LOG_UUCP" "LOG_AUTHPRIV" "LOG_LOCAL1" "LOG_LOCAL3" "LOG_LOCAL5" "LOG_LOCAL7" "LOG_CONS" "LOG_NDELAY" "LOG_PERROR" ;; Filter constants "INPUT_POST" "INPUT_GET" "INPUT_COOKIE" "INPUT_ENV" "INPUT_SERVER" "INPUT_SESSION" "INPUT_REQUEST" "FILTER_FLAG_NONE" "FILTER_REQUIRE_SCALAR" "FILTER_REQUIRE_ARRAY" "FILTER_FORCE_ARRAY" "FILTER_NULL_ON_FAILURE" "FILTER_VALIDATE_INT" "FILTER_VALIDATE_BOOLEAN" "FILTER_VALIDATE_FLOAT" "FILTER_VALIDATE_REGEXP" "FILTER_VALIDATE_URL" "FILTER_VALIDATE_EMAIL" "FILTER_VALIDATE_IP" "FILTER_DEFAULT" "FILTER_UNSAFE_RAW" "FILTER_SANITIZE_STRING" "FILTER_SANITIZE_STRIPPED" "FILTER_SANITIZE_ENCODED" "FILTER_SANITIZE_SPECIAL_CHARS" "FILTER_SANITIZE_FULL_SPECIAL_CHARS" "FILTER_SANITIZE_EMAIL" "FILTER_SANITIZE_URL" "FILTER_SANITIZE_NUMBER_INT" "FILTER_SANITIZE_NUMBER_FLOAT" "FILTER_SANITIZE_MAGIC_QUOTES" "FILTER_CALLBACK" "FILTER_FLAG_ALLOW_OCTAL" "FILTER_FLAG_ALLOW_HEX" "FILTER_FLAG_STRIP_LOW" "FILTER_FLAG_STRIP_HIGH" "FILTER_FLAG_ENCODE_LOW" "FILTER_FLAG_ENCODE_HIGH" "FILTER_FLAG_ENCODE_AMP" "FILTER_FLAG_NO_ENCODE_QUOTES" "FILTER_FLAG_EMPTY_STRING_NULL" "FILTER_FLAG_ALLOW_FRACTION" "FILTER_FLAG_ALLOW_THOUSAND" "FILTER_FLAG_ALLOW_SCIENTIFIC" "FILTER_FLAG_PATH_REQUIRED" "FILTER_FLAG_QUERY_REQUIRED" "FILTER_FLAG_IPV4" "FILTER_FLAG_IPV6" "FILTER_FLAG_NO_RES_RANGE" "FILTER_FLAG_NO_PRIV_RANGE" ;; Password constants "PASSWORD_DEFAULT" "PASSWORD_BCRYPT" ;; PREG constants "PREG_PATTERN_ORDER" "PREG_SET_ORDER" "PREG_OFFSET_CAPTURE" "PREG_SPLIT_NO_EMPTY" "PREG_SPLIT_DELIM_CAPTURE" "PREG_SPLIT_OFFSET_CAPTURE" "PREG_NO_ERROR" "PREG_INTERNAL_ERROR" "PREG_BACKTRACK_LIMIT_ERROR" "PREG_RECURSION_LIMIT_ERROR" "PREG_BAD_UTF8_ERROR" "PREG_BAD_UTF8_OFFSET_ERROR" "PCRE_VERSION" ;; cURL constants "CURLOPT_AUTOREFERER" "CURLOPT_COOKIESESSION" "CURLOPT_DNS_USE_GLOBAL_CACHE" "CURLOPT_DNS_CACHE_TIMEOUT" "CURLOPT_FTP_SSL" "CURLFTPSSL_TRY" "CURLFTPSSL_ALL" "CURLFTPSSL_CONTROL" "CURLFTPSSL_NONE" "CURLOPT_PRIVATE" "CURLOPT_FTPSSLAUTH" "CURLOPT_PORT" "CURLOPT_FILE" "CURLOPT_INFILE" "CURLOPT_INFILESIZE" "CURLOPT_URL" "CURLOPT_PROXY" "CURLOPT_VERBOSE" "CURLOPT_HEADER" "CURLOPT_HTTPHEADER" "CURLOPT_NOPROGRESS" "CURLOPT_NOBODY" "CURLOPT_FAILONERROR" "CURLOPT_UPLOAD" "CURLOPT_POST" "CURLOPT_FTPLISTONLY" "CURLOPT_FTPAPPEND" "CURLOPT_FTP_CREATE_MISSING_DIRS" "CURLOPT_NETRC" "CURLOPT_FOLLOWLOCATION" "CURLOPT_FTPASCII" "CURLOPT_PUT" "CURLOPT_MUTE" "CURLOPT_USERPWD" "CURLOPT_PROXYUSERPWD" "CURLOPT_RANGE" "CURLOPT_TIMEOUT" "CURLOPT_TIMEOUT_MS" "CURLOPT_TCP_NODELAY" "CURLOPT_POSTFIELDS" "CURLOPT_PROGRESSFUNCTION" "CURLOPT_REFERER" "CURLOPT_USERAGENT" "CURLOPT_FTPPORT" "CURLOPT_FTP_USE_EPSV" "CURLOPT_LOW_SPEED_LIMIT" "CURLOPT_LOW_SPEED_TIME" "CURLOPT_RESUME_FROM" "CURLOPT_COOKIE" "CURLOPT_SSLCERT" "CURLOPT_SSLCERTPASSWD" "CURLOPT_WRITEHEADER" "CURLOPT_SSL_VERIFYHOST" "CURLOPT_COOKIEFILE" "CURLOPT_SSLVERSION" "CURLOPT_TIMECONDITION" "CURLOPT_TIMEVALUE" "CURLOPT_CUSTOMREQUEST" "CURLOPT_STDERR" "CURLOPT_TRANSFERTEXT" "CURLOPT_RETURNTRANSFER" "CURLOPT_QUOTE" "CURLOPT_POSTQUOTE" "CURLOPT_INTERFACE" "CURLOPT_KRB4LEVEL" "CURLOPT_HTTPPROXYTUNNEL" "CURLOPT_FILETIME" "CURLOPT_WRITEFUNCTION" "CURLOPT_READFUNCTION" "CURLOPT_PASSWDFUNCTION" "CURLOPT_HEADERFUNCTION" "CURLOPT_MAXREDIRS" "CURLOPT_MAXCONNECTS" "CURLOPT_CLOSEPOLICY" "CURLOPT_FRESH_CONNECT" "CURLOPT_FORBID_REUSE" "CURLOPT_RANDOM_FILE" "CURLOPT_EGDSOCKET" "CURLOPT_CONNECTTIMEOUT" "CURLOPT_CONNECTTIMEOUT_MS" "CURLOPT_SSL_VERIFYPEER" "CURLOPT_CAINFO" "CURLOPT_CAPATH" "CURLOPT_COOKIEJAR" "CURLOPT_SSL_CIPHER_LIST" "CURLOPT_BINARYTRANSFER" "CURLOPT_NOSIGNAL" "CURLOPT_PROXYTYPE" "CURLOPT_BUFFERSIZE" "CURLOPT_HTTPGET" "CURLOPT_HTTP_VERSION" "CURLOPT_SSLKEY" "CURLOPT_SSLKEYTYPE" "CURLOPT_SSLKEYPASSWD" "CURLOPT_SSLENGINE" "CURLOPT_SSLENGINE_DEFAULT" "CURLOPT_SSLCERTTYPE" "CURLOPT_CRLF" "CURLOPT_ENCODING" "CURLOPT_PROXYPORT" "CURLOPT_UNRESTRICTED_AUTH" "CURLOPT_FTP_USE_EPRT" "CURLOPT_HTTP200ALIASES" "CURLOPT_HTTPAUTH" "CURLAUTH_BASIC" "CURLAUTH_DIGEST" "CURLAUTH_GSSNEGOTIATE" "CURLAUTH_NTLM" "CURLAUTH_ANY" "CURLAUTH_ANYSAFE" "CURLOPT_PROXYAUTH" "CURLOPT_MAX_RECV_SPEED_LARGE" "CURLOPT_MAX_SEND_SPEED_LARGE" "CURLCLOSEPOLICY_LEAST_RECENTLY_USED" "CURLCLOSEPOLICY_LEAST_TRAFFIC" "CURLCLOSEPOLICY_SLOWEST" "CURLCLOSEPOLICY_CALLBACK" "CURLCLOSEPOLICY_OLDEST" "CURLINFO_PRIVATE" "CURLINFO_EFFECTIVE_URL" "CURLINFO_HTTP_CODE" "CURLINFO_HEADER_OUT" "CURLINFO_HEADER_SIZE" "CURLINFO_REQUEST_SIZE" "CURLINFO_TOTAL_TIME" "CURLINFO_NAMELOOKUP_TIME" "CURLINFO_CONNECT_TIME" "CURLINFO_PRETRANSFER_TIME" "CURLINFO_SIZE_UPLOAD" "CURLINFO_SIZE_DOWNLOAD" "CURLINFO_SPEED_DOWNLOAD" "CURLINFO_SPEED_UPLOAD" "CURLINFO_FILETIME" "CURLINFO_SSL_VERIFYRESULT" "CURLINFO_CONTENT_LENGTH_DOWNLOAD" "CURLINFO_CONTENT_LENGTH_UPLOAD" "CURLINFO_STARTTRANSFER_TIME" "CURLINFO_CONTENT_TYPE" "CURLINFO_REDIRECT_TIME" "CURLINFO_REDIRECT_COUNT" "CURL_TIMECOND_IFMODSINCE" "CURL_TIMECOND_IFUNMODSINCE" "CURL_TIMECOND_LASTMOD" "CURL_VERSION_IPV6" "CURL_VERSION_KERBEROS4" "CURL_VERSION_SSL" "CURL_VERSION_LIBZ" "CURLVERSION_NOW" "CURLE_OK" "CURLE_UNSUPPORTED_PROTOCOL" "CURLE_FAILED_INIT" "CURLE_URL_MALFORMAT" "CURLE_URL_MALFORMAT_USER" "CURLE_COULDNT_RESOLVE_PROXY" "CURLE_COULDNT_RESOLVE_HOST" "CURLE_COULDNT_CONNECT" "CURLE_FTP_WEIRD_SERVER_REPLY" "CURLE_FTP_ACCESS_DENIED" "CURLE_FTP_USER_PASSWORD_INCORRECT" "CURLE_FTP_WEIRD_PASS_REPLY" "CURLE_FTP_WEIRD_USER_REPLY" "CURLE_FTP_WEIRD_PASV_REPLY" "CURLE_FTP_WEIRD_227_FORMAT" "CURLE_FTP_CANT_GET_HOST" "CURLE_FTP_CANT_RECONNECT" "CURLE_FTP_COULDNT_SET_BINARY" "CURLE_PARTIAL_FILE" "CURLE_FTP_COULDNT_RETR_FILE" "CURLE_FTP_WRITE_ERROR" "CURLE_FTP_QUOTE_ERROR" "CURLE_HTTP_NOT_FOUND" "CURLE_WRITE_ERROR" "CURLE_MALFORMAT_USER" "CURLE_FTP_COULDNT_STOR_FILE" "CURLE_READ_ERROR" "CURLE_OUT_OF_MEMORY" "CURLE_OPERATION_TIMEOUTED" "CURLE_FTP_COULDNT_SET_ASCII" "CURLE_FTP_PORT_FAILED" "CURLE_FTP_COULDNT_USE_REST" "CURLE_FTP_COULDNT_GET_SIZE" "CURLE_HTTP_RANGE_ERROR" "CURLE_HTTP_POST_ERROR" "CURLE_SSL_CONNECT_ERROR" "CURLE_FTP_BAD_DOWNLOAD_RESUME" "CURLE_FILE_COULDNT_READ_FILE" "CURLE_LDAP_CANNOT_BIND" "CURLE_LDAP_SEARCH_FAILED" "CURLE_LIBRARY_NOT_FOUND" "CURLE_FUNCTION_NOT_FOUND" "CURLE_ABORTED_BY_CALLBACK" "CURLE_BAD_FUNCTION_ARGUMENT" "CURLE_BAD_CALLING_ORDER" "CURLE_HTTP_PORT_FAILED" "CURLE_BAD_PASSWORD_ENTERED" "CURLE_TOO_MANY_REDIRECTS" "CURLE_UNKNOWN_TELNET_OPTION" "CURLE_TELNET_OPTION_SYNTAX" "CURLE_OBSOLETE" "CURLE_SSL_PEER_CERTIFICATE" "CURLE_GOT_NOTHING" "CURLE_SSL_ENGINE_NOTFOUND" "CURLE_SSL_ENGINE_SETFAILED" "CURLE_SEND_ERROR" "CURLE_RECV_ERROR" "CURLE_SHARE_IN_USE" "CURLE_SSL_CERTPROBLEM" "CURLE_SSL_CIPHER" "CURLE_SSL_CACERT" "CURLE_BAD_CONTENT_ENCODING" "CURLE_LDAP_INVALID_URL" "CURLE_FILESIZE_EXCEEDED" "CURLE_FTP_SSL_FAILED" "CURLFTPAUTH_DEFAULT" "CURLFTPAUTH_SSL" "CURLFTPAUTH_TLS" "CURLPROXY_HTTP" "CURLPROXY_SOCKS5" "CURL_NETRC_OPTIONAL" "CURL_NETRC_IGNORED" "CURL_NETRC_REQUIRED" "CURL_HTTP_VERSION_NONE" "CURL_HTTP_VERSION_1_0" "CURL_HTTP_VERSION_1_1" "CURLM_CALL_MULTI_PERFORM" "CURLM_OK" "CURLM_BAD_HANDLE" "CURLM_BAD_EASY_HANDLE" "CURLM_OUT_OF_MEMORY" "CURLM_INTERNAL_ERROR" "CURLMSG_DONE" "CURLOPT_KEYPASSWD" "CURLOPT_SSH_AUTH_TYPES" "CURLOPT_SSH_HOST_PUBLIC_KEY_MD5" "CURLOPT_SSH_PRIVATE_KEYFILE" "CURLOPT_SSH_PUBLIC_KEYFILE" "CURLSSH_AUTH_ANY" "CURLSSH_AUTH_DEFAULT" "CURLSSH_AUTH_HOST" "CURLSSH_AUTH_KEYBOARD" "CURLSSH_AUTH_NONE" "CURLSSH_AUTH_PASSWORD" "CURLSSH_AUTH_PUBLICKEY" ;; SESSION constants "PHP_SESSION_DISABLED" "PHP_SESSION_NONE" "PHP_SESSION_ACTIVE" ;; IMAP constants "NIL" "OP_DEBUG" "OP_READONLY" "OP_ANONYMOUS" "OP_SHORTCACHE" "OP_SILENT" "OP_PROTOTYPE" "OP_HALFOPEN" "OP_EXPUNGE" "OP_SECURE" "CL_EXPUNGE" "FT_UID" "FT_PEEK" "FT_NOT" "FT_INTERNAL" "FT_PREFETCHTEXT" "ST_UID" "ST_SILENT" "ST_SET" "CP_UID" "CP_MOVE" "SE_UID" "SE_FREE" "SE_NOPREFETCH" "SO_FREE" "SO_NOSERVER" "SA_MESSAGES" "SA_RECENT" "SA_UNSEEN" "SA_UIDNEXT" "SA_UIDVALIDITY" "SA_ALL" "LATT_NOINFERIORS" "LATT_NOSELECT" "LATT_MARKED" "LATT_UNMARKED" "SORTDATE" "SORTARRIVAL" "SORTFROM" "SORTSUBJECT" "SORTTO" "SORTCC" "SORTSIZE" "TYPETEXT" "TYPEMULTIPART" "TYPEMESSAGE" "TYPEAPPLCATION" "TYPEAUDIO" "TYPEIMAGE" "TYPEVIDEO" "TYPEOTHER" "ENC7BIT" "ENC8BIT" "ENCBINARY" "ENCBASE64" "ENCQUOTEDPRINTABLE" "ENCOTHER" "IMAP_OPENTIMEOUT" "IMAP_READTIMEOUT" "IMAP_WRITETIMEOUT" "IMAP_CLOSETIMEOUT" "LATT_REFERRAL" "LATT_HASCHILDREN" "LATT_HASNOCHILDREN" "TYPEMODEL" "IMAP_GC_ELT" "IMAP_GC_ENV" "IMAP_GC_TEXTS"))) "PHP constants.") (defconst php-keywords (eval-when-compile (regexp-opt (append (when (boundp 'web-mode-extra-php-keywords) web-mode-extra-php-keywords) ;; "class", "new" and "extends" get special treatment ;; "case" gets special treatment elsewhere '("abstract" "and" "array" "as" "break" "catch all" "catch" "clone" "const" "continue" "declare" "default" "die" "do" "echo" "else" "elseif" "empty" "encoding" "enddeclare" "endfor" "endforeach" "endif" "endswitch" "endwhile" "eval" "exit" "extends" "final" "finally" "for" "foreach" "function" "global" "if" "include" "include_once" "instanceof" "insteadof" "isset" "list" "or" "private" "protected" "public" "require" "require_once" "return" "static" "switch" "throw" "ticks" "try" "unset" "use" "var" "while" "xor" "yield")))) "PHP keywords.") (defconst php-types (eval-when-compile (regexp-opt '("array" "bool" "boolean" "callable" "char" "double" "float" "int" "integer" "long" "mixed" "object" "real" "string"))) "PHP types.") (defconst php-superglobals (eval-when-compile (regexp-opt '("_GET" "_POST" "_COOKIE" "_SESSION" "_ENV" "GLOBALS" "_SERVER" "_FILES" "_REQUEST"))) "PHP superglobal variables.") ;; Set up font locking (defconst php-font-lock-keywords-1 (append (list ;; Fontify constants (cons (concat "[^_$]?\\<\\(" php-constants "\\)\\>[^_]?") '(1 font-lock-constant-face)) ;; Fontify keywords (cons (concat "[^_$]?\\<\\(" php-keywords "\\)\\>[^_]?") '(1 font-lock-keyword-face)) ;; Fontify keywords and targets, and case default tags. (list "\\<\\(break\\|case\\|continue\\)\\>\\s-+\\(-?\\sw+\\)?" '(1 font-lock-keyword-face) '(2 font-lock-constant-face keep t)) ;; This must come after the one for keywords and targets. '(":" ("^\\s-+\\(\\sw+\\)\\s-+\\s-+$" (beginning-of-line) (end-of-line) (1 font-lock-constant-face))) ;; treat 'print' as keyword only when not used like a function name '("\\" . font-lock-keyword-face) ;; Fontify PHP tag (cons php-tags-key font-lock-preprocessor-face) ) (if php-template-compatibility (list ;; Fontify ASP-style tag '("<\\%\\(=\\)?" . font-lock-preprocessor-face) '("\\%>" . font-lock-preprocessor-face)) ()) ) "Subdued level highlighting for PHP mode.") (defconst php-font-lock-keywords-2 (append php-font-lock-keywords-1 (list ;; namespace, class, interface, and trait declarations '("\\<\\(namespace\\|class\\|interface\\|trait\\)\\s-+\\(\\(?:\\sw\\|\\\\\\)+\\)?" (1 font-lock-keyword-face) (2 font-lock-type-face nil t)) ;; handle several words specially, to include following word, ;; thereby excluding it from unknown-symbol checks later ;; FIX to handle implementing multiple ;; currently breaks on "class Foo implements Bar, Baz" '("\\<\\(new\\|extends\\|implements\\)\\s-+\\$?\\(\\(:?\\sw\\|\\\\\\)+\\)" (1 font-lock-keyword-face) (2 font-lock-type-face nil t)) ;; instanceof operator '("\\ '("<[^>]*\\(>\\)" (1 font-lock-constant-face)) ;; HTML tags '("\\(<[a-z]+\\)[[:space:]]+\\([a-z:]+=\\)[^>]*?" (1 font-lock-constant-face) (2 font-lock-constant-face)) '("\"[[:space:]]+\\([a-z:]+=\\)" (1 font-lock-constant-face)) ) ()) (list ;; warn about $word.word -- it could be a valid concatenation, ;; but without any spaces we'll assume $word->word was meant. '("\\$\\sw+\\(\\.\\)\\sw" 1 font-lock-warning-face) ;; Warn about ==> instead of => '("==+>" . font-lock-warning-face) ;; exclude casts from bare-word treatment (may contain spaces) `(,(concat "(\\s-*\\(" php-types "\\)\\s-*)") 1 font-lock-type-face) ;; PHP5: function declarations may contain classes as parameters type `("[(,]\\(?:\\s-\\|\n\\)*\\(\\(?:\\sw\\|\\\\\\)+\\)\\s-+&?\\$\\sw+\\>" 1 font-lock-type-face) ;; Function calls qualified by namespaces '("\\(\\\\?\\(?:\\sw+\\\\\\)+\\)\\sw+(" (1 font-lock-type-face)) ;; Fontify variables and function calls '("\\$\\(this\\|that\\)\\W" (1 font-lock-constant-face nil nil)) ;; $_GET & co `(,(concat "\\$\\(" php-superglobals "\\)\\W") (1 font-lock-constant-face nil nil)) ;; $variable '("\\$\\(\\sw+\\)" (1 font-lock-variable-name-face)) ;; ->function_call '("->\\(\\sw+\\)\\s-*(" (1 php-function-call-face keep t)) ;; ->variable '("->\\(\\sw+\\)" (1 font-lock-variable-name-face keep t)) ;; class::member '("\\(\\(\\sw\\|\\\\\\)+\\)::\\sw+\\s-*(?" . (1 font-lock-type-face)) ;; class::constant '("::\\(\\(?:\\sw\\|\\s_\\)+\\>\\)[^(]" . (1 font-lock-constant-face)) ;; using a trait in a class '("\\" . font-lock-warning-face))) "Gauchy level highlighting for PHP mode.") ;;; Provide support for Flymake so that users can see warnings and ;;; errors in real-time as they write code. (defun flymake-php-init () (let* ((temp-file (flymake-init-create-temp-buffer-copy 'flymake-create-temp-inplace)) (local-file (file-relative-name temp-file (file-name-directory buffer-file-name)))) (list php-executable (list "-f" local-file "-l")))) (add-to-list 'flymake-allowed-file-name-masks '("\\.php[345s]?$" flymake-php-init flymake-simple-cleanup flymake-get-real-file-name)) (add-to-list 'flymake-err-line-patterns '("\\(Parse\\|Fatal\\) error: \\(.*?\\) in \\(.*?\\) on line \\([0-9]+\\)" 3 4 nil 2)) (defun php-send-region (start end) "Send the region between `start' and `end' to PHP for execution. The output will appear in the buffer *PHP*." (interactive "r") (let ((php-buffer (get-buffer-create "*PHP*")) (code (buffer-substring start end))) ;; Calling 'php -r' will fail if we send it code that starts with ;; '\\|::") (no-front-space "->\\|::")) (when (and (eq major-mode 'php-mode) (or (looking-at-p (concat " \\(" no-behind-space "\\)")) (save-excursion (forward-char -2) (looking-at-p no-front-space)))) (delete-char 1)))) (ad-activate 'fixup-whitespace) ;;;###autoload (dolist (pattern '("\\.php[s345t]?\\'" "\\.phtml\\'" "Amkfile" "\\.amk$")) (add-to-list 'auto-mode-alist `(,pattern . php-mode) t)) (provide 'php-mode) ;;; php-mode.el ends here php-mode-1.13.5/tests/000077500000000000000000000000001236230067600144615ustar00rootroot00000000000000php-mode-1.13.5/tests/README.md000066400000000000000000000012221236230067600157350ustar00rootroot00000000000000Tests ===== This directory contains tests for PHP Mode. Each test begins with a comment header explaining the purpose of the test and a link to the relative [Github issue][github]. The main purpose of these tests are to demonstrate whether or not features like syntax highlighting and indentation work properly. Because of that, executing most of the tests is not important, since we do not care about how PHP itself interprets the test scripts. We only care about how Emacs and PHP Mode formats the code within each test. Please use the file `tests/template.php` as a start when creating new tests cases. [github]: https://github.com/ejmr/php-mode php-mode-1.13.5/tests/issue-100.php000066400000000000000000000007661236230067600166310ustar00rootroot00000000000000' characters. * */ $x = ["x" => $this->foo() ->bar() // ###php-mode-test### ((indent c-lineup-cascaded-calls)) ->baz()]; // ###php-mode-test### ((indent c-lineup-cascaded-calls)) $y = array("y" => $this->foo() ->bar() // ###php-mode-test### ((indent c-lineup-cascaded-calls)) ->baz()); // ###php-mode-test### ((indent c-lineup-cascaded-calls)) php-mode-1.13.5/tests/issue-124.php000066400000000000000000000006271236230067600166330ustar00rootroot00000000000000name; } public function getID() { return $this->id; } } $user = new User(); $user->name = "Eric"; $users = array($user); $index = 0; ob_start(); echo "My name is $name"; echo "My name is ${name}"; echo "My name is {$name}"; echo "My name is {$user->name}"; echo "My name is {$user->getName()}"; echo "My name is {$users[0]->name}"; echo "My name is {$users[$index]->name}"; echo "My name is {$users[$user->id]->name}"; echo "My name is {$users[$user->getID()]->name}"; ob_end_clean(); php-mode-1.13.5/tests/issue-14.php000066400000000000000000000012631236230067600165460ustar00rootroot00000000000000find(array( * 'select' => 'title', * 'condition' => 'postID=:postID', * 'params' => array(':postID'=>10), * )); * */ $post = Post::model()->find(array( 'select' => 'title', // ###php-mode-test### ((indent c-basic-offset)) 'condition' => 'postID=:postID', // ###php-mode-test### ((indent c-basic-offset)) 'params' => array(':postID'=>10), // ###php-mode-test### ((indent c-basic-offset)) )); // ###php-mode-test### ((indent 0))php-mode-1.13.5/tests/issue-145.php000066400000000000000000000005061236230067600166320ustar00rootroot00000000000000' operators aligned: * * $object = new SomeClass(); * $object->method() * ->another(); * * Alignment should occur on the '->' characters regardless of the * scope in which the method calls appear. */ $object = new StdClass(); $object->call() ->something(); class Whatever { public function __construct() { $object = new StdClass(); $object->call() ->something(); } public function something() { $object = new StdClass(); $object->call() ->something(); } } $closure = function() { $object = new StdClass(); $object->call() ->something(); }; function something() { $object = new StdClass(); $object->call() ->something(); } php-mode-1.13.5/tests/issue-21.php000066400000000000000000000004161236230067600165430ustar00rootroot00000000000000get("/index", function() { * $app->redirect("foo"); * }); * */ $app->get("/index", function() { $app->redirect("foo"); // ###php-mode-test### ((indent c-basic-offset)) }); // ###php-mode-test### ((indent 0)) php-mode-1.13.5/tests/issue-42.php000066400000000000000000000012051236230067600165430ustar00rootroot00000000000000set('config', function () use ($config) { return $config; }); $di->set('logger', function() use ($config) { $filename = date('Ymd'); $logger = new \Logger($config->application->logger->dir . $filename); $logger->setFormat($config->application->logger->format); return $logger; }); php-mode-1.13.5/tests/issue-53.php000066400000000000000000000010431236230067600165450ustar00rootroot00000000000000bar = $bar; } public function getBar() { // here is the whitespace return $this->bar; } } $foo = new Foo('bar'); $bar = $foo->getBar(); php-mode-1.13.5/tests/issue-68.php000066400000000000000000000026701236230067600165620ustar00rootroot00000000000000 'mat_replica')); } catch (\MongoConnectionException $e) { throw $e; } catch (\Exception $e) { throw $e; } /* CC Mode uses the indentation syntax for 'topmost-intro' for the * 'catch' keywords in the remaining tests. */ try { $mongo = new \Mongo($dsn, array("replicaSet" => 'mat_replica')); } catch (\MongoConnectionException $e) { throw $e; } catch (\Exception $e) { throw $e; } try { $mongo = new \Mongo($dsn, array("replicaSet" => 'mat_replica')); } catch (\MongoConnectionException $e) { throw $e; } catch (\Exception $e) { throw $e; } php-mode-1.13.5/tests/issue-73.php000066400000000000000000000011271236230067600165520ustar00rootroot00000000000000' amd '::' and after '->' and * '::'. */ # Correct TEST::di->set('config', function () use ($config); # Test TEST :: di->set('config', function () use ($config); # Test TEST::di -> set('config', function () use ($config); # Test TEST::di->set('config' , function () use ($config); # Test TEST::di->set('config', function () use ($config) ; php-mode-1.13.5/tests/issue-8.php000066400000000000000000000014321236230067600164670ustar00rootroot00000000000000 tag should match the highlighting of its opening tag. */ ?> We'll go therephp-mode-1.13.5/tests/issue-99.php000066400000000000000000000007201236230067600165600ustar00rootroot00000000000000