Commit Graph

31 Commits

Author SHA1 Message Date
Weston Ruter
bd3f20e8c7 Build/Test Tools: Integrate PHPStan into the core development workflow.
This change introduces PHPStan static analysis configured at [https://phpstan.org/user-guide/rule-levels rule level 0], which includes: "basic checks, unknown classes, unknown functions, unknown methods called on `$this`, wrong number of arguments passed to those methods and functions, always undefined variables". Contributors may elect for a higher PHPStan rule level by creating a `phpstan.neon` which overrides `phpstan.neon.dist`.

* Fix various PHPStan level 0 errors by adding `@phpstan-ignore` comments, updating PHPDoc types, and adding missing return values.
* Remove existing `@phpstan-ignore` comments that are now obsolete or inapplicable for level 0.
* Add a new GitHub Actions workflow for PHPStan Static Analysis. Reports are currently provided as warnings with inline annotations in pull requests and do not fail the build.
* Add a `phpstan` Grunt task and include it in the `precommit:php` task to run before `phpunit`.
* Introduce a `typecheck:php` npm script and a `composer phpstan` script to run analysis in local development environments.
* Add documentation for PHPStan usage in `tests/phpstan/README.md`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10419

Props justlevine, westonruter, johnbillion, desrosj, SirLouen, dmsnell, oglekler, joehoyle, jorbin.
See #64238, #63268, #52217, #51423.
Fixes #61175.

Built from https://develop.svn.wordpress.org/trunk@61699


git-svn-id: http://core.svn.wordpress.org/trunk@61007 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-20 02:25:46 +00:00
Weston Ruter
7b752c237e Script Loader: Allow classic scripts to depend on script modules.
This allows classic scripts to declare dependencies on script modules by passing `module_dependencies` in the `$args` param for `wp_register_script()` or `wp_enqueue_script()`. The `WP_Script_Modules::get_import_map()` method is updated to traverse the dependency tree of all enqueued classic scripts to find any associated script module dependencies and include them in the `importmap`, enabling dynamic imports of modules within classic scripts.

A `_wp_scripts_add_args_data()` helper function is introduced to consolidate argument validation and processing for `wp_register_script()` and `wp_enqueue_script()`, reducing code duplication. This function validates that the `$args` array only contains recognized keys (`strategy`, `in_footer`, `fetchpriority`, `module_dependencies`) and triggers a `_doing_it_wrong()` notice for any unrecognized keys. Similarly, `WP_Scripts::add_data()` is updated to do early type checking for the data passed to `$args`. The script modules in `module_dependencies` may be referenced by a module ID string or by an array that has an `id` key, following the same pattern as dependencies in `WP_Script_Modules`.

When a script module is added to the `module_dependencies` for a classic script, but it does not exist at the time the `importmap` is printed, a `_doing_it_wrong()` notice is emitted.

Developed in https://github.com/WordPress/wordpress-develop/pull/8024

Follow-up to [61323].

Props sirreal, westonruter.
See #64229.
Fixes #61500.

Built from https://develop.svn.wordpress.org/trunk@61587


git-svn-id: http://core.svn.wordpress.org/trunk@60898 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-02-04 01:42:44 +00:00
wildworks
b3b6af82bf Script Loader: Use localized list separators in dependency warning messages.
Improve dependency warning messages so that list separators are localized according to the current locale when multiple dependencies are listed.

Follow-up to [61323], [60999], [61357].

Props mukeshpanchal27, jorbin, westonruter, wildworks.
See #64229.
Built from https://develop.svn.wordpress.org/trunk@61542


git-svn-id: http://core.svn.wordpress.org/trunk@60853 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-28 01:07:42 +00:00
Weston Ruter
56076b1bc4 Code Modernization: Script Loader: Use null coalescing operator instead of isset() ternaries.
Developed as a subset of https://github.com/WordPress/wordpress-develop/pull/10654
Initially developed in https://github.com/WordPress/wordpress-develop/pull/4886

Follow-up to [61436], [61435], [61434], [61403], [61433], [61432], [61431], [61430], [61429], [61424], [61404], [61403].

Props costdev, westonruter.
See #58874, #63430.

Built from https://develop.svn.wordpress.org/trunk@61442


git-svn-id: http://core.svn.wordpress.org/trunk@60754 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2026-01-06 05:14:55 +00:00
Weston Ruter
641cf5a127 Script Loader: Fix script module fetchpriority calculation when dependent with higher priority is not enqueued.
Developed in https://github.com/WordPress/wordpress-develop/pull/10651

Follow-up to [60931], [60704].

Props westonruter, jonsurrell, youknowriad.
See #61734.
Fixes #64429.

Built from https://develop.svn.wordpress.org/trunk@61401


git-svn-id: http://core.svn.wordpress.org/trunk@60713 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-22 20:20:33 +00:00
Weston Ruter
46045c50d7 Script Loader: Fix adding default version to script/style URL when args are supplied via enqueued handle.
Also fixes phpdoc for some member variables of `WP_Scripts` and `WP_Styles`.

Developed in https://github.com/WordPress/wordpress-develop/pull/10608

Follow-up to [61358].

Props westonruter, peterwilsoncc.
See #64224, #64238.
Fixes #64372.

Built from https://develop.svn.wordpress.org/trunk@61397


git-svn-id: http://core.svn.wordpress.org/trunk@60709 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-22 00:56:42 +00:00
Weston Ruter
5e940f833d Docs: Improve accuracy for types in phpdoc for WP_Dependencies, _WP_Dependency, WP_Scripts, and WP_Styles.
This increases these classes to PHPStan level 8.

Developed in https://github.com/WordPress/wordpress-develop/pull/10607

See #64238.

Built from https://develop.svn.wordpress.org/trunk@61358


git-svn-id: http://core.svn.wordpress.org/trunk@60670 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-07 04:16:33 +00:00
Weston Ruter
67c33bebb7 Script Loader: Re-target release for missing dependency notices from 7.0.0 to 6.9.1.
Follow-up to [61323], [60999].

See #64229.

Built from https://develop.svn.wordpress.org/trunk@61357


git-svn-id: http://core.svn.wordpress.org/trunk@60669 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-12-07 01:11:33 +00:00
Weston Ruter
58465aa777 Script Loader: Emit notices when enqueueing a script, style, or script module with missing dependencies.
Developed in https://github.com/WordPress/wordpress-develop/pull/10545

Follow-up to [60999].

Props deepakprajapati, westonruter.
See #63486.
Fixes #64229.

Built from https://develop.svn.wordpress.org/trunk@61323


git-svn-id: http://core.svn.wordpress.org/trunk@60635 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-30 00:56:32 +00:00
jonsurrell
8629a48ecb Script Loader: Omit sourceURL from translation data when not printed.
The data returned from `WP_Scripts::print_translations()` when `$display` is `false` may be used in unpredictable ways that are incompatible with `sourceURL` comments. Omit the `sourceURL` comment in this case.

Developed in https://github.com/WordPress/wordpress-develop/pull/10505.

Follow-up to [60719].

Props jonsurrell, ralucastn, westonruter, peterwilsoncc.
See #63887.

Built from https://develop.svn.wordpress.org/trunk@61223


git-svn-id: http://core.svn.wordpress.org/trunk@60552 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-12 11:36:33 +00:00
Weston Ruter
1d0e9badff Script Loader: Guard against exponential recursion during calculation of loading strategy and fetchpriority.
This addresses a performance issue in the recursive `WP_Scripts::get_highest_fetchpriority_with_dependents()` and `WP_Scripts::filter_eligible_strategies()` methods for redundant processing of shared dependencies in complex dependency graphs. To fix this, a `$stored_results` param is introduced which is passed by reference; this variable contains a cache of the calculated results for all scripts handles, so that subsequent calls for the same handle can return the cached value instead of re-computing it.

Developed in https://github.com/WordPress/wordpress-develop/pull/10459

Follow-up to [60704], [60931], [56033].

Props ciobanucatalin, b1ink0, westonruter, mukesh27.
See #61734, #12009.
Fixes #64194.

Built from https://develop.svn.wordpress.org/trunk@61176


git-svn-id: http://core.svn.wordpress.org/trunk@60512 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-11-07 06:13:38 +00:00
joedolson
83f64ea185 General: Remove support for IE conditional comments.
Remove the ability to enqueue scripts and styles wrapped in IE conditional comment tags. Conditional comment support was removed from IE in version 10 in 2012, and no core supported browser renders them in any way. IE9 has global usage approaching zero. WordPress dropped support for IE10 and below in version 4.8.

Patch adds a deprecation notice if the conditional data argument is added. Scripts and styles are not printed, and neither are their dependencies if they are not required by other non-conditional scripts. Conditional dependencies are removed from core enqueues. 

Props jonsurrell, joedolson, shailu25, siliconforks, dmsnell, sabernhardt, rollybueno.
Fixes #63821.
Built from https://develop.svn.wordpress.org/trunk@60948


git-svn-id: http://core.svn.wordpress.org/trunk@60284 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-16 20:01:36 +00:00
Weston Ruter
7b5a81698f Script Loader: Propagate fetchpriority from dependents to dependencies.
This introduces a "fetchpriority bumping" mechanism for both classic scripts (`WP_Scripts`) and script modules (`WP_Script_Modules`). When a script with a higher `fetchpriority` is enqueued, any of its dependencies will have their `fetchpriority` elevated to match that of the highest-priority dependent. This ensures that all assets in a critical dependency chain are loaded with the appropriate priority, preventing a high-priority script from being blocked by a low-priority dependency. This is similar to logic used in script loading strategies to ensure that a blocking dependent causes delayed (`async`/`defer`) dependencies to also become blocking. See #12009. 

When a script's `fetchpriority` is escalated, its original, registered priority is added to the tag via a `data-wp-fetchpriority` attribute. This matches the addition of the `data-wp-strategy` parameter added when the resulting loading strategy does not match the original.

Developed in https://github.com/WordPress/wordpress-develop/pull/9770.

Follow-up to [60704].

Props westonruter, jonsurrell.
Fixes #61734.

Built from https://develop.svn.wordpress.org/trunk@60931


git-svn-id: http://core.svn.wordpress.org/trunk@60267 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-10-14 05:47:32 +00:00
jonsurrell
33e7fbc1a9 Script Loader: Fix typo in code comment about sourceURL.
Developed in https://github.com/WordPress/wordpress-develop/pull/9794.

Follow-up to [60719].

Props jonsurrell, tobiasbg.
See #63887.

Built from https://develop.svn.wordpress.org/trunk@60722


git-svn-id: http://core.svn.wordpress.org/trunk@60058 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-08 14:30:26 +00:00
jonsurrell
ec862f5d99 Script Loader: Add sourceURL to inline scripts and styles.
Improve the source locations referenced by developer tooling in supporting browsers. Inline source locations are named like inline:handle-js-after and appear in the developer tools "sources" panel.

This is the second attempt to add sourceURL comments. The first attempt in [60685] was reverted due to an issue with script concatenation that has been addressed.

Developed in https://github.com/WordPress/wordpress-develop/pull/9672.

Follow-up to [60685], [60690].

Props jonsurrell, westonruter, wildworks, peterwilsoncc, johnbillion, tobiasbg.
Fixes #63887.

Built from https://develop.svn.wordpress.org/trunk@60719


git-svn-id: http://core.svn.wordpress.org/trunk@60055 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-08 11:27:31 +00:00
Weston Ruter
c97bb4a4bd Script Loader: Introduce fetchpriority for Scripts and Script Modules.
* Allow scripts and script modules to be registered with a `fetchpriority` of `auto` (default), `high`, `low`:
  * When registering a script, add a `fetchpriority` arg to go alongside the `strategy` arg which was added for loading scripts with the `defer` and `async` loading strategies. See #12009. 
  * For script modules, introduce an `$args` array parameter with a `fetchpriority` key to the `wp_register_script_module()`, and `wp_enqueue_script_module()` functions (and their respective underlying `WP_Script_Modules::register()` and `WP_Script_Modules::enqueue()` methods). This `$args` parameter corresponds with the same parameter used when registering non-module scripts.
  * Also for script modules, introduce `WP_Script_Modules::set_fetchpriority()` to override the `fetchpriority` for what was previously registered.
  * Emit a `_doing_it_wrong()` warning when an invalid `fetchpriority` value is used, and when `fetchpriority` is added to a script alias.
  * Include `fetchpriority` as an attribute on printed `SCRIPT` tags as well as on preload `LINK` tags for static script module dependencies.
* Use a `fetchpriority` of `low` by default for:
  * Script modules used with the Interactivity API. For overriding this default in blocks, see [https://github.com/WordPress/gutenberg/issues/71366 Gutenberg#71366].
  * The `comment-reply` script.
* Improve type checks and type hints.

Developed in [https://github.com/WordPress/wordpress-develop/pull/8815 GitHub PR], with [https://github.com/WordPress/gutenberg/pull/70173 companion for Gutenberg].

Props westonruter, jonsurrell, swissspidy, luisherranz, kraftbj, audrasjb, dennysdionigi.
Fixes #61734.

Built from https://develop.svn.wordpress.org/trunk@60704


git-svn-id: http://core.svn.wordpress.org/trunk@60040 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-09-03 22:17:39 +00:00
jonsurrell
2c4aab7e8c Script Loader: Revert sourceURL addition.
It was discovered that these changes cause some issues in the customizer when `SCRIPT_DEBUG` is `false`.

Reverts [60685] and [60686].

Developed in https://github.com/WordPress/wordpress-develop/pull/9671

Props jonsurrell, wildworks, tyxla.
See #63887.

Built from https://develop.svn.wordpress.org/trunk@60690


git-svn-id: http://core.svn.wordpress.org/trunk@60026 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-29 17:18:28 +00:00
jonsurrell
0213b11319 Script Loader: Remove "inline:" prefix from sourceURL.
The prefix may negatively impact some APIs such as the Long Animation Frames API.

Developed in https://github.com/WordPress/wordpress-develop/pull/9655.

Follow-up to [60685].

Props jonsurrell, swissspidy.
Fixes #63887.

Built from https://develop.svn.wordpress.org/trunk@60686


git-svn-id: http://core.svn.wordpress.org/trunk@60022 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-28 14:46:37 +00:00
jonsurrell
3b163e81c7 Script Loader: Add sourceURL to inline scripts and styles.
Improve the source locations referenced by developer tooling in supporting browsers. Inline source locations are named like `inline:handle-js-after` and appear in the developer tools "sources" panel.

Developed in https://github.com/WordPress/wordpress-develop/pull/9628.

Props jonsurrell, swissspidy, alshakero, westonruter.
Fixes #63887.

Built from https://develop.svn.wordpress.org/trunk@60685


git-svn-id: http://core.svn.wordpress.org/trunk@60021 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-28 07:56:30 +00:00
jonsurrell
a8d180e55e Scripts: Use appropriate JSON encoding flags for script tags.
`wp_json_encode()` with default arguments is insufficient to safely escape JSON for script tags. Use `JSON_HEX_TAG | JSON_UNESCAPED_SLASHES` flags.

Developed in https://github.com/WordPress/wordpress-develop/pull/9557.

Props devasheeshkaul, jonsurrell, siliconforks.
Fixes #63851.

Built from https://develop.svn.wordpress.org/trunk@60681


git-svn-id: http://core.svn.wordpress.org/trunk@60017 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2025-08-27 10:34:28 +00:00
Peter Wilson
bf103e6621 Code Quality: Clarify variable names in dependency classes.
Renames several variables in the `WP_Scripts` and `WP_Styles` classes to clarify their purpose for developers reading the code.

Props peterwilsoncc, sergeybiryukov.
See #61607.


Built from https://develop.svn.wordpress.org/trunk@58878


git-svn-id: http://core.svn.wordpress.org/trunk@58274 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-08-10 23:00:14 +00:00
Pascal Birchler
aed15fedb9 Script Loader: Remove unused WP_Scripts::get_unaliased_deps() method.
This private method was introduced in [56033] / #12009 but it's not actually used.
It was part of the inline script implementation which was later reverted before final merge.
The method can be safely removed because it’s private and cannot be used by extenders.

Props joemcgill.
Fixes #60438.
Built from https://develop.svn.wordpress.org/trunk@57533


git-svn-id: http://core.svn.wordpress.org/trunk@57034 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2024-02-05 09:43:12 +00:00
Weston Ruter
793eaf7f19 Script Loader: Move delayed head script to footer when there is a blocking footer dependent.
This prevents a performance regression when a blocking script is enqueued in the footer which depends on a delayed script in the `head` (with `async` or `defer`). In order to preserve the execution order, a delayed dependency must fall back to blocking when there is a blocking dependent. But since it was originally delayed (and thus executes similarly to a footer script), it does not need to be in the head and can be moved to the footer. This prevents blocking the critical rendering path.

Props adamsilverstein, westonruter, flixos90.
Fixes #59599.
See #12009.

Built from https://develop.svn.wordpress.org/trunk@56933


git-svn-id: http://core.svn.wordpress.org/trunk@56444 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-10-13 18:46:21 +00:00
Weston Ruter
e7747ce23e Script Loader: Use wp_get_script_tag() and wp_get_inline_script_tag()/wp_print_inline_script_tag() helper functions to output scripts on the frontend and login screen.
Using script tag helper functions allows plugins to employ the `wp_script_attributes` and `wp_inline_script_attributes` filters to inject the `nonce` attribute to apply Content Security Policy (e.g. Strict CSP). Use of helper functions also simplifies logic in `WP_Scripts`.

* Update `wp_get_inline_script_tag()` to wrap inline script in CDATA blocks for XHTML-compatibility when not using HTML5.
* Ensure the `type` attribute is printed first in `wp_get_inline_script_tag()` for back-compat.
* Wrap existing `<script>` tags in output buffering to retain IDE supports.
* In `wp_get_inline_script_tag()`, append the newline to `$javascript` before it is passed into the `wp_inline_script_attributes` filter so that the CSP hash can be computed properly.
* In `the_block_template_skip_link()`, opt to enqueue the inline script rather than print it.
* Add `ext-php` to `composer.json` under `suggest` as previously it was an undeclared dependency for running PHPUnit tests.
* Update tests to rely on `DOMDocument` to compare script markup, normalizing unsemantic differences.

Props westonruter, spacedmonkey, flixos90, 10upsimon, dmsnell, mukesh27, joemcgill, swissspidy, azaozz.
Fixes #58664.
See #39941.

Built from https://develop.svn.wordpress.org/trunk@56687


git-svn-id: http://core.svn.wordpress.org/trunk@56199 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-09-25 21:05:21 +00:00
Sergey Biryukov
3a065bfb2c Coding Standards: Correct equals sign alignment in various files.
This resolves a few WPCS warnings:
{{{
Equals sign not aligned with surrounding statements
}}}
so that the output of `composer format` is clean.

Follow-up to [55971], [56033], [56056], [56143], [56214].

Props jrf.
See #58831.
Built from https://develop.svn.wordpress.org/trunk@56273


git-svn-id: http://core.svn.wordpress.org/trunk@55785 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-20 00:06:21 +00:00
Joe McGill
e1b050cb9b Script Loader: Improve test coverage for wp_print_scripts().
This is a follow-up to [56092], which further improves PHPUnit test coverage and inline docs for ensuring `async` and `defer` attributes are being properly handled for scripts that are printed without being enqueued.

Props peterwilsoncc, azaozz, westonruter, joemcgill.
See #58648.

Built from https://develop.svn.wordpress.org/trunk@56246


git-svn-id: http://core.svn.wordpress.org/trunk@55758 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-07-17 14:05:29 +00:00
Andrew Ozz
88a4cf17a6 Script Loader: Fix unintended adding of async to scripts that are printed directly with wp_print_scripts() without enqueueing them beforehand.
Props: joemcgill, westonruter, felixarntz, peterwilsoncc.
See: #58648.
Built from https://develop.svn.wordpress.org/trunk@56092


git-svn-id: http://core.svn.wordpress.org/trunk@55604 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-28 14:16:27 +00:00
Joe McGill
53e7cc3ddf Script Loader: Add support for HTML 5 "async" and "defer" attributes.
This allows developers to register scripts with an intended loading strategy by changing the `$in_footer` parameter of `wp_register_script` and `wp_enqueue_script` to an array that accepts both an `in_footer` and `strategy` argument. If present, the loading strategy attribute will be added to the script tag when that script is printed to the page as long as it is not a dependency of any blocking scripts, including any inline scripts attached to the script or any of its dependents.

Props 10upsimon, thekt12, westonruter, costdev, flixos90, spacedmonkey, adamsilverstein, azaozz, mukeshpanchal27, mor10, scep, wpnook, vanaf1979, Otto42.
Fixes #12009.

Built from https://develop.svn.wordpress.org/trunk@56033


git-svn-id: http://core.svn.wordpress.org/trunk@55545 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-06-26 13:42:23 +00:00
Sergey Biryukov
2ec23a82ed Code Modernization: Replace usage of strpos() with str_starts_with().
`str_starts_with()` was introduced in PHP 8.0 to perform a case-sensitive check indicating if the string to search in (haystack) begins with the given substring (needle).

WordPress core includes a polyfill for `str_starts_with()` on PHP < 8.0 as of WordPress 5.9.

This commit replaces `0 === strpos( ... )` with `str_starts_with()` in core files, making the code more readable and consistent, as well as improving performance.

While `strpos()` is slightly faster than the polyfill on PHP < 8.0, `str_starts_with()` is noticeably faster on PHP 8.0+, as it is optimized to avoid unnecessarily searching along the whole haystack if it does not find the needle.

Follow-up to [52039], [52040], [52326].

Props spacedmonkey, costdev, sabernhardt, mukesh27, desrosj, jorbin, TobiasBg, ayeshrajans, lgadzhev, SergeyBiryukov.
Fixes #58012.
Built from https://develop.svn.wordpress.org/trunk@55703


git-svn-id: http://core.svn.wordpress.org/trunk@55215 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2023-05-02 15:45:22 +00:00
Sergey Biryukov
70f3a062db I18N: Use correct default value for JavaScript translations path.
The `$path` parameter of some script translation functions had a default value of `null`, even though the parameter is documented as a string.

This commit corrects the default value for `$path` in:
* `WP_Dependency::set_translations()`
* `WP_Scripts::set_translations()`
* `wp_set_script_translations()`

Additionally, this commit removes an `is_string()` check for `$path` in `load_script_textdomain()`. Now that the default value for `$path` in that function has also been corrected to an empty string instead of `null`, that check is no longer necessary, as it would ''hide'' an error which should be ''fixed'' (at the source of the problem) instead.

Follow-up to [54349].

Props jrf, johnjamesjacoby.
See #55967, #55656.
Built from https://develop.svn.wordpress.org/trunk@54351


git-svn-id: http://core.svn.wordpress.org/trunk@53910 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-28 22:19:10 +00:00
Sergey Biryukov
c58963b07f Coding Standards: Rename WordPress Dependencies API class files.
The current coding standards note that the name of the class files should be based on the class name with `class-` prepended, and the underscores replaced by hyphens (see the [https://developer.wordpress.org/coding-standards/wordpress-coding-standards/php/#naming-conventions Naming Conventions] section in the handbook), except for the three legacy files: `class.wp-dependencies.php`, `class.wp-scripts.php`, `class.wp-styles.php`.

To bring more consistency to the codebase and make it easier to implement autoloading in the future, this commit renames those three legacy files to conform to the coding standards:

* `wp-includes/class.wp-dependencies.php` → `wp-includes/class-wp-dependencies.php`
* `wp-includes/class.wp-scripts.php` → `wp-includes/class-wp-scripts.php`
* `wp-includes/class.wp-styles.php` → `wp-includes/class-wp-styles.php`

Includes:
* Loading the new files from the old ones, for anyone that may have been including the files directly.
* Replacing references to the old filenames with the new filenames.

Follow-up to [7970], [45654], [45662], [45663], [45678], [47197], [52026], [53749].

Props afragen, schlessera, swissspidy, dingo_d, hellofromTonya, SergeyBiryukov.
Fixes #37861. See #55647.
Built from https://develop.svn.wordpress.org/trunk@54254


git-svn-id: http://core.svn.wordpress.org/trunk@53813 1a063a9b-81f0-0310-95a4-ce76da25c4cd
2022-09-20 14:17:12 +00:00