106 Commits

Author SHA1 Message Date
Dylan K. Taylor
dc9351b024 Merge remote-tracking branch 'origin/stable' into next-minor 2020-05-19 11:26:25 +01:00
SOFe
786f416f2e
Improved support for paths with backslashes on Unix filesystems (#3501)
Fixes #3497
2020-05-19 10:34:51 +01:00
Dylan K. Taylor
717b866605 Merge branch 'stable' into next-minor 2020-05-06 20:25:11 +01:00
Dylan T
ef97c8f99e
Utils: fix parsing of single-line doc comments, closes #3388 (#3469)
* Utils: fix parsing of single-line doc comments, closes #3388

* correctly handle the empty doc-comment case, add another test case

* ignore an extra phpstan bug
2020-05-06 14:17:08 +01:00
Dylan K. Taylor
1755b25808 Utils: make explicit assumption about result of scandir() in recursiveUnlink()
TODO: this assumption might be flawed in the case of threading...
2020-04-15 12:13:26 +01:00
Dylan K. Taylor
a78133d0e3 Utils: provide phpstan type information for testValidInstance() 2020-04-15 12:12:18 +01:00
Dylan K. Taylor
a51a16a55c Utils: silence PHPStan warning about array_combine() result
phpstan doesn't account for having 2 arrays of the same size, and even if it did, the size cannot be inferred easily here.
2020-04-15 12:11:13 +01:00
Dylan K. Taylor
099562d582 Utils: assume explicitly that ob_get_contents() will not return false in getReferenceCount() based on context 2020-04-15 12:10:21 +01:00
Dylan K. Taylor
ae76e8f08f Utils: fix some implicit casts to boolean on result of preg_match_all() 2020-04-15 12:09:10 +01:00
Dylan K. Taylor
42a08e7e4a Utils: don't assume that callable is only array|string implicitly
this should really support closures too, but since it's not used anywhere, I feel OK with this change.
2020-04-15 12:08:33 +01:00
Dylan K. Taylor
372202b3dc Utils: use type-safe checks to ensure file validity
this gives the same results while keeping phpstan happy.
2020-04-15 10:19:51 +01:00
Dylan K. Taylor
917c744266 Properly handle error conditions in Utils::decodeJWT() 2020-04-15 10:18:02 +01:00
Dylan K. Taylor
2281fe4e67 Account for reflection filename being false (in the case of classes/functions defined by builtins) 2020-04-15 10:15:38 +01:00
Dylan K. Taylor
3907a2b6ba Process: split getMemoryUsage() into 2 functions
this isn't released yet so it's OK to change.
phpstan level 7 doesn't like these kinds of ambiguous return types because there's no way for it to tell which type is returned without a return type specifying extension, and it's easier to just change the API than to make PHPStan understand it.
2020-03-13 17:32:17 +00:00
Dylan K. Taylor
15b76a24b7 scrub useless phpdoc 2020-02-10 12:21:07 +00:00
Dylan K. Taylor
f08e411cad Merge branch 'stable' into next-minor 2020-02-10 11:40:08 +00:00
Dylan K. Taylor
79acaa3253 Utils: remove useless typecasts 2020-02-06 16:06:58 +00:00
Dylan K. Taylor
fa82cb26d8 added native types to closures (phpstan-strict-rules) 2020-02-05 16:35:10 +00:00
Dylan K. Taylor
e5a2cfb65f avoid type juggling in conditions, always use explicit boolean conditions 2020-02-05 15:44:06 +00:00
Dylan K. Taylor
260ac47588 add some phpstan array types 2020-01-30 22:23:11 +00:00
Dylan K. Taylor
da43ae82fe populate missing array value types in utils namespace, pass 1 2020-01-30 21:30:01 +00:00
Dylan K. Taylor
9cdea43794 provide more array type information for Internet functions 2020-01-29 20:45:03 +00:00
Dylan K. Taylor
e007fad5b8 fix return types for Utils/Internet getURL()/postURL() 2020-01-29 20:43:09 +00:00
Dylan K. Taylor
5cf2fcbbb7 simpleCurl() second return value is string[][], not string[] 2020-01-29 20:38:19 +00:00
Dylan K. Taylor
9e6cbb5b6a Internet: fix type information for getURL(), postURL() and simpleCurl() 2020-01-29 20:20:52 +00:00
Dylan K. Taylor
2b402e525a add some PHPStan-specific callable prototypes 2020-01-29 15:03:55 +00:00
Dylan K. Taylor
f624871b3f strip extra blank lines (php-cs-fixer) 2020-01-22 14:50:29 +00:00
Dylan K. Taylor
c4793241f5 Mass removal of useless @param/@return PHPDoc annotations, pass 1 2020-01-21 15:10:18 +00:00
Dylan K. Taylor
17720041a3 phpdoc: populate missing parameter typeinfo 2020-01-11 21:53:24 +00:00
Dylan K. Taylor
8794292788 remove &$var reference notations in phpdoc
this isn't required by the spec and PHPStan chokes on it. I was previously having it ignore these errors, but it turns out that PHPStan is not making use of extended typeinfo provided if it can't parse the tag, which is problematic on level 6 and also a problem for array-of-type. Therefore, we are going to have to take the hit.
2020-01-11 21:20:55 +00:00
Dylan K. Taylor
1eedac87b2 added missing @var property types (reported by phpstan) 2020-01-09 14:13:54 +00:00
Dylan K. Taylor
1a467420e3 Merge branch 'stable' into next-minor 2019-12-12 13:07:02 +00:00
Dylan K. Taylor
73d4ff6b52 more missed function imports 2019-12-09 21:16:35 +00:00
Dylan K. Taylor
bb048fb361 Merge branch 'stable' into next-minor 2019-07-26 19:50:17 +01:00
Dylan K. Taylor
622f93df45 remove usages of deprecated {} string access, closes #3035 2019-07-22 16:39:33 +01:00
Dylan K. Taylor
4635b93f4d backport 23071d257 + deprecations: Extract process-related functions from Utils into a separate Process class 2019-06-16 14:40:51 +01:00
Dylan K. Taylor
680cdb8e3e backport f5dbbea5f: Utils: added recursiveUnlink() 2019-06-16 14:20:05 +01:00
Dylan K. Taylor
0058bfcd23 Utils: Limit length of printed stack trace strings to 80 characters 2019-06-06 14:56:19 +01:00
Dylan K. Taylor
9f31b479e1 Improve stack trace rendering, show array and string lengths 2019-06-06 14:53:50 +01:00
Dylan K. Taylor
c83b7d9b69 Utils: fixed getNiceClosureName() not processing namespaced closures properly 2019-01-26 12:08:07 +00:00
Dylan K. Taylor
2cdf97b7b5 CrashDump: Scan full stack trace to determine plugin involvement 2019-01-06 18:07:29 +00:00
Dylan K. Taylor
4b9a142a5d Import global functions and constants for enhanced performance
This is better for performance because these then don't need to be reevaluated every time they are called.

When encountering an unqualified function or constant reference, PHP will first try to locate a symbol in the current namespace by that name, and then fall back to the global namespace.
This short-circuits the check, which has substantial performance effects in some cases - in particular, ord(), chr() and strlen() show ~1500x faster calls when they are fully qualified.

However, this doesn't mean that PM is getting a massive amount faster. In real world terms, this translates to about 10-15% performance improvement.
But before anyone gets excited, you should know that the CodeOptimizer in the PreProcessor repo has been applying fully-qualified symbol optimizations to Jenkins builds for years, which is one of the reasons why Jenkins builds have better performance than home-built or source installations.
We're choosing to do this for the sake of future SafePHP integration and also to be able to get rid of the buggy CodeOptimizer, so that phar and source are more consistent.
2019-01-04 20:43:15 +00:00
Dylan K. Taylor
1455c38dbe Utils: fixed crash in getCoreCount(), closes #2600
this should just default to 2 instead of shitting its pants.
2018-12-22 13:27:11 +00:00
Dylan K. Taylor
34a899e28b Clean up Utils error handling functions (internal) 2018-12-16 17:50:00 +00:00
Dylan K. Taylor
b80868040e Utils: fixed getTrace() including itself in trace when no alt trace is given
it always seemed a little strange that crashdump trace would pop 4 frames when only 3 are written in the comment...
2018-12-16 17:15:16 +00:00
Dylan K. Taylor
762405d16a Add daverandom/callback-validator as a dependency 2018-12-04 17:14:37 +00:00
Dylan K. Taylor
788b278fc3 Utils: fixed handling of non-anonymous closure functions 2018-11-11 19:43:00 +00:00
Dylan T
755db3dac8
Added a ClosureTask implementation for easier task scheduling (#2497) 2018-11-04 22:55:40 +00:00
Dylan K. Taylor
7b24fbc8db Utils: fix a mistake in getNiceClassName() doc 2018-11-04 22:38:38 +00:00
Dylan K. Taylor
ab48d85c35 Properly deal with anonymous tasks in timings 2018-10-31 18:51:30 +00:00