Merge branch 'master' into laravel-9

This commit is contained in:
Niels Vanpachtenbeke 2022-03-21 09:06:21 +01:00 committed by GitHub
commit ce996c6dd6
No known key found for this signature in database
GPG Key ID: 4AEE18F83AFDEB23
31 changed files with 105 additions and 33 deletions

15
.editorconfig Normal file
View File

@ -0,0 +1,15 @@
root = true
[*]
charset = utf-8
indent_size = 4
indent_style = space
end_of_line = lf
insert_final_newline = true
trim_trailing_whitespace = true
[*.md]
trim_trailing_whitespace = false
[*.{yml,yaml}]
indent_size = 2

14
.gitattributes vendored Normal file
View File

@ -0,0 +1,14 @@
# Path-based git attributes
# https://www.kernel.org/pub/software/scm/git/docs/gitattributes.html
# Ignore all test and documentation with "export-ignore".
/.github export-ignore
/.gitattributes export-ignore
/.gitignore export-ignore
/tests export-ignore
/.editorconfig export-ignore
/.php_cs.xml export-ignore
/codeception.yml export-ignore
/psalm.xml export-ignore
/psalm-baseline.xml export-ignore
/UPGRADING.md export-ignore

View File

@ -9,8 +9,6 @@ jobs:
steps:
- name: Checkout code
uses: actions/checkout@v2
with:
ref: ${{ github.head_ref }}
- name: Setup PHP
uses: shivammathur/setup-php@v2

View File

@ -1,5 +1,7 @@
<?xml version="1.0"?>
<psalm
errorLevel="2"
reportMixedIssues="false"
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xmlns="https://getpsalm.org/schema/config"
xsi:schemaLocation="https://getpsalm.org/schema/config"

View File

@ -23,6 +23,12 @@ class SchemaAggregator
foreach ($stmts as $stmt) {
if ($stmt instanceof PhpParser\Node\Stmt\Class_) {
$this->addClassStatements($stmt->stmts);
} elseif (
$stmt instanceof PhpParser\Node\Stmt\Return_ &&
$stmt->expr instanceof PhpParser\Node\Expr\New_ &&
$stmt->expr->class instanceof PhpParser\Node\Stmt\Class_
) {
$this->addClassStatements($stmt->expr->class->stmts);
}
}
}

View File

@ -52,6 +52,7 @@ final class ApplicationProvider
}
if (file_exists($applicationPath = __DIR__ . '/../../../../bootstrap/app.php')) { // Applications
/** @psalm-suppress MissingFile file is checked for existence */
$app = require $applicationPath;
} elseif (file_exists($applicationPath = getcwd() . '/bootstrap/app.php')) { // Local Dev
$app = require $applicationPath;

View File

@ -5,7 +5,7 @@ Feature: abort_if()
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Collection types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Console Command types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Container
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: DB facade alias
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="false">
<psalm errorLevel="2" reportMixedIssues="false">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Database Builder types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Eloquent Builder types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Eloquent Collection types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Eloquent Model property types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true" usePhpDocPropertiesWithoutMagicCall="true">
<psalm errorLevel="1" usePhpDocPropertiesWithoutMagicCall="true">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Eloquent Model types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Eloquent Relation types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: ExceptionHandler
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: factory()
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -3,7 +3,7 @@ Feature: helpers
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Http FormRequest types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Http Resource types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -6,7 +6,7 @@ Feature: Notification types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Path helpers
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: redirect()
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: Request types
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="false">
<psalm errorLevel="2" reportMixedIssues="false">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: response()
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -5,7 +5,7 @@ Feature: url()
Given I have the following config
"""
<?xml version="1.0"?>
<psalm totallyTyped="true">
<psalm errorLevel="1">
<projectFiles>
<directory name="."/>
<ignoreFiles> <directory name="../../vendor"/> </ignoreFiles>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69">
<files psalm-version="4.20.0@f82a70e7edfc6cf2705e9374c8a0b6a974a779ed">
<file src="app/Broadcasting/ExampleChannel.php">
<InvalidReturnType occurrences="1">
<code>array|bool</code>
@ -37,14 +37,41 @@
<code>ExampleController</code>
</UnusedClass>
</file>
<file src="app/Http/Kernel.php">
<NonInvariantDocblockPropertyType occurrences="3">
<code>$middleware</code>
<code>$middlewareGroups</code>
<code>$routeMiddleware</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Middleware/EncryptCookies.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$except</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Middleware/ExampleMiddleware.php">
<UnusedClass occurrences="1">
<code>ExampleMiddleware</code>
</UnusedClass>
</file>
<file src="app/Http/Middleware/PreventRequestsDuringMaintenance.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$except</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Middleware/TrimStrings.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$except</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Middleware/TrustProxies.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$headers</code>
<code>$proxies</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Middleware/VerifyCsrfToken.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$except</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Http/Requests/ExampleRequest.php">
@ -63,8 +90,10 @@
</UnusedClass>
</file>
<file src="app/Models/User.php">
<NonInvariantDocblockPropertyType occurrences="1">
<NonInvariantDocblockPropertyType occurrences="3">
<code>$casts</code>
<code>$fillable</code>
<code>$hidden</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Observers/ExampleObserver.php">
@ -77,6 +106,16 @@
<code>ExamplePolicy</code>
</UnusedClass>
</file>
<file src="app/Providers/AuthServiceProvider.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$policies</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Providers/EventServiceProvider.php">
<NonInvariantDocblockPropertyType occurrences="1">
<code>$listen</code>
</NonInvariantDocblockPropertyType>
</file>
<file src="app/Providers/ExampleProvider.php">
<UnusedClass occurrences="1">
<code>ExampleProvider</code>

View File

@ -1,5 +1,5 @@
<?xml version="1.0" encoding="UTF-8"?>
<files psalm-version="4.8.1@f73f2299dbc59a3e6c4d66cff4605176e728ee69">
<files psalm-version="4.20.0@f82a70e7edfc6cf2705e9374c8a0b6a974a779ed">
<file src="app/Console/Kernel.php">
<PropertyNotSetInConstructor occurrences="1">
<code>Kernel</code>
@ -29,9 +29,6 @@
</UnusedClass>
</file>
<file src="app/Jobs/ExampleJob.php">
<PropertyNotSetInConstructor occurrences="1">
<code>ExampleJob</code>
</PropertyNotSetInConstructor>
<UnusedClass occurrences="1">
<code>ExampleJob</code>
</UnusedClass>

View File

@ -6,12 +6,12 @@ echo "Cleaning Up"
rm -rf ../lumen/
echo "Installing Lumen"
composer create-project --quiet --prefer-dist "laravel/lumen" ../lumen
composer create-project laravel/lumen ../lumen 8.* --quiet --prefer-dist
cd ../lumen/
echo "Adding package from source"
sed -e 's|"type": "project",|&"repositories": [ { "type": "path", "url": "../psalm-plugin-laravel" } ],|' -i composer.json
COMPOSER_MEMORY_LIMIT=-1 composer require --dev "psalm/plugin-laravel:*"
COMPOSER_MEMORY_LIMIT=-1 composer require --dev "psalm/plugin-laravel:*" -W
echo "Analyzing Lumen"
./vendor/bin/psalm -c ../psalm-plugin-laravel/tests/lumen-test-psalm.xml