Skip to content

Commit

Permalink
Merge branch 'bump-dependencies' into no-lumen
Browse files Browse the repository at this point in the history
  • Loading branch information
alies-dev committed Mar 12, 2024
2 parents 701bc7f + b2a14b9 commit 17c9195
Show file tree
Hide file tree
Showing 5 changed files with 17 additions and 46 deletions.
18 changes: 11 additions & 7 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,23 @@ ________
[![Tests](https://github.com/psalm/psalm-plugin-laravel/actions/workflows/test-laravel.yml/badge.svg)](https://github.com/psalm/psalm-plugin-laravel/actions/workflows/test-laravel.yml)

## Overview
This [Psalm](https://github.com/vimeo/psalm) plugin brings static analysis and type support to projects using Laravel. Our goal is to find as many type-related
bugs as possible, therefore increasing developer productivity and application health. Find bugs without the overhead
of writing tests!
This [Psalm](https://github.com/vimeo/psalm) plugin brings static analysis and type support to projects using Laravel.
Our goal is to find as many type-related bugs as possible, therefore increasing developer productivity and application health.
Find bugs without the overhead of writing tests!

![Screenshot](/assets/screenshot.png)


## Versions & Dependencies

| Laravel Psalm Plugin | PHP | Laravel | Psalm |
|----------------------|-------|--------------|-------|
| 2.x | ^8.0 | 8, 9, 10, 11 | 4, 5 |
| 1.x | ^7.1 | 5, 6, 7, 8 | 3, 4 |
| Laravel Psalm Plugin | PHP | Laravel | Psalm |
|----------------------|------|------------|-------|
| 2.10+ | ^8.1 | 10, 11 | 5 |
| 2.9.x | ^8.0 | 9, 10, 11 | 4, 5 |
| 2.7-2.8 | ^8.0 | 9, 10 | 4, 5 |
| 2.1-2.6 | ^8.0 | 9 | 4, 5 |
| 2.0.x | ^8.0 | 8, 9 | 4, 5 |
| 1.x | ^7.1 | 5, 6, 7, 8 | 3, 4 |

See [releases](https://github.com/psalm/psalm-plugin-laravel/releases) for more details about supported PHP, Laravel and Psalm versions.

Expand Down
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -26,7 +26,7 @@
"nikic/php-parser": "^4.18 || ^5.0",
"orchestra/testbench": "^7.40 || ^8.21 || ^9.0",
"symfony/console": "^6.0 || ^7.0",
"vimeo/psalm": "^4.30 || ^5.23"
"vimeo/psalm": "^5.20"
},
"require-dev": {
"codeception/codeception": "^5.0",
Expand Down
20 changes: 1 addition & 19 deletions tests/Acceptance/acceptance/EloquentBuilderTypes.feature
Original file line number Diff line number Diff line change
Expand Up @@ -208,7 +208,7 @@ Feature: Eloquent Builder types
When I run Psalm
Then I see no errors

Scenario: can not call whereDate with incompatible type [ Psalm 5 ]
Scenario: can not call whereDate with incompatible type
Given I have the following code
"""
/**
Expand All @@ -219,29 +219,11 @@ Feature: Eloquent Builder types
return $builder->whereDate('created_at', '>', 1);
}
"""
And I have Psalm newer than "5.0" (because of "changed issue type")
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidArgument | Argument 3 of Illuminate\Database\Eloquent\Builder::whereDate expects DateTimeInterface\|null\|string, but 1 provided |

Scenario: can not call whereDate with incompatible type [ Psalm 4 ]
Given I have the following code
"""
/**
* @psalm-param Builder $builder
* @psalm-return Builder
*/
function test_whereDateWithInt(Builder $builder): Builder {
return $builder->whereDate('created_at', '>', 1);
}
"""
And I have Psalm older than "5.0.0" (because of "changed issue type")
When I run Psalm
Then I see these errors
| Type | Message |
| InvalidScalarArgument | Argument 3 of Illuminate\Database\Eloquent\Builder::whereDate expects DateTimeInterface\|null\|string, but 1 provided |

Scenario: can call count on the builder instance
Given I have the following code
"""
Expand Down
17 changes: 2 additions & 15 deletions tests/Acceptance/acceptance/FoundationHelpers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -56,25 +56,13 @@ Feature: Foundation helpers
When I run Psalm
Then I see no errors

Scenario: app() support: env can be pulled off the app [ Psalm <5.20 ]
Scenario: app() support: env can be pulled off the app
Given I have the following code
"""
if (app()->environment('production')) {
// do something
}
"""
And I have Psalm older than "5.20.0" (because of "changed issue type")
When I run Psalm
Then I see no errors

Scenario: app() support: env can be pulled off the app [ Psalm >5.20 ]
Given I have the following code
"""
if (app()->environment('production')) {
// do something
}
"""
And I have Psalm newer than "5.20.0" (because of "changed issue type")
When I run Psalm
Then I see these errors
| Type | Message |
Expand Down Expand Up @@ -201,15 +189,14 @@ Feature: Foundation helpers
When I run Psalm
Then I see no errors

Scenario: precognitive() support [ Psalm 5 ]
Scenario: precognitive() support
Given I have the following code
"""
$payload = precognitive(function () {
return ['foo' => 'bar'];
});
/** @psalm-check-type $payload = array{'foo': 'bar'} */
"""
And I have Psalm newer than "5.0" (because of "new psalm-check-type syntax")
When I run Psalm
Then I see no errors

Expand Down
6 changes: 2 additions & 4 deletions tests/Acceptance/acceptance/PathHelpers.feature
Original file line number Diff line number Diff line change
Expand Up @@ -111,13 +111,12 @@ Feature: Path helpers
| Type | Message |
| MissingFile | Cannot find file |

Scenario: public path can be resolved from application instance [ Psalm 5 ]
Scenario: public path can be resolved from application instance
Given I have the following code
"""
/** @psalm-check-type $path = string */
$path = app()->make('path.public');
"""
And I have Psalm newer than "5.0" (because of "new psalm-check-type syntax")
When I run Psalm
Then I see no errors

Expand Down Expand Up @@ -151,12 +150,11 @@ Feature: Path helpers
| Type | Message |
| MissingFile | Cannot find file |

Scenario: storage path can be resolved from application instance [ Psalm 5 ]
Scenario: storage path can be resolved from application instance
Given I have the following code
"""
/** @psalm-check-type $path = string */
$path = app()->make('path.storage');
"""
And I have Psalm newer than "5.0" (because of "new psalm-check-type syntax")
When I run Psalm
Then I see no errors

0 comments on commit 17c9195

Please sign in to comment.