Update dependency phpstan/phpstan to v1
This MR contains the following updates:
Package | Type | Update | Change |
---|---|---|---|
phpstan/phpstan | require-dev | major |
^0.12.33 -> ^1.0.0
|
Release Notes
phpstan/phpstan
v1.1.1
🐛
Bugfixes - Fixed
/** @​phpstan-ignore-line */
and/** @​phpstan-ignore-next-line */
annotations sometimes not working because of AST (https://github.com/phpstan/phpstan-src/commit/9474696dff040ba6d5a9adadc8c87551074cbf94), #4750, #4759, #3834, #3563, #4250, #4798 - Do not report non-existent function after
function_exists()
check (https://github.com/phpstan/phpstan-src/commit/28e8c11a2bdf11eede53a152825fd3bd7733d95d), #3576 - Make
function_exists()
similar tois_callable()
(https://github.com/phpstan/phpstan-src/commit/4a988637e67b6ff6854192c57adbbe3c32d62629), #1849
v1.1.0
🔧
Improvements - Update
nikic/php-parser
to 4.13.1 (https://github.com/phpstan/phpstan-src/commit/6a64c8aa95ebdd15832cf482d10e543cbe18ae35), #5458 - Update
jetbrains/phpstorm-stubs
(https://github.com/phpstan/phpstan-src/commit/546e87c61ff1b8591c7300d16484093870410a8c), #5833- Support for
PhpStormStubsElementAvailable
attribute injetbrains/phpstorm-stubs
(https://github.com/phpstan/phpstan-src/commit/e41e66a1ecab998ed6e49376e6a5d0894c8ccc98)
- Support for
- Support for some features from PHP 8.1
- Support for native
never
return type - RFC (https://github.com/phpstan/phpstan-src/commit/59be92fd7e736217185b075c99d2fca21a6393b1) - Support for native pure intersection types - RFC (https://github.com/phpstan/phpstan-src/commit/be0555743559a43c183089417a390299a11b7a3b, https://github.com/phpstan/phpstan-src/commit/021e25ed2b6da96401ef754455ac5589db8eeda1), #5870
- Support for tentative return types - RFC (https://github.com/phpstan/phpstan-src/commit/0e98150eff1d71de28c683a8de115c4efef83b8a, https://github.com/phpstan/phpstan-src/commit/762fc470a2b5308d4d0469457bac809e6ddc2196)
- ReflectionEnum runtime stubs (PHP 8.0+) (https://github.com/phpstan/phpstan-src/commit/e3a0e0d1b968c4338d2a50d76562c49e49521565)
- Full Enums support is coming in a later release
- Support for native
🐛
Bugfixes - Fix chaining nullsafe operator (#752), #5868, thanks @olsavmic!
🤖
Function signature fixes - Fix return type of
get_loaded_extensions()
(#754), thanks @dktapps! -
call_user_func_array()
support named arguments (#727), thanks @mglaman! -
phpversion()
does not return false when no arguments are given (#753), thanks @dktapps!
v1.0.2
🐛
Bugfixes - Analyze
Composer
namespace only with static reflection, some classes in PHAR are unprefixed (https://github.com/phpstan/phpstan-src/commit/95754d1c52c99a9cfebfb595d58413955bbe61d4), https://github.com/composer/composer/pull/10253 - ArrayType - use BenevolentUnionType even if it contains StrictMixedType (https://github.com/phpstan/phpstan-src/commit/c59330c539a5cabba7a1c06a7f468d0c3a7dcfa7), #5834, #5881, #5872, #5861
- This fixes "expects array, array given" errors
🤖
Function signature fixes - Unified the name of the second
array_map
parameter (https://github.com/phpstan/phpstan-src/commit/94333459e3fc2cfdd2800437e2bb336bb46d304f) - More precise
connection_aborted()
signature (#715), thanks @staabm! - More precise
str_split()
signature (#718), thanks @staabm! -
DateFunctionReturnTypeExtension
: support more precise single-char date-formats (#721), thanks @staabm! - Support
$preserve_keys
argument foriterator_to_array()
(#748), thanks @Lctrs!
v1.0.1
- Fixed "Expected node type PhpParser\Node\Stmt\Property, NULL occurred" (https://github.com/phpstan/phpstan-src/commit/e5f8e72c41692014f1352c411e81e605b694fabe), #5875
-
DerivativeContainerFactory
- pass all arguments to the derived container (https://github.com/phpstan/phpstan-src/commit/f28c7e9d06f65fff2ebcb954a581989078929a90) -
PhpStanNamespaceIn3rdPartyPackageRule
- fix segfault when there's no composer.json (https://github.com/phpstan/phpstan-src/commit/d4efedbd50af2317b18a2628cbadac40d66eed6d)
v1.0.0
PHPStan 1.0 is here and I'm really excited about it! Read the accompanying article on PHPStan's blog and also check out the merchandise we're selling for limited time (until November 22nd). It includes white and blue PHPStan t-shirts, PHPStan stickers, and also something very special: Rule level badges that you can pin to your clothes to show off that you care about code quality
🚀
Major new features - Level 9 with checkExplicitMixed (https://github.com/phpstan/phpstan-src/commit/e5bbb52fbc9139502f231999173ba6412e62587d)
- Consistent remembering and forgetting returned values (https://github.com/phpstan/phpstan-src/commit/d4edc59b36927a2d70f2e8665e657f99dd9d6be2)
- Precise try-catch-finally analysis (https://github.com/phpstan/phpstan-src/commit/4588e73dd618e1077bfe1cec7b8e62e251d5eb95)
- Validate overriding methods in stubs (https://github.com/phpstan/phpstan-src/commit/c98d0a4946c373543c379427983e02ccef71f86c)
- Nicer type descriptions usable in PHPDocs (https://github.com/phpstan/phpstan-src/commit/03341cc6bf010faf1e99f1dbddf5cea66d56e3cf, https://github.com/phpstan/phpstan-src/commit/51d7431dbe802827bac61907d7bcb58a168dff81)
New rules
- Level 0
- Check leading and trailing file whitespace and BOM (https://github.com/phpstan/phpstan-src/commit/6905d66cf4256eae48ae997b88fbbc58e0ad2ae8)
- Check overriding constants (https://github.com/phpstan/phpstan-src/commit/89acb0db4400c95b231ae74830e8607d72824cbc)
- Check classes extending
@final
classes (https://github.com/phpstan/phpstan-src/commit/dffd2c2351e5fc5d22b752bf3b8be84bf1708f71), https://github.com/phpstan/phpstan/discussions/5343 - Check that function-scoped template type is in a parameter (https://github.com/phpstan/phpstan-src/commit/18bdd34a808763764ea281d4f1b62fc0e7968873)
- Check overriding properties (https://github.com/phpstan/phpstan-src/commit/0f4885aa101e0cc49f906e72990e356bd281ec63), #4281
- Level 1
- Rule for checking null-coalescing
??
operator issues (#36), thanks @leongersen!
- Rule for checking null-coalescing
- Level 2
- Detect wrong usage of
@var
PHPDoc tag (https://github.com/phpstan/phpstan-src/commit/58860536dcc60bfc86c29ad67711ed1b19046cb0) - Rules for accessing private class elements through
static::
(https://github.com/phpstan/phpstan-src/commit/d8e89538ac84236cb3c40ea85b524e4f7cc30852, https://github.com/phpstan/phpstan-src/commit/bad2607a032787d822a1a8f91d5176455eac8693, https://github.com/phpstan/phpstan-src/commit/270326a1ed22398a98b15880e12a3b8015a83c4a) - Class constants - incompatible PHPDoc types (https://github.com/phpstan/phpstan-src/commit/780a54cd0149d8cb5a62bb1ef6fa2b0871114ee5)
- Cross-check generic interface implementations (https://github.com/phpstan/phpstan-src/commit/284af50d76210a449f210699732171ecacf3307f), #5222
- Detect wrong usage of
- Level 3
- Check that function with
@throws void
does not have an explicit throw point (https://github.com/phpstan/phpstan-src/commit/8b3382aceac801b9801fccda253033d8e8e5f655) - Check array deconstruction (https://github.com/phpstan/phpstan-src/commit/aae34d935081a8f8d34f5bd9bdf50ebdfdb85a7e), #3267
- Check that function with
- Level 4
- Detect unused and write-only/read-only private properties, methods, and constants
- Rule for checking additional issues like always-defined/never-defined properties, array offsets etc. in
isset()
(https://github.com/phpstan/phpstan-src/commit/25b61d974f5ca1cb00d7d2be4dce750553787b87) -
empty()
rule (https://github.com/phpstan/phpstan-src/commit/601460ccecfd72888d96e9c53d21cc3a8b66c719), #970 - While loop - detect always true and always false conditions (https://github.com/phpstan/phpstan-src/commit/217fac309862f82485f8b756f09665192235aa13, https://github.com/phpstan/phpstan-src/commit/fb3f83e8f601b31a6eb5a12d58211dfced629821)
- Do-while loop - detect always true and always false conditions (https://github.com/phpstan/phpstan-src/commit/e81ccd40a4872bde4f6578919b93b4d821021557)
- Report dead catch with exception that is not thrown in the try block (https://github.com/phpstan/phpstan-src/commit/ce9299c0e9ab55fc63d7a2e0814c99cc221cb514)
- Rule for detecting overwriting exit points in finally (https://github.com/phpstan/phpstan-src/commit/3f712be7c4a840fcae3bb8d3ebfa888ead4e964e)
- Level 5
- Check callable parameter types for
array_map()
andarray_filter()
calls (#555), #5609, #5356, #1954, thanks @BackEndTea! -
implode()
function rule (#679), thanks @staabm! - Check
DateTime
instantiation (#380), thanks @b1rdex! -
random_int()
dynamic return type extension and parameters rule (#99), thanks @cs278!
- Check callable parameter types for
- Level 6
- Detect unresolvable return type after generic function call (https://github.com/phpstan/phpstan-src/commit/9070c5bce39105a186d03e3e5b6871c2b5d28550), #2581
- Inspect types for missing typehints recursively (https://github.com/phpstan/phpstan-src/commit/2f456b91bbbc8c376ad4e5866fc7a7b457710eab), #5148
BC breaks for end-users
- Level
max
is now level 9. Feel free to updatemax
to8
if your code isn't ready. - Description of some types was updated to match the syntax in PHPDocs. This includes
numeric-string
(it was previously described asstring&numeric
), and also array shapes. - Removed
baselineNeon
error formatter, use--generate-baseline
CLI option instead (https://github.com/phpstan/phpstan-src/commit/492cfbcd74b540eda1520e11b67d7be00cbc7c31) - Removed
polluteCatchScopeWithTryAssignments
config parameter (https://github.com/phpstan/phpstan-src/commit/8933c7e28c2ebb1fd69584c031f579cd53ddf4ae) - Removed deprecated
autoload_files
parameter - use Discovering Symbols instead (https://github.com/phpstan/phpstan-src/commit/7a21246cae9dd7968bf7bef92223b53f5d681b72) - Removed deprecated
autoload_directories
parameter - use Discovering Symbols instead (https://github.com/phpstan/phpstan-src/commit/f67b48a71220b295a1704fe9749492e5de9ee18f) - Removed
bootstrap
parameter - usebootstrapFiles
instead (https://github.com/phpstan/phpstan-src/commit/1baa29425d2e170af8ac53e4e579c34c25b640e4) - Moved
implicitThrows
configuration parameter toexceptions.implicitThrows
(https://github.com/phpstan/phpstan-src/commit/96b7c48025dcbd5a709cea71ee4e9e73770e0d54) - Removed
--paths-file
CLI option (https://github.com/phpstan/phpstan-src/commit/5670cf221723eb652643623ad487351cb187f6c3), #5756 - Removed
dump-deps
command (https://github.com/phpstan/phpstan-src/commit/9c7017c697c29668f8a7c766236e597737f99f91) - Deprecated
excludes_analyse
option, useexcludePaths
instead (https://github.com/phpstan/phpstan-src/commit/d25c5e5a6c62a4537d4a108707ff26b5bea687d9)
The following are interesting only if you create a custom ruleset in your configuration file:
- Removed
DeadCatchRule
, replaced byCatchWithUnthrownExceptionRule
(https://github.com/phpstan/phpstan-src/commit/4dba60bacbf3ac0efe8627fa32177ee21cdd3eca) - Removed
VariableCertaintyInIssetRule
, replaced byIssetRule
(https://github.com/phpstan/phpstan-src/commit/2e858dee389d4843e4d1a7dc1bc565c264be247f) - Removed
MissingClosureNativeReturnTypehintRule
, no longer needed thanks to type inference (https://github.com/phpstan/phpstan-src/commit/1c34d8dc855cb5f4cf5c8b033b7155eeed0e277b) - Rename rules with typos (https://github.com/phpstan/phpstan-src/commit/003ab1aea558085cd27636a0b95a4c9f0e062e9a)
BC breaks for extension developers
- Extensions are checked with rules for correct usage of PHPStan internals according to backward compatibility promise.
- Thanks to upgrading
nikic/php-parser
to version 4.13.0, you should now use->getArgs()
instead of->args
wherever possible. * Helpful message about this change is also included in PHPStan itself: https://github.com/phpstan/phpstan-src/commit/c836a423d34faa818127e34efb89ef4b3a7b66b6 -
PHPStan\Parser\Parser
service is no longer autowired. You need to choose the right instance for your needs and register it in thearguments
section of your service that needs the parser in the configuration. The Parser services you can choose from are:-
@defaultAnalysisParser
- the best choice if you're parsing files that are among the analysed files -
@currentPhpVersionSimpleDirectParser
- the closest choice to default behaviour from previous PHPStan versions - Read more about this here.
- Helpful message about this change is also included in PHPStan itself: https://github.com/phpstan/phpstan-src/commit/038c7a518f57b1a04536b038d24f110f9d06aa01
-
- Removed
CompoundTypeHelper
(https://github.com/phpstan/phpstan-src/commit/145c4e3af4045b074b1d6e697022a835433cd5f2) - Removed
CommentHelper
(https://github.com/phpstan/phpstan-src/commit/ebad6f61b9a65b68c200f7ac3a444ce198149396) - Removed
DependencyDumper
(https://github.com/phpstan/phpstan-src/commit/9c7017c697c29668f8a7c766236e597737f99f91) - Removed
PHPStan\Reflection\Generic\ResolvedFunctionVariant
, replaced byPHPStan\Reflection\ResolvedFunctionVariant
(https://github.com/phpstan/phpstan-src/commit/1cc6c8175a6d92cf717cd553506c9da8a2dd72cc) - Removed
ClassReflection::getNativeMethods()
, usegetNativeReflection()
instead (https://github.com/phpstan/phpstan-src/commit/d2c1446b3b0f581502019c522ccb521b37e7dc15) - Removed
PhpPropertyReflection::hasPhpDoc()
, replaced byhasPhpDocType()
(https://github.com/phpstan/phpstan-src/commit/bedd5be99107254f42efb7728c9ce3a7b958e33e) -
NodeDependencies
no longer iterable (https://github.com/phpstan/phpstan-src/commit/f76875a84d8dcca8f9d67c08b6492c609e9aff98) - Renamed
TestCase
toPHPStanTestCase
(#634), thanks @frankdejonge! -
StaticType
andThisType
- requireClassReflection
in constructor (https://github.com/phpstan/phpstan-src/commit/7aabc848351689f18a1db99598df8d5b4944aa87) -
PHPStanTestCase
- extensions can no longer be provided by overriding methods fromPHPStanTestCase
. UsegetAdditionalConfigFiles()
instead. (https://github.com/phpstan/phpstan-src/commit/65efd93f764e9db076851ef262179fe670f1ab38, https://github.com/phpstan/phpstan-src/commit/239291a91089da6684d8c52e58b9a77ceb178071) - Removed some unused internal helper methods from Broker (https://github.com/phpstan/phpstan-src/commit/d57815103091d8f25347b8441da3ed099f70d7af)
- Changed return types of various methods that had
|false
to|null
(https://github.com/phpstan/phpstan-src/commit/629ccf6b02146e1cbf0499982358c595e3d6edd5) - Type generalization precision is now a required argument (https://github.com/phpstan/phpstan-src/commit/65681033ff625c67a478212a0cd6da29cd5ab5fa)
- Some constructor parameters are now required (https://github.com/phpstan/phpstan-src/commit/1f4062fe2d0d5406e9b8a782f99b6da61eceafde)
- Deprecated
BrokerAwareExtension
(https://github.com/phpstan/phpstan-src/commit/db2f7fb9e7928de68665ca09a3e1002d8a329b33) - Deprecated
PHPStanTestCase::createBroker()
. UsecreateReflectionProvider()
instead. (https://github.com/phpstan/phpstan-src/commit/1e5cf58e07446e634803c3be87e7c41fdd903c7c) - Deprecated
PHPStan\Broker\Broker
. UsePHPStan\Reflection\ReflectionProvider
instead. (https://github.com/phpstan/phpstan-src/commit/c7755948c124cfbcb1220ab912a6eaa863cdf5fb) - Deprecated
PHPStan\Broker\Broker::getInstance()
. UsePHPStan\Reflection\ReflectionProviderStaticAccessor
instead. (https://github.com/phpstan/phpstan-src/commit/4e7d60d74b3fda7dc4d3e0c0798b7fd55a7b32f2) - Cannot create
IntersectionType
with less than two types (https://github.com/phpstan/phpstan-src/commit/f7d232a666151bd3cd6417e103b358b8b13afa69) - Removed
ReflectionWithFilename
, useClassReflection|FunctionReflection
instead (https://github.com/phpstan/phpstan-src/commit/3738fcd98a98f5a8ef61b40a4c0c5384b7704714)
🔧
Improvements - Performance optimizations
- use is_file() over file_exists(), which is faster (#724), thanks @staabm!
- faster IgnoredError->shouldIgnore() (#736), thanks @staabm!
- faster
FileHelper::normalizePath()
(#735), thanks @staabm! - faster
TypeCombinator::compareTypesInUnion()
(#742), thanks @voku! - faster
TypeCombinator::union()
(#743), thanks @voku! - faster
TypeCombinator::union()
v2 (#747), thanks @voku! - faster
TypeCombinator::intersect()
(#747), thanks @voku! - faster
TypeCombinator::remove()
(#746), thanks @voku! - TypeCombinator - call count() less often (https://github.com/phpstan/phpstan-src/commit/f3c054b19975d570991b2ea99c1ca1c42d42161c)
- TypeCombinator - eliminate same types before normalization (https://github.com/phpstan/phpstan-src/commit/ac6a1022ff90851171f29cbceb45b1d639099255)
- This caused bad memory leak (https://github.com/phpstan/phpstan-src/commit/25cb765aca4c9a3ab05fee99ff3295b61ccaf7c0)
- Improve memory consumption (https://github.com/phpstan/phpstan-src/commit/d781e34a35e1dd6d6918b3160edae8d93b9fae6b)
- FileExcluder: Improve performance of isExcludedFromAnalysing (#728), thanks @dktapps!
- Changing analysedPaths does not regenerate the DI container (https://github.com/phpstan/phpstan-src/commit/27df5cf55ee17cd3368c9cbecb681105def7f581), #5825
- Do not clear old containers in worker processes (#733), #5825, thanks @dktapps!
- Always populate
analysedPathsFromConfig
(https://github.com/phpstan/phpstan-src/commit/9f5f911337e810e5674421abc1745b2f9b6ae0b5), #5850
- Teach
IssetRule
everything whatVariableCertaintyInIssetRule
does (https://github.com/phpstan/phpstan-src/commit/9689fbd0ed9f8438afc8679c90df61ee48a638fe), #970 -
MissingReturnRule
- make the error non-ignorable for native typehints (https://github.com/phpstan/phpstan-src/commit/9ecefd56d8b1d5cf0100c50d6e620285d5312291) -
get_class()
returnsfalse
for mixed argument types (https://github.com/phpstan/phpstan-src/commit/e86742db58f9cb3459b777570cc33d64af0ed8fa), #4741 - Require specifying template types for
RecursiveIterator
,RecursiveArrayIterator
,WeakMap
(https://github.com/phpstan/phpstan-src/commit/0b9288832073210d52a3915d9fdc1d7991a1b86b) - Rewrite OptimizedDirectorySourceLocator to use PhpFileCleaner from Composer (https://github.com/phpstan/phpstan-src/commit/b7bd0a98dbe3f8536f92b66ff17a42c98968783c)
- Detect stub file added multiple times (https://github.com/phpstan/phpstan-src/commit/4a82eec4044e900be192096d58f04b4e2be80a0a)
- Type inference of
new $string
leads toobject
, notmixed
(https://github.com/phpstan/phpstan-src/commit/78a9f057d7a1c73cc34af70db406b9392ce0ca3a) - Basic support for
interface-string
andtrait-string
(https://github.com/phpstan/phpstan-src/commit/d0ef5d4af755e52eba3fd678bdd28f211f3b7d80) - Change message 'typehint' to 'type' and 'typehint type' to 'type'. (#270), thanks @Danack!
- IgnoredErrorHelper does not produce warnings, only errors (https://github.com/phpstan/phpstan-src/commit/915fa2e2bb567d22e9d5968008a46e762605c780)
- Support general array and array shape as template type bound (#673), thanks @drupol!
- TypeSpecifierContext - Do not create multiple equivalent objects (#677), thanks @jlherren!
- Distinguish circular type aliases from invalid type definitions (#678), thanks @jiripudil!
- more precise
SpecifiedTypes
phpdocs (#682), thanks @staabm - Resolve
PHP_INT_MAX
as positive integer (#684), thanks @herndlm! -
config.platform.php
in project'scomposer.json
is respected and overrides the current runtime PHP version (https://github.com/phpstan/phpstan-src/commit/d2351952200507028d6785de882aaccf0b649336) - Check LogicalOr and LogicalAnd constant conditions (https://github.com/phpstan/phpstan-src/commit/40a76e88d0866f7d541e0e43364de07c5a94c465, https://github.com/phpstan/phpstan-src/commit/ae9a558484dc4f330873e962b8dc1b2d18f0c9b7)
- Tip about template bound type when combined with a native type (https://github.com/phpstan/phpstan-src/commit/5314a6b20503e8e1ccaa74e8dfb1e3c30c5667ed)
- define: case_insensitive is ignored, case-insensitive constants are no longer supported (#589), thanks @mglaman!
- NativeFunctionReflection deprecated support (#713), thanks @mglaman!
- ReturnTypeWillChange attribute class is always defined (https://github.com/phpstan/phpstan-src/commit/c72145976431cf95b90dbb7397b53575597e3b06)
- Intersect array key type with
int|string
(https://github.com/phpstan/phpstan-src/commit/724c8bad2e458852f177df26cb863ad62aa0c41d), #3753 - Inspect prefixed PHPDocs for invalid types recursively (https://github.com/phpstan/phpstan-src/commit/003d235cc59ed2a3b79d2960043d0d2b2d3b72e7), #3723
- Inspect unresolvable types in PHPDoc recursively (https://github.com/phpstan/phpstan-src/commit/1de5de80ecb02255251ee0324801c56ac30a1943), #3753
- NameResolver -
preserveOriginalNames
set to true (https://github.com/phpstan/phpstan-src/commit/2a9d1beb7aa15e747d4f5ec486bc762df8ca06e1) - Fixed PHP 8.1 deprecations (https://github.com/phpstan/phpstan-src/commit/4e5ed5d8b9cd5090e8ed5559a9da2454bf081509, https://github.com/phpstan/phpstan-src/commit/fd99879e0bcd53b0586030fba6afe3dcb9ad74d9, https://github.com/phpstan/phpstan-src/commit/9d0e070ed9cacf9093397f16280dab99caf3a37c, https://github.com/phpstan/phpstan-src/commit/458a8fb66300e203ae2e46ceb92fcf66972e83c8, https://github.com/phpstan/phpstan-src/commit/50a7141a6eaa8df169933116164ad12d63f8ebb4)
- Analyser: do not report
E_DEMRECATED
(https://github.com/phpstan/phpstan-src/commit/1a4338552e45e4e0026a07682ba13cd516fc6db1) - All FunctionReflection implementations have getFileName() (https://github.com/phpstan/phpstan-src/commit/5ddca4279e348a3e9e8ce1b1dbac70459b7ab20c)
🐛
Bugfixes - MethodCall with Expr name adds an implicit throw point (https://github.com/phpstan/phpstan-src/commit/84b09349dc04fa30097900b5deb8e316b1657e4b)
- Fixed InterRangeType multiplication/division of maximas by a negative constant (#670), thanks @staabm!
-
Throwable::toString()
can throw an exception (https://github.com/phpstan/phpstan-src/commit/18adc8c99f725ce95f097cba0ece1369626f26d1) - Fixed
new $object
with a template type (https://github.com/phpstan/phpstan-src/commit/956a7f483552dff1e3fb8195651bd983304ac17e) - Respect treatPhpDocAsCertain in IssetCheck (#674), thanks @VincentLanglet!
- Function that returns
never
is always an explicit throw point (https://github.com/phpstan/phpstan-src/commit/c362fc59b25e10d3079b5004cd738ae5fd4fed4e), #5627 - ObjectType - make class line part of the cache key (https://github.com/phpstan/phpstan-src/commit/be27584056cbfe25b6a0e875d3e42e1fcd7efb31), #5639
- eval function can throw exception (#676), thanks @canvural!
- Updated BetterReflection with trait fixes (https://github.com/phpstan/phpstan-src/commit/1e717d73c22061a2b275fb73fd27c704588b2be1)
- Process do-while loop condition even if the loop always terminates (https://github.com/phpstan/phpstan-src/commit/0837be403f590f857a9ba117fbe236e4ce7dcc99)
- Process attribute arguments recursively (https://github.com/phpstan/phpstan-src/commit/0cfeb1b93021e293481e3071196b1d360dc04962), #5651
- Set the correct method visibility when entering the method in regard to trait adaptation (https://github.com/phpstan/phpstan-src/commit/c524c4e134c547a6ac4d6db9989a37c5ee303489), #4516
- Fix unreachable code after do-while loop (https://github.com/phpstan/phpstan-src/commit/d484ea890dd09bbd1e2e214f2b5a0ee34f5eab75), #4370
- sprintf format string needs to be sanitized first (https://github.com/phpstan/phpstan-src/commit/a2bdfd148559dc5314dbd38ef6bb6f70aad0c351), #5669
- Property assignment invalidates all remembered method values on an object (https://github.com/phpstan/phpstan-src/commit/5f91da66bd865487bc411903640e21acb55f86b1), #5501
- Fix array_splice bugs (https://github.com/phpstan/phpstan-src/commit/6754df565a75125a800b04892e467d8c0868ab41), #4743, #5017
- TypeCombinator - fix segfault (https://github.com/phpstan/phpstan-src/commit/ac5fe1bc92b0a91e7b164c1f43eabf134dcb15b8), #5692
- Fixed integer range minus bugs (#690), thanks @staabm!
- Make array_map() accept null as first argument (https://github.com/phpstan/phpstan-src/commit/84bafe79d6b59f18dcbc0b3c8b9978d7af9bd837)
- RuleLevelHelper::findTypeToCheck - make null-safe shortcircuiting optional (#687), thanks @olsavmic!
- IntegerRangeMath: cover more maxima cases (#702), thanks @staabm!
- Update react/child-process (https://github.com/phpstan/phpstan-src/commit/ca3aad0790d9a470f74992e1c0196d593f5bebeb), #5709
- Variadic parameters in PHP8 can have int|string key (#725), thanks @canvural!
- Fix CompileCommand renaming PhpStormStubsMap on Windows (#732), thanks @dktapps!
-
+
-operator withnon-empty-array
should lead tonon-empty-array
(#739), thanks @staabm!
🤖
Function signature fixes - Rename
$cmp_function
parameters to$callback
(https://github.com/phpstan/phpstan-src/commit/27a5d0f10b1b9b65c3165ddae500e40b769d1301) - Fix ext-ds.stub (#675), thanks @enumag!
- ext-ds: `Sequence::copy()! (https://github.com/phpstan/phpstan-src/commit/2b51392ad6e86b7ac858bc3e0094ef36488977f7), #5638
- mb_ereg_replace and mb_ereg_replace_callback can return null (#681), thanks @hbrecht!
- Update functionMap for SoapClient methods (#683) (#683), thanks @hbrecht!
- more precise func_* types (#697), thanks @staabm!
- use more precise types in file IO functions (#695), thanks @staabm!
- Added xdebug 3.1 functions "xdebug_notify" & "xdebug_connect_to_client" (#699), thanks @marc-mabe!
- Fix signature of ReflectionClass::setStaticPropertyValue() (#691), thanks @jlherren!
- mysqli_stmt_param_count() returns a non-negative int (#692), thanks @morozov!
- preg_match_all can return null (https://github.com/phpstan/phpstan-src/commit/0d025e7bc2ec6e84a441b2da7813ff933b5a00aa)
- Add stub for mysqli_stmt properties (#700), thanks @morozov!
- Remove specific configuration for array_fill() with PHP 8 (#701), thanks @steevanb!
- SimpleXMLElement probably iterates over
static
(https://github.com/phpstan/phpstan-src/commit/4653d1574ec85393d2f083ddd134c3d48ec960e1), #5700 -
exit()
status should be in the range 0 to 254 (#707), thanks @staabm! - functionMap: fix callable signature for sapi_windows_set_ctrl_handler() (#708), thanks @dktapps!
- More precise dirname signature (#712), thanks @staabm!
- More precise chunk_split signature (#711), thanks @staabm!
- More precise array_ unshift signature (#710), thanks @staabm!
- Document possible return type for PDO::lastInsertId() (#719), thanks @greg0ire!
- More precise json_* signature (#720), #5809, thanks @staabm!
- Implement ArrayAccess in ext-ds (#723), thanks @simPod!
- mysqli::fetch_fields does not return false (#731), thanks @kamil-tekiela!
- functionMap: fixed incorrect signatures for igbinary_serialize() and igbinary_unserialize() In particular, igbinary_serialize() may return null on error. (#737), thanks @staabm!
v0.12.99
🔧
Improvements -
CompoundTypeHelper
is deprecated (https://github.com/phpstan/phpstan-src/commit/fff85f3c08a38110bca6a13d341778bbd79a2108) - Update
phpstorm-stubs
(https://github.com/phpstan/phpstan-src/commit/6fa12857c88dccfcf58492fc20aaa1f8aaa60535) - Add support for multiple wildcards in const type annotations (#658), #5534,thanks @Seldaek!
🔪
Bleeding edge -
empty()
rule (https://github.com/phpstan/phpstan-src/commit/601460ccecfd72888d96e9c53d21cc3a8b66c719) -
MissingReturnRule
- make the error non-ignorable for native typehints (https://github.com/phpstan/phpstan-src/commit/9ecefd56d8b1d5cf0100c50d6e620285d5312291) - Check callable parameter types for
array_map()
andarray_filter()
calls, #5609, #5356, #1954 - Teach
IssetRule
everything whatVariableCertaintyInIssetRule
does (https://github.com/phpstan/phpstan-src/commit/9689fbd0ed9f8438afc8679c90df61ee48a638fe), #970 - Teach
CatchWithUnthrownExceptionRule
everything whatDeadCatchRule
does (https://github.com/phpstan/phpstan-src/commit/165504cf9c4ae6e2dcfc2c3570a631441a411615) - Check that function with
@throws void
does not have an explicit throw point (https://github.com/phpstan/phpstan-src/commit/8b3382aceac801b9801fccda253033d8e8e5f655)
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
🐛
Bugfixes - Fix false-positive when merging unions with plus operator (#657), #5584, thanks @staabm!
-
checkExplicitMixed
- replace mixed type recursively (https://github.com/phpstan/phpstan-src/commit/b4f81dbd777f071d78ccfc453c12e82b6f950f11), #5218 - Fixed
checkExplicitMixed
withTemplateMixedType
(https://github.com/phpstan/phpstan-src/commit/6ba9ef29cb5ccd5b540815e899c95e6a1602ccad), #3566 -
BaselineNeonErrorFormatter
: Sort errors by normalized relative path (#536), #5085, thanks @dktapps! - Enter assignment of property fetch's var when in null coalesce operator (https://github.com/phpstan/phpstan-src/commit/7ddfa174a60a15e584c7e6f4fec82237ccd70da8), #3283
- Pass-by-ref argument type passed to callable should be mixed after calling the callable (https://github.com/phpstan/phpstan-src/commit/109bf999b8791f512f2fe82b026ccd67d1f152a2), #5615, #5428, #2191
-
StubSourceLocatorFactory
- always use PHP 8 parser for PhpStorm stubs (https://github.com/phpstan/phpstan-src/commit/731ce1dd8d65537a61dddac417d5f5169f4bfce6) - support unary-minus on
IntegerRangeType
(#669), thanks @staabm! -
array_map
- understand call with multiple arrays (https://github.com/phpstan/phpstan-src/commit/3e0ecec8fc2482e412f67f6a62bdb6542be0fe5d), #5039 -
range()
ofnumeric-string
s can produce array of float|int (https://github.com/phpstan/phpstan-src/commit/3b6f0bf739c77e1fb8fb5116ae89cd70a2ac96c2)
🤖
Function signature fixes - Fix parameter definition for
Grpc\ChannelCredentials::createSsl
(#665), thanks @howyi! - Make
SimpleXMLElement
stub more specific (#666), thanks @devbanana!
v0.12.98
Allow dynamic list of stub files thanks to StubFilesExtension (https://github.com/phpstan/phpstan-src/commit/2ba9332d29c1acdde0f85a2781308d2e8972f00e), https://github.com/phpstan/phpstan-symfony/issues/195
v0.12.97
🔧
Improvements - Support for
literal-string
PHPDoc type inspired byis_literal()
RFC (https://wiki.php.net/rfc/is_literal), #5507 - Support
bool
as template type bound (https://github.com/phpstan/phpstan-src/commit/9d191f9abb00b3c293a26934ba1b92bb413569b4) - Support
float
as template type bound (https://github.com/phpstan/phpstan-src/commit/4e7d6c155c52e11f81bcabf75f84e14a2e0e1727), #5331 - Make
ReflectionAttribute
generic (#640, #643), thanks @vhenzl! - Implemented math on IntegerRangeType and ConstantIntegerType (#637), #4843, thanks @staabm!
- Support
non-empty-array
type in[] != $arr
conditions (#649), thanks @staabm! - Optimization - do not sort huge unions (https://github.com/phpstan/phpstan-src/commit/5a44c297adb6ded659c3206e9e9525f60a37d55b), #5500
- Optimize calculating scalar values from huge unions (https://github.com/phpstan/phpstan-src/commit/a6ca5f7a7ef60f20ca9c2f5ec5410d28224e2db8), #5527
- Update PHP 8 stubs (https://github.com/phpstan/phpstan-src/commit/a82605fbb80c5b09614ad6b82d872f2833eecce8)
🐛
Bugfixes - Reflection: fixed context of invoking a trait method (https://github.com/phpstan/phpstan-src/commit/89ceb6a9790d534b1d101b76317e487f0ee5d0c8), #5497
- Union normalization - do not take template types apart (https://github.com/phpstan/phpstan-src/commit/3b17c0e1d5a712f75f85ab604cb84741bdf38c72)
-
self::CONSTANT
can be precise even with PHPDoc type (https://github.com/phpstan/phpstan-src/commit/5010ef459465fa27a3b0fe3593bdd445b6dae8f3), #5517 - Fix CallableType's string type assumptions (https://github.com/phpstan/phpstan-src/commit/9a9f19380499a4836aa89d46a29477aed17b5da5)
- OptimizedDirectorySourceLocator - fixed crash when parsing
Text.php
ofnl_BE
from Faker (https://github.com/phpstan/phpstan-src/commit/a09a98d251002a061c96e7a49132693d46a0dee9), #5525 - Fix
?parent
in return type (https://github.com/phpstan/phpstan-src/commit/30c9b01fd12bf2a1f655b369629c3a38acff978e), #5529 - Fixed missing return rule for native mixed type (https://github.com/phpstan/phpstan-src/commit/03d8312e3ea62bb2c6a3ed89a88a6d86101a5594)
- Make mixin method static if there's
__callStatic()
in the class (https://github.com/phpstan/phpstan-src/commit/114a38f87a7ce2e7a53d55454a61cdfd832ea69f), #5536 - added
sizeof()
as alias ofcount()
for Smaller/SmallerOrEqual (#647, #648), #4843, thanks @staabm! - Refactor PreInc and PreDec (https://github.com/phpstan/phpstan-src/commit/a6a23dcaf6254c182e39117cbeb9f8087c1ee22c), #1870
- Fix inferring
TemplateUnionType
((https://github.com/phpstan/phpstan-src/commit/1b5710a3aa87a3d475d565c8ded12de170ee6cb6), #5562
🤖
Function signature fixes - substr_count returns non-negative integer (https://github.com/phpstan/phpstan-src/commit/8db058a52c763408f30cd914d743d930ff3e7e8e), #5513
- mb_str_split() / str_split() always returns
non-empty-array
(#633), thanks @staabm! - Third parameter of
sodium_base642bin()
is optional. (#644), thanks @tehbeard! - Make
filter_var()
returnnon-empty-string
if input is non-empty (#642), thanks @devbanana! - use positive-int in
iterator_count()
/iterator_apply()
(#646), thanks @staabm! - use positive-int in
array_count_values()
(#645), thanks @staabm! -
filter_var()
should return non empty string only when it will not be sanitized (#650), thanks @devbanana! - Sync
parse_url
signature with PHP 8 (https://github.com/phpstan/phpstan-src/commit/f7c6464067e04d5fc3f11b6f624a29fee067b1be)
v0.12.96
- OverridingPropertyRule - relax checking PHPDoc types (https://github.com/phpstan/phpstan-src/commit/24f6264bac7af157bb4efdd34a8536f6445c6ac3), #5494
- Add
PHP_WINDOWS_*
constants todynamicConstantNames
(https://github.com/phpstan/phpstan-src/commit/9762d371ebb2663ada1e6947d2edc685330011ee)
v0.12.95
🔧
Improvements - Support
@var
above class constants (https://github.com/phpstan/phpstan-src/commit/b932769213234a3ee78c39c7505ded5fade3568c), #4361, #3530 - Removed lossy type optimization:
TypeCombinator::CONSTANT_SCALAR_UNION_THRESHOLD
(https://github.com/phpstan/phpstan-src/commit/c56d866e63d6cd9eb80eecc9c7f1c989b2110cd3), #5447, #5454, #4925, #4793, #5062, #3366, #3555-
TypeCombinator::union()
- new optimization for constant scalar types (https://github.com/phpstan/phpstan-src/commit/da9e0613b8c21f0263680715da6986c921a75840)
-
- Final constant rule (PHP 8.1) (https://github.com/phpstan/phpstan-src/commit/6be077e92dfa11d2bddddd4a86669139bf3c716e)
- Readonly property rule (PHP 8.1) (https://github.com/phpstan/phpstan-src/commit/502596f1a1ee3ec319bab13462bb74294ff4f770)
- Deprecated wrongly-named
PhpPropertyReflection::hasPhpDoc()
(https://github.com/phpstan/phpstan-src/commit/d78d60a286fc094593586f596c05f5ff997fe2d7) - Use IntegerRangeType in modulo-operator (#614), thanks @staabm!
🔪
Bleeding edge - IncompatibleClassConstantPhpDocTypeRule (https://github.com/phpstan/phpstan-src/commit/780a54cd0149d8cb5a62bb1ef6fa2b0871114ee5)
- OverridingConstantRule (https://github.com/phpstan/phpstan-src/commit/89acb0db4400c95b231ae74830e8607d72824cbc)
- OverridingPropertyRule (https://github.com/phpstan/phpstan-src/commit/0f4885aa101e0cc49f906e72990e356bd281ec63), #4281
- Private method called through
static::
(https://github.com/phpstan/phpstan-src/commit/bad2607a032787d822a1a8f91d5176455eac8693) - Private property accessed through
static::
(https://github.com/phpstan/phpstan-src/commit/d8e89538ac84236cb3c40ea85b524e4f7cc30852) - Private constant accessed through
static::
(https://github.com/phpstan/phpstan-src/commit/270326a1ed22398a98b15880e12a3b8015a83c4a)
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
🐛
Bugfixes - Scalar type in PHPDoc can mean an existing class (https://github.com/phpstan/phpstan-src/commit/cdf9cb50129502217aca5a3d9ee3ed0c3795a148), https://github.com/phpstan/phpstan/discussions/5392
-
DateTime|DateTimeInterface
union acceptsDateTimeInterface
(#586), thanks @VincentLanglet! - Make default
parallel.processTimeout
10x bigger (https://github.com/phpstan/phpstan-src/commit/abb4378d635d1b8caaa2b5bd50e0304eec396f5f), #5341 - ParallelAnalyser - do not allow to go below the default timeout (https://github.com/phpstan/phpstan-src/commit/2f1615bdfdd439bda946b52df46804dc56c2c289)
-
ZEND_
dynamic constants (#613), thanks @dktapps! -
PDOStatement
implementsIteratorAggregate
on PHP 8 (https://github.com/phpstan/phpstan-src/commit/dec054d330550d4706870b3cdbbd5c51e2880876), #5436 - Assure GitLab error formatter have integer line properties (#616), thanks @simonhammes!
- Fix inferring template type from
non-empty-string
(https://github.com/phpstan/phpstan-src/commit/6a33de94e447fdfdb8a67ac374e971dc2673fc5a), #5372 - AppendedArrayKeyTypeRule - more precise type description (https://github.com/phpstan/phpstan-src/commit/aa9e2e8f4969ea89976e5781f0381b8201944b55)
- Fix casting
non-empty-string
array key type (https://github.com/phpstan/phpstan-src/commit/7172e5fc42154dbc73e78068bf12dbe3e27f9af5), #5372 - Fix
TemplateTypeMap::isEmpty()
(https://github.com/phpstan/phpstan-src/commit/f7250dbe9b23415f02961edc5f34e3f084e2b659) - Fix fetching class constants on object instances (https://github.com/phpstan/phpstan-src/commit/4cb02d15c326be71c8d1eeb0227a4931398928bb), #2959
- Do not produce reflection error for unknown constants in class constants (https://github.com/phpstan/phpstan-src/commit/29fcf80e1676f1a13ee04e88db6dbeb8685b58e1)
🤖
Function signature fixes - change return type for
chr()
(#599), thanks @AIlkiv! - Remove wrong return type of
imagejpeg
GD function (#619), thanks @mauriciofauth! - fix return type for gzeof() (#620), thanks @forrest79!
- Fix
openssl_seal()
$iv
parameter (#624), thanks @jlherren! - fix
pg_field_name
prototype (#626), thanks @thierry-f-78! - Fix
Phar
/PharData::extractTo
type information (#628), thanks @Seldaek! - More precise
abs()
return-type (#629), thanks @staabm! -
str_split()
length parameter is always positive (#631), thanks @staabm! - return
non-empty-array
frommb_str_split
/str_split
(#632), thanks @staabm! - Cover
non-empty-string
in more string fuctions (#606), #5350, thanks @staabm! - Added
rand()
dynamic return type extension (#606), thanks @staabm! - Added stub for
WeakMap
(#623), thanks @dktapps! - Add
#[ReturnTypeWillChange]
stub (#618), thanks @zonuexe! - Cover
non-empty-array
inarray_map()
(#601), thanks @Lctrs! - Add dynamic return type extension for
mb_substitute_character
(#607), thanks @TRowbotham! -
strlen
: cover more scalar types (#630), thanks @staabm! - support integer-range type in
min()
/max()
for two arguments (#627), #5072, thanks @staabm! -
array_fill()
: handle negative cases, support integer ranges andnon-empty-array
(#603), thanks @staabm!
v0.12.94
🔧
Improvements - Added integer range PHPDoc support (#596), thanks @clxmstaab!
- Cover
non-empty-array
inarray_flip
(#583), thanks @staabm! - Update
nikic/php-parser
to 4.12.0 (https://github.com/phpstan/phpstan-src/commit/dca48f34bcec87971ceaa4643eef02ed9b2fd812) - Custom PHAR namespace prefix with Git commit (https://github.com/phpstan/phpstan-src/commit/1501229bb601298c9bc0914433cfa98e9dd050e6)
- Simplify FileCacheStorage (#593), thanks @staabm!
- Result cache - notice change in class constant PHPDoc (https://github.com/phpstan/phpstan-src/commit/d88b568cae5759e56cdc1c21433f002db07aefaf)
- Result cache - notice change in
readonly
property (PHP 8.1) (https://github.com/phpstan/phpstan-src/commit/c19506b58e334a8b8ccaaefdfe2beabfa3c064a1) - Result cache - notice change in
final
class constant (PHP 8.1) (https://github.com/phpstan/phpstan-src/commit/092d8e3bbf013fe52db81ec7f09385bed2db9f63) - Do not rely on registered exception handler when debugging (https://github.com/phpstan/phpstan-src/commit/48ec184015023796ec32234d918fbda305606c51)
- ResultCacheManager: introduce flag
checkDependenciesOfProjectExtensionFiles
(#595), #5296, thanks @janedbal! - Update PHP 8 stubs (https://github.com/phpstan/phpstan-src/commit/91fde71dc649e07b5ee19a565eb021e6205a7cbe)
🔪
Bleeding edge - Check classes extending
@final
classes (https://github.com/phpstan/phpstan-src/commit/dffd2c2351e5fc5d22b752bf3b8be84bf1708f71), https://github.com/phpstan/phpstan/discussions/5343
If you want to see the shape of things to come and adopt bleeding edge features early, you can include this config file in your project's phpstan.neon
:
includes:
- vendor/phpstan/phpstan/conf/bleedingEdge.neon
Of course, there are no backwards compatibility guarantees when you include this file. The behaviour and reported errors can change in minor versions with this file included. Learn more
🐛
Bugfixes - Fix overriding
Memcache::get()
andMemcachePool::get()
(https://github.com/phpstan/phpstan-src/commit/c5f9d2400ee430a4850a87186a751d1e1d9fc9be) - Fix overriding throw point with inline
@throws void
(https://github.com/phpstan/phpstan-src/commit/da3790efa9f5ee96c3b7905342904fe3651a29af), #5364 - ResultCacheManager: read also
rules
in config.neon
file (#594), thanks @janedbal!
🤖
Function signature fixes
Configuration
-
If you want to rebase/retry this MR, click this checkbox.
This MR has been generated by Renovate Bot.