⚗️ Adds code analysis to Laravel improving developer productivity and code quality.

Overview

Larastan Logo

Larastan Example

Build Status Total Downloads Latest Version License


⚗️ About Larastan

Larastan was created by Can Vural and Nuno Maduro, got artwork designed by @Caneco, is maintained by Can Vural, Nuno Maduro, and Viktor Szépe, and is a PHPStan wrapper for Laravel. Larastan focuses on finding errors in your code. It catches whole classes of bugs even before you write tests for the code.

  • Adds static typing to Laravel to improve developer productivity and code quality
  • Supports most of Laravel's beautiful magic
  • Discovers bugs in your code

While by definition, "static analysis" doesn't load any of your application's code. Larastan boots your application's container, so it can resolve types that are only possible to compute at runtime. That's why we use the term "code analysis" instead of "static analysis".

Getting Started In 3 Steps

Requires:

1: First, you may use Composer to install Larastan as a development dependency into your Laravel project:

composer require nunomaduro/larastan --dev

Using Larastan for analysing Laravel packages? You may need to install orchestra/testbench.

2: Then, create a phpstan.neon or phpstan.neon.dist file in the root of your application. It might look like this:

includes:
    - ./vendor/nunomaduro/larastan/extension.neon

parameters:

    paths:
        - app

    # The level 9 is the highest level
    level: 5

    ignoreErrors:
        - '#Unsafe usage of new static#'

    excludePaths:
        - ./*/*/FileToBeExcluded.php

    checkMissingIterableValueType: false

For all available options, please take a look at the PHPStan documentation: https://phpstan.org/config-reference

3: Finally, you may start analyzing your code using the phpstan console command:

./vendor/bin/phpstan analyse

If you are getting the error Allowed memory size exhausted, then you can use the --memory-limit option fix the problem:

./vendor/bin/phpstan analyse --memory-limit=2G

Ignoring errors

Ignoring a specific error can be done either with a php comment or in the configuration file:

// @phpstan-ignore-next-line
$test->badMethod();

$test->badMethod(); // @phpstan-ignore-line

When ignoring errors in PHPStan's configuration file, they are ignored by writing a regex based on error messages:

parameters:
    ignoreErrors:
        - '#Call to an undefined method .*badMethod\(\)#'

Baseline file

In older codebases it might be hard to spend the time fixing all the code to pass a high PHPStan Level.

To get around this a baseline file can be generated. The baseline file will create a configuration file with all of the current errors, so new code can be written following a higher standard than the old code. (PHPStan Docs)

./vendor/bin/phpstan analyse --generate-baseline

Rules

A list of configurable rules specific to Laravel can be found here.

Custom PHPDoc types

A list of PHPDoc types specific to Larastan can be found here.

Custom PHPStan config parameters

A list of custom config parameters that you can use in your PHPStan config file can be found here.

Errors To Ignore

Some parts of Laravel are currently too magical for Larastan/PHPStan to understand. We listed common errors to ignore, add them as needed

👊🏻 Contributing

Thank you for considering contributing to Larastan. All the contribution guidelines are mentioned here.

You can have a look at the CHANGELOG for constant updates & detailed information about the changes. You can also follow the Twitter account for the latest announcements or just come say hi!: @enunomaduro, @can__vural.

❤️ Support The Development

Do you like this project? Support it by donating

📖 License

Larastan is an open-sourced software licensed under the MIT license.

