501 Commits (a4a2b6da876ca6aca7bd12843ca772c1fa4509e8)

Author SHA1 Message Date
Jordi Boggiano e1bf45aa80
Fix issue parsing php files with unterminated comments found inside backticks, fixes #10385 3 years ago
Jordi Boggiano 24ce1eddbd
Add composer/pcre dependency and use it everywhere instead of preg_* 3 years ago
Wataru Kurashima 10f8edb816
fix typo (#10331) 3 years ago
Helmut Hummel 0b9e1da4fc
Allow recursively call composerRequire (#10312)
Fixes: #10311
Related: #10065
3 years ago
Jordi Boggiano f509c41280
Upgrade PHPStan to 1.0 (#10253)
Co-authored-by: Martin Herndl <martin@herndl.org>
3 years ago
Nicolas Grekas 0662fa2662
Fix loading files for plugins/scripts (#10279) 3 years ago
Martin Herndl 3013674c92
Refactor ignore platform reqs checks (#10079)
Introduces a `PlatformRequirementFilter` with methods that help to decide if a requirement is ignored or not as discussed in #10045 but without changing behaviour.
3 years ago
Jordi Boggiano ba5b7a5a9f
Add missing docblocks 3 years ago
Nicolas Grekas 8553c6d978
Add loading of files autoload section for plugins and Composer runtime autoloaders (#10065) 3 years ago
Jordi Boggiano 44b69ba77f
Upgrade php-cs-fixer to 3.x and fix CS 3 years ago
Jordi Boggiano 87f25e6df6
Specify parseAutoloads more narrowly, refs #10179 3 years ago
immeëmosol be25cf1d7a
Reaching phpstan level 6 in Composer/Autoload (refs #10159) (#10179)
Co-authored-by: Jordi Boggiano <j.boggiano@seld.be>
3 years ago
Jordi Boggiano 9599eb613b
Type annotations 3 years ago
Jordi Boggiano c3c6969cf5
Type annotations 3 years ago
Jordi Boggiano 97fe881af4
Add some docblocks 3 years ago
Jordi Boggiano d1c8a4d1b4
Lots of typing improvements 3 years ago
Jordi Boggiano d64d1adf61
Rewrite php file cleaning step to be less regex intensive and support extreme cases better, fixes #10106 (#10107) 3 years ago
Jordi Boggiano 8cd2d0e541
Fix scanning of classmaps in files containing invalid Unicode, fixes #10102 3 years ago
Jordi Boggiano 0761474599
Add type info to many properties/methods 3 years ago
Jordi Boggiano fc04c86f82
Add type info to Autoload namespace 3 years ago
Jordi Boggiano d8054d1d2f
Add more possessive quantifiers, unicode flag and support for more post-heredoc syntax, fix test file syntax being invalid 3 years ago
Jordi Boggiano 6ab1b6a7d2
Regex simplifications 3 years ago
Jordi Boggiano f6c446bdd7
Tweak to allow matching delimiter within the string 3 years ago
Jordi Boggiano c44be998ab
Undo new stripping code and fix regex 3 years ago
jrfnl 40bd4b03ad
ClassMapGenerator: stabilize the heredoc/nowdoc stripping
I've looked into 10067 and have come to the conclusion that using a single regex to strip the heredoc/nowdocs is always going to run into trouble as:
* Either the matching will be too greedy (issue 10067);
* Or the matching will run into backtrace limits for large heredoc/nowdocs.

We cannot solve both within a single regex.

So, I'm proposing a slightly different solution which should support both and should also improve performance for files containing large heredoc/nowdocs.

The `stripHereNowDocs()` function will find a start marker and remember the offset of the start marker.
It will then find the end marker and strip the contents between the two (replace with `null`).
The function will then recurse onto itself until all heredocs/nowdocs in a file have been removed.
3 years ago
Jordi Boggiano d3c176ec69
PHPStan Level 5 (#10070)
* Bump PHPStan to level 5

* Update seld/phar-utils to latest

* Add phpstan-setup / phpstan scripts
3 years ago
jrfnl 42c6a0d7c5 ClassMapGenerator: fix the regex
By using a look ahead assertion to match "new line - maybe whitespace - marker", the negative performance impact of the `.*` is significantly mitigated and backtracing will be severely limited.

This fixes the bug as reported in 10037.

The bug was discovered due to a PHP 8.1 "passing null to non-nullable" deprecation notice being thrown, but is not a PHP 8.1 bug.

In actual fact, this issue affected all PHP versions and could lead to incomplete classmaps when the code base contained files with huge heredocs/nowdocs.

The regex change (not completely) incidentally also fixes an issue with markers in a heredoc/nowdoc not being correctly handled. This bug could lead to "classes" being added to the class map which aren't actually classes.

Fixes 10037
3 years ago
Jordi Boggiano d5ce7a7385
Fix autoload generation for dev dependencies when --no-scripts is used, fixes #9934 3 years ago
Jordi Boggiano 91dd175f74
Fix env var handling when variables_order includes E and symfony/console 3.3.15+ is used, fixes #9930 3 years ago
Jordi Boggiano 3380178798
Introduce a cross-platform safe version of is_readable to support UNC / wsl$ paths on Windows (#9861) 3 years ago
Jordi Boggiano 4940009f83
Bump phpstan to level 3 (#9734)
Clean up PackageInterface/CompletePackageInterface, add missing methods, type things in solver as BasePackage, added CompleteAliasPackage, ..
3 years ago
Jordi Boggiano d0aac44ed2
Auto-detect dev-mode in autoload-dump and deprecate dump-autoload --no-dev (#9714) 3 years ago
Jordi Boggiano 09639a0cfc
Merge pull request #9670 from Ayesh/enums
Add support for autoloading Enums
3 years ago
Jordi Boggiano d4073a40f9
Prepend runtime-autoloaders so that dependencies get loaded over Composer bundled packages
As Composer is generally compatible with newer versions of Symfony than the bundled ones, this should
not be a problem if dependencies are shared, and it ensures that the most relevant code gets loaded.
3 years ago
Ayesh Karunaratne 228428747a
Add support for autoloading Enums
PHP 8.1 supports Enums, and [Enums follow class-semantics](https://php.watch/versions/8.1/enums#class-semantics-autoload).

Composer's class-map generator currently looks for `class`, `interface`, and `trait` keywords. If Composer is run in PHP 8.1 or later, Composer now additionally looks for `enum` keyword as well. This is similar to how Hack's `enum` support is added.

This PR also adds tests for basic enums, backed enums, namespaced enums, and an enum that implements an interface and extends a class.
3 years ago
Ayesh Karunaratne 980aac6eb2
Minor improvement to ClassLoader::register no-op block
A recent change in the ClassAutoloader (#9635) added support for specifying a vendorDir, and `\Composer\Autoload\ClassLoader::register` now has a if-elseif-else chain.
The first block has a `// no-op` comment, followed by an `elseif` block. It's more readable to `return;`, and remove the `elseif` for readability.
3 years ago
Jordi Boggiano 07b8c23f02
Merge branch '1.10' 3 years ago
Jordi Boggiano 92313447d6
Filter out exclude-from-classmap rules to avoid generating very long regexes, fixes #9487 3 years ago
Nicolas Grekas ba94445bb9 Ensure InstalledVersions reports info about all currently registered class loaders 3 years ago
Jordi Boggiano b7d770659b
CS fixes 4 years ago
Jordi Boggiano b78b2df5bb
Reuse devPackageNames if available instead of filtering the dev packages out by looping through all requirements 4 years ago
Jordi Boggiano b574f10d9d
Rename mainPackage to rootPackage in AutoloadGenerator and ensure we use RootPackageInterface 4 years ago
Jakub Bouček 8dc5effee7
AutoloadGenerator: Send error HTTP status on error 4 years ago
Jordi Boggiano 56c65a58e2
Make platform-check only check non-dev requires, refs #9412 4 years ago
Jordi Boggiano 8c1355f448
Improve output of platform check further in case errors are hidden 4 years ago
Jordi Boggiano ec960d12b0
Merge remote-tracking branch 'jakubboucek/feature/jb-platform-check-tigger-error' 4 years ago
Jordi Boggiano 6c31744c04
Disable full platform-check for extensions by default, now set to php-only, refs #9412 4 years ago
Jakub Bouček 3f63bc9205
AutoloadGenerator: Trigger native PHP error on platform checks fails 4 years ago
Jakub Bouček b83b186ac0
AutoloadGenerator: Send error HTTP status on error 4 years ago
zorn 5aa90baab1 Add new lines to platform reqs issues 4 years ago