1.0.0 #5858
ondrejmirtes
started this conversation in
General
1.0.0
#5858
Replies: 3 comments 1 reply
-
Fyi, just getting the credits right here
should be :) |
Beta Was this translation helpful? Give feedback.
1 reply
-
This affects RuleTestCase as well. My test failed because getStaticMethodTypeSpecifyingExtensions was removed. |
Beta Was this translation helpful? Give feedback.
0 replies
Sign up for free
to join this conversation on GitHub.
Already have an account?
Sign in to comment
-
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 🚀
mt_rand
assumed to always return the same value #4091, Wrong return type in ternary operator #2288, Unable to infer type when using a getter #1157New rules
@final
classes (phpstan/phpstan-src@dffd2c2), PHPStan extension for final classes (in theory) that cannot be final (because of mocking, Doctrine proxies, etc) #5343??
operator issues (#36), thanks @leongersen!@var
PHPDoc tag (phpstan/phpstan-src@5886053)static::
(phpstan/phpstan-src@d8e8953, phpstan/phpstan-src@bad2607, phpstan/phpstan-src@270326a)@throws void
does not have an explicit throw point (phpstan/phpstan-src@8b3382a)isset()
(phpstan/phpstan-src@25b61d9)empty()
rule (phpstan/phpstan-src@601460c), Empty check should fail on undefined var #970array_map()
andarray_filter()
calls (#555), checkExplicitMixed - hardcoded functions in NodeScopeResolver like array_map and array_filter expect wrong callable #5609, Report wrong type expected by an array_map closure #5356, No checks for array_map closure params #1954, thanks @BackEndTea!implode()
function rule (#679), thanks @staabm!DateTime
instantiation (#380), thanks @b1rdex!random_int()
dynamic return type extension and parameters rule (#99), thanks @cs278!BC breaks for end-users
max
is now level 9. Feel free to updatemax
to8
if your code isn't ready.numeric-string
(it was previously described asstring&numeric
), and also array shapes.baselineNeon
error formatter, use--generate-baseline
CLI option instead (phpstan/phpstan-src@492cfbc)polluteCatchScopeWithTryAssignments
config parameter (phpstan/phpstan-src@8933c7e)autoload_files
parameter - use Discovering Symbols instead (phpstan/phpstan-src@7a21246)autoload_directories
parameter - use Discovering Symbols instead (phpstan/phpstan-src@f67b48a)bootstrap
parameter - usebootstrapFiles
instead (phpstan/phpstan-src@1baa294)implicitThrows
configuration parameter toexceptions.implicitThrows
(phpstan/phpstan-src@96b7c48)--paths-file
CLI option (phpstan/phpstan-src@5670cf2), Document paths-file command line option #5756dump-deps
command (phpstan/phpstan-src@9c7017c)excludes_analyse
option, useexcludePaths
instead (phpstan/phpstan-src@d25c5e5)The following are interesting only if you create a custom ruleset in your configuration file:
DeadCatchRule
, replaced byCatchWithUnthrownExceptionRule
(phpstan/phpstan-src@4dba60b)VariableCertaintyInIssetRule
, replaced byIssetRule
(phpstan/phpstan-src@2e858de)MissingClosureNativeReturnTypehintRule
, no longer needed thanks to type inference (phpstan/phpstan-src@1c34d8d)BC breaks for extension developers
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: phpstan/phpstan-src@c836a42
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 versionsCompoundTypeHelper
(phpstan/phpstan-src@145c4e3)CommentHelper
(phpstan/phpstan-src@ebad6f6)DependencyDumper
(phpstan/phpstan-src@9c7017c)PHPStan\Reflection\Generic\ResolvedFunctionVariant
, replaced byPHPStan\Reflection\ResolvedFunctionVariant
(phpstan/phpstan-src@1cc6c81)ClassReflection::getNativeMethods()
, usegetNativeReflection()
instead (phpstan/phpstan-src@d2c1446)PhpPropertyReflection::hasPhpDoc()
, replaced byhasPhpDocType()
(phpstan/phpstan-src@bedd5be)NodeDependencies
no longer iterable (phpstan/phpstan-src@f76875a)TestCase
toPHPStanTestCase
(#634), thanks @frankdejonge!StaticType
andThisType
- requireClassReflection
in constructor (phpstan/phpstan-src@7aabc84)PHPStanTestCase
- extensions can no longer be provided by overriding methods fromPHPStanTestCase
. UsegetAdditionalConfigFiles()
instead. (phpstan/phpstan-src@65efd93, phpstan/phpstan-src@239291a)|false
to|null
(phpstan/phpstan-src@629ccf6)BrokerAwareExtension
(phpstan/phpstan-src@db2f7fb)PHPStanTestCase::createBroker()
. UsecreateReflectionProvider()
instead. (phpstan/phpstan-src@1e5cf58)PHPStan\Broker\Broker
. UsePHPStan\Reflection\ReflectionProvider
instead. (phpstan/phpstan-src@c775594)PHPStan\Broker\Broker::getInstance()
. UsePHPStan\Reflection\ReflectionProviderStaticAccessor
instead. (phpstan/phpstan-src@4e7d60d)IntersectionType
with less than two types (phpstan/phpstan-src@f7d232a)ReflectionWithFilename
, useClassReflection|FunctionReflection
instead (phpstan/phpstan-src@3738fcd)Improvements 🔧
FileHelper::normalizePath()
(#735), thanks @staabm!TypeCombinator::compareTypesInUnion()
(#742), thanks @voku!TypeCombinator::union()
(#743), thanks @voku!TypeCombinator::union()
v2 (#747), thanks @voku!TypeCombinator::intersect()
(#747), thanks @voku!TypeCombinator::remove()
(#746), thanks @voku!analysedPathsFromConfig
(phpstan/phpstan-src@9f5f911), Class not found in PhpStorm for Entities that implement an interface in PHP 8 using attributes #5850IssetRule
everything whatVariableCertaintyInIssetRule
does (phpstan/phpstan-src@9689fbd), Empty check should fail on undefined var #970MissingReturnRule
- make the error non-ignorable for native typehints (phpstan/phpstan-src@9ecefd5)get_class()
returnsfalse
for mixed argument types (phpstan/phpstan-src@e86742d), Strict comparison using === between class-string and false will always evaluate to false #4741RecursiveIterator
,RecursiveArrayIterator
,WeakMap
(phpstan/phpstan-src@0b92888)new $string
leads toobject
, notmixed
(phpstan/phpstan-src@78a9f05)interface-string
andtrait-string
(phpstan/phpstan-src@d0ef5d4)SpecifiedTypes
phpdocs (#682), thanks @staabm!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 (phpstan/phpstan-src@d235195)int|string
(phpstan/phpstan-src@724c8ba), array key type not being checked for validity #3753preserveOriginalNames
set to true (phpstan/phpstan-src@2a9d1be)E_DEPRECATED
(phpstan/phpstan-src@1a43385)Bugfixes 🐛
Throwable::toString()
can throw an exception (phpstan/phpstan-src@18adc8c)new $object
with a template type (phpstan/phpstan-src@956a7f4)never
is always an explicit throw point (phpstan/phpstan-src@c362fc5), report swallowed exception #5627+
-operator withnon-empty-array
should lead tonon-empty-array
(#739), thanks @staabm!Function signature fixes 🤖
$cmp_function
parameters to$callback
(phpstan/phpstan-src@27a5d0f)static
(phpstan/phpstan-src@4653d15), SimpleXMLElement childrent method returns self instead of static #5700exit()
status should be in the range 0 to 254 (#707), thanks @staabm!This discussion was created from the release 1.0.0.
Beta Was this translation helpful? Give feedback.
All reactions