Comments
  • Upgrade to PHPStan 0.12

    Upgrade to PHPStan 0.12

    • PHPStan\Analyser\Scope is now an interface. And it's only implementation MutatingScope is marked as @internal So I removed our scope class. It didn't affect any tests. If we find any error, we can try to fix it in another way.

    • Currently, the biggest issue is in the OptionsResolver class. We are getting errors like Parameter #1 $option of method _HumbugBox06db9be5fe9f\Symfony\Component\Console\Input\InputDefinition: :addOption() expects _HumbugBox06db9be5fe9f\Symfony\Component\Console\Input\InputOption, Symfony\Component\Console\Input\InputOption given. because PHPStan now distrubuted as PHAR file. (IMO we can drop providing a Laravel specific command and just let the users run PHPStan normally)

    • ModelTypeHelper and RelationCreateExtension classes still needs some work.

    Closes #381

    opened by canvural 62
  • Support for Lumen framework

    Support for Lumen framework

    Would be good add support to Lumen.

    https://medium.com/@rafaelcanical/although-i-agree-with-jan-alfred-richter-this-is-cool-can-this-be-used-with-lumen-projects-also-259b64c3d10c

    enhancement help wanted good first issue 
    opened by nunomaduro 49
  • Call to an undefined method `withTrashed` - SoftDeletes

    Call to an undefined method `withTrashed` - SoftDeletes

    $project = $task->project()->withTrashed()->first();
    

    Produce:

    Call to an undefined method Illuminate\Database\Eloquent\Relations\BelongsTo::withTrashed().

    false positive 
    opened by antonkomarev 48
  • Take advantage of `@mixin` in Laravel's code itself

    Take advantage of `@mixin` in Laravel's code itself

    Hi, PHPStan's dev-master now supports @mixin annotation (https://github.com/phpstan/phpstan-src/commit/b02ee1444440ed995c17171c456feec2c56e0cb2). I've been told that Laravel's codebase uses this annotation heavily, so maybe Larastan could take advantage of it. Maybe we could delete some of Larastan's custom code if the only thing it does is describing Laravel magic that's also described by the @mixin annotation.

    What I'd like to see happen:

    1. Require phpstan/phpstan: ^0.12.20 (soon to be released, in a matter of days) so that people that would update Larastan but not PHPStan are not left without this functionality.
    2. Go through extensions that describe Laravel's code that uses @mixin and try to delete them/reduce them.

    (If you don't find any code in Larastan that can be deleted thanks to @mixin support, then ^0.12.20 doesn't have to be required.)

    Thank you!

    opened by ondrejmirtes 38
  • Call to a member function get() on null in …/src/Methods/Pipes/Mixins.php:73

    Call to a member function get() on null in …/src/Methods/Pipes/Mixins.php:73

    • Larastan Version: 0.5.0
    • --level used: 6
    • Laravel Version: 6.10.1

    Description

    Fatal error: Uncaught Symfony\Component\Debug\Exception\FatalThrowableError: 
    Call to a member function get() on null 
    in /vagrant/project/vendor/nunomaduro/larastan/src/Methods/Pipes/Mixins.php:73
    
    Stack trace:
    #0 /vagrant/project/vendor/nunomaduro/larastan/src/Methods/Pipes/Mixins.php(42): NunoMaduro\Larastan\Methods\Pipes\Mixins->getMixinsFromClass()
    #1 /vagrant/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): NunoMaduro\Larastan\Methods\Pipes\Mixins->handle()
    #2 /vagrant/project/vendor/nunomaduro/larastan/src/Methods/Pipes/Macros.php(114): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
    #3 /vagrant/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171): NunoMaduro\Larastan\Methods\Pipes\Macros->handle()
    #4 /vagrant/project/vendor/nunomaduro/larastan/src/Methods/Pipes/SelfClass.php(34): Illuminate\Pipeline\Pipeline->Illuminate\Pipeline\{closure}()
    #5 /vagrant/project/vendor/laravel/framework/src/Illuminate/Pipeline/Pipeline.php(171):  in /vagrant/project/vendor/nunomaduro/larastan/src/Methods/Pipes/Mixins.php on line 73
    

    Laravel code where the issue was found

    This is on a project which works with phpstan 0.12.4 (which I removed) and then installed larastan ^0.5.0.

    It happens on a file which is a Mail/….php and which references e.g. some models. I suspect it's models related (?) becaus the problem has to do with mixins and I have @mixin \Eloquent annotations in all my models (using barryvdh/laravel-ide-helper to write them there).

    It's private code repo so ...

    Any suggestion how can I further debug this? I was already running vendor/bin/phpstan analyse --configuration=phpstan.neon app --debug

    Thanks!

    opened by mfn 38
  • Extend service provider search

    Extend service provider search

    My attempt to implement a suggestion implied in https://github.com/nunomaduro/larastan/issues/273#issuecomment-503291317 , namely getting a list of directories to check for service providers, directly from Composer data.

    @szepeviktor , I wasn't sure exactly how to test the load-from-extra-search-directories without polluting production use with test code (such as a dummy service provider). In lieu of a way to do that cleanly, I added a test that verified my changes didn't break the status quo on Larastan itself.

    enhancement 
    opened by CyberiaResurrection 35
  • Larastan is not auto-registering service providers in packages.

    Larastan is not auto-registering service providers in packages.

    • Larastan Version: v2.2.0

    Description

    Upon investigation i found the getVendorDir static method here: https://github.com/nunomaduro/larastan/blob/master/src/ApplicationResolver.php#L39

    When i do

        /**
         * Creates an application and registers service providers found.
         *
         * @return \Illuminate\Contracts\Foundation\Application
         *
         * @throws \ReflectionException
         */
        public static function resolve(): Application
        {
            $app = (new self)->createApplication();
    
            $vendorDir = self::getVendorDir() ?? getcwd().DIRECTORY_SEPARATOR.'vendor';
            $composerConfigPath = dirname($vendorDir).DIRECTORY_SEPARATOR.'composer.json';
    
            var_dump($composerConfigPath, $app->basePath());
            // ...
    

    i get this output:

    string(101) "phar:///home/brad/code/esb-workspace/esb-foundation/vendor/phpstan/phpstan/phpstan.phar/composer.json"
    string(84) "/home/brad/code/esb-workspace/esb-foundation/vendor/orchestra/testbench-core/laravel"
    

    it appears that getVendorDir is returning the vendor dir of the PHPStan phar, rather than the local project. This causes larastan to read the composer.json from there, and fail to auto-register service providers. This package used to work in the past (i'm not sure what version of phpstan / larastan) so along the way a change to phpstan / larastan has caused this to happen.

    I suspect this is the root of my view-string issue i posted a while ago.

    Not sure how you'd go about fixing this as i'm not super familiar with the bootstrapping of larastan (yet)

    opened by mad-briller 33
  • Unit test problem on MINGW64

    Unit test problem on MINGW64

    Laravel version: master

    Description

    I just fork this repo and run composer test on master branch. I got a fail test for my PHPUnit. I already run composer install. Is there anything that I'm doing wrongly?

    image

    I'm using windows 10. PHP 7.4.5

    opened by xitox97 30
  • Literal string is not a `non-empty-string`

    Literal string is not a `non-empty-string`

    • Larastan Version: 1.0.0
    • --level used: 7
    • Pull request with failing test:

    Description

    non-empty-string appeared as errors even no actually bugs happen

    Laravel code where the issue was found

    
    #  381
            $products = Product::whereIn((new Product())->getRouteKeyName(), $values)
                ->pluck('title', (new Product())->getRouteKeyName())
                ->toArray();
    
    # 417
            $users = User::whereIn((new User())->getRouteKeyName(), $values)
                ->get()
                ->pluck('full_name', (new User())->getRouteKeyName())
                ->toArray();
    
    # 610
           $products = Product::whereIn((new Product())->getRouteKeyName(), $this->freeProducts)->get();
    
    # 627
           ? User::whereIn(
                    (new User())->getRouteKeyName(),
                    $this->specificCustomers
                )->get()->all()
                : [];
    
    # models
        public function getRouteKeyName(): string
        {
            return 'slug';
        }
    

    Screenshot from 2021-11-05 11-44-09

    I try to search the solution but it was not found any

    thank you

    opened by lloricode 28
  • Example as in the Laravel documentation, if I want to update something

    Example as in the Laravel documentation, if I want to update something

    • Larastan Version: 0.2.4
    • --level used: max

    Description:

    For that test I oriented at the documentation of Laravel, if I want to update data.

    Laravel code where the issue was found:

    $user = Users::find($id);
    $user->name = $name;
    $user->save();
    

    Messages

     Cannot access property $name on (Illuminate\Database\Eloquent\Collection&iterable<static(App\Users)>)|static(App\Users)|null.
    
     Cannot call method save() on (Illuminate\Database\Eloquent\Collection&iterable<static(App\Users)>)|static(App\Users)|null.
    

    If I would use this one, there is no message by Larastan.

    $user->update([
    'name' => $name
    ]);
    
    opened by ghost 28
  • Access to undefined constant all over the proyect

    Access to undefined constant all over the proyect

    • Larastan Version: 0.6.11
    • --level used: 0

    Description

    Just installed larastan in a just upgraded proyect (was laravel 7 but now it's laravel 8) and phpstan is giving me errors about undefined class constants that are already defined.

    In phpstan playground it's working as it should.

    Laravel code where the issue was found

    // In app/Http/Middleware/TrustProxies.php
    <?php
    
    namespace App\Http\Middleware;
    
    use Fideloper\Proxy\TrustProxies as Middleware;
    use Illuminate\Http\Request;
    
    class TrustProxies extends Middleware
    {
        /**
         * The trusted proxies for this application.
         *
         * @var array|string|null
         */
        protected $proxies;
    
        /**
         * The headers that should be used to detect proxies.
         *
         * @var int
         */
        protected $headers = Request::HEADER_X_FORWARDED_ALL; // defined here
    }
    
    // And in Character.php
    namespace App\Models;
    
    use Illuminate\Database\Eloquent\Model;
    use Illuminate\Support\Facades\DB;
    
    class Character extends Model
    {
    	public const NAME_VALIDATION_RULE = [ // defined here
    		'required',
    		'exists:chars,nombre',
    		'max:16',
    	];
    
    	// extra code removed
    }
    
    
    

    Output

     ------ --------------------------------------------------
      Line   Http/Middleware/TrustProxies.php
     ------ --------------------------------------------------
      22     Access to undefined constant
             Illuminate\Http\Request::HEADER_X_FORWARDED_ALL.
     ------ --------------------------------------------------
    
     ------ --------------------------------------------------------------------------
      Line   Http/Requests/CharLoginRequest.php
     ------ --------------------------------------------------------------------------
      30     Access to undefined constant App\Models\Character::NAME_VALIDATION_RULE.
     ------ --------------------------------------------------------------------------
    
     ------ --------------------------------------------------------------------------
      Line   Http/Requests/CharNameRequest.php
     ------ --------------------------------------------------------------------------
      29     Access to undefined constant App\Models\Character::NAME_VALIDATION_RULE.
     ------ --------------------------------------------------------------------------
    
     ------ --------------------------------------------------------------------------
      Line   Http/Requests/DistributeStatsRequest.php
     ------ --------------------------------------------------------------------------
      30     Access to undefined constant App\Models\Character::NAME_VALIDATION_RULE.
     ------ --------------------------------------------------------------------------
    
     ------ --------------------------------------------------------------------------
      Line   Http/Requests/ResetStatsRequest.php
     ------ --------------------------------------------------------------------------
      30     Access to undefined constant App\Models\Character::NAME_VALIDATION_RULE.
     ------ --------------------------------------------------------------------------
    
    opened by manuelmaceira 25
  • feat: container binding implements abstract rule

    feat: container binding implements abstract rule

    • [x] Added or updated tests
    • [x] Documented user facing changes
    • [x] Updated CHANGELOG.md

    Changes

    Adds a new collector and rule to check that container bindings make sense.

    Questions:

    • Should this rule be optional?
    • Add support for $bindings and $singletons defined on Service Providers?
    • Should this check that the concrete type is either an instance or instantiable?
    opened by jdjfisher 2
  • assert nullable type information by filled/blank function calls

    assert nullable type information by filled/blank function calls

    • [ ] Added or updated tests
    • [ ] Documented user facing changes
    • [ ] Updated CHANGELOG.md

    Resolves #1290

    Changes

    The blank and filled helpers have been added to the stubs file with new assertions from the PHPStan 1.9.0 release. With the new assertions PHPStan can infer whether a variable is !null from the return type of blank and filled.

    Breaking changes

    None

    opened by tpetry 0
  • UUID database field with default field name

    UUID database field with default field name

    • Larastan Version: 2.2.9
    • --level used: 8

    Description

    Access to an undefined property App\Models\User::$uuid.
    

    https://github.com/laravel/framework/blob/0702f556f72745f34570fbdfa8e37b8ea0b7ffa5/src/Illuminate/Database/Schema/Blueprint.php#L1245-L1254

    Laravel code where the issue was found

    $table->uuid(); is not recognized $table->uuid('someName'); works

    https://github.com/szepeviktor/larastan-issue/pull/6/files

    bug 
    opened by szepeviktor 0
  • phpmyadmin/sql-parser dependency has a 'viral license'

    phpmyadmin/sql-parser dependency has a 'viral license'

    • Larastan Version: v2.2.0
    • --level used: N/A
    • Pull request with failing test: N/A

    Description

    Larastan uses phpmyadmin/sql-parser in PhpMyAdminDataTypeToPhpTypeConverter through the SquashedMigrationHelper, which is used in the ModelPropertyExtension. This package has a so called Viral license (GPL-2.0-or-later). Because of the 'viral' aspect of this, AFAIK this means that we are actually unable to use Larastan in a closed source project. Would it be possible to 'easily' remove this dependency and would you be willing to do so?

    I would really like to contribute if this is necessary. Could you point me to what's need to be changed?

    opened by gisostallenberg 5
Releases(2.3.3)
  • 2.3.3(Dec 29, 2022)

    What's Changed?

    Fixed

    • Corrected an issue with return type for Collection methods that are in trait. https://github.com/nunomaduro/larastan/commit/8558ec396e10ac060c3e9b9e2c365dc2ea741fa1

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.3.2...2.3.3

    Source code(tar.gz)
    Source code(zip)
  • 2.3.2(Dec 29, 2022)

    What's Changed

    Fixed

    • Fixed view helper method return type https://github.com/nunomaduro/larastan/commit/b09aee194d4e2fb3bb9f68ed5b29c2840f46f7d6
    • Fixed Windows compatibility https://github.com/nunomaduro/larastan/commit/7751e4b3715c1ce1731e7e9404a6f5c6d6da1aff
    • fix: make, makeWith and resolve methods not resolving to correct type on Application and Container. by @mad-briller in https://github.com/nunomaduro/larastan/pull/1451
    • fix: keep original type in collect function in some cases by @canvural in https://github.com/nunomaduro/larastan/pull/1495

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.3.1...2.3.2

    Source code(tar.gz)
    Source code(zip)
  • 2.3.1(Dec 23, 2022)

    What's Changed

    • Fix for Windows directory separator by @rcerljenko in https://github.com/nunomaduro/larastan/pull/1488

    New Contributors

    • @rcerljenko made their first contribution in https://github.com/nunomaduro/larastan/pull/1488

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.3.0...2.3.1

    Source code(tar.gz)
    Source code(zip)
  • 2.3.0(Dec 23, 2022)

    What's Changed

    Added

    • feat: support for encrypted and parameterized casts by @jdjfisher in https://github.com/nunomaduro/larastan/pull/1439
    • New Rule 🚀 UnusedViewsRule. Read more about it here by @canvural in https://github.com/nunomaduro/larastan/pull/1423
    • feat: add createOneQuietly stub by @amooij in https://github.com/nunomaduro/larastan/pull/1462
    • Assert view-string with view()->exists(). by @mad-briller in https://github.com/nunomaduro/larastan/pull/1464
    • feat(refactor): ModelProperty casting by @erikgaal in https://github.com/nunomaduro/larastan/pull/1333

    Fixed

    • fix: retry helper supports array of sleep times for $times by @tpetry in https://github.com/nunomaduro/larastan/pull/1369
    • Fix CS in stubs by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1450
    • fix: changed concrete config class to interface by @Nai4rus in https://github.com/nunomaduro/larastan/pull/1478
    • Document PHPStan compatible version for 1.x by @oliverpool in https://github.com/nunomaduro/larastan/pull/1482
    • Prevent false positive for NoUnnecessaryCollectionCallRule when using arrow functions by @JeppeKnockaert in https://github.com/nunomaduro/larastan/pull/1483

    Internal

    • feat(refactor): get rid of most instanceof ConstantStringType checks by @canvural in https://github.com/nunomaduro/larastan/pull/1459
    • feat(refactor): get rid of more instanceof *Type by @canvural in https://github.com/nunomaduro/larastan/pull/1475

    New Contributors

    • @amooij made their first contribution in https://github.com/nunomaduro/larastan/pull/1462
    • @Nai4rus made their first contribution in https://github.com/nunomaduro/larastan/pull/1478
    • @oliverpool made their first contribution in https://github.com/nunomaduro/larastan/pull/1482
    • @JeppeKnockaert made their first contribution in https://github.com/nunomaduro/larastan/pull/1483

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.9...2.3.0

    Source code(tar.gz)
    Source code(zip)
  • 1.0.4(Nov 9, 2022)

    What's Changed

    This release adds a constraint on allowed PHPStan versions. 1.x is branch is not compatible with PHPStan 1.9

    Also 1.x branch is not maintained anymore. Users should upgrade to Larastan 2.x as soon as possible.

    Source code(tar.gz)
    Source code(zip)
  • 2.2.9(Nov 4, 2022)

    What's Changed

    • Organize E2E tests by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1433
    • feat: add support for generic paginators by @erikgaal in https://github.com/nunomaduro/larastan/pull/1372
    • feat: conditional return types for Eloquent\Collection::find() by @sebdesign in https://github.com/nunomaduro/larastan/pull/1419

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.8...2.2.9

    Source code(tar.gz)
    Source code(zip)
  • 2.2.8(Nov 3, 2022)

    What's Changed

    • fix: PHPStan 1.9.0 compatibility by @canvural in https://github.com/nunomaduro/larastan/pull/1431

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.7...2.2.8

    Source code(tar.gz)
    Source code(zip)
  • 2.2.7(Oct 31, 2022)

    What's Changed

    • Less arguments passed to ScopeFactory by @ondrejmirtes in https://github.com/nunomaduro/larastan/pull/1430

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.6...2.2.7

    Source code(tar.gz)
    Source code(zip)
  • 2.2.6(Oct 24, 2022)

    What's Changed

    Added

    • feat: add stub for whereRelation by @mad-briller in https://github.com/nunomaduro/larastan/pull/1412
    • feat: remove composer/pcre dependency by @canvural in https://github.com/nunomaduro/larastan/pull/1414
    • feat: test on PHP 8.2 by @canvural in https://github.com/nunomaduro/larastan/pull/1415
    • feat: let Testbench handle vendor symlink if used with Testbench 7.11+ by @crynobone in https://github.com/nunomaduro/larastan/pull/1416
    • feat: refined return type of safe method. by @jdjfisher in https://github.com/nunomaduro/larastan/pull/1417
    • feat: refined return type of DB::transaction method by @jdjfisher in https://github.com/nunomaduro/larastan/pull/1420

    New Contributors

    • @jdjfisher made their first contribution in https://github.com/nunomaduro/larastan/pull/1417

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.5...2.2.6

    Source code(tar.gz)
    Source code(zip)
  • 2.2.5(Oct 18, 2022)

    What's Changed

    Added

    • feat: support macros on custom builders and models by @canvural in https://github.com/nunomaduro/larastan/pull/1409
    • feat: add integration job names by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1411

    Fixed

    • fix: Attribute::make callable signature by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1410

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.4...2.2.5

    Source code(tar.gz)
    Source code(zip)
  • 2.2.4(Oct 15, 2022)

    What's Changed

    Fixed

    • fix: consider macros registered with array callables by @canvural in https://github.com/nunomaduro/larastan/pull/1407

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.3...2.2.4

    Source code(tar.gz)
    Source code(zip)
  • 2.2.3(Oct 14, 2022)

    What's Changed

    Fixed

    • fix: don't attempt to discover any packages during symlink. by @crynobone in https://github.com/nunomaduro/larastan/pull/1404

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.2...2.2.3

    Source code(tar.gz)
    Source code(zip)
  • 2.2.2(Oct 14, 2022)

    What's Changed

    Added

    • feat: refined return type of Request::header method. by @mad-briller in https://github.com/nunomaduro/larastan/pull/1394
    • feat: added better typing for the Optional class and helper. by @mad-briller in https://github.com/nunomaduro/larastan/pull/1344
    • feat: use Orchestra\Testbench\Foundation\Application and allow custom laravel path based on testbench.yaml by @crynobone in https://github.com/nunomaduro/larastan/pull/1392
    • feat: delete bootstrap/cache/packages.php on vendor symlink. by @crynobone in https://github.com/nunomaduro/larastan/pull/1400
    • Do not overwrite variable in getComposerJsonPath by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1402
    • feat: add more precise type for Model::with arguments by @ariaieboy in https://github.com/nunomaduro/larastan/pull/1363

    Fixed

    • fix: abstract manager would cause larastan to crash. by @mad-briller in https://github.com/nunomaduro/larastan/pull/1354

    New Contributors

    • @crynobone made their first contribution in https://github.com/nunomaduro/larastan/pull/1392
    • @ariaieboy made their first contribution in https://github.com/nunomaduro/larastan/pull/1363

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.2.1...2.2.2

    Source code(tar.gz)
    Source code(zip)
  • 2.2.1(Oct 6, 2022)

    What's Changed

    • docs: help copy-pasters with configuration by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1347
    • Remove comments from test config by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1360
    • feat: run integration tests in Github Actions by @canvural in https://github.com/nunomaduro/larastan/pull/1358
    • chore: run integration tests parallel to normal tests by @canvural in https://github.com/nunomaduro/larastan/pull/1361
    • chore: add PSR-4 mapping check by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1356
    • Expand docblock of JoinSub to allow other models by @harmenjanssen in https://github.com/nunomaduro/larastan/pull/1352
    • feat:dont use ExtendedMethodReflection by @canvural in https://github.com/nunomaduro/larastan/pull/1389

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.2.0...2.2.1

    Source code(tar.gz)
    Source code(zip)
  • v2.2.0(Aug 31, 2022)

    2.2.0

    New rules 📏

    • Rules for unnecessary uses of with() and values() functions by @PrinsFrank in https://github.com/nunomaduro/larastan/pull/1226
    • Rule for missing 'provides' method in Deferrable ServiceProviders by @PrinsFrank in https://github.com/nunomaduro/larastan/pull/1262

    Improvements 🔧

    • Install fileinfo PHP extension by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1318
    • Configure Composer properly in CI by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1329
    • feat: conditional return type for Collection::random method by @canvural in https://github.com/nunomaduro/larastan/pull/1338
    • Remove all unnecessary method stubs for the Query Builder by @lupinitylabs in https://github.com/nunomaduro/larastan/pull/1343
    • feat: add ViewWithMethodsClassReflectionExtension by @canvural in https://github.com/nunomaduro/larastan/pull/1348

    Fixed 🐛

    • fix: use Composer autoloader to determine vendor-dir by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1319
    • fix: return correct types from model factories by @canvural in https://github.com/nunomaduro/larastan/pull/1339
    • fix: better return types for App::environment by @crissi in https://github.com/nunomaduro/larastan/pull/1303
    • fix: remove fromSub from stubs by @crissi in https://github.com/nunomaduro/larastan/pull/1340

    New Contributors

    • @crissi made their first contribution in https://github.com/nunomaduro/larastan/pull/1303
    • @lupinitylabs made their first contribution in https://github.com/nunomaduro/larastan/pull/1343

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.12...v2.2.0

    Source code(tar.gz)
    Source code(zip)
  • v2.1.12(Jul 17, 2022)

    What's Changed

    • fix: remove when and unless from EloquentBuilder stub by @canvural in https://github.com/nunomaduro/larastan/pull/1277
    • Run CI nightly by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1281
    • Update phpstan-dev.yml by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1283
    • fix: use composer/class-map-generator instead of copied class by @canvural in https://github.com/nunomaduro/larastan/pull/1288
    • [9.x] DOC BLOCK params fix on orderBy methods at Query Builder stub file by @hirenkeraliya in https://github.com/nunomaduro/larastan/pull/1291
    • Display matrix.dependencies in CI by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1297
    • feat: use correct builder return types for Model::newQuery* methods by @canvural in https://github.com/nunomaduro/larastan/pull/1299
    • Translation Helper with underscore function support by @niekbr in https://github.com/nunomaduro/larastan/pull/1296
    • fix: use ClosureTypeFactory to resolve default values for macros by @canvural in https://github.com/nunomaduro/larastan/pull/1295

    New Contributors

    • @hirenkeraliya made their first contribution in https://github.com/nunomaduro/larastan/pull/1291
    • @niekbr made their first contribution in https://github.com/nunomaduro/larastan/pull/1296

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.11...v2.1.12

    Source code(tar.gz)
    Source code(zip)
  • v2.1.11(Jun 13, 2022)

    What's changed?

    Fixed

    • Bumped minimum PHPStan version to 1.7.12

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.10...v2.1.11

    Source code(tar.gz)
    Source code(zip)
  • v2.1.10(Jun 9, 2022)

  • v2.1.9(Jun 9, 2022)

    What's Changed

    Fixed

    • fix: Type hinting for having() and orHaving() QueryBuilder methods by @Maxoulak in https://github.com/nunomaduro/larastan/pull/1258
    • Factory name is not correctly resolved when application namespace is empty by @BertvanHoekelen in https://github.com/nunomaduro/larastan/pull/1270

    Internal Changes

    • Fixed PHPStan 1.7.12 compatibility in https://github.com/nunomaduro/larastan/commit/d233e1c3efe5de35430f5b1b1ea3a5a545e4c966

    New Contributors

    • @Maxoulak made their first contribution in https://github.com/nunomaduro/larastan/pull/1258

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.8...v2.1.9

    Source code(tar.gz)
    Source code(zip)
  • v2.1.8(Jun 4, 2022)

    What's changed?

    Fixed

    • Don't use ReflectionClass directly https://github.com/nunomaduro/larastan/commit/2404fa8d9e27d726bb9e42ec754b323d6727bdfd
    • Don't try to invoke methods on classes https://github.com/nunomaduro/larastan/commit/2a0b2dade387bc19bdf070650c1ba1e035c709da

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.7...v2.1.8

    Source code(tar.gz)
    Source code(zip)
  • v2.1.7(Jun 3, 2022)

    What's Changed

    Added

    • Conditional return types to some global helper functions by @canvural in https://github.com/nunomaduro/larastan/pull/1260
    • Conditional return types for Conditionable trait by @canvural in https://github.com/nunomaduro/larastan/pull/1261
    • Conditional return type for Route::middleware by @canvural in https://github.com/nunomaduro/larastan/commit/0543c454896f07079d86145afbc318a947ee72c1

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.6...v2.1.7

    Source code(tar.gz)
    Source code(zip)
  • v2.1.6(May 23, 2022)

    Added

    • Increased minimum PHPStan version to 1.7.0

    For class alias errors please see https://github.com/nunomaduro/larastan/issues/1246#issuecomment-1135698009

    Source code(tar.gz)
    Source code(zip)
  • v2.1.5(May 23, 2022)

    What's Changed

    Added

    • feat: add dynamic return type extension for App::make by @PrinsFrank in https://github.com/nunomaduro/larastan/pull/1222
    • Improve DX: specify memory limits for tests (custom composer scripts) by @lptn in https://github.com/nunomaduro/larastan/pull/1220
    • Allow Builder-s in Builder::union* $query parameter by @fagai in https://github.com/nunomaduro/larastan/pull/1231
    • Added conditional return types by @ricklambrechts in https://github.com/nunomaduro/larastan/pull/1236
    • Add support for Storage::drive besides Storage::disk by @PrinsFrank in https://github.com/nunomaduro/larastan/pull/1241
    • Date type extension by @bastien-phi in https://github.com/nunomaduro/larastan/pull/1142

    Fixed

    • fix: typo in doc file name by @mnastalski in https://github.com/nunomaduro/larastan/pull/1208
    • fix: fix: change QueryBuilder::newQuery() @return from $this to static by @dotdash in https://github.com/nunomaduro/larastan/pull/1221
    • Update joinSub docblock by @harmenjanssen in https://github.com/nunomaduro/larastan/pull/1212
    • When unless void default by @BertvanHoekelen in https://github.com/nunomaduro/larastan/pull/1203
    • Fix Model property types by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1234

    New Contributors

    • @mnastalski made their first contribution in https://github.com/nunomaduro/larastan/pull/1208
    • @dotdash made their first contribution in https://github.com/nunomaduro/larastan/pull/1221
    • @PrinsFrank made their first contribution in https://github.com/nunomaduro/larastan/pull/1222
    • @harmenjanssen made their first contribution in https://github.com/nunomaduro/larastan/pull/1212
    • @lptn made their first contribution in https://github.com/nunomaduro/larastan/pull/1220
    • @fagai made their first contribution in https://github.com/nunomaduro/larastan/pull/1231
    • @ricklambrechts made their first contribution in https://github.com/nunomaduro/larastan/pull/1236

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.4...v2.1.5

    Source code(tar.gz)
    Source code(zip)
  • v2.1.4(Mar 30, 2022)

    What's Changed

    • feat: add cursorPaginate() support by @BramVanBerkel in https://github.com/nunomaduro/larastan/pull/1198
    • fix: inverted check in the ModelRuleHelper by @mad-briller in https://github.com/nunomaduro/larastan/pull/1207

    New Contributors

    • @BramVanBerkel made their first contribution in https://github.com/nunomaduro/larastan/pull/1198
    • @mad-briller made their first contribution in https://github.com/nunomaduro/larastan/pull/1207

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.3...v2.1.4

    Source code(tar.gz)
    Source code(zip)
  • v2.1.3(Mar 23, 2022)

    What's Changed

    Improvements

    • feat: add exact typehints for Model casts, hidden and visible properties by @Magiczne in https://github.com/nunomaduro/larastan/pull/1158
    • feat: support with in RelationExistenceRule by @canvural in https://github.com/nunomaduro/larastan/pull/1175
    • feat: update Eloquent Builder stubs to be more specific by @canvural in https://github.com/nunomaduro/larastan/pull/1178
    • Break long line in transformStaticParameters by @szepeviktor in https://github.com/nunomaduro/larastan/pull/1183
    • feat: improve model factory after* methods by @mdpoulter in https://github.com/nunomaduro/larastan/pull/1195

    Fixes

    • fix: use custom collection if it does not have template types by @canvural in https://github.com/nunomaduro/larastan/pull/1170
    • fix: ignore Model in ModelPropertyRule by @canvural in https://github.com/nunomaduro/larastan/pull/1184
    • fix: use TypeTraverser to handle Union and Intersection types in ModelRelationsExtension by @canvural in https://github.com/nunomaduro/larastan/pull/1187

    New Contributors

    • @Magiczne made their first contribution in https://github.com/nunomaduro/larastan/pull/1158
    • @mdpoulter made their first contribution in https://github.com/nunomaduro/larastan/pull/1195

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.2...v2.1.3

    Source code(tar.gz)
    Source code(zip)
  • v2.1.2(Mar 8, 2022)

    What's Changed

    • feat: support Laravel 9 style attribute accessors and mutators by @canvural in https://github.com/nunomaduro/larastan/pull/1156

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.1...v2.1.2

    Source code(tar.gz)
    Source code(zip)
  • v2.1.1(Mar 5, 2022)

    What's Changed

    • Use recent version of composer/pcre by @orkhanahmadov in https://github.com/nunomaduro/larastan/pull/1152
    • feat: add parsing of foreignId in migrations by @Riley19280 in https://github.com/nunomaduro/larastan/pull/1148

    New Contributors

    • @orkhanahmadov made their first contribution in https://github.com/nunomaduro/larastan/pull/1152
    • @Riley19280 made their first contribution in https://github.com/nunomaduro/larastan/pull/1148

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.1.0...v2.1.1

    Source code(tar.gz)
    Source code(zip)
  • v2.1.0(Mar 4, 2022)

    2.1.0

    This release adds the ability to infer model properties from schema dumps. You can try to remove your migrations and use just the dump files. Note: Currently only dumps that have MySQL and MariaDB syntax are supported. SQLite is partially supported. And PostgreSQL is not tested.

    Also this release introduces new config option called squashedMigrationsPath. You can read more about it here.

    What's Changed

    Added

    • feat: add return type support for $request->user() call by @canvural in https://github.com/nunomaduro/larastan/pull/1136
    • feat: schema dump parsing by @canvural in https://github.com/nunomaduro/larastan/pull/1147
    • feat: add support for migrations using Schema::connection by @canvural in https://github.com/nunomaduro/larastan/pull/1151

    Fixed

    • 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 https://github.com/nunomaduro/larastan/pull/1123
    • fix: update PHPStan version and stubs by @canvural in https://github.com/nunomaduro/larastan/pull/1144
    • fix: deleted_at column has date type rather than string by @totov in https://github.com/nunomaduro/larastan/pull/1124

    New Contributors

    • @gitetsu made their first contribution in https://github.com/nunomaduro/larastan/pull/1123
    • @totov made their first contribution in https://github.com/nunomaduro/larastan/pull/1124

    Full Changelog: https://github.com/nunomaduro/larastan/compare/v2.0.1...v2.1.0

    Source code(tar.gz)
    Source code(zip)
  • v2.0.1(Feb 9, 2022)

    What's Changed

    • fix: incorrect return type by route on Request class by @fragkp in https://github.com/nunomaduro/larastan/pull/1113
    • refactor: replace composer with copy of ClassMapGenerator by @canvural in https://github.com/nunomaduro/larastan/pull/1119

    Full Changelog: https://github.com/nunomaduro/larastan/compare/2.0.0...v2.0.1

    Source code(tar.gz)
    Source code(zip)
  • 2.0.0(Jan 26, 2022)

    Larastan 2.0.0 🎊

    Main reason we have a major version increase is we dropped support for Laravel versions older than 9. Because now all the Collection stubs Larastan had are moved to the Laravel core! And since we only support Laravel 9, minimum PHP version we require is now 8.

    Upgrade from Larastan 1.x should be straightforward. But be make sure you read the upgrade guide!

    Other notable changes

    • Infer type of model id without migrations by @sebdesign in https://github.com/nunomaduro/larastan/pull/1057
    • Enable Testbench package discovery by @mewejo in https://github.com/nunomaduro/larastan/pull/1093

    New Contributors

    • @mewejo made their first contribution in https://github.com/nunomaduro/larastan/pull/1093

    Full Changelog: https://github.com/nunomaduro/larastan/compare/1.0.3...2.0.0

    Source code(tar.gz)
    Source code(zip)
Owner
Nuno Maduro
Software engineer at @laravel — working on Laravel, Forge, and Vapor. Created @pestphp, @laravel-zero, collision, larastan, php insights, termwind, and more.
Nuno Maduro
WPForms coding standards are based on the WordPress Coding Standards and the PHPCompatibility Coding Standards and help create strict and high-quality code.

WPForms coding standards are based on the WordPress Coding Standards and the PHPCompatibility Coding Standards and help create strict and high-quality code.

Awesome Motive, Inc. 7 Nov 29, 2022
The SensioLabs DeprecationDetector runs a static code analysis against your project's source code to find usages of deprecated methods, classes and interfaces

SensioLabs DeprecationDetector CAUTION: This package is abandoned and will no longer receive any updates. The SensioLabs DeprecationDetector runs a st

QOSSMIC GmbH 389 Nov 24, 2022
Enhance product data quality and streamline content creation with the Pimcore and ChatGPT integration.

chatgpt-pimcore Enhance product data quality and streamline content creation with the Pimcore and ChatGPT integration. Overview The integration of Pim

Pravin chaudhary 6 Jun 5, 2023
PHP_Depend is an adaptation of the established Java development tool JDepend. This tool shows you the quality of your design in terms of extensibility, reusability and maintainability.

PHP Depend Documentation PHP Depend for enterprise Available as part of the Tidelift Subscription. The maintainers of PHP Depend and thousands of othe

PHP_Depend 837 Dec 14, 2022
Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files

Quality Hook Installer Install an execute script of specify quality tools to your git pre-commit hook, and it executes only for changed files Install

Kay W. 2 Dec 15, 2022
This package provides a wrapper for Google Lighthouse to audit the quality of web pages with Laravel.

laravel-google-lighthouse This package is based on octoper/lighthouse-php. This package provides a wrapper for Google Lighthouse to audit the quality

Logiek 5 Jun 1, 2022
Internal Quality Assurance Cell, IQAC Project Data Capturing System.

IQAC-DCS-2021 Added AQAR Directory with template pages! Old Readme Internal Quality Assurance Cell, IQAC Project Data Capturing System. Fork Repo Clon

Kashif Raza 4 Jan 4, 2022
The Barista explores every Latte (file) for strict quality, helps with Latte 2 to 3 upgrade

The Barista makes Your Perfectly Tasty Latte Do you drink Latte with your templates? Get it from Barista that knows his job: explore Latte via node vi

Tomas Votruba 5 Sep 7, 2022
Comprehensive Plugin for composer to execute PHP Quality assurance Tools

NOT MAINTANED ANYMORE The development of composer-plugin-qa was dropped in favor of phpqa which is actively maintained. The project use docker and can

Webysther Nunes 25 Apr 30, 2021
A pure PHP implementation of the open Language Server Protocol. Provides static code analysis for PHP for any IDE.

A pure PHP implementation of the open Language Server Protocol. Provides static code analysis for PHP for any IDE.

Felix Becker 1.1k Jan 4, 2023
Extension for PHPStan to allow analysis of Drupal code.

phpstan-drupal Extension for PHPStan to allow analysis of Drupal code. Sponsors Would you like to sponsor? Usage When you are using phpstan/extension-

Matt Glaman 154 Jan 2, 2023
Perform static analysis of Drupal PHP code with phpstan-drupal.

Perform static analysis of Drupal PHP code with PHPStan and PHPStan-Drupal on Drupal using PHP 8. For example: docker run --rm \ -v $(pwd)/example01

Dcycle 0 Dec 10, 2021
Developer-friendly framework heavily inspired by Laravel and based on Timber and Wpemerge solutions for WordPress themes development with Bedrock folder structure

Lightweight Brocooly (Brocket) Improved Controllers, Middleware and Routers, but slightly less powerful Container Open beta. Package in development Cr

Ihar Aliakseyenka 3 Mar 4, 2022
Collection of PHP functions, mini classes and snippets for everyday developer's routine life

JBZoo / Utils Collection of PHP functions, mini classes and snippets for everyday developer's routine life. Install composer require jbzoo/utils Usage

JBZoo Toolbox 776 Jun 2, 2022
PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP language

php-text-analysis PHP Text Analysis is a library for performing Information Retrieval (IR) and Natural Language Processing (NLP) tasks using the PHP l

null 464 Dec 28, 2022
Beautiful and understandable static analysis tool for PHP

PhpMetrics PhpMetrics provides metrics about PHP project and classes, with beautiful and readable HTML report. Documentation | Twitter | Contributing

PhpMetrics 2.3k Jan 5, 2023
Find undefined and unused variables with the PHP Codesniffer static analysis tool.

PHP_CodeSniffer VariableAnalysis Plugin for PHP_CodeSniffer static analysis tool that adds analysis of problematic variable use. Warns if variables ar

Payton Swick 116 Dec 14, 2022
This project is a microcosm of a system for booking doses, booking analysis, and consulting a doctor

About Laravel Laravel is a web application framework with expressive, elegant syntax. We believe development must be an enjoyable and creative experie

Abdelrahman Badawy 2 Dec 25, 2022
WooCommerce function and class declaration stubs for static analysis.

WooCommerce Stubs This package provides stub declarations for WooCommerce functions, classes and interfaces. These stubs can help plugin and theme dev

PHP Stubs Library 54 Dec 27, 2022