All notable changes to this project will be documented in this file.
The format is based on Keep a Changelog and this project adheres to Semantic Versioning.
2.1.4 - 2022-03-30
- feat: add cursorPaginate() support by @BramVanBerkel in larastan#1198
- fix: inverted check in the ModelRuleHelper by @mad-briller in larastan#1207
2.1.3 - 2022-03-23
- feat: add exact typehints for
Model
casts
,hidden
andvisible
properties by @Magiczne in larastan#1158 - feat: support
with
in RelationExistenceRule by @canvural in larastan#1175 - feat: update Eloquent Builder stubs to be more specific by @canvural in larastan#1178
- Break long line in transformStaticParameters by @szepeviktor in larastan#1183
- feat: improve model factory
after*
methods by @mdpoulter in larastan#1195
-
fix: use custom collection if it does not have template types by @canvural in larastan#1170
-
fix: ignore Model in ModelPropertyRule by @canvural in larastan#1184
-
fix: use TypeTraverser to handle Union and Intersection types in
ModelRelationsExtension
by @canvural in larastan#1187 -
fix: updated
composer/pcre
to new PHP relevant version -
feat: add support for the
foreignId
column in migrations
2.1.0 - 2022-03-04
- feat: add return type support for
$request->user()
call by @canvural in larastan#1136 - feat: schema dump parsing by @canvural in larastan#1147
- feat: add support for migrations using
Schema::connection
by @canvural in larastan#1151
- fix: collect() returns collection which can have array-key as key type in https://github.com/nunomaduro/larastan/commit/b0a50dfe2d21c44c9f2577aa5d7c9825b6b9d5b2
- fix:
Query::whereBetween
typehint by @gitetsu in larastan#1123 - fix: update PHPStan version and stubs by @canvural in larastan#1144
- fix:
deleted_at
column has date type rather thanstring
by @totov in larastan#1124
2.0.1 - 2022-02-09
- Fix incorrect return type by
route
on Request class by @fragkp in larastan#1113
- refactor: replace composer with copy of ClassMapGenerator by @canvural in larastan#1119
2.0.0 - 2022-01-26
- Dropped support for Laravel versions older than 9.
- Moved all Collection stubs to Laravel core.
- Infer type of model
id
without migrations by @sebdesign in larastan#1057 - Enable Testbench package discovery by @mewejo in larastan#1093
1.0.3 - 2022-01-20
- Avoid #1059 by @szepeviktor in larastan#1062
- Fix SchemaAggregation when renaming tables through non-static method call by @N-Silbernagel in larastan#1065
- fix: Call to an undefined method Eloquent\Builder::restore by @ryo-imai-bit in larastan#1061
- fix: check for trait with getDeclaringTrait if method is declared in a trait
- fix: use container to get the FunctionCallParametersCheck class in test
1.0.2 - 2021-11-23
- Throw types for macros by @canvural in larastan#1013
- Improve return types for Collection::first, last, get and pull when default value is given. by @bastien-phi in larastan#1010
- Respect ancestor property tags in model extensions by @spawnia in larastan#1037
- Correct method reflection for magic
with*
calls onRedirectResponse
by @canvural in larastan#1016 - Eloquent collection has array-key for the key type by @canvural in larastan#1027
- Laravel container can have scalar bindings by @canvural in larastan#1028
tap
helper should not enforce any return type for the callback by @tpetry in larastan#1031
- Improve return types for Collection
first
,firstWhere
,last
by @sebdesign in larastan#1025 - Update default config to match new highest level by @felixdorn in larastan#1014
1.0.1 - 2021-11-06
- Fix
groupBy
Collection method signature - Renamed
CheckJobDispatchArgumentTypesCompatibleWithClassConstructorRule
toCheckDispatchArgumentTypesCompatibleWithClassConstructorRule
by @canvural in larastan#1003 CheckDispatchArgumentTypesCompatibleWithClassConstructorRule
now checks for argument types compatibility with the class constructor for both Event and Job classes. by @canvural in larastan#1003
- Clarified "static analysis" wording in docs and logo by @asgrim in larastan#1008
1.0.0 - 2021-11-01
- Dynamic method return type extension for
Enumerable::filter
in larastan#981 - New rule to check for relation existence in larastan#985
rescue
parameter ofrescue
function now accepts theThrowable
by @sebdesign in larastan#989- New
CheckJobDispatchArgumentTypesCompatibleWithClassConstructorRule
rule in larastan#991 - Added
non-empty-string
types in stubs. https://github.com/nunomaduro/larastan/commit/c5b81cfee07686e2ce0ea557f8e32f2f022d47eb
- PHPStan 1.0 compatibility in larastan#968
JsonResource
class is no longer generic. You can remove@template
tags from your resource classes and directly add@mixin Model
tags to your resource classes. https://github.com/nunomaduro/larastan/commit/37f9ce80890a67a02b1d55bf79eb73604880c6b9
0.7.15 - 2021-10-26
- Removed tags from conditional rules.
0.7.14 - 2021-10-25
- Fixed template resolution when
flatMap
's callback returns anEnumerable
(#970) Thanks @bastien-phi
- Detection of fields added/modified a migration $table->after() method (Added in Laravel 8.27). (#972) Thanks @jimohalloran
- Add new rule
NoModelMake
to prevent inefficient model instantiation (#976) Thanks @spawnia
0.7.13 - 2021-10-14
- Fixed
Dynamic call to static method
error for regular methods to work withphpstan-strict-rules
. (#483, #917)
- Support global macros on the eloquent query builder.
- Partial support for defining columns with
foreignIdFor
in migrations. (#932) Thanks @Josh-G - Extension for
collect
helper andCollection::make
(#904) - Support for scopes defined in model docblocks (88422fb)
rescue
helper stub (#961) Thanks @jrmajor- Added
trait_exists
to ensureorchestra/testbench
is installed for packages. (#957) Thanks @rajyan
0.7.12 - 2021-07-26
- Support for
AsArrayObject
andAsCollection
model casts. - Use bleeding edge config to run tests.
- Corrected stubs from bleeding edge feedback.
- Changed
EloquentBuilder
stub to fix several relation builder methods return types when custom builder is used. (#899) Thanks @fragkp - Changed
EloquentBuilder
stub to fixwhereHas
return type when custom builder is used. (#896) Thanks @fragkp
- Refactored tests to separate Laravel 8 specific tests.
0.7.11 - 2021-07-22
- Support for Laravel 8 model factories. (#861,
6a03ad7
) - Support for
orWhere
HigherOrderBuilderProxy property. (#884) Thanks @shaffe-fr - Added more precise declarations to Factory stub (#888) Thanks @spawnia
- Laravel 9 tests cannot run on PHP 7.4
0.7.10 - 2021-07-07
- Fixed an issue when using
return null
in PHPDocs forced thereturn
keyword on the code. (1e85de7)
0.7.9 - 2021-07-05
- Fixed an issue where accessing
dateClass
property directly causing issues. (#865)
0.7.8 - 2021-07-02
- Revert "fix bootstrap path" (#858)
0.7.7 - 2021-07-01
- Use
checkExplicitMixed
PHPStan option when running tests (#844) - Added .github folder to the export list (#849) Thanks @dingo-d
- Added support for detecting nested trait usage for SoftDeletes trait (#838) Thanks @IAmRGroot
- Added support for vendor-dir (#850) Thanks @rajyan
- Correct return type for restore method
- Nullable properties should not be overwritten when applying model casts
- Fixed suggest in Composer config (#846) Thanks @szepeviktor
- Fixed bootstrap path (#852) Thanks @rajyan
0.7.6 - 2021-05-18
- Update link to Octane dependency injection docs (#829) Thanks @spawnia
0.7.5 - 2021-04-29
- Support for
sole
method on Eloquent builder (#822) Thanks @ThibaudDauce
- Cleanup call forwarding logic in extensions (#816)
increment
anddecrement
methods on query builder has side effects
0.7.4 - 2021-04-16
0.7.3 - 2021-04-12
- Octane compatibility checking rule (#809)
0.7.2 - 2021-04-08
- PHPStan 0.12.82 compatibility (#801)
0.7.1 - 2021-03-19
- Support for HigherOrderCollectionProxy (#781)
- Support for Illuminate\Database\Query\Expression as column (#784)
- Support for
when
andunless
methods on Eloquent builder (#791)
- Fixed incorrectly inferring the return type of custom methods that return Collections (#751) Thanks @Josh-G
- Locked phpstan/phpstan dependency to v0.12.81
0.7.0 - 2021-02-01
- Updated
phpstan/phpstan
from v0.12.65 to v0.12.70 (#774) Thanks @chrisp-github
- BREAKING: Changed
databaseMigrationsPath
to be an array instead of a string, so it allows multiple directories. (#777) Thanks @haringsrob - Support for Log facade (#771) Thanks @Pe46dro
0.6.13 - 2021-01-22
- Use updated excludePaths parameter (#759) Thanks @erikgaal
- Improve Pipes\Facades (#744) Thanks @szepeviktor
- Fixed insertOrIgnore typehint (#756) Thanks @bistory
- Fix BelongsToMany stub's file name (#736) Thanks @szepeviktor
0.6.12 - 2021-01-03
- Search missing method also in templated model (#739)
0.6.11 - 2020-12-07
- Support for autoloaded arrays (#725) Thanks @stancl
- Changed bootstrap file path (#727) Thanks @bepsvpt
- Removed mixin pipe class (#704)
- Don't return dummy method reflection for unknown methods (2581f3b)
0.6.10 - 2020-11-26
- Added
dd
to list of early terminating functions (#710)
- Model::with() accepts array of Closure (#713) Thanks @kvas-damian
- Use function map instead of calling newQuery on model (#717)
0.6.9 - 2020-10-30
- Support to PHP 8 (#701)
- Corrected return type for some QueryBuilder methods (#702)
0.6.8 - 2020-10-23
- Dynamic return type support for
$request->file()
method call.
- Fixed an issue with running tests on Windows (#696) Thanks @kwebble
- Fixed autoloading of autoload-dev classes during bootstrap. (#696) Thanks @kwebble
0.6.7 - 2020-10-21
SoftDeletes
methods on relations are no longer marked as undefined (#692) Thanks @jdrieghe- Generic model type is preserved when
with
method is used on a model instance.
0.6.6 - 2020-10-17
- Support for checking model properties on dynamic wheres (#686)
0.6.5 - 2020-10-15
This release introduces a new rule that can check the arguments of methods that expects a model property name, and can warn you if the passed argument is not actually a property of the model. You can read the details about the rule here.
NOTE: This rule is currently in beta! If you want to improve it's analysis, you can check out the issue here and contribute!
- Add a new
view-string
PHPDoc type (#654) - Stubs for Eloquent builder
value
andorWhere
methods
- Parameter type of the query builder's
where
,orWhere
andaddArrayOfWheres
(#651). - Fix callback parameters for
retry
(#663). - Using Reflection to initiate a model in
ModelPropertyExtension
to avoid errors caused by using Model constructor. (#666)
- Made improvements to database migrations scanning. (#670)
- Improved running test suite commands and Windows compatibility (#682)
0.6.4 - 2020-09-02
- Update
orchestra/testbench
version to allow Laravel 8 installations (#646)
- Return type of
firstWhere
method on model, builder and relations (#649)
0.6.3 - 2020-08-31
- Return type extension for
validator
helper (#641)
- Return type of
associate
,dissociate
andgetChild
methods ofBelongsTo
relations (#633)
0.6.2 - 2020-07-30
- Fix false positive for NoUnnecessaryCollectionCallRule when statically calling hydrate on a Model class. (#609)
- Fixed slightly incorrect stubs for accepted $values for
whereBetween
/orWhereBetween
andwhereRowValues
/orWhereRowValues
(#626) - Check if facade fake exists (852c131)
- Correct query builder stub (d8d8b41)
- Dont override return type when eloquent builder returns a query builder instance (b5f96b4)
- Handle the case when a custom query builder does not have generic annotations (c54b517)
- Soft delete trait methods should return generic Eloquent builder with model (023043b)
- Support for Redis facade (#615) (a42b2f6)
- Auth guard with multiple dynamic auth models (#605) (63a3934)
- Use latest version of Composer in travis (#599) (29a9023)
0.6.1 - 2020-06-20
- Support for dynamic auth model loading from config. Thanks @0xb4lint (#602)
- Support for Laravel 8
- Fix false positive when calling
tap($this)
(#601)
0.6.0 - 2020-06-10
- Document common errors for users to ignore (#564)
- Add
abort
toearlyTerminatingFunctionCalls
config option (#567) - Support for
tap
helper. (#575) - Bumped minimum PHPStan version to 0.12.28
- Avoid false-positive when calling static builder methods such as
::find()
on Model classes where the concrete subclass is not yet known (#565) - Use correct argument order for
Str::startsWith
(#570)
- Do not overwrite PHPStan's default for
reportUnmatchedIgnoredErrors
(#564)
- Stop ignoring errors (#564)
0.5.8 - 2020-05-06
- Support for custom Eloquent collections. Thanks @timacdonald (#537)
- Added issue and PR templates for new contributors. Thanks @spawnia (#560)
- Fixed some of the collection methods in stub files. Thanks @Daanra (#556)
- Fixed a bug with Composer autoloading. Thanks @ondrejmirtes (#561)
0.5.7 - 2020-04-28
- Fixed incorrect stubs for model creation methods. (85716a5)
- Fixed false positives on NoUnnecessaryCollectionCallRule rule. Thanks @Daanra (#546)
- Added more methods to collection stubs. Thanks @Daanra (#547)
0.5.6 - 2020-04-26
- Fixed relation methods with custom builders always returning custom builder. (#520)
- Fixed reading
boolean
columns from migrations. (#514, #513, 692fcd1, d1f1861) - Annotations for model properties have higher order than migration files. (ec22906)
- Improved support for Eloquent relationships. (#533)
- Eloquent relations are now also generic. (#518)
- Support for Composer 2. Thanks @GrahamCampbell (#528)
- Support for
abort_unless
,throw_if
andthrow_unless
functions. Thanks @Daanra (#542) - Support for
retry
helper return type. Thanks @Daanra (#543) - A rule for detecting expensive calls on a Collection. Thanks @Daanra (#538)
- Support for
value
helper function return type. Thanks @Daanra (#545)
0.5.5 - 2020-03-26
- Assume id property exists only when it is not found. (#510)
- Fixed an issue with generics in BuilderModelFindExtension. (#511)
0.5.4 - 2020-03-22
- Support for return type inference of
find*
methods on Builder class depending on passed arguments. (#503)
0.5.3 - 2020-03-21
- Support for Eloquent resources. Thanks @mr-feek (#470)
- Treat Laravel ide-helper generated relationship properties as generic Collections. Thanks @mr-feek (#479)
- Treat Laravel ide-helper generated builder typehints as generic Builders. (#497)
id
property on any model class will be recognized as integer type. (#499)
- Corrected parameter type of builder dynamic wheres. Thanks @mr-feek (#482)
- Added a check to see if migrations directory exists. Thanks @deleugpn (#498)
- Added
Carbon/Carbon
to possible types for a date properties in models. Thanks @arxeiss (#500) - Fixed issue with scanning the migrations. (#501)
0.5.2 - 2020-02-10
- Model scopes returns the builder, if return type is
void
(#450) - Fix return type of calling query builder methods on custom builders (#453)
- Fix return type of
all
on model. Thanks @BertvanHoekelen (#454) - Any query builder method should return the generic query builder (#457)
- Don't throw exception when unknown column type is encountered while scanning the migrations (#451)
0.5.1 - 2020-02-04
- Support for model accessors (#401)
- Handle Builder method calls, model scope calls and dynamic where calls on relations. Thanks @BertvanHoekelen (#410, #419, #423)
- Support for custom Eloquent builders (#432)
- Infer Eloquent model property types. Thanks @muglug (#435)
- Support for app and resolve helper functions return type. Thanks @troelsselch (#431)
- Add generic stubs for Eloquent collection and Support collection. (#439)
- Better return type support for find* methods (#400)
- Don't register abstract service providers. Thanks @CyberiaResurrection (#440)
0.5.0 - 2019-12-25
Blogpost: nunomaduro.com/larastan-0-5-is-out Upgrade guide: UPGRADE.md
- Support to PHPStan
0.12
#378 - Support to Laravel 7 #377
- Support for Facade fakes #347
- Support for model relations accessed as properties #361
- Support for custom Eloquent builders #364
- Support for return types of
spy
,mock
andpartialMock
methods ofTestCase
#362
- Fixed a bug about handling method calls that starts with
find
on model instances #360
- The artisan
code:analyse
command. 391
0.4.3 - 2019-10-22
0.4.2 - 2019-10-16
getProjectClasses
method to use Composer data to get the classes (#318)- Return type of calling scope on relation (#322)
0.4.1 - 2019-10-07
- Better return type inference in relation methods (#319)
- Better return type inference for auth guard method calls on auth helper and facade (#317)
- Support to phpstan extension plugin (#314)
0.4.0 - 2019-08-28
- Support to
Carbon
macros (#301)
- Support to
laravel/framework:^6.0
withoutlaravel/helpers
package (#311)
- Dependency of
orchestra/testbench
in Laravel projects (#305)
0.3.21 - 2019-08-17
- Macro method detector class implements MethodReflection instead of BuiltinMethodReflection (#299)
0.3.20 - 2019-08-17
- Macro method detector class implements MethodReflection instead of BuiltinMethodReflection (#298)
0.3.19 - 2019-08-16
- Partial support to
auth
helper (#254)
- Compatibility with PHPStan 0.11.13 (#294)
0.3.18 - 2019-08-04
- Support to Laravel 6 (2be403c)
0.3.17 - 2019-05-29
- Issue with PHPStan 0.11.8 because of MethodReflectionFactory signature change (#270)
0.3.16 - 2019-03-30
- Support to Lumen (Put commit here)
- Void return type on Models (Put commit here)
0.3.15 - 2019-01-23
- Support to Laravel 5.8 (0949fa5)
0.3.14 - 2019-01-22
- Bumps PHPStan version to > 0.11.1 (#229)
0.3.13 - 2018-12-21
- Support to
trans
helper (#220)
0.3.12 - 2018-12-03
- Support to paginators (c29af44)
0.3.11 - 2018-11-26
- Null return type in
Auth::user()
(#211)
0.3.10 - 2018-11-22
- Support to return type of
$this
from Eloquent builder
0.3.9 - 2018-11-21
- Support to return type of
Auth::user()
0.3.8 - 2018-11-01
- Auto detects configuration
phpstan.neon
(#194)
0.3.7 - 2018-10-31
- Fixes while resolving application with invalid php files (7dd69ad)
0.3.6 - 2018-10-30
- Support to return type of
url
helper (#179)
0.3.5 - 2018-10-29
- Internal error caused by non-existing provider name (#170)
- Issue when project name have spaces (#186)
0.3.4 - 2018-10-09
- Issue while calling soft deletes macros staticly
0.3.3 - 2018-10-09
- Support for Soft Deletes
0.3.2 - 2018-10-05
- Support to return type of
redirect
&view
helpers (#157)
0.3.1 - 2018-10-04
- Usage with Laravel 5.6 (2d13d9a)
0.3.0 - 2018-10-04
- Support for code analysis in Laravel Packages
0.2.12 - 2018-09-27
- Support to return type of
request
helper (#145)
0.2.11 - 2018-09-21
- Support to return type of
response
helper - Support to return type of
\Illuminate\Http\Response::input
method
- False positives when performing long Eloquent queries
- Issue when there is recursive mixins
- When container got used twice using the
ArrayAccess
interface
0.2.10 - 2018-09-12
- Issue while using invalid mixins (#137)
0.2.9 - 2018-09-01
- Usage of spaces with the option
--paths
0.2.8 - 2018-09-01
- Issue while resolving implementations from container
0.2.7 - 2018-08-27
- Issue on Windows with the default path param (#128)
- Issue with exit code (#115)
- While running Larastan on CI envs (#113)
0.2.6 - 2018-08-27
- Support to Laravel 5.7
0.2.5 - 2018-08-17
- Issue with option
errorFormat
(#121)
0.2.4 - 2018-07-24
- Issue while resolving implementations that don't exist on the container
0.2.3 - 2018-07-23
- Common laravel false positives on trusted proxies and app exception handler
0.2.2 - 2018-07-23
- Resolved null type from container
0.2.1 - 2018-07-23
- Error - "internal error: * product does not exist"
0.2.0 - 2018-07-22
- Issues while using Lumen
0.1.9 - 2018-07-22
- Support to Lumen and Laravel Zero
0.1.8 - 2018-07-22
- Support to builder dynamic wheres
0.1.7 - 2018-07-22
- Support to "object" return type
- Bug on macro extension
0.1.6 - 2018-07-22
- Allows array access on objects that respects container's contract
0.1.5 - 2018-07-22
- Removes unused
dd
0.1.4 - 2018-07-22
- Issue when
static
is missing was return type hint on Illuminate Model mixins
0.1.3 - 2018-07-20
- Usage on Windows + Laravel Homestead (#55)
0.1.2 - 2018-07-20
Illuminate\Contracts
property extension
0.1.1 - 2018-07-18
- Infinite recursion in mixins middleware (b5a4317)
- Adds first alpha version