mirror of
https://github.com/barryvdh/laravel-ide-helper.git
synced 2026-08-18 18:13:11 +00:00
Compare commits
| Author | SHA1 | Date | |
|---|---|---|---|
|
|
64a6b90258 | ||
|
|
25cc68c75f | ||
|
|
36c4406b3a | ||
|
|
9ba2f5c557 | ||
|
|
5515cabea3 | ||
|
|
9859958cfa | ||
|
|
ae5d7708b7 | ||
|
|
113545bc1a | ||
|
|
ff54a20d21 | ||
|
|
db53e8e2b5 | ||
|
|
b3a79fe6c1 | ||
|
|
b4138e5122 | ||
|
|
c4d1f780b0 | ||
|
|
317889805b | ||
|
|
ca0cf7355a | ||
|
|
336ae44ef2 | ||
|
|
0168e7256b | ||
|
|
1044f466e9 | ||
|
|
fd4d280a80 | ||
|
|
2ff9672a49 | ||
|
|
00ee13e0cf | ||
|
|
4ef3876b94 | ||
|
|
5db6029f2c | ||
|
|
2a3c7fb087 | ||
|
|
b677af89c2 | ||
|
|
594534ec5a | ||
|
|
7305504c99 | ||
|
|
186340bedc | ||
|
|
4aa2e6a576 | ||
|
|
9baf93a502 |
@@ -0,0 +1,24 @@
|
|||||||
|
---
|
||||||
|
name: "🐛 Bug Report"
|
||||||
|
about: 'Report a general bug.'
|
||||||
|
labels: bug
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Versions:
|
||||||
|
- ide-helper Version: #.#.#
|
||||||
|
- Laravel Version: #.#.# <!-- remove if not applicable -->
|
||||||
|
- Lumen Version: #.#.# <!-- remove if not applicable -->
|
||||||
|
- PHP Version: #.#.#
|
||||||
|
|
||||||
|
### Description:
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Please describe in detail the nature of the bug, code samples, etc.
|
||||||
|
|
||||||
|
The more, the better.
|
||||||
|
-->
|
||||||
|
|
||||||
|
### Steps To Reproduce:
|
||||||
|
|
||||||
|
- …
|
||||||
@@ -0,0 +1,12 @@
|
|||||||
|
---
|
||||||
|
name: "✨ Feature request"
|
||||||
|
about: 'Suggest a new feature or other improvements.'
|
||||||
|
labels: enhancement
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Summary
|
||||||
|
|
||||||
|
<!--
|
||||||
|
Describe in detail what you propose, show (preferable) code examples and also signal if you're willing to work on it!
|
||||||
|
-->
|
||||||
@@ -0,0 +1,15 @@
|
|||||||
|
---
|
||||||
|
name: "🙋🏼♂️ Support question"
|
||||||
|
about: 'I need assistance or clarification on usage of this library.'
|
||||||
|
labels: question
|
||||||
|
|
||||||
|
---
|
||||||
|
|
||||||
|
### Versions:
|
||||||
|
- ide-helper Version: #.#.#
|
||||||
|
- Laravel Version: #.#.# <!-- remove if not applicable -->
|
||||||
|
- Lumen Version: #.#.# <!-- remove if not applicable -->
|
||||||
|
- PHP Version: #.#.#
|
||||||
|
|
||||||
|
### Question:
|
||||||
|
|
||||||
@@ -0,0 +1,18 @@
|
|||||||
|
## Summary
|
||||||
|
<!-- Please provide an exhaustive description. -->
|
||||||
|
|
||||||
|
## Type of change
|
||||||
|
|
||||||
|
<!-- Please delete options that are not relevant. -->
|
||||||
|
|
||||||
|
- [ ] Bug fix (non-breaking change which fixes an issue)
|
||||||
|
- [ ] New feature (non-breaking change which adds functionality)
|
||||||
|
- [ ] Breaking change (fix or feature that would cause existing functionality to not work as expected)
|
||||||
|
- [ ] This change requires a documentation update
|
||||||
|
- [ ] Misc. change (internal, infrastructure, maintenance, etc.)
|
||||||
|
|
||||||
|
### Checklist
|
||||||
|
- [ ] Existing tests have been adapted and/or new tests have been added
|
||||||
|
- [ ] Add a CHANGELOG.md entry
|
||||||
|
- [ ] Update the README.md
|
||||||
|
- [ ] Code style has been fixed via `composer fix-style`
|
||||||
@@ -8,7 +8,7 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
normalize:
|
normalize:
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
steps:
|
steps:
|
||||||
- name: Git checkout
|
- name: Git checkout
|
||||||
uses: actions/checkout@v2
|
uses: actions/checkout@v2
|
||||||
|
|||||||
@@ -7,7 +7,7 @@ jobs:
|
|||||||
fix-style:
|
fix-style:
|
||||||
name: Fix Code Style
|
name: Fix Code Style
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
env:
|
env:
|
||||||
COMPOSER_NO_INTERACTION: 1
|
COMPOSER_NO_INTERACTION: 1
|
||||||
|
|
||||||
@@ -20,7 +20,6 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: 7.4
|
php-version: 7.4
|
||||||
coverage: none
|
coverage: none
|
||||||
tools: composer:v2
|
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer update --prefer-dist --no-progress
|
run: composer update --prefer-dist --no-progress
|
||||||
|
|||||||
@@ -0,0 +1,122 @@
|
|||||||
|
name: Integration Tests
|
||||||
|
|
||||||
|
on:
|
||||||
|
push:
|
||||||
|
branches:
|
||||||
|
- master
|
||||||
|
pull_request:
|
||||||
|
branches:
|
||||||
|
- "*"
|
||||||
|
schedule:
|
||||||
|
- cron: '0 0 * * *'
|
||||||
|
|
||||||
|
jobs:
|
||||||
|
php-lumen-integration-tests:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
timeout-minutes: 15
|
||||||
|
env:
|
||||||
|
COMPOSER_NO_INTERACTION: 1
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php: [8.0, 7.4, 7.3]
|
||||||
|
lumen: [8.*]
|
||||||
|
name: P${{ matrix.php }} - Lumen${{ matrix.lumen }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php }}
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer create-project --prefer-dist laravel/lumen:${{ matrix.lumen }} --no-progress sample
|
||||||
|
cd sample
|
||||||
|
composer require "league/flysystem:^1" --no-update --no-progress
|
||||||
|
composer update --prefer-stable --prefer-dist --no-progress
|
||||||
|
|
||||||
|
- name: Add package from source
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../src" } ],|' -i composer.json
|
||||||
|
composer require --dev "barryvdh/laravel-ide-helper:*"
|
||||||
|
|
||||||
|
- name: Insert service provider
|
||||||
|
run: sed -e 's|// \$app->register(App\\\Providers\\\EventServiceProvider::class);|&\n$app->register(\\Barryvdh\\LaravelIdeHelper\\IdeHelperServiceProvider::class);|' -i sample/bootstrap/app.php
|
||||||
|
|
||||||
|
- name: Execute generate run
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
php artisan ide-helper:generate
|
||||||
|
|
||||||
|
- name: Execute meta run
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
php artisan ide-helper:meta
|
||||||
|
|
||||||
|
- name: Check file existence
|
||||||
|
run: |
|
||||||
|
ls sample/_ide_helper.php
|
||||||
|
ls sample/.phpstorm.meta.php
|
||||||
|
|
||||||
|
- name: Check file count in logs
|
||||||
|
run: |
|
||||||
|
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi
|
||||||
|
|
||||||
|
php-laravel-integration-tests:
|
||||||
|
runs-on: ubuntu-20.04
|
||||||
|
timeout-minutes: 15
|
||||||
|
env:
|
||||||
|
COMPOSER_NO_INTERACTION: 1
|
||||||
|
strategy:
|
||||||
|
matrix:
|
||||||
|
php: [8.0, 7.4, 7.3]
|
||||||
|
laravel: [8.*]
|
||||||
|
name: P${{ matrix.php }} - Laravel${{ matrix.laravel }}
|
||||||
|
steps:
|
||||||
|
- name: Checkout code
|
||||||
|
uses: actions/checkout@v2
|
||||||
|
with:
|
||||||
|
path: src
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: ${{ matrix.php }}
|
||||||
|
coverage: none
|
||||||
|
|
||||||
|
- name: Install dependencies
|
||||||
|
run: |
|
||||||
|
composer create-project --prefer-dist laravel/laravel:${{ matrix.laravel }} --no-progress sample
|
||||||
|
cd sample
|
||||||
|
composer update --prefer-stable --prefer-dist --no-progress
|
||||||
|
|
||||||
|
- name: Add package from source
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
sed -e 's|"type": "project",|&\n"repositories": [ { "type": "path", "url": "../src" } ],|' -i composer.json
|
||||||
|
composer require --dev "barryvdh/laravel-ide-helper:*"
|
||||||
|
|
||||||
|
- name: Execute generate run
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
php artisan ide-helper:generate
|
||||||
|
|
||||||
|
- name: Execute meta run
|
||||||
|
run: |
|
||||||
|
cd sample
|
||||||
|
php artisan ide-helper:meta
|
||||||
|
|
||||||
|
- name: Check file existence
|
||||||
|
run: |
|
||||||
|
ls sample/_ide_helper.php
|
||||||
|
ls sample/.phpstorm.meta.php
|
||||||
|
|
||||||
|
- name: Check file count in logs
|
||||||
|
run: |
|
||||||
|
if [ `ls -1q "sample/storage/logs/" | wc -l` -gt 0 ];then exit 1;fi
|
||||||
@@ -9,11 +9,18 @@ on:
|
|||||||
jobs:
|
jobs:
|
||||||
build:
|
build:
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
|
|
||||||
steps:
|
steps:
|
||||||
- uses: actions/checkout@v2
|
- uses: actions/checkout@v2
|
||||||
|
|
||||||
|
- name: Setup PHP
|
||||||
|
uses: shivammathur/setup-php@v2
|
||||||
|
with:
|
||||||
|
php-version: 7.4
|
||||||
|
coverage: none
|
||||||
|
extensions: pdo_sqlite
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: composer install --prefer-dist --no-progress --no-suggest
|
run: composer install --prefer-dist --no-progress --no-suggest
|
||||||
|
|
||||||
|
|||||||
@@ -12,19 +12,19 @@ on:
|
|||||||
|
|
||||||
jobs:
|
jobs:
|
||||||
php-tests:
|
php-tests:
|
||||||
runs-on: ubuntu-latest
|
runs-on: ubuntu-20.04
|
||||||
timeout-minutes: 15
|
timeout-minutes: 15
|
||||||
env:
|
env:
|
||||||
COMPOSER_NO_INTERACTION: 1
|
COMPOSER_NO_INTERACTION: 1
|
||||||
|
|
||||||
strategy:
|
strategy:
|
||||||
matrix:
|
matrix:
|
||||||
php: [7.4, 7.3, 7.2]
|
php: [8.0, 7.4, 7.3]
|
||||||
laravel: [8.*, 7.*, 6.*]
|
laravel: [8.*]
|
||||||
dependency-version: [prefer-lowest, prefer-stable]
|
dependency-version: [prefer-lowest, prefer-stable]
|
||||||
exclude:
|
exclude:
|
||||||
- laravel: 8.*
|
- php: 8.0
|
||||||
php: 7.2
|
dependency-version: prefer-lowest
|
||||||
|
|
||||||
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
|
name: P${{ matrix.php }} - L${{ matrix.laravel }} - ${{ matrix.dependency-version }}
|
||||||
|
|
||||||
@@ -37,11 +37,12 @@ jobs:
|
|||||||
with:
|
with:
|
||||||
php-version: ${{ matrix.php }}
|
php-version: ${{ matrix.php }}
|
||||||
coverage: none
|
coverage: none
|
||||||
tools: composer:v2
|
extensions: pdo_sqlite
|
||||||
|
|
||||||
- name: Install dependencies
|
- name: Install dependencies
|
||||||
run: |
|
run: |
|
||||||
composer remove vimeo/psalm --no-update --dev
|
composer remove vimeo/psalm --no-update --dev
|
||||||
|
composer remove friendsofphp/php-cs-fixer --no-update --dev
|
||||||
composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress
|
composer require "laravel/framework:${{ matrix.laravel }}" --no-update --no-progress
|
||||||
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
|
composer update --${{ matrix.dependency-version }} --prefer-dist --no-progress
|
||||||
|
|
||||||
|
|||||||
+24
-1
@@ -2,8 +2,31 @@
|
|||||||
|
|
||||||
All notable changes to this project will be documented in this file.
|
All notable changes to this project will be documented in this file.
|
||||||
|
|
||||||
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.8.0...master)
|
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.8.1...master)
|
||||||
--------------
|
--------------
|
||||||
|
### Changed
|
||||||
|
- Dropped support for Laravel 6 and Laravel 7, as well as support for PHP 7.2 [\# / mfn]()
|
||||||
|
|
||||||
|
### Added
|
||||||
|
- Fix phpdoc generate for custom cast with parameter [\#986 / artelkr](https://github.com/barryvdh/laravel-ide-helper/pull/986)
|
||||||
|
- Created a possibility to add custom relation type [\#987 / efinder2](https://github.com/barryvdh/laravel-ide-helper/pull/987)
|
||||||
|
- Added `@see` with macro/mixin definition location to PhpDoc [\#1054 / riesjart](https://github.com/barryvdh/laravel-ide-helper/pull/1054)
|
||||||
|
- Initial compatibility for PHP8 [\#1106 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1106)
|
||||||
|
|
||||||
|
### Changed
|
||||||
|
- Implement DeferrableProvider [\#914 / kon-shou](https://github.com/barryvdh/laravel-ide-helper/pull/914)
|
||||||
|
|
||||||
|
### Fixed
|
||||||
|
- Compatibility with Lumen [\#1043 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1043)
|
||||||
|
- Allow model_locations to have glob patterns [\#1059 / saackearl](https://github.com/barryvdh/laravel-ide-helper/pull/1059)
|
||||||
|
- Error when generating helper for macroable classes which are not facades and contain a "fake" method [\#1066 / domkrm] (https://github.com/barryvdh/laravel-ide-helper/pull/1066)
|
||||||
|
- Casts with a return type of `static` or `$this` now resolve to an instance of the cast [\#1103 / riesjart](https://github.com/barryvdh/laravel-ide-helper/pull/1103)
|
||||||
|
|
||||||
|
### Removed
|
||||||
|
- Removed format and broken generateJsonHelper [\#1053 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1053)
|
||||||
|
|
||||||
|
2020-09-07, 2.8.1
|
||||||
|
-----------------
|
||||||
### Added
|
### Added
|
||||||
- Support Laravel 8 [\#1022 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1022)
|
- Support Laravel 8 [\#1022 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1022)
|
||||||
- Add option to force usage of FQN [\#1031 / edvordo](https://github.com/barryvdh/laravel-ide-helper/pull/1031)
|
- Add option to force usage of FQN [\#1031 / edvordo](https://github.com/barryvdh/laravel-ide-helper/pull/1031)
|
||||||
|
|||||||
@@ -216,6 +216,13 @@ You may use the [`::withCount`](https://laravel.com/docs/master/eloquent-relatio
|
|||||||
|
|
||||||
By default, these attributes are generated in the phpdoc. You can turn them off by setting the config `write_model_relation_count_properties` to `false`.
|
By default, these attributes are generated in the phpdoc. You can turn them off by setting the config `write_model_relation_count_properties` to `false`.
|
||||||
|
|
||||||
|
#### Dedicated Eloquent Builder methods
|
||||||
|
|
||||||
|
A new method to the eloquent models was added called `newEloquentBuilder` [Reference](https://timacdonald.me/dedicated-eloquent-model-query-builders/) where we can
|
||||||
|
add support for creating a new dedicated class instead of using local scopes in the model itself.
|
||||||
|
|
||||||
|
If for some reason it's undesired to have them generated (one for each column), you can disable this via config `write_model_external_builder_methods` and setting it to `false`.
|
||||||
|
|
||||||
#### Unsupported or custom database types
|
#### Unsupported or custom database types
|
||||||
|
|
||||||
Common column types (e.g. varchar, integer) are correctly mapped to PHP types (`string`, `int`).
|
Common column types (e.g. varchar, integer) are correctly mapped to PHP types (`string`, `int`).
|
||||||
@@ -256,6 +263,7 @@ Then run `php artisan ide-helper:generate`, you will now see all Fluent methods
|
|||||||
|
|
||||||
If you would like the `factory()->create()` and `factory()->make()` methods to return the correct model class,
|
If you would like the `factory()->create()` and `factory()->make()` methods to return the correct model class,
|
||||||
you can enable custom factory builders with the `include_factory_builders` line your `config/ide-helper.php` file.
|
you can enable custom factory builders with the `include_factory_builders` line your `config/ide-helper.php` file.
|
||||||
|
Deprecated for Laravel 8 or latest.
|
||||||
|
|
||||||
```php
|
```php
|
||||||
'include_factory_builders' => true,
|
'include_factory_builders' => true,
|
||||||
|
|||||||
+14
-12
@@ -20,24 +20,25 @@
|
|||||||
}
|
}
|
||||||
],
|
],
|
||||||
"require": {
|
"require": {
|
||||||
"php": ">=7.2",
|
"php": "^7.3 || ^8.0",
|
||||||
"ext-json": "*",
|
"ext-json": "*",
|
||||||
"barryvdh/reflection-docblock": "^2.0.6",
|
"barryvdh/reflection-docblock": "^2.0.6",
|
||||||
"composer/composer": "^1.6 || ^2.0@dev",
|
"composer/composer": "^1.6 || ^2",
|
||||||
"doctrine/dbal": "~2.3",
|
"doctrine/dbal": "^2.6 || ^3",
|
||||||
"illuminate/console": "^6 || ^7 || ^8",
|
"illuminate/console": "^8",
|
||||||
"illuminate/filesystem": "^6 || ^7 || ^8",
|
"illuminate/filesystem": "^8",
|
||||||
"illuminate/support": "^6 || ^7 || ^8",
|
"illuminate/support": "^8",
|
||||||
"phpdocumentor/type-resolver": "^1.1.0"
|
"phpdocumentor/type-resolver": "^1.1.0"
|
||||||
},
|
},
|
||||||
"require-dev": {
|
"require-dev": {
|
||||||
|
"ext-pdo_sqlite": "*",
|
||||||
"friendsofphp/php-cs-fixer": "^2",
|
"friendsofphp/php-cs-fixer": "^2",
|
||||||
"illuminate/config": "^6 || ^7 || ^8",
|
"illuminate/config": "^8",
|
||||||
"illuminate/view": "^6 || ^7 || ^8",
|
"illuminate/view": "^8",
|
||||||
"mockery/mockery": "^1.3",
|
"mockery/mockery": "^1.4",
|
||||||
"orchestra/testbench": "^4 || ^5 || ^6",
|
"orchestra/testbench": "^6",
|
||||||
"phpunit/phpunit": "^8.5 || ^9",
|
"phpunit/phpunit": "^8.5 || ^9",
|
||||||
"spatie/phpunit-snapshot-assertions": "^1.4 || ^2.2 || ^3",
|
"spatie/phpunit-snapshot-assertions": "^3 || ^4",
|
||||||
"vimeo/psalm": "^3.12"
|
"vimeo/psalm": "^3.12"
|
||||||
},
|
},
|
||||||
"config": {
|
"config": {
|
||||||
@@ -45,7 +46,7 @@
|
|||||||
},
|
},
|
||||||
"extra": {
|
"extra": {
|
||||||
"branch-alias": {
|
"branch-alias": {
|
||||||
"dev-master": "2.8-dev"
|
"dev-master": "2.9-dev"
|
||||||
},
|
},
|
||||||
"laravel": {
|
"laravel": {
|
||||||
"providers": [
|
"providers": [
|
||||||
@@ -75,6 +76,7 @@
|
|||||||
"php-cs-fixer fix",
|
"php-cs-fixer fix",
|
||||||
"php-cs-fixer fix --config=.php_cs.tests.php"
|
"php-cs-fixer fix --config=.php_cs.tests.php"
|
||||||
],
|
],
|
||||||
|
"psalm-set-baseline": "psalm --set-baseline=psalm-baseline.xml",
|
||||||
"test": "phpunit",
|
"test": "phpunit",
|
||||||
"test-ci": "phpunit -d --without-creating-snapshots",
|
"test-ci": "phpunit -d --without-creating-snapshots",
|
||||||
"test-regenerate": "phpunit -d --update-snapshots"
|
"test-regenerate": "phpunit -d --update-snapshots"
|
||||||
|
|||||||
+28
-3
@@ -7,12 +7,11 @@ return [
|
|||||||
| Filename & Format
|
| Filename & Format
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
|
||||||
| The default filename (without extension) and the format (php or json)
|
| The default filename
|
||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'filename' => '_ide_helper',
|
'filename' => '_ide_helper.php',
|
||||||
'format' => 'php',
|
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
@@ -45,6 +44,8 @@ return [
|
|||||||
| Set to true to generate factory generators for better factory()
|
| Set to true to generate factory generators for better factory()
|
||||||
| method auto-completion.
|
| method auto-completion.
|
||||||
|
|
|
|
||||||
|
| Deprecated for Laravel 8 or latest.
|
||||||
|
|
|
||||||
*/
|
*/
|
||||||
|
|
||||||
'include_factory_builders' => false,
|
'include_factory_builders' => false,
|
||||||
@@ -60,6 +61,17 @@ return [
|
|||||||
|
|
||||||
'write_model_magic_where' => true,
|
'write_model_magic_where' => true,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Write Model External Eloquent Builder methods
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Set to false to disable write external eloquent builder methods
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
|
||||||
|
'write_model_external_builder_methods' => true,
|
||||||
|
|
||||||
/*
|
/*
|
||||||
|--------------------------------------------------------------------------
|
|--------------------------------------------------------------------------
|
||||||
| Write Model relation count properties
|
| Write Model relation count properties
|
||||||
@@ -253,4 +265,17 @@ return [
|
|||||||
|
|
|
|
||||||
*/
|
*/
|
||||||
'force_fqn' => false,
|
'force_fqn' => false,
|
||||||
|
|
||||||
|
/*
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
| Additional relation types
|
||||||
|
|--------------------------------------------------------------------------
|
||||||
|
|
|
||||||
|
| Sometimes it's needed to create custom relation types. The key of the array
|
||||||
|
| is the Relationship Method name. The value of the array is the canonical class
|
||||||
|
| name of the Relationship, e.g. `'relationName' => RelationShipClass::class`.
|
||||||
|
|
|
||||||
|
*/
|
||||||
|
'additional_relation_types' => [],
|
||||||
|
|
||||||
];
|
];
|
||||||
|
|||||||
+13
-3
@@ -1,8 +1,13 @@
|
|||||||
<?xml version="1.0" encoding="UTF-8"?>
|
<?xml version="1.0" encoding="UTF-8"?>
|
||||||
<files psalm-version="3.12.0@d46283075d76ed244f7825b378eeb1cee246af73">
|
<files psalm-version="3.15@de6e7f324f44dde540ebe7ebd4eb481b97c86f30">
|
||||||
|
<file src="src/Factories.php">
|
||||||
|
<UndefinedClass occurrences="2">
|
||||||
|
<code>Factory</code>
|
||||||
|
<code>Factory</code>
|
||||||
|
</UndefinedClass>
|
||||||
|
</file>
|
||||||
<file src="src/Generator.php">
|
<file src="src/Generator.php">
|
||||||
<UndefinedClass occurrences="8">
|
<UndefinedClass occurrences="7">
|
||||||
<code>'\Laravel\Lumen\Application'</code>
|
|
||||||
<code>\Auth</code>
|
<code>\Auth</code>
|
||||||
<code>\DB</code>
|
<code>\DB</code>
|
||||||
<code>\Cache</code>
|
<code>\Cache</code>
|
||||||
@@ -12,4 +17,9 @@
|
|||||||
<code>\Storage</code>
|
<code>\Storage</code>
|
||||||
</UndefinedClass>
|
</UndefinedClass>
|
||||||
</file>
|
</file>
|
||||||
|
<file src="src/IdeHelperServiceProvider.php">
|
||||||
|
<TooFewArguments occurrences="1">
|
||||||
|
<code>new PhpEngine()</code>
|
||||||
|
</TooFewArguments>
|
||||||
|
</file>
|
||||||
</files>
|
</files>
|
||||||
|
|||||||
@@ -35,7 +35,7 @@ namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
|
|||||||
//Method inherited from <?= $method->getDeclaringClass() ?>
|
//Method inherited from <?= $method->getDeclaringClass() ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($method->isInstanceCall()) :?>
|
<?php if ($method->isInstanceCall()) : ?>
|
||||||
/** @var <?=$method->getRoot()?> $instance */
|
/** @var <?=$method->getRoot()?> $instance */
|
||||||
<?php endif?>
|
<?php endif?>
|
||||||
<?= $method->shouldReturn() ? 'return ' : '' ?><?= $method->getRootMethodCall() ?>;
|
<?= $method->shouldReturn() ? 'return ' : '' ?><?= $method->getRootMethodCall() ?>;
|
||||||
@@ -58,7 +58,7 @@ namespace <?= $namespace == '__root' ? '' : trim($namespace, '\\') ?> {
|
|||||||
//Method inherited from <?= $method->getDeclaringClass() ?>
|
//Method inherited from <?= $method->getDeclaringClass() ?>
|
||||||
<?php endif; ?>
|
<?php endif; ?>
|
||||||
|
|
||||||
<?php if ($method->isInstanceCall()) :?>
|
<?php if ($method->isInstanceCall()) : ?>
|
||||||
/** @var <?=$method->getRoot()?> $instance */
|
/** @var <?=$method->getRoot()?> $instance */
|
||||||
<?php endif?>
|
<?php endif?>
|
||||||
<?= $method->shouldReturn() ? 'return ' : '' ?><?= $method->getRootMethodCall() ?>;
|
<?= $method->shouldReturn() ? 'return ' : '' ?><?= $method->getRootMethodCall() ?>;
|
||||||
|
|||||||
+8
-1
@@ -17,6 +17,8 @@ use Barryvdh\Reflection\DocBlock\Serializer as DocBlockSerializer;
|
|||||||
use Barryvdh\Reflection\DocBlock\Tag\MethodTag;
|
use Barryvdh\Reflection\DocBlock\Tag\MethodTag;
|
||||||
use Closure;
|
use Closure;
|
||||||
use Illuminate\Config\Repository as ConfigRepository;
|
use Illuminate\Config\Repository as ConfigRepository;
|
||||||
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Support\Facades\Facade;
|
||||||
use ReflectionClass;
|
use ReflectionClass;
|
||||||
|
|
||||||
class Alias
|
class Alias
|
||||||
@@ -202,6 +204,10 @@ class Alias
|
|||||||
{
|
{
|
||||||
$facade = $this->facade;
|
$facade = $this->facade;
|
||||||
|
|
||||||
|
if (!is_subclass_of($facade, Facade::class)) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
if (!method_exists($facade, 'fake')) {
|
if (!method_exists($facade, 'fake')) {
|
||||||
return;
|
return;
|
||||||
}
|
}
|
||||||
@@ -363,8 +369,9 @@ class Alias
|
|||||||
}
|
}
|
||||||
|
|
||||||
// Check if the class is macroable
|
// Check if the class is macroable
|
||||||
|
// (Eloquent\Builder is also macroable but doesn't use Macroable trait)
|
||||||
$traits = collect($reflection->getTraitNames());
|
$traits = collect($reflection->getTraitNames());
|
||||||
if ($traits->contains('Illuminate\Support\Traits\Macroable')) {
|
if ($traits->contains('Illuminate\Support\Traits\Macroable') || $class === EloquentBuilder::class) {
|
||||||
$properties = $reflection->getStaticProperties();
|
$properties = $reflection->getStaticProperties();
|
||||||
$macros = isset($properties['macros']) ? $properties['macros'] : [];
|
$macros = isset($properties['macros']) ? $properties['macros'] : [];
|
||||||
foreach ($macros as $macro_name => $macro_func) {
|
foreach ($macros as $macro_name => $macro_func) {
|
||||||
|
|||||||
@@ -89,15 +89,13 @@ class GeneratorCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$filename = $this->argument('filename');
|
$filename = $this->argument('filename');
|
||||||
$format = $this->option('format');
|
|
||||||
|
|
||||||
// Strip the php extension
|
// Add the php extension if missing
|
||||||
if (substr($filename, -4, 4) === '.php') {
|
// This is a backwards-compatible shim and can be removed in the future
|
||||||
$filename = substr($filename, 0, -4);
|
if (substr($filename, -4, 4) !== '.php') {
|
||||||
|
$filename .= '.php';
|
||||||
}
|
}
|
||||||
|
|
||||||
$filename .= '.' . $format;
|
|
||||||
|
|
||||||
if ($this->option('memory')) {
|
if ($this->option('memory')) {
|
||||||
$this->useMemoryDriver();
|
$this->useMemoryDriver();
|
||||||
}
|
}
|
||||||
@@ -115,7 +113,7 @@ class GeneratorCommand extends Command
|
|||||||
}
|
}
|
||||||
|
|
||||||
$generator = new Generator($this->config, $this->view, $this->getOutput(), $helpers);
|
$generator = new Generator($this->config, $this->view, $this->getOutput(), $helpers);
|
||||||
$content = $generator->generate($format);
|
$content = $generator->generate();
|
||||||
$written = $this->files->put($filename, $content);
|
$written = $this->files->put($filename, $content);
|
||||||
|
|
||||||
if ($written !== false) {
|
if ($written !== false) {
|
||||||
@@ -165,11 +163,9 @@ class GeneratorCommand extends Command
|
|||||||
*/
|
*/
|
||||||
protected function getOptions()
|
protected function getOptions()
|
||||||
{
|
{
|
||||||
$format = $this->config->get('ide-helper.format');
|
|
||||||
$writeMixins = $this->config->get('ide-helper.write_eloquent_model_mixins');
|
$writeMixins = $this->config->get('ide-helper.write_eloquent_model_mixins');
|
||||||
|
|
||||||
return [
|
return [
|
||||||
['format', 'F', InputOption::VALUE_OPTIONAL, 'The format for the IDE Helper', $format],
|
|
||||||
['write_mixins', 'W', InputOption::VALUE_OPTIONAL, 'Write mixins to Laravel Model?', $writeMixins],
|
['write_mixins', 'W', InputOption::VALUE_OPTIONAL, 'Write mixins to Laravel Model?', $writeMixins],
|
||||||
['helpers', 'H', InputOption::VALUE_NONE, 'Include the helper files'],
|
['helpers', 'H', InputOption::VALUE_NONE, 'Include the helper files'],
|
||||||
['memory', 'M', InputOption::VALUE_NONE, 'Use sqlite memory driver'],
|
['memory', 'M', InputOption::VALUE_NONE, 'Use sqlite memory driver'],
|
||||||
|
|||||||
+186
-37
@@ -19,6 +19,16 @@ use Composer\Autoload\ClassMapGenerator;
|
|||||||
use Illuminate\Console\Command;
|
use Illuminate\Console\Command;
|
||||||
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasManyThrough;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOne;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\HasOneThrough;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphMany;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphOne;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphTo;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
||||||
use Illuminate\Database\Eloquent\Relations\Relation;
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
use Illuminate\Filesystem\Filesystem;
|
use Illuminate\Filesystem\Filesystem;
|
||||||
use Illuminate\Support\Str;
|
use Illuminate\Support\Str;
|
||||||
@@ -28,6 +38,7 @@ use ReflectionObject;
|
|||||||
use Symfony\Component\Console\Input\InputArgument;
|
use Symfony\Component\Console\Input\InputArgument;
|
||||||
use Symfony\Component\Console\Input\InputOption;
|
use Symfony\Component\Console\Input\InputOption;
|
||||||
use Symfony\Component\Console\Output\OutputInterface;
|
use Symfony\Component\Console\Output\OutputInterface;
|
||||||
|
use Throwable;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* A command to generate autocomplete information for your IDE
|
* A command to generate autocomplete information for your IDE
|
||||||
@@ -36,6 +47,20 @@ use Symfony\Component\Console\Output\OutputInterface;
|
|||||||
*/
|
*/
|
||||||
class ModelsCommand extends Command
|
class ModelsCommand extends Command
|
||||||
{
|
{
|
||||||
|
protected const RELATION_TYPES = [
|
||||||
|
'hasMany' => HasMany::class,
|
||||||
|
'hasManyThrough' => HasManyThrough::class,
|
||||||
|
'hasOneThrough' => HasOneThrough::class,
|
||||||
|
'belongsToMany' => BelongsToMany::class,
|
||||||
|
'hasOne' => HasOne::class,
|
||||||
|
'belongsTo' => BelongsTo::class,
|
||||||
|
'morphOne' => MorphOne::class,
|
||||||
|
'morphTo' => MorphTo::class,
|
||||||
|
'morphMany' => MorphMany::class,
|
||||||
|
'morphToMany' => MorphToMany::class,
|
||||||
|
'morphedByMany' => MorphToMany::class,
|
||||||
|
];
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @var Filesystem $files
|
* @var Filesystem $files
|
||||||
*/
|
*/
|
||||||
@@ -66,6 +91,7 @@ class ModelsCommand extends Command
|
|||||||
protected $reset;
|
protected $reset;
|
||||||
protected $keep_text;
|
protected $keep_text;
|
||||||
protected $phpstorm_noinspections;
|
protected $phpstorm_noinspections;
|
||||||
|
protected $write_model_external_builder_methods;
|
||||||
/**
|
/**
|
||||||
* @var bool[string]
|
* @var bool[string]
|
||||||
*/
|
*/
|
||||||
@@ -110,6 +136,7 @@ class ModelsCommand extends Command
|
|||||||
$this->keep_text = $this->reset = true;
|
$this->keep_text = $this->reset = true;
|
||||||
}
|
}
|
||||||
$this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);
|
$this->write_model_magic_where = $this->laravel['config']->get('ide-helper.write_model_magic_where', true);
|
||||||
|
$this->write_model_external_builder_methods = $this->laravel['config']->get('ide-helper.write_model_external_builder_methods', true);
|
||||||
$this->write_model_relation_count_properties =
|
$this->write_model_relation_count_properties =
|
||||||
$this->laravel['config']->get('ide-helper.write_model_relation_count_properties', true);
|
$this->laravel['config']->get('ide-helper.write_model_relation_count_properties', true);
|
||||||
|
|
||||||
@@ -253,7 +280,7 @@ class ModelsCommand extends Command
|
|||||||
$output .= $this->createPhpDocs($name);
|
$output .= $this->createPhpDocs($name);
|
||||||
$ignore[] = $name;
|
$ignore[] = $name;
|
||||||
$this->nullableColumns = [];
|
$this->nullableColumns = [];
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
$this->error('Exception: ' . $e->getMessage() .
|
$this->error('Exception: ' . $e->getMessage() .
|
||||||
"\nCould not analyze class $name.\n\nTrace:\n" .
|
"\nCould not analyze class $name.\n\nTrace:\n" .
|
||||||
$e->getTraceAsString());
|
$e->getTraceAsString());
|
||||||
@@ -280,13 +307,14 @@ class ModelsCommand extends Command
|
|||||||
$dir = base_path($dir);
|
$dir = base_path($dir);
|
||||||
}
|
}
|
||||||
|
|
||||||
if (!is_dir($dir)) {
|
|
||||||
$this->error("Cannot locate directory '{'$dir}'");
|
|
||||||
continue;
|
|
||||||
}
|
|
||||||
|
|
||||||
$dirs = glob($dir, GLOB_ONLYDIR);
|
$dirs = glob($dir, GLOB_ONLYDIR);
|
||||||
foreach ($dirs as $dir) {
|
foreach ($dirs as $dir) {
|
||||||
|
|
||||||
|
if (!is_dir($dir)) {
|
||||||
|
$this->error("Cannot locate directory '{'$dir}'");
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
if (file_exists($dir)) {
|
if (file_exists($dir)) {
|
||||||
$classMap = ClassMapGenerator::createMap($dir);
|
$classMap = ClassMapGenerator::createMap($dir);
|
||||||
|
|
||||||
@@ -344,6 +372,9 @@ class ModelsCommand extends Command
|
|||||||
$realType = '\Illuminate\Support\Collection';
|
$realType = '\Illuminate\Support\Collection';
|
||||||
break;
|
break;
|
||||||
default:
|
default:
|
||||||
|
// In case of an optional custom cast parameter , only evaluate
|
||||||
|
// the `$type` until the `:`
|
||||||
|
$type = strtok($type, ':');
|
||||||
$realType = class_exists($type) ? ('\\' . $type) : 'mixed';
|
$realType = class_exists($type) ? ('\\' . $type) : 'mixed';
|
||||||
break;
|
break;
|
||||||
}
|
}
|
||||||
@@ -395,7 +426,7 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$database = null;
|
$database = null;
|
||||||
if (strpos($table, '.')) {
|
if (strpos($table, '.')) {
|
||||||
list($database, $table) = explode('.', $table);
|
[$database, $table] = explode('.', $table);
|
||||||
}
|
}
|
||||||
|
|
||||||
$columns = $schema->listTableColumns($table, $database);
|
$columns = $schema->listTableColumns($table, $database);
|
||||||
@@ -459,9 +490,13 @@ class ModelsCommand extends Command
|
|||||||
!$column->getNotnull()
|
!$column->getNotnull()
|
||||||
);
|
);
|
||||||
if ($this->write_model_magic_where) {
|
if ($this->write_model_magic_where) {
|
||||||
|
$builderClass = $this->write_model_external_builder_methods
|
||||||
|
? get_class($model->newModelQuery())
|
||||||
|
: '\Illuminate\Database\Eloquent\Builder';
|
||||||
|
|
||||||
$this->setMethod(
|
$this->setMethod(
|
||||||
Str::camel('where_' . $name),
|
Str::camel('where_' . $name),
|
||||||
$this->getClassNameInDestinationFile($model, \Illuminate\Database\Eloquent\Builder::class)
|
$this->getClassNameInDestinationFile($model, $builderClass)
|
||||||
. '|'
|
. '|'
|
||||||
. $this->getClassNameInDestinationFile($model, get_class($model)),
|
. $this->getClassNameInDestinationFile($model, get_class($model)),
|
||||||
['$value']
|
['$value']
|
||||||
@@ -514,7 +549,7 @@ class ModelsCommand extends Command
|
|||||||
array_shift($args);
|
array_shift($args);
|
||||||
$builder = $this->getClassNameInDestinationFile(
|
$builder = $this->getClassNameInDestinationFile(
|
||||||
$reflection->getDeclaringClass(),
|
$reflection->getDeclaringClass(),
|
||||||
\Illuminate\Database\Eloquent\Builder::class
|
get_class($model->newModelQuery())
|
||||||
);
|
);
|
||||||
$modelName = $this->getClassNameInDestinationFile(
|
$modelName = $this->getClassNameInDestinationFile(
|
||||||
$reflection->getDeclaringClass(),
|
$reflection->getDeclaringClass(),
|
||||||
@@ -529,6 +564,10 @@ class ModelsCommand extends Command
|
|||||||
$method,
|
$method,
|
||||||
$builder . '|' . $this->getClassNameInDestinationFile($model, get_class($model))
|
$builder . '|' . $this->getClassNameInDestinationFile($model, get_class($model))
|
||||||
);
|
);
|
||||||
|
|
||||||
|
if ($this->write_model_external_builder_methods) {
|
||||||
|
$this->writeModelExternalBuilderMethods($model);
|
||||||
|
}
|
||||||
} elseif (
|
} elseif (
|
||||||
!method_exists('Illuminate\Database\Eloquent\Model', $method)
|
!method_exists('Illuminate\Database\Eloquent\Model', $method)
|
||||||
&& !Str::startsWith($method, 'get')
|
&& !Str::startsWith($method, 'get')
|
||||||
@@ -558,19 +597,7 @@ class ModelsCommand extends Command
|
|||||||
$code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
|
$code = substr($code, $begin, strrpos($code, '}') - $begin + 1);
|
||||||
|
|
||||||
foreach (
|
foreach (
|
||||||
[
|
$this->getRelationTypes() as $relation => $impl
|
||||||
'hasMany' => '\Illuminate\Database\Eloquent\Relations\HasMany',
|
|
||||||
'hasManyThrough' => '\Illuminate\Database\Eloquent\Relations\HasManyThrough',
|
|
||||||
'hasOneThrough' => '\Illuminate\Database\Eloquent\Relations\HasOneThrough',
|
|
||||||
'belongsToMany' => '\Illuminate\Database\Eloquent\Relations\BelongsToMany',
|
|
||||||
'hasOne' => '\Illuminate\Database\Eloquent\Relations\HasOne',
|
|
||||||
'belongsTo' => '\Illuminate\Database\Eloquent\Relations\BelongsTo',
|
|
||||||
'morphOne' => '\Illuminate\Database\Eloquent\Relations\MorphOne',
|
|
||||||
'morphTo' => '\Illuminate\Database\Eloquent\Relations\MorphTo',
|
|
||||||
'morphMany' => '\Illuminate\Database\Eloquent\Relations\MorphMany',
|
|
||||||
'morphToMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany',
|
|
||||||
'morphedByMany' => '\Illuminate\Database\Eloquent\Relations\MorphToMany',
|
|
||||||
] as $relation => $impl
|
|
||||||
) {
|
) {
|
||||||
$search = '$this->' . $relation . '(';
|
$search = '$this->' . $relation . '(';
|
||||||
if (stripos($code, $search) || ltrim($impl, '\\') === ltrim((string)$type, '\\')) {
|
if (stripos($code, $search) || ltrim($impl, '\\') === ltrim((string)$type, '\\')) {
|
||||||
@@ -586,7 +613,9 @@ class ModelsCommand extends Command
|
|||||||
$relationObj = Relation::noConstraints(function () use ($model, $method) {
|
$relationObj = Relation::noConstraints(function () use ($model, $method) {
|
||||||
try {
|
try {
|
||||||
return $model->$method();
|
return $model->$method();
|
||||||
} catch (\Throwable $e) {
|
} catch (Throwable $e) {
|
||||||
|
$this->warn(sprintf('Error resolving relation model of %s:%s() : %s', get_class($model), $method, $e->getMessage()));
|
||||||
|
|
||||||
return null;
|
return null;
|
||||||
}
|
}
|
||||||
});
|
});
|
||||||
@@ -597,14 +626,6 @@ class ModelsCommand extends Command
|
|||||||
get_class($relationObj->getRelated())
|
get_class($relationObj->getRelated())
|
||||||
);
|
);
|
||||||
|
|
||||||
$relations = [
|
|
||||||
'hasManyThrough',
|
|
||||||
'belongsToMany',
|
|
||||||
'hasMany',
|
|
||||||
'morphMany',
|
|
||||||
'morphToMany',
|
|
||||||
'morphedByMany',
|
|
||||||
];
|
|
||||||
if (strpos(get_class($relationObj), 'Many') !== false) {
|
if (strpos(get_class($relationObj), 'Many') !== false) {
|
||||||
//Collection or array of models (because Collection is Arrayable)
|
//Collection or array of models (because Collection is Arrayable)
|
||||||
$relatedClass = '\\' . get_class($relationObj->getRelated());
|
$relatedClass = '\\' . get_class($relationObj->getRelated());
|
||||||
@@ -877,6 +898,7 @@ class ModelsCommand extends Command
|
|||||||
*
|
*
|
||||||
* @param $method
|
* @param $method
|
||||||
* @return array
|
* @return array
|
||||||
|
* @throws \ReflectionException
|
||||||
*/
|
*/
|
||||||
public function getParameters($method)
|
public function getParameters($method)
|
||||||
{
|
{
|
||||||
@@ -884,8 +906,11 @@ class ModelsCommand extends Command
|
|||||||
$paramsWithDefault = [];
|
$paramsWithDefault = [];
|
||||||
/** @var \ReflectionParameter $param */
|
/** @var \ReflectionParameter $param */
|
||||||
foreach ($method->getParameters() as $param) {
|
foreach ($method->getParameters() as $param) {
|
||||||
$paramClass = $param->getClass();
|
$paramStr = '$' . $param->getName();
|
||||||
$paramStr = (!is_null($paramClass) ? '\\' . $paramClass->getName() . ' ' : '') . '$' . $param->getName();
|
if ($paramType = $this->getParamType($method, $param)) {
|
||||||
|
$paramStr = $paramType . ' ' . $paramStr;
|
||||||
|
}
|
||||||
|
|
||||||
if ($param->isOptional() && $param->isDefaultValueAvailable()) {
|
if ($param->isOptional() && $param->isDefaultValueAvailable()) {
|
||||||
$default = $param->getDefaultValue();
|
$default = $param->getDefaultValue();
|
||||||
if (is_bool($default)) {
|
if (is_bool($default)) {
|
||||||
@@ -899,8 +924,10 @@ class ModelsCommand extends Command
|
|||||||
} else {
|
} else {
|
||||||
$default = "'" . trim($default) . "'";
|
$default = "'" . trim($default) . "'";
|
||||||
}
|
}
|
||||||
|
|
||||||
$paramStr .= " = $default";
|
$paramStr .= " = $default";
|
||||||
}
|
}
|
||||||
|
|
||||||
$paramsWithDefault[] = $paramStr;
|
$paramsWithDefault[] = $paramStr;
|
||||||
}
|
}
|
||||||
return $paramsWithDefault;
|
return $paramsWithDefault;
|
||||||
@@ -926,6 +953,15 @@ class ModelsCommand extends Command
|
|||||||
return '\\' . get_class($model->newCollection());
|
return '\\' . get_class($model->newCollection());
|
||||||
}
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Returns the available relation types
|
||||||
|
*/
|
||||||
|
protected function getRelationTypes(): array
|
||||||
|
{
|
||||||
|
$configuredRelations = $this->laravel['config']->get('ide-helper.additional_relation_types', []);
|
||||||
|
return array_merge(self::RELATION_TYPES, $configuredRelations);
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @return bool
|
* @return bool
|
||||||
*/
|
*/
|
||||||
@@ -1059,13 +1095,17 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
$methodReflection = new \ReflectionMethod($type, 'get');
|
$methodReflection = new \ReflectionMethod($type, 'get');
|
||||||
|
|
||||||
$type = $this->getReturnTypeFromReflection($methodReflection);
|
$reflectionType = $this->getReturnTypeFromReflection($methodReflection);
|
||||||
|
|
||||||
if ($type === null) {
|
if ($reflectionType === null) {
|
||||||
$type = $this->getReturnTypeFromDocBlock($methodReflection);
|
$reflectionType = $this->getReturnTypeFromDocBlock($methodReflection);
|
||||||
}
|
}
|
||||||
|
|
||||||
return $type;
|
if($reflectionType === 'static' || $reflectionType === '$this') {
|
||||||
|
$reflectionType = $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $reflectionType;
|
||||||
}
|
}
|
||||||
|
|
||||||
protected function getTypeInModel(object $model, ?string $type): ?string
|
protected function getTypeInModel(object $model, ?string $type): ?string
|
||||||
@@ -1112,4 +1152,113 @@ class ModelsCommand extends Command
|
|||||||
|
|
||||||
return $namespaceAliases;
|
return $namespaceAliases;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function writeModelExternalBuilderMethods(Model $model): void
|
||||||
|
{
|
||||||
|
$fullBuilderClass = '\\' . get_class($model->newModelQuery());
|
||||||
|
$newBuilderMethods = get_class_methods($fullBuilderClass);
|
||||||
|
$originalBuilderMethods = get_class_methods('\Illuminate\Database\Eloquent\Builder');
|
||||||
|
|
||||||
|
// diff the methods between the new builder and original one
|
||||||
|
// and create helpers for the ones that are new
|
||||||
|
$newMethodsFromNewBuilder = array_diff($newBuilderMethods, $originalBuilderMethods);
|
||||||
|
|
||||||
|
if (!$newMethodsFromNewBuilder) {
|
||||||
|
return;
|
||||||
|
}
|
||||||
|
|
||||||
|
// after we have retrieved the builder's methods
|
||||||
|
// get the class of the builder based on the FQCN option
|
||||||
|
$builderClassBasedOnFQCNOption = $this->getClassNameInDestinationFile($model, get_class($model->newModelQuery()));
|
||||||
|
|
||||||
|
foreach ($newMethodsFromNewBuilder as $builderMethod) {
|
||||||
|
$reflection = new \ReflectionMethod($fullBuilderClass, $builderMethod);
|
||||||
|
$args = $this->getParameters($reflection);
|
||||||
|
|
||||||
|
$this->setMethod(
|
||||||
|
$builderMethod,
|
||||||
|
$builderClassBasedOnFQCNOption . '|' . $this->getClassNameInDestinationFile($model, get_class($model)),
|
||||||
|
$args
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getParamType(\ReflectionMethod $method, \ReflectionParameter $parameter): ?string
|
||||||
|
{
|
||||||
|
if ($paramType = $parameter->getType()) {
|
||||||
|
$parameterName = $paramType->getName();
|
||||||
|
|
||||||
|
if (!$paramType->isBuiltin()) {
|
||||||
|
$parameterName = '\\' . $parameterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
if ($paramType->allowsNull()) {
|
||||||
|
return '?' . $parameterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
return $parameterName;
|
||||||
|
}
|
||||||
|
|
||||||
|
$docComment = $method->getDocComment();
|
||||||
|
|
||||||
|
if (!$docComment) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
preg_match(
|
||||||
|
'/@param ((?:(?:[\w?|\\\\<>])+(?:\[])?)+)/',
|
||||||
|
$docComment ?? '',
|
||||||
|
$matches
|
||||||
|
);
|
||||||
|
$type = $matches[1] ?? null;
|
||||||
|
|
||||||
|
if (strpos($type, '|') !== false) {
|
||||||
|
$types = explode('|', $type);
|
||||||
|
|
||||||
|
// if we have more than 2 types
|
||||||
|
// we return null as we cannot use unions in php yet
|
||||||
|
if (count($types) > 2) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$hasNull = false;
|
||||||
|
|
||||||
|
foreach ($types as $currentType) {
|
||||||
|
if ($currentType === 'null') {
|
||||||
|
$hasNull = true;
|
||||||
|
continue;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we didn't find null assign the current type to the type we want
|
||||||
|
$type = $currentType;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we haven't found null type set
|
||||||
|
// we return null as we cannot use unions with different types yet
|
||||||
|
if (!$hasNull) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
$type = '?' . $type;
|
||||||
|
}
|
||||||
|
|
||||||
|
// convert to proper type hint types in php
|
||||||
|
$type = str_replace(['boolean', 'integer'], ['bool', 'int'], $type);
|
||||||
|
|
||||||
|
$allowedTypes = [
|
||||||
|
'int',
|
||||||
|
'bool',
|
||||||
|
'string',
|
||||||
|
'float',
|
||||||
|
];
|
||||||
|
|
||||||
|
// we replace the ? with an empty string so we can check the actual type
|
||||||
|
if (!in_array(str_replace('?', '', $type), $allowedTypes)) {
|
||||||
|
return null;
|
||||||
|
}
|
||||||
|
|
||||||
|
// if we have a match on index 1
|
||||||
|
// then we have found the type of the variable if not we return null
|
||||||
|
return $type;
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+14
-7
@@ -12,18 +12,25 @@ class Factories
|
|||||||
{
|
{
|
||||||
$factories = [];
|
$factories = [];
|
||||||
|
|
||||||
$factory = app(Factory::class);
|
if (static::isLaravelSevenOrLower()) {
|
||||||
|
$factory = app(Factory::class);
|
||||||
|
|
||||||
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
$definitions = (new ReflectionClass(Factory::class))->getProperty('definitions');
|
||||||
$definitions->setAccessible(true);
|
$definitions->setAccessible(true);
|
||||||
|
|
||||||
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
foreach ($definitions->getValue($factory) as $factory_target => $config) {
|
||||||
try {
|
try {
|
||||||
$factories[] = new ReflectionClass($factory_target);
|
$factories[] = new ReflectionClass($factory_target);
|
||||||
} catch (Exception $exception) {
|
} catch (Exception $exception) {
|
||||||
|
}
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
return $factories;
|
return $factories;
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected static function isLaravelSevenOrLower()
|
||||||
|
{
|
||||||
|
return class_exists('Illuminate\Database\Eloquent\Factory');
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+1
-40
@@ -67,21 +67,9 @@ class Generator
|
|||||||
/**
|
/**
|
||||||
* Generate the helper file contents;
|
* Generate the helper file contents;
|
||||||
*
|
*
|
||||||
* @param string $format The format to generate the helper in (php/json)
|
|
||||||
* @return string;
|
* @return string;
|
||||||
*/
|
*/
|
||||||
public function generate($format = 'php')
|
public function generate()
|
||||||
{
|
|
||||||
// Check if the generator for this format exists
|
|
||||||
$method = 'generate' . ucfirst($format) . 'Helper';
|
|
||||||
if (method_exists($this, $method)) {
|
|
||||||
return $this->$method();
|
|
||||||
}
|
|
||||||
|
|
||||||
return $this->generatePhpHelper();
|
|
||||||
}
|
|
||||||
|
|
||||||
public function generatePhpHelper()
|
|
||||||
{
|
{
|
||||||
$app = app();
|
$app = app();
|
||||||
return $this->view->make('helper')
|
return $this->view->make('helper')
|
||||||
@@ -94,33 +82,6 @@ class Generator
|
|||||||
->render();
|
->render();
|
||||||
}
|
}
|
||||||
|
|
||||||
public function generateJsonHelper()
|
|
||||||
{
|
|
||||||
$classes = [];
|
|
||||||
foreach ($this->getValidAliases() as $aliases) {
|
|
||||||
foreach ($aliases as $alias) {
|
|
||||||
$functions = [];
|
|
||||||
foreach ($alias->getMethods() as $method) {
|
|
||||||
$functions[$method->getName()] = '(' . $method->getParamsWithDefault() . ')';
|
|
||||||
}
|
|
||||||
$classes[$alias->getAlias()] = [
|
|
||||||
'functions' => $functions,
|
|
||||||
];
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
$flags = JSON_FORCE_OBJECT;
|
|
||||||
if (defined('JSON_PRETTY_PRINT')) {
|
|
||||||
$flags |= JSON_PRETTY_PRINT;
|
|
||||||
}
|
|
||||||
|
|
||||||
return json_encode([
|
|
||||||
'php' => [
|
|
||||||
'classes' => $classes,
|
|
||||||
],
|
|
||||||
], $flags);
|
|
||||||
}
|
|
||||||
|
|
||||||
protected function detectDrivers()
|
protected function detectDrivers()
|
||||||
{
|
{
|
||||||
$defaultUserModel = config('auth.providers.users.model', config('auth.model', 'App\User'));
|
$defaultUserModel = config('auth.providers.users.model', config('auth.model', 'App\User'));
|
||||||
|
|||||||
@@ -0,0 +1,13 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper;
|
||||||
|
|
||||||
|
class Helpers
|
||||||
|
{
|
||||||
|
public static function isLaravel(): bool
|
||||||
|
{
|
||||||
|
return class_exists('Illuminate\Foundation\Application');
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -15,6 +15,7 @@ use Barryvdh\LaravelIdeHelper\Console\EloquentCommand;
|
|||||||
use Barryvdh\LaravelIdeHelper\Console\GeneratorCommand;
|
use Barryvdh\LaravelIdeHelper\Console\GeneratorCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Console\MetaCommand;
|
use Barryvdh\LaravelIdeHelper\Console\MetaCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Illuminate\Contracts\Support\DeferrableProvider;
|
||||||
use Illuminate\Foundation\Application;
|
use Illuminate\Foundation\Application;
|
||||||
use Illuminate\Support\ServiceProvider;
|
use Illuminate\Support\ServiceProvider;
|
||||||
use Illuminate\View\Engines\EngineResolver;
|
use Illuminate\View\Engines\EngineResolver;
|
||||||
@@ -22,15 +23,8 @@ use Illuminate\View\Engines\PhpEngine;
|
|||||||
use Illuminate\View\Factory;
|
use Illuminate\View\Factory;
|
||||||
use Illuminate\View\FileViewFinder;
|
use Illuminate\View\FileViewFinder;
|
||||||
|
|
||||||
class IdeHelperServiceProvider extends ServiceProvider
|
class IdeHelperServiceProvider extends ServiceProvider implements DeferrableProvider
|
||||||
{
|
{
|
||||||
/**
|
|
||||||
* Indicates if loading of the provider is deferred.
|
|
||||||
*
|
|
||||||
* @var bool
|
|
||||||
*/
|
|
||||||
protected $defer = true;
|
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* Bootstrap the application events.
|
* Bootstrap the application events.
|
||||||
*
|
*
|
||||||
@@ -116,7 +110,7 @@ class IdeHelperServiceProvider extends ServiceProvider
|
|||||||
{
|
{
|
||||||
$resolver = new EngineResolver();
|
$resolver = new EngineResolver();
|
||||||
$resolver->register('php', function () {
|
$resolver->register('php', function () {
|
||||||
if ((int) Application::VERSION < 8) {
|
if (Helpers::isLaravel() && (int) Application::VERSION < 8) {
|
||||||
return new PhpEngine();
|
return new PhpEngine();
|
||||||
}
|
}
|
||||||
|
|
||||||
|
|||||||
+40
-12
@@ -4,6 +4,8 @@ namespace Barryvdh\LaravelIdeHelper;
|
|||||||
|
|
||||||
use Barryvdh\Reflection\DocBlock;
|
use Barryvdh\Reflection\DocBlock;
|
||||||
use Barryvdh\Reflection\DocBlock\Tag;
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Support\Collection;
|
||||||
|
|
||||||
class Macro extends Method
|
class Macro extends Method
|
||||||
{
|
{
|
||||||
@@ -31,28 +33,54 @@ class Macro extends Method
|
|||||||
*/
|
*/
|
||||||
protected function initPhpDoc($method)
|
protected function initPhpDoc($method)
|
||||||
{
|
{
|
||||||
$this->phpdoc = new DocBlock('/** */');
|
$this->phpdoc = new DocBlock($method);
|
||||||
|
|
||||||
// Add macro parameters
|
$this->addLocationToPhpDoc();
|
||||||
foreach ($method->getParameters() as $parameter) {
|
|
||||||
$type = $parameter->hasType() ? $parameter->getType()->getName() : 'mixed';
|
|
||||||
$type .= $parameter->hasType() && $parameter->getType()->allowsNull() ? '|null' : '';
|
|
||||||
|
|
||||||
$name = $parameter->isVariadic() ? '...' : '';
|
// Add macro parameters if they are missed in original docblock
|
||||||
$name .= '$' . $parameter->getName();
|
if (!$this->phpdoc->hasTag('param')) {
|
||||||
|
foreach ($method->getParameters() as $parameter) {
|
||||||
|
$type = $parameter->hasType() ? $parameter->getType()->getName() : 'mixed';
|
||||||
|
$type .= $parameter->hasType() && $parameter->getType()->allowsNull() ? '|null' : '';
|
||||||
|
|
||||||
$this->phpdoc->appendTag(Tag::createInstance("@param {$type} {$name}"));
|
$name = $parameter->isVariadic() ? '...' : '';
|
||||||
|
$name .= '$' . $parameter->getName();
|
||||||
|
|
||||||
|
$this->phpdoc->appendTag(Tag::createInstance("@param {$type} {$name}"));
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
// Add macro return type
|
// Add macro return type if it missed in original docblock
|
||||||
if ($method->hasReturnType()) {
|
if ($method->hasReturnType() && !$this->phpdoc->hasTag('return')) {
|
||||||
$type = $method->getReturnType()->getName();
|
$builder = EloquentBuilder::class;
|
||||||
$type .= $method->getReturnType()->allowsNull() ? '|null' : '';
|
$return = $method->getReturnType();
|
||||||
|
|
||||||
|
$type = $return->getName();
|
||||||
|
$type .= $this->root === "\\{$builder}" && $return->getName() === $builder ? '|static' : '';
|
||||||
|
$type .= $return->allowsNull() ? '|null' : '';
|
||||||
|
|
||||||
$this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
|
$this->phpdoc->appendTag(Tag::createInstance("@return {$type}"));
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|
||||||
|
protected function addLocationToPhpDoc()
|
||||||
|
{
|
||||||
|
$enclosingClass = $this->method->getClosureScopeClass();
|
||||||
|
|
||||||
|
/** @var \ReflectionMethod $enclosingMethod */
|
||||||
|
$enclosingMethod = Collection::make($enclosingClass->getMethods())
|
||||||
|
->first(function (\ReflectionMethod $method) {
|
||||||
|
return $method->getStartLine() <= $this->method->getStartLine()
|
||||||
|
&& $method->getEndLine() >= $this->method->getEndLine();
|
||||||
|
});
|
||||||
|
|
||||||
|
if ($enclosingMethod) {
|
||||||
|
$this->phpdoc->appendTag(Tag::createInstance(
|
||||||
|
'@see \\' . $enclosingClass->getName() . '::' . $enclosingMethod->getName() . '()'
|
||||||
|
));
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
* @param \ReflectionFunctionAbstract $method
|
* @param \ReflectionFunctionAbstract $method
|
||||||
* @param \ReflectionClass $class
|
* @param \ReflectionClass $class
|
||||||
|
|||||||
@@ -0,0 +1,105 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Alias;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Macro;
|
||||||
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use Illuminate\Database\Query\Builder;
|
||||||
|
use Illuminate\Support\Arr;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversDefaultClass \Barryvdh\LaravelIdeHelper\Alias
|
||||||
|
*/
|
||||||
|
class AliasTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers ::detectMethods
|
||||||
|
*/
|
||||||
|
public function testDetectMethodsMacroableMacros(): void
|
||||||
|
{
|
||||||
|
// Mock
|
||||||
|
$macro = __FUNCTION__;
|
||||||
|
$alias = new AliasMock();
|
||||||
|
|
||||||
|
// Macros
|
||||||
|
Builder::macro(
|
||||||
|
$macro,
|
||||||
|
function () {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Prepare
|
||||||
|
$alias->setClasses([Builder::class]);
|
||||||
|
$alias->detectMethods();
|
||||||
|
|
||||||
|
// Test
|
||||||
|
$this->assertNotNull($this->getAliasMacro($alias, Builder::class, $macro));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::detectMethods
|
||||||
|
*/
|
||||||
|
public function testDetectMethodsEloquentBuilderMacros(): void
|
||||||
|
{
|
||||||
|
// Mock
|
||||||
|
$macro = __FUNCTION__;
|
||||||
|
$alias = new AliasMock();
|
||||||
|
|
||||||
|
// Macros
|
||||||
|
EloquentBuilder::macro(
|
||||||
|
$macro,
|
||||||
|
function () {
|
||||||
|
// empty
|
||||||
|
}
|
||||||
|
);
|
||||||
|
|
||||||
|
// Prepare
|
||||||
|
$alias->setClasses([EloquentBuilder::class]);
|
||||||
|
$alias->detectMethods();
|
||||||
|
|
||||||
|
// Test
|
||||||
|
$this->assertNotNull($this->getAliasMacro($alias, EloquentBuilder::class, $macro));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function getAliasMacro(Alias $alias, string $class, string $method): ?Macro
|
||||||
|
{
|
||||||
|
return Arr::first(
|
||||||
|
$alias->getMethods(),
|
||||||
|
function ($macro) use ($class, $method) {
|
||||||
|
return $macro instanceof Macro
|
||||||
|
&& $macro->getDeclaringClass() === "\\{$class}"
|
||||||
|
&& $macro->getName() === $method;
|
||||||
|
}
|
||||||
|
);
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @noinspection PhpMultipleClassesDeclarationsInOneFile
|
||||||
|
*/
|
||||||
|
class AliasMock extends Alias
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// no need to call parent
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param string[] $classes
|
||||||
|
*/
|
||||||
|
public function setClasses(array $classes)
|
||||||
|
{
|
||||||
|
$this->classes = $classes;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function detectMethods()
|
||||||
|
{
|
||||||
|
parent::detectMethods();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,11 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory\Services\Post\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
}
|
||||||
@@ -0,0 +1,44 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
|
||||||
|
final class Test extends AbstractModelsCommand
|
||||||
|
{
|
||||||
|
/** @var string */
|
||||||
|
private $cwd;
|
||||||
|
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
$this->cwd = getcwd();
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tearDown(): void
|
||||||
|
{
|
||||||
|
chdir($this->cwd);
|
||||||
|
|
||||||
|
parent::tearDown();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test(): void
|
||||||
|
{
|
||||||
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|
||||||
|
chdir(__DIR__);
|
||||||
|
|
||||||
|
$tester = $this->runCommand($command, [
|
||||||
|
'--dir' => ['Services/*/Models'],
|
||||||
|
'--write' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
|
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
||||||
|
$this->assertMatchesMockedSnapshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,165 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory\Services\Post\Models;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AllowGlobDirectory\Services\Post\Models\Post
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string|null $char_nullable
|
||||||
|
* @property string $char_not_nullable
|
||||||
|
* @property string|null $string_nullable
|
||||||
|
* @property string $string_not_nullable
|
||||||
|
* @property string|null $text_nullable
|
||||||
|
* @property string $text_not_nullable
|
||||||
|
* @property string|null $medium_text_nullable
|
||||||
|
* @property string $medium_text_not_nullable
|
||||||
|
* @property string|null $long_text_nullable
|
||||||
|
* @property string $long_text_not_nullable
|
||||||
|
* @property integer|null $integer_nullable
|
||||||
|
* @property integer $integer_not_nullable
|
||||||
|
* @property integer|null $tiny_integer_nullable
|
||||||
|
* @property integer $tiny_integer_not_nullable
|
||||||
|
* @property integer|null $small_integer_nullable
|
||||||
|
* @property integer $small_integer_not_nullable
|
||||||
|
* @property integer|null $medium_integer_nullable
|
||||||
|
* @property integer $medium_integer_not_nullable
|
||||||
|
* @property integer|null $big_integer_nullable
|
||||||
|
* @property integer $big_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_integer_nullable
|
||||||
|
* @property integer $unsigned_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_tiny_integer_nullable
|
||||||
|
* @property integer $unsigned_tiny_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_small_integer_nullable
|
||||||
|
* @property integer $unsigned_small_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_medium_integer_nullable
|
||||||
|
* @property integer $unsigned_medium_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_big_integer_nullable
|
||||||
|
* @property integer $unsigned_big_integer_not_nullable
|
||||||
|
* @property float|null $float_nullable
|
||||||
|
* @property float $float_not_nullable
|
||||||
|
* @property float|null $double_nullable
|
||||||
|
* @property float $double_not_nullable
|
||||||
|
* @property string|null $decimal_nullable
|
||||||
|
* @property string $decimal_not_nullable
|
||||||
|
* @property string|null $unsigned_decimal_nullable
|
||||||
|
* @property string $unsigned_decimal_not_nullable
|
||||||
|
* @property integer|null $boolean_nullable
|
||||||
|
* @property integer $boolean_not_nullable
|
||||||
|
* @property string|null $enum_nullable
|
||||||
|
* @property string $enum_not_nullable
|
||||||
|
* @property string|null $json_nullable
|
||||||
|
* @property string $json_not_nullable
|
||||||
|
* @property string|null $jsonb_nullable
|
||||||
|
* @property string $jsonb_not_nullable
|
||||||
|
* @property string|null $date_nullable
|
||||||
|
* @property string $date_not_nullable
|
||||||
|
* @property string|null $datetime_nullable
|
||||||
|
* @property string $datetime_not_nullable
|
||||||
|
* @property string|null $datetimetz_nullable
|
||||||
|
* @property string $datetimetz_not_nullable
|
||||||
|
* @property string|null $time_nullable
|
||||||
|
* @property string $time_not_nullable
|
||||||
|
* @property string|null $timetz_nullable
|
||||||
|
* @property string $timetz_not_nullable
|
||||||
|
* @property string|null $timestamp_nullable
|
||||||
|
* @property string $timestamp_not_nullable
|
||||||
|
* @property string|null $timestamptz_nullable
|
||||||
|
* @property string $timestamptz_not_nullable
|
||||||
|
* @property integer|null $year_nullable
|
||||||
|
* @property integer $year_not_nullable
|
||||||
|
* @property mixed|null $binary_nullable
|
||||||
|
* @property mixed $binary_not_nullable
|
||||||
|
* @property string|null $uuid_nullable
|
||||||
|
* @property string $uuid_not_nullable
|
||||||
|
* @property string|null $ipaddress_nullable
|
||||||
|
* @property string $ipaddress_not_nullable
|
||||||
|
* @property string|null $macaddress_nullable
|
||||||
|
* @property string $macaddress_not_nullable
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post newModelQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post newQuery()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
}
|
||||||
+20
@@ -0,0 +1,20 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Builders;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
|
class PostExternalQueryBuilder extends Builder
|
||||||
|
{
|
||||||
|
public function isActive(): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isStatus(string $status): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
public function newEloquentBuilder($query): PostExternalQueryBuilder
|
||||||
|
{
|
||||||
|
return new PostExternalQueryBuilder($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,31 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
|
||||||
|
class Test extends AbstractModelsCommand
|
||||||
|
{
|
||||||
|
protected function getEnvironmentSetUp($app)
|
||||||
|
{
|
||||||
|
parent::getEnvironmentSetUp($app);
|
||||||
|
|
||||||
|
$app['config']->set('ide-helper.write_model_external_builder_methods', false);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function test(): void
|
||||||
|
{
|
||||||
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|
||||||
|
$tester = $this->runCommand($command, [
|
||||||
|
'--nowrite' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
|
$this->assertStringContainsString('Model information was written to _ide_helper_models.php', $tester->getDisplay());
|
||||||
|
$this->assertMatchesMockedSnapshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
+169
@@ -0,0 +1,169 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
/**
|
||||||
|
* A helper file for your Eloquent Models
|
||||||
|
* Copy the phpDocs from this file to the correct Model,
|
||||||
|
* And remove them from this file, to prevent double declarations.
|
||||||
|
*
|
||||||
|
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models{
|
||||||
|
/**
|
||||||
|
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Models\Post
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string|null $char_nullable
|
||||||
|
* @property string $char_not_nullable
|
||||||
|
* @property string|null $string_nullable
|
||||||
|
* @property string $string_not_nullable
|
||||||
|
* @property string|null $text_nullable
|
||||||
|
* @property string $text_not_nullable
|
||||||
|
* @property string|null $medium_text_nullable
|
||||||
|
* @property string $medium_text_not_nullable
|
||||||
|
* @property string|null $long_text_nullable
|
||||||
|
* @property string $long_text_not_nullable
|
||||||
|
* @property integer|null $integer_nullable
|
||||||
|
* @property integer $integer_not_nullable
|
||||||
|
* @property integer|null $tiny_integer_nullable
|
||||||
|
* @property integer $tiny_integer_not_nullable
|
||||||
|
* @property integer|null $small_integer_nullable
|
||||||
|
* @property integer $small_integer_not_nullable
|
||||||
|
* @property integer|null $medium_integer_nullable
|
||||||
|
* @property integer $medium_integer_not_nullable
|
||||||
|
* @property integer|null $big_integer_nullable
|
||||||
|
* @property integer $big_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_integer_nullable
|
||||||
|
* @property integer $unsigned_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_tiny_integer_nullable
|
||||||
|
* @property integer $unsigned_tiny_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_small_integer_nullable
|
||||||
|
* @property integer $unsigned_small_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_medium_integer_nullable
|
||||||
|
* @property integer $unsigned_medium_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_big_integer_nullable
|
||||||
|
* @property integer $unsigned_big_integer_not_nullable
|
||||||
|
* @property float|null $float_nullable
|
||||||
|
* @property float $float_not_nullable
|
||||||
|
* @property float|null $double_nullable
|
||||||
|
* @property float $double_not_nullable
|
||||||
|
* @property string|null $decimal_nullable
|
||||||
|
* @property string $decimal_not_nullable
|
||||||
|
* @property string|null $unsigned_decimal_nullable
|
||||||
|
* @property string $unsigned_decimal_not_nullable
|
||||||
|
* @property integer|null $boolean_nullable
|
||||||
|
* @property integer $boolean_not_nullable
|
||||||
|
* @property string|null $enum_nullable
|
||||||
|
* @property string $enum_not_nullable
|
||||||
|
* @property string|null $json_nullable
|
||||||
|
* @property string $json_not_nullable
|
||||||
|
* @property string|null $jsonb_nullable
|
||||||
|
* @property string $jsonb_not_nullable
|
||||||
|
* @property string|null $date_nullable
|
||||||
|
* @property string $date_not_nullable
|
||||||
|
* @property string|null $datetime_nullable
|
||||||
|
* @property string $datetime_not_nullable
|
||||||
|
* @property string|null $datetimetz_nullable
|
||||||
|
* @property string $datetimetz_not_nullable
|
||||||
|
* @property string|null $time_nullable
|
||||||
|
* @property string $time_not_nullable
|
||||||
|
* @property string|null $timetz_nullable
|
||||||
|
* @property string $timetz_not_nullable
|
||||||
|
* @property string|null $timestamp_nullable
|
||||||
|
* @property string $timestamp_not_nullable
|
||||||
|
* @property string|null $timestamptz_nullable
|
||||||
|
* @property string $timestamptz_not_nullable
|
||||||
|
* @property integer|null $year_nullable
|
||||||
|
* @property integer $year_not_nullable
|
||||||
|
* @property mixed|null $binary_nullable
|
||||||
|
* @property mixed $binary_not_nullable
|
||||||
|
* @property string|null $uuid_nullable
|
||||||
|
* @property string $uuid_not_nullable
|
||||||
|
* @property string|null $ipaddress_nullable
|
||||||
|
* @property string $ipaddress_not_nullable
|
||||||
|
* @property string|null $macaddress_nullable
|
||||||
|
* @property string $macaddress_not_nullable
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newModelQuery()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newQuery()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DoesNotGeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereId($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value)
|
||||||
|
*/
|
||||||
|
class Post extends \Eloquent {}
|
||||||
|
}
|
||||||
|
|
||||||
@@ -17,8 +17,23 @@ class Test extends AbstractModelsCommand
|
|||||||
'--write' => true,
|
'--write' => true,
|
||||||
]);
|
]);
|
||||||
|
|
||||||
|
if (PHP_VERSION_ID >= 80000) {
|
||||||
|
$errors = <<<TXT
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Attempt to read property "created_at" on null
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Attempt to read property "created_at" on null
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Attempt to read property "created_at" on null
|
||||||
|
TXT;
|
||||||
|
} else {
|
||||||
|
$errors = <<<TXT
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicBelongsTo() : Trying to get property 'created_at' of non-object
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasMany() : Trying to get property 'created_at' of non-object
|
||||||
|
Error resolving relation model of Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\DynamicRelations\Models\Dynamic:dynamicHasOne() : Trying to get property 'created_at' of non-object
|
||||||
|
TXT;
|
||||||
|
}
|
||||||
|
|
||||||
$this->assertSame(0, $tester->getStatusCode());
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
||||||
|
$this->assertStringContainsString($errors, $tester->getDisplay());
|
||||||
$this->assertMatchesMockedSnapshot();
|
$this->assertMatchesMockedSnapshot();
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
|
class PostExternalQueryBuilder extends Builder
|
||||||
|
{
|
||||||
|
public function isActive(): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isStatus(string $status): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isLoadingWith(?string $with): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withTheNumber($number): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withTheNumberDifferently($number): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withBool($booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withBoolDifferently($booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withBoolTypeHinted(bool $booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int|string $someone
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withSomeone($someone): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $option
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withMixedOption($option): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withTestCommand(ModelsCommand $testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withNullTestCommand(?ModelsCommand $testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withNullAndAssignmentTestCommand(?ModelsCommand $testCommand = null): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ModelsCommand $testCommand
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withNullTestCommandInDocBlock($testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
public function newEloquentBuilder($query): PostExternalQueryBuilder
|
||||||
|
{
|
||||||
|
return new PostExternalQueryBuilder($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
|
||||||
|
class Test extends AbstractModelsCommand
|
||||||
|
{
|
||||||
|
public function test(): void
|
||||||
|
{
|
||||||
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|
||||||
|
$tester = $this->runCommand($command, [
|
||||||
|
'--nowrite' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
|
$this->assertStringContainsString('Model information was written to _ide_helper_models.php', $tester->getDisplay());
|
||||||
|
$this->assertMatchesMockedSnapshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
+183
@@ -0,0 +1,183 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
// @formatter:off
|
||||||
|
/**
|
||||||
|
* A helper file for your Eloquent Models
|
||||||
|
* Copy the phpDocs from this file to the correct Model,
|
||||||
|
* And remove them from this file, to prevent double declarations.
|
||||||
|
*
|
||||||
|
* @author Barry vd. Heuvel <barryvdh@gmail.com>
|
||||||
|
*/
|
||||||
|
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models{
|
||||||
|
/**
|
||||||
|
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Models\Post
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string|null $char_nullable
|
||||||
|
* @property string $char_not_nullable
|
||||||
|
* @property string|null $string_nullable
|
||||||
|
* @property string $string_not_nullable
|
||||||
|
* @property string|null $text_nullable
|
||||||
|
* @property string $text_not_nullable
|
||||||
|
* @property string|null $medium_text_nullable
|
||||||
|
* @property string $medium_text_not_nullable
|
||||||
|
* @property string|null $long_text_nullable
|
||||||
|
* @property string $long_text_not_nullable
|
||||||
|
* @property integer|null $integer_nullable
|
||||||
|
* @property integer $integer_not_nullable
|
||||||
|
* @property integer|null $tiny_integer_nullable
|
||||||
|
* @property integer $tiny_integer_not_nullable
|
||||||
|
* @property integer|null $small_integer_nullable
|
||||||
|
* @property integer $small_integer_not_nullable
|
||||||
|
* @property integer|null $medium_integer_nullable
|
||||||
|
* @property integer $medium_integer_not_nullable
|
||||||
|
* @property integer|null $big_integer_nullable
|
||||||
|
* @property integer $big_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_integer_nullable
|
||||||
|
* @property integer $unsigned_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_tiny_integer_nullable
|
||||||
|
* @property integer $unsigned_tiny_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_small_integer_nullable
|
||||||
|
* @property integer $unsigned_small_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_medium_integer_nullable
|
||||||
|
* @property integer $unsigned_medium_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_big_integer_nullable
|
||||||
|
* @property integer $unsigned_big_integer_not_nullable
|
||||||
|
* @property float|null $float_nullable
|
||||||
|
* @property float $float_not_nullable
|
||||||
|
* @property float|null $double_nullable
|
||||||
|
* @property float $double_not_nullable
|
||||||
|
* @property string|null $decimal_nullable
|
||||||
|
* @property string $decimal_not_nullable
|
||||||
|
* @property string|null $unsigned_decimal_nullable
|
||||||
|
* @property string $unsigned_decimal_not_nullable
|
||||||
|
* @property integer|null $boolean_nullable
|
||||||
|
* @property integer $boolean_not_nullable
|
||||||
|
* @property string|null $enum_nullable
|
||||||
|
* @property string $enum_not_nullable
|
||||||
|
* @property string|null $json_nullable
|
||||||
|
* @property string $json_not_nullable
|
||||||
|
* @property string|null $jsonb_nullable
|
||||||
|
* @property string $jsonb_not_nullable
|
||||||
|
* @property string|null $date_nullable
|
||||||
|
* @property string $date_not_nullable
|
||||||
|
* @property string|null $datetime_nullable
|
||||||
|
* @property string $datetime_not_nullable
|
||||||
|
* @property string|null $datetimetz_nullable
|
||||||
|
* @property string $datetimetz_not_nullable
|
||||||
|
* @property string|null $time_nullable
|
||||||
|
* @property string $time_not_nullable
|
||||||
|
* @property string|null $timetz_nullable
|
||||||
|
* @property string $timetz_not_nullable
|
||||||
|
* @property string|null $timestamp_nullable
|
||||||
|
* @property string $timestamp_not_nullable
|
||||||
|
* @property string|null $timestamptz_nullable
|
||||||
|
* @property string $timestamptz_not_nullable
|
||||||
|
* @property integer|null $year_nullable
|
||||||
|
* @property integer $year_not_nullable
|
||||||
|
* @property mixed|null $binary_nullable
|
||||||
|
* @property mixed $binary_not_nullable
|
||||||
|
* @property string|null $uuid_nullable
|
||||||
|
* @property string $uuid_not_nullable
|
||||||
|
* @property string|null $ipaddress_nullable
|
||||||
|
* @property string $ipaddress_not_nullable
|
||||||
|
* @property string|null $macaddress_nullable
|
||||||
|
* @property string $macaddress_not_nullable
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post isActive()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post isLoadingWith(?string $with)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post isStatus(string $status)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newModelQuery()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post newQuery()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post query()
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBigIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBigIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBinaryNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBinaryNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBooleanNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereBooleanNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCharNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCharNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereCreatedAt($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDateNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDateNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimeNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimeNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimetzNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDatetimetzNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDecimalNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDecimalNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDoubleNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereDoubleNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereEnumNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereEnumNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereFloatNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereFloatNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereId($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIpaddressNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereIpaddressNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonbNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereJsonbNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereLongTextNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereLongTextNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMacaddressNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMacaddressNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumTextNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereMediumTextNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereSmallIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereStringNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereStringNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTextNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTextNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimeNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimeNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestampNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestampNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestamptzNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimestamptzNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimetzNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTimetzNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereTinyIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedBigIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedDecimalNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUpdatedAt($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUuidNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereUuidNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereYearNotNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post whereYearNullable($value)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBool(?bool $booleanVar)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBoolDifferently(?bool $booleanVar)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withBoolTypeHinted(bool $booleanVar)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withMixedOption($option)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withNullAndAssignmentTestCommand(?\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand = null)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withNullTestCommand(?\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withNullTestCommandInDocBlock($testCommand)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withSomeone($someone)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withTestCommand(\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withTheNumber(?int $number)
|
||||||
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilder\Builders\PostExternalQueryBuilder|Post withTheNumberDifferently(?int $number)
|
||||||
|
*/
|
||||||
|
class Post extends \Eloquent {}
|
||||||
|
}
|
||||||
|
|
||||||
+109
@@ -0,0 +1,109 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Builders;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
|
|
||||||
|
class PostExternalQueryBuilder extends Builder
|
||||||
|
{
|
||||||
|
public function isActive(): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isStatus(string $status): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function isLoadingWith(?string $with): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withTheNumber($number): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param integer|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withTheNumberDifferently($number): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withBool($booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param bool|null $number
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withBoolDifferently($booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withBoolTypeHinted(bool $booleanVar): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param int|string $someone
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withSomeone($someone): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param mixed $option
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withMixedOption($option): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withTestCommand(ModelsCommand $testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withNullTestCommand(?ModelsCommand $testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
public function withNullAndAssignmentTestCommand(?ModelsCommand $testCommand = null): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @param ModelsCommand $testCommand
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function withNullTestCommandInDocBlock($testCommand): self
|
||||||
|
{
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
}
|
||||||
+16
@@ -0,0 +1,16 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Models;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Builders\PostExternalQueryBuilder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
public function newEloquentBuilder($query): PostExternalQueryBuilder
|
||||||
|
{
|
||||||
|
return new PostExternalQueryBuilder($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
|
||||||
|
class Test extends AbstractModelsCommand
|
||||||
|
{
|
||||||
|
public function test(): void
|
||||||
|
{
|
||||||
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|
||||||
|
$tester = $this->runCommand($command, [
|
||||||
|
'--write' => true,
|
||||||
|
]);
|
||||||
|
|
||||||
|
$this->assertSame(0, $tester->getStatusCode());
|
||||||
|
$this->assertStringContainsString('Written new phpDocBlock to', $tester->getDisplay());
|
||||||
|
$this->assertMatchesMockedSnapshot();
|
||||||
|
}
|
||||||
|
}
|
||||||
+184
@@ -0,0 +1,184 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Models;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Builders\PostExternalQueryBuilder;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithExternalEloquentBuilderWithFqn\Models\Post
|
||||||
|
*
|
||||||
|
* @property integer $id
|
||||||
|
* @property string|null $char_nullable
|
||||||
|
* @property string $char_not_nullable
|
||||||
|
* @property string|null $string_nullable
|
||||||
|
* @property string $string_not_nullable
|
||||||
|
* @property string|null $text_nullable
|
||||||
|
* @property string $text_not_nullable
|
||||||
|
* @property string|null $medium_text_nullable
|
||||||
|
* @property string $medium_text_not_nullable
|
||||||
|
* @property string|null $long_text_nullable
|
||||||
|
* @property string $long_text_not_nullable
|
||||||
|
* @property integer|null $integer_nullable
|
||||||
|
* @property integer $integer_not_nullable
|
||||||
|
* @property integer|null $tiny_integer_nullable
|
||||||
|
* @property integer $tiny_integer_not_nullable
|
||||||
|
* @property integer|null $small_integer_nullable
|
||||||
|
* @property integer $small_integer_not_nullable
|
||||||
|
* @property integer|null $medium_integer_nullable
|
||||||
|
* @property integer $medium_integer_not_nullable
|
||||||
|
* @property integer|null $big_integer_nullable
|
||||||
|
* @property integer $big_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_integer_nullable
|
||||||
|
* @property integer $unsigned_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_tiny_integer_nullable
|
||||||
|
* @property integer $unsigned_tiny_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_small_integer_nullable
|
||||||
|
* @property integer $unsigned_small_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_medium_integer_nullable
|
||||||
|
* @property integer $unsigned_medium_integer_not_nullable
|
||||||
|
* @property integer|null $unsigned_big_integer_nullable
|
||||||
|
* @property integer $unsigned_big_integer_not_nullable
|
||||||
|
* @property float|null $float_nullable
|
||||||
|
* @property float $float_not_nullable
|
||||||
|
* @property float|null $double_nullable
|
||||||
|
* @property float $double_not_nullable
|
||||||
|
* @property string|null $decimal_nullable
|
||||||
|
* @property string $decimal_not_nullable
|
||||||
|
* @property string|null $unsigned_decimal_nullable
|
||||||
|
* @property string $unsigned_decimal_not_nullable
|
||||||
|
* @property integer|null $boolean_nullable
|
||||||
|
* @property integer $boolean_not_nullable
|
||||||
|
* @property string|null $enum_nullable
|
||||||
|
* @property string $enum_not_nullable
|
||||||
|
* @property string|null $json_nullable
|
||||||
|
* @property string $json_not_nullable
|
||||||
|
* @property string|null $jsonb_nullable
|
||||||
|
* @property string $jsonb_not_nullable
|
||||||
|
* @property string|null $date_nullable
|
||||||
|
* @property string $date_not_nullable
|
||||||
|
* @property string|null $datetime_nullable
|
||||||
|
* @property string $datetime_not_nullable
|
||||||
|
* @property string|null $datetimetz_nullable
|
||||||
|
* @property string $datetimetz_not_nullable
|
||||||
|
* @property string|null $time_nullable
|
||||||
|
* @property string $time_not_nullable
|
||||||
|
* @property string|null $timetz_nullable
|
||||||
|
* @property string $timetz_not_nullable
|
||||||
|
* @property string|null $timestamp_nullable
|
||||||
|
* @property string $timestamp_not_nullable
|
||||||
|
* @property string|null $timestamptz_nullable
|
||||||
|
* @property string $timestamptz_not_nullable
|
||||||
|
* @property integer|null $year_nullable
|
||||||
|
* @property integer $year_not_nullable
|
||||||
|
* @property mixed|null $binary_nullable
|
||||||
|
* @property mixed $binary_not_nullable
|
||||||
|
* @property string|null $uuid_nullable
|
||||||
|
* @property string $uuid_not_nullable
|
||||||
|
* @property string|null $ipaddress_nullable
|
||||||
|
* @property string $ipaddress_not_nullable
|
||||||
|
* @property string|null $macaddress_nullable
|
||||||
|
* @property string $macaddress_not_nullable
|
||||||
|
* @property \Illuminate\Support\Carbon|null $created_at
|
||||||
|
* @property \Illuminate\Support\Carbon|null $updated_at
|
||||||
|
* @method static PostExternalQueryBuilder|Post isActive()
|
||||||
|
* @method static PostExternalQueryBuilder|Post isLoadingWith(?string $with)
|
||||||
|
* @method static PostExternalQueryBuilder|Post isStatus(string $status)
|
||||||
|
* @method static PostExternalQueryBuilder|Post newModelQuery()
|
||||||
|
* @method static PostExternalQueryBuilder|Post newQuery()
|
||||||
|
* @method static PostExternalQueryBuilder|Post query()
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBigIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBigIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBinaryNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBinaryNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBooleanNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereBooleanNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereCharNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereCharNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereCreatedAt($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDateNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDateNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDatetimeNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDatetimeNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDatetimetzNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDatetimetzNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDecimalNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDecimalNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDoubleNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereDoubleNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereEnumNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereEnumNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereFloatNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereFloatNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereId($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereIpaddressNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereIpaddressNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereJsonNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereJsonNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereJsonbNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereJsonbNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereLongTextNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereLongTextNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMacaddressNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMacaddressNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMediumIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMediumIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMediumTextNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereMediumTextNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereSmallIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereSmallIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereStringNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereStringNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTextNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTextNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimeNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimeNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimestampNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimestampNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimestamptzNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimestamptzNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimetzNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTimetzNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTinyIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereTinyIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedBigIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedDecimalNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedDecimalNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedMediumIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedSmallIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUnsignedTinyIntegerNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUpdatedAt($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUuidNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereUuidNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereYearNotNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post whereYearNullable($value)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withBool(?bool $booleanVar)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withBoolDifferently(?bool $booleanVar)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withBoolTypeHinted(bool $booleanVar)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withMixedOption($option)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withNullAndAssignmentTestCommand(?\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand = null)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withNullTestCommand(?\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withNullTestCommandInDocBlock($testCommand)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withSomeone($someone)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withTestCommand(\Barryvdh\LaravelIdeHelper\Console\ModelsCommand $testCommand)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withTheNumber(?int $number)
|
||||||
|
* @method static PostExternalQueryBuilder|Post withTheNumberDifferently(?int $number)
|
||||||
|
* @mixin \Eloquent
|
||||||
|
*/
|
||||||
|
class Post extends Model
|
||||||
|
{
|
||||||
|
public function newEloquentBuilder($query): PostExternalQueryBuilder
|
||||||
|
{
|
||||||
|
return new PostExternalQueryBuilder($query);
|
||||||
|
}
|
||||||
|
}
|
||||||
+1
-1
@@ -88,7 +88,7 @@ use Illuminate\Database\Eloquent\SoftDeletes;
|
|||||||
* @property-read int|null $posts_count
|
* @property-read int|null $posts_count
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post newQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null($unusedParam)
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post null(string $unusedParam)
|
||||||
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
|
* @method static \Illuminate\Database\Query\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post onlyTrashed()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post query()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|\Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithForcedFqn\Models\Post whereBigIntegerNotNullable($value)
|
||||||
|
|||||||
@@ -94,7 +94,7 @@ use Illuminate\Support\Carbon;
|
|||||||
* @property-read int|null $posts_count
|
* @property-read int|null $posts_count
|
||||||
* @method static EloquentBuilder|Post newModelQuery()
|
* @method static EloquentBuilder|Post newModelQuery()
|
||||||
* @method static EloquentBuilder|Post newQuery()
|
* @method static EloquentBuilder|Post newQuery()
|
||||||
* @method static EloquentBuilder|Post null($unusedParam)
|
* @method static EloquentBuilder|Post null(string $unusedParam)
|
||||||
* @method static QueryBuilder|Post onlyTrashed()
|
* @method static QueryBuilder|Post onlyTrashed()
|
||||||
* @method static EloquentBuilder|Post query()
|
* @method static EloquentBuilder|Post query()
|
||||||
* @method static EloquentBuilder|Post whereBigIntegerNotNullable($value)
|
* @method static EloquentBuilder|Post whereBigIntegerNotNullable($value)
|
||||||
|
|||||||
+73
-73
@@ -90,79 +90,79 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWi
|
|||||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post newModelQuery()
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post newModelQuery()
|
||||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post newQuery()
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post newQuery()
|
||||||
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post query()
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post query()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBigIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBigIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBigIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBinaryNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBinaryNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBinaryNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBooleanNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereBooleanNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereBooleanNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereCharNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCharNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereCharNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereCreatedAt($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereCreatedAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDateNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDateNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDateNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDatetimeNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimeNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDatetimeNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDatetimetzNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDatetimetzNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDatetimetzNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDecimalNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDecimalNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDecimalNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDoubleNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereDoubleNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereDoubleNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereEnumNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereEnumNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereEnumNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereFloatNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereFloatNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereFloatNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereId($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereId($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereIpaddressNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereIpaddressNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereIpaddressNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereJsonNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereJsonNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereJsonbNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereJsonbNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereJsonbNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereLongTextNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereLongTextNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereLongTextNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMacaddressNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMacaddressNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMacaddressNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMediumIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMediumIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMediumTextNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereMediumTextNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereMediumTextNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereSmallIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereSmallIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereSmallIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereStringNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereStringNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereStringNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTextNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTextNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTextNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimeNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimeNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimeNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimestampNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestampNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimestampNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimestamptzNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimestamptzNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimestamptzNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimetzNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTimetzNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTimetzNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTinyIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereTinyIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereTinyIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedBigIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedBigIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedBigIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedDecimalNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedDecimalNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedDecimalNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedMediumIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedMediumIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedMediumIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedSmallIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedSmallIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedSmallIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedTinyIntegerNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUnsignedTinyIntegerNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUnsignedTinyIntegerNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUpdatedAt($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUpdatedAt($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUuidNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereUuidNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereUuidNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNotNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereYearNotNullable($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Post whereYearNullable($value)
|
* @method static \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\GeneratePhpdocWithFqnInExternalFile\Builders\EMaterialQueryBuilder|Post whereYearNullable($value)
|
||||||
*/
|
*/
|
||||||
class Post extends \Eloquent {}
|
class Post extends \Eloquent {}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,24 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|
||||||
|
class CustomCasterWithParam implements CastsAttributes
|
||||||
|
{
|
||||||
|
public function __construct(string $param)
|
||||||
|
{
|
||||||
|
}
|
||||||
|
|
||||||
|
public function get($model, string $key, $value, array $attributes): CastedProperty
|
||||||
|
{
|
||||||
|
return new CastedProperty();
|
||||||
|
}
|
||||||
|
|
||||||
|
public function set($model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
// TODO: Implement set() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
|
class ExtendedSelfCastingCasterWithStaticDocblockReturn extends SelfCastingCasterWithStaticDocblockReturn
|
||||||
|
{
|
||||||
|
}
|
||||||
+9
@@ -0,0 +1,9 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
|
class ExtendedSelfCastingCasterWithThisDocblockReturn extends SelfCastingCasterWithStaticDocblockReturn
|
||||||
|
{
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|
||||||
|
class SelfCastingCasterWithStaticDocblockReturn implements CastsAttributes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return static
|
||||||
|
*/
|
||||||
|
public function get($model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
return new static();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function set($model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
// TODO: Implement set() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
+26
@@ -0,0 +1,26 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts;
|
||||||
|
|
||||||
|
use Illuminate\Contracts\Database\Eloquent\CastsAttributes;
|
||||||
|
|
||||||
|
class SelfCastingCasterWithThisDocblockReturn implements CastsAttributes
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @return $this
|
||||||
|
*/
|
||||||
|
public function get($model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
return new static();
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @inheritDoc
|
||||||
|
*/
|
||||||
|
public function set($model, string $key, $value, array $attributes)
|
||||||
|
{
|
||||||
|
// TODO: Implement set() method.
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -8,9 +8,14 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Cas
|
|||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturnFqn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturnFqn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithNullablePrimitiveReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithNullablePrimitiveReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithoutReturnType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithoutReturnType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithParam;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveDocblockReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveDocblockReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithReturnType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithReturnType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\ExtendedSelfCastingCasterWithStaticDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\ExtendedSelfCastingCasterWithThisDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\SelfCastingCasterWithStaticDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\SelfCastingCasterWithThisDocblockReturn;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
class CustomCast extends Model
|
class CustomCast extends Model
|
||||||
@@ -23,5 +28,11 @@ class CustomCast extends Model
|
|||||||
'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class,
|
'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class,
|
||||||
'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class,
|
'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class,
|
||||||
'casted_property_without_return' => CustomCasterWithoutReturnType::class,
|
'casted_property_without_return' => CustomCasterWithoutReturnType::class,
|
||||||
|
'casted_property_with_param' => CustomCasterWithParam::class . ':param',
|
||||||
|
'casted_property_with_static_return_docblock' => SelfCastingCasterWithStaticDocblockReturn::class,
|
||||||
|
'casted_property_with_this_return_docblock' => SelfCastingCasterWithThisDocblockReturn::class,
|
||||||
|
'extended_casted_property_with_static_return_docblock' => ExtendedSelfCastingCasterWithStaticDocblockReturn::class,
|
||||||
|
'extended_casted_property_with_this_return_docblock' => ExtendedSelfCastingCasterWithThisDocblockReturn::class,
|
||||||
|
'casted_property_with_static_return_docblock_and_param' => SelfCastingCasterWithStaticDocblockReturn::class . ':param',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,19 +6,9 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCas
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
protected function setUp(): void
|
|
||||||
{
|
|
||||||
parent::setUp();
|
|
||||||
|
|
||||||
if (version_compare(Application::VERSION, '7.0', '<')) {
|
|
||||||
$this->markTestSkipped('This test requires Laravel 7.0 or higher');
|
|
||||||
}
|
|
||||||
}
|
|
||||||
|
|
||||||
public function test(): void
|
public function test(): void
|
||||||
{
|
{
|
||||||
$command = $this->app->make(ModelsCommand::class);
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|||||||
@@ -8,9 +8,14 @@ use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Cas
|
|||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturnFqn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithDocblockReturnFqn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithNullablePrimitiveReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithNullablePrimitiveReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithoutReturnType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithoutReturnType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithParam;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveDocblockReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveDocblockReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveReturn;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithPrimitiveReturn;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithReturnType;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CustomCasterWithReturnType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\ExtendedSelfCastingCasterWithStaticDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\ExtendedSelfCastingCasterWithThisDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\SelfCastingCasterWithStaticDocblockReturn;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\SelfCastingCasterWithThisDocblockReturn;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -23,16 +28,28 @@ use Illuminate\Database\Eloquent\Model;
|
|||||||
* @property array|null $casted_property_with_return_primitive_docblock
|
* @property array|null $casted_property_with_return_primitive_docblock
|
||||||
* @property array|null $casted_property_with_return_nullable_primitive
|
* @property array|null $casted_property_with_return_nullable_primitive
|
||||||
* @property $casted_property_without_return
|
* @property $casted_property_without_return
|
||||||
|
* @property \Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\LaravelCustomCasts\Casts\CastedProperty $casted_property_with_param
|
||||||
|
* @property SelfCastingCasterWithStaticDocblockReturn $casted_property_with_static_return_docblock
|
||||||
|
* @property SelfCastingCasterWithThisDocblockReturn $casted_property_with_this_return_docblock
|
||||||
|
* @property ExtendedSelfCastingCasterWithStaticDocblockReturn $extended_casted_property_with_static_return_docblock
|
||||||
|
* @property ExtendedSelfCastingCasterWithThisDocblockReturn $extended_casted_property_with_this_return_docblock
|
||||||
|
* @property SelfCastingCasterWithStaticDocblockReturn $casted_property_with_static_return_docblock_and_param
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast newQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast query()
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast query()
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithParam($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblock($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblock($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblockFqn($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnDocblockFqn($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnNullablePrimitive($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnNullablePrimitive($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitive($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitive($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitiveDocblock($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnPrimitiveDocblock($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnType($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithReturnType($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithStaticReturnDocblock($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithStaticReturnDocblockAndParam($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithThisReturnDocblock($value)
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithoutReturn($value)
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereCastedPropertyWithoutReturn($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereExtendedCastedPropertyWithStaticReturnDocblock($value)
|
||||||
|
* @method static \Illuminate\Database\Eloquent\Builder|CustomCast whereExtendedCastedPropertyWithThisReturnDocblock($value)
|
||||||
* @mixin \Eloquent
|
* @mixin \Eloquent
|
||||||
*/
|
*/
|
||||||
class CustomCast extends Model
|
class CustomCast extends Model
|
||||||
@@ -45,5 +62,11 @@ class CustomCast extends Model
|
|||||||
'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class,
|
'casted_property_with_return_primitive_docblock' => CustomCasterWithPrimitiveDocblockReturn::class,
|
||||||
'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class,
|
'casted_property_with_return_nullable_primitive' => CustomCasterWithNullablePrimitiveReturn::class,
|
||||||
'casted_property_without_return' => CustomCasterWithoutReturnType::class,
|
'casted_property_without_return' => CustomCasterWithoutReturnType::class,
|
||||||
|
'casted_property_with_param' => CustomCasterWithParam::class . ':param',
|
||||||
|
'casted_property_with_static_return_docblock' => SelfCastingCasterWithStaticDocblockReturn::class,
|
||||||
|
'casted_property_with_this_return_docblock' => SelfCastingCasterWithThisDocblockReturn::class,
|
||||||
|
'extended_casted_property_with_static_return_docblock' => ExtendedSelfCastingCasterWithStaticDocblockReturn::class,
|
||||||
|
'extended_casted_property_with_this_return_docblock' => ExtendedSelfCastingCasterWithThisDocblockReturn::class,
|
||||||
|
'casted_property_with_static_return_docblock_and_param' => SelfCastingCasterWithStaticDocblockReturn::class . ':param',
|
||||||
];
|
];
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models;
|
||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Traits\HasTestRelations;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
@@ -17,6 +18,8 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
|||||||
|
|
||||||
class Simple extends Model
|
class Simple extends Model
|
||||||
{
|
{
|
||||||
|
use HasTestRelations;
|
||||||
|
|
||||||
// Regular relations
|
// Regular relations
|
||||||
public function relationHasMany(): HasMany
|
public function relationHasMany(): HasMany
|
||||||
{
|
{
|
||||||
@@ -84,4 +87,14 @@ class Simple extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(AnotherModel::class, __FUNCTION__);
|
return $this->belongsTo(AnotherModel::class, __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relationSampleToManyRelationType()
|
||||||
|
{
|
||||||
|
return $this->testToOneRelation(Simple::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function relationSampleRelationType()
|
||||||
|
{
|
||||||
|
return $this->testToManyRelation(Simple::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -6,9 +6,22 @@ namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Console\ModelsCommand;
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\AbstractModelsCommand;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType;
|
||||||
|
use Illuminate\Support\Facades\Config;
|
||||||
|
|
||||||
class Test extends AbstractModelsCommand
|
class Test extends AbstractModelsCommand
|
||||||
{
|
{
|
||||||
|
protected function setUp(): void
|
||||||
|
{
|
||||||
|
parent::setUp();
|
||||||
|
|
||||||
|
Config::set('ide-helper.additional_relation_types', [
|
||||||
|
'testToOneRelation' => SampleToOneRelationType::class,
|
||||||
|
'testToManyRelation' => SampleToManyRelationType::class,
|
||||||
|
]);
|
||||||
|
}
|
||||||
|
|
||||||
public function test(): void
|
public function test(): void
|
||||||
{
|
{
|
||||||
$command = $this->app->make(ModelsCommand::class);
|
$command = $this->app->make(ModelsCommand::class);
|
||||||
|
|||||||
@@ -0,0 +1,23 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Traits;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToManyRelationType;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types\SampleToOneRelationType;
|
||||||
|
|
||||||
|
trait HasTestRelations
|
||||||
|
{
|
||||||
|
public function testToOneRelation($related)
|
||||||
|
{
|
||||||
|
$instance = $this->newRelatedInstance($related);
|
||||||
|
return new SampleToOneRelationType($instance->newQuery(), $this);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function testToManyRelation($related)
|
||||||
|
{
|
||||||
|
$instance = $this->newRelatedInstance($related);
|
||||||
|
return new SampleToManyRelationType($instance->newQuery(), $this);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,36 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
|
|
||||||
|
class SampleToManyRelationType extends Relation
|
||||||
|
{
|
||||||
|
public function addConstraints()
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addEagerConstraints(array $models)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initRelation(array $models, $relation)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function match(array $models, Collection $results, $relation)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResults()
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,52 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Types;
|
||||||
|
|
||||||
|
use Illuminate\Database\Eloquent\Collection;
|
||||||
|
use Illuminate\Database\Eloquent\Model;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Concerns\SupportsDefaultModels;
|
||||||
|
use Illuminate\Database\Eloquent\Relations\Relation;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* Sample for custom relation
|
||||||
|
*
|
||||||
|
* the relation is a big fake and only for testing of the docblock generation
|
||||||
|
*
|
||||||
|
* @package Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations
|
||||||
|
*/
|
||||||
|
class SampleToOneRelationType extends Relation
|
||||||
|
{
|
||||||
|
use SupportsDefaultModels;
|
||||||
|
|
||||||
|
public function addConstraints()
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function addEagerConstraints(array $models)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function initRelation(array $models, $relation)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function match(array $models, Collection $results, $relation)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getResults()
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function newRelatedInstanceFor(Model $parent)
|
||||||
|
{
|
||||||
|
// Fake
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -5,6 +5,7 @@ declare(strict_types=1);
|
|||||||
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models;
|
namespace Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Models;
|
||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel;
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\ModelsOtherNamespace\AnotherModel;
|
||||||
|
use Barryvdh\LaravelIdeHelper\Tests\Console\ModelsCommand\Relations\Traits\HasTestRelations;
|
||||||
use Illuminate\Database\Eloquent\Model;
|
use Illuminate\Database\Eloquent\Model;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
use Illuminate\Database\Eloquent\Relations\BelongsTo;
|
||||||
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
use Illuminate\Database\Eloquent\Relations\BelongsToMany;
|
||||||
@@ -38,6 +39,9 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
|||||||
* @property-read Model|\Eloquent $relationMorphTo
|
* @property-read Model|\Eloquent $relationMorphTo
|
||||||
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationMorphedByMany
|
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationMorphedByMany
|
||||||
* @property-read int|null $relation_morphed_by_many_count
|
* @property-read int|null $relation_morphed_by_many_count
|
||||||
|
* @property-read \Illuminate\Database\Eloquent\Collection|Simple[] $relationSampleRelationType
|
||||||
|
* @property-read int|null $relation_sample_relation_type_count
|
||||||
|
* @property-read Simple $relationSampleToManyRelationType
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Simple newModelQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
|
* @method static \Illuminate\Database\Eloquent\Builder|Simple newQuery()
|
||||||
* @method static \Illuminate\Database\Eloquent\Builder|Simple query()
|
* @method static \Illuminate\Database\Eloquent\Builder|Simple query()
|
||||||
@@ -46,6 +50,8 @@ use Illuminate\Database\Eloquent\Relations\MorphToMany;
|
|||||||
*/
|
*/
|
||||||
class Simple extends Model
|
class Simple extends Model
|
||||||
{
|
{
|
||||||
|
use HasTestRelations;
|
||||||
|
|
||||||
// Regular relations
|
// Regular relations
|
||||||
public function relationHasMany(): HasMany
|
public function relationHasMany(): HasMany
|
||||||
{
|
{
|
||||||
@@ -113,4 +119,14 @@ class Simple extends Model
|
|||||||
{
|
{
|
||||||
return $this->belongsTo(AnotherModel::class, __FUNCTION__);
|
return $this->belongsTo(AnotherModel::class, __FUNCTION__);
|
||||||
}
|
}
|
||||||
|
|
||||||
|
public function relationSampleToManyRelationType()
|
||||||
|
{
|
||||||
|
return $this->testToOneRelation(Simple::class);
|
||||||
|
}
|
||||||
|
|
||||||
|
public function relationSampleRelationType()
|
||||||
|
{
|
||||||
|
return $this->testToManyRelation(Simple::class);
|
||||||
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -18,6 +18,12 @@ class CustomCastsTable extends Migration
|
|||||||
$table->string('casted_property_with_return_primitive_docblock');
|
$table->string('casted_property_with_return_primitive_docblock');
|
||||||
$table->string('casted_property_with_return_nullable_primitive');
|
$table->string('casted_property_with_return_nullable_primitive');
|
||||||
$table->string('casted_property_without_return');
|
$table->string('casted_property_without_return');
|
||||||
|
$table->string('casted_property_with_param');
|
||||||
|
$table->string('casted_property_with_static_return_docblock');
|
||||||
|
$table->string('casted_property_with_this_return_docblock');
|
||||||
|
$table->string('extended_casted_property_with_static_return_docblock');
|
||||||
|
$table->string('extended_casted_property_with_this_return_docblock');
|
||||||
|
$table->string('casted_property_with_static_return_docblock_and_param');
|
||||||
});
|
});
|
||||||
}
|
}
|
||||||
}
|
}
|
||||||
|
|||||||
@@ -0,0 +1,18 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests\Factories;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Factories;
|
||||||
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
|
class AllTest extends TestCase
|
||||||
|
{
|
||||||
|
public function testAll(): void
|
||||||
|
{
|
||||||
|
$factories = Factories::all();
|
||||||
|
|
||||||
|
self::assertEmpty($factories);
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -0,0 +1,220 @@
|
|||||||
|
<?php
|
||||||
|
|
||||||
|
declare(strict_types=1);
|
||||||
|
|
||||||
|
namespace Barryvdh\LaravelIdeHelper\Tests;
|
||||||
|
|
||||||
|
use Barryvdh\LaravelIdeHelper\Macro;
|
||||||
|
use Barryvdh\Reflection\DocBlock;
|
||||||
|
use Barryvdh\Reflection\DocBlock\Tag;
|
||||||
|
use Illuminate\Database\Eloquent\Builder as EloquentBuilder;
|
||||||
|
use ReflectionClass;
|
||||||
|
use ReflectionFunction;
|
||||||
|
use ReflectionFunctionAbstract;
|
||||||
|
|
||||||
|
use function array_map;
|
||||||
|
use function implode;
|
||||||
|
|
||||||
|
use const PHP_EOL;
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @coversDefaultClass \Barryvdh\LaravelIdeHelper\Macro
|
||||||
|
*/
|
||||||
|
class MacroTest extends TestCase
|
||||||
|
{
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocEloquentBuilderHasStaticInReturnType(): void
|
||||||
|
{
|
||||||
|
$class = new ReflectionClass(EloquentBuilder::class);
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
function (): EloquentBuilder {
|
||||||
|
return $this;
|
||||||
|
}
|
||||||
|
),
|
||||||
|
$class
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertEquals(
|
||||||
|
'@return \Illuminate\Database\Eloquent\Builder|static',
|
||||||
|
$this->tagsToString($phpdoc, 'return')
|
||||||
|
);
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocClosureWithoutDocBlock(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
function (int $a = null): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertEmpty($phpdoc->getText());
|
||||||
|
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
|
||||||
|
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
|
||||||
|
$this->assertTrue($phpdoc->hasTag('see'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocClosureWithArgsAndReturnType(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
/**
|
||||||
|
* Test docblock.
|
||||||
|
*/
|
||||||
|
function (int $a = null): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertStringContainsString('Test docblock', $phpdoc->getText());
|
||||||
|
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
|
||||||
|
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
|
||||||
|
$this->assertTrue($phpdoc->hasTag('see'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocClosureWithArgs(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
/**
|
||||||
|
* Test docblock.
|
||||||
|
*/
|
||||||
|
function (int $a = null) {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertStringContainsString('Test docblock', $phpdoc->getText());
|
||||||
|
$this->assertEquals('@param int|null $a', $this->tagsToString($phpdoc, 'param'));
|
||||||
|
$this->assertFalse($phpdoc->hasTag('return'));
|
||||||
|
$this->assertTrue($phpdoc->hasTag('see'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
* @throws \ReflectionException
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocClosureWithReturnType(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
/**
|
||||||
|
* Test docblock.
|
||||||
|
*/
|
||||||
|
function (): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertStringContainsString('Test docblock', $phpdoc->getText());
|
||||||
|
$this->assertFalse($phpdoc->hasTag('param'));
|
||||||
|
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
|
||||||
|
$this->assertTrue($phpdoc->hasTag('see'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocParamsAddedOnlyNotPresent(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
/**
|
||||||
|
* Test docblock.
|
||||||
|
*
|
||||||
|
* @param \stdClass|null $a aaaaa
|
||||||
|
*/
|
||||||
|
function ($a = null): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertStringContainsString('Test docblock', $phpdoc->getText());
|
||||||
|
$this->assertEquals('@param \stdClass|null $a aaaaa', $this->tagsToString($phpdoc, 'param'));
|
||||||
|
$this->assertEquals('@return int', $this->tagsToString($phpdoc, 'return'));
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @covers ::initPhpDoc
|
||||||
|
*/
|
||||||
|
public function testInitPhpDocReturnAddedOnlyNotPresent(): void
|
||||||
|
{
|
||||||
|
$phpdoc = (new MacroMock())->getPhpDoc(
|
||||||
|
new ReflectionFunction(
|
||||||
|
/**
|
||||||
|
* Test docblock.
|
||||||
|
*
|
||||||
|
* @return \stdClass|null rrrrrrr
|
||||||
|
*/
|
||||||
|
function ($a = null): int {
|
||||||
|
return 0;
|
||||||
|
}
|
||||||
|
)
|
||||||
|
);
|
||||||
|
|
||||||
|
$this->assertNotNull($phpdoc);
|
||||||
|
$this->assertStringContainsString('Test docblock', $phpdoc->getText());
|
||||||
|
$this->assertEquals('@param mixed $a', $this->tagsToString($phpdoc, 'param'));
|
||||||
|
$this->assertEquals('@return \stdClass|null rrrrrrr', $this->tagsToString($phpdoc, 'return'));
|
||||||
|
}
|
||||||
|
|
||||||
|
protected function tagsToString(DocBlock $docBlock, string $name)
|
||||||
|
{
|
||||||
|
$tags = $docBlock->getTagsByName($name);
|
||||||
|
$tags = array_map(
|
||||||
|
function (Tag $tag) {
|
||||||
|
return trim((string)$tag);
|
||||||
|
},
|
||||||
|
$tags
|
||||||
|
);
|
||||||
|
$tags = implode(PHP_EOL, $tags);
|
||||||
|
|
||||||
|
return $tags;
|
||||||
|
}
|
||||||
|
}
|
||||||
|
|
||||||
|
/**
|
||||||
|
* @internal
|
||||||
|
* @noinspection PhpMultipleClassesDeclarationsInOneFile
|
||||||
|
*/
|
||||||
|
class MacroMock extends Macro
|
||||||
|
{
|
||||||
|
public function __construct()
|
||||||
|
{
|
||||||
|
// no need to call parent
|
||||||
|
}
|
||||||
|
|
||||||
|
public function getPhpDoc(ReflectionFunctionAbstract $method, ReflectionClass $class = null): DocBlock
|
||||||
|
{
|
||||||
|
return (new Macro($method, '', $class ?? $method->getClosureScopeClass()))->phpdoc;
|
||||||
|
}
|
||||||
|
}
|
||||||
@@ -6,7 +6,6 @@ namespace Barryvdh\LaravelIdeHelper\Tests;
|
|||||||
|
|
||||||
use Barryvdh\LaravelIdeHelper\Method;
|
use Barryvdh\LaravelIdeHelper\Method;
|
||||||
use Illuminate\Database\Eloquent\Builder;
|
use Illuminate\Database\Eloquent\Builder;
|
||||||
use Illuminate\Foundation\Application;
|
|
||||||
use PHPUnit\Framework\TestCase;
|
use PHPUnit\Framework\TestCase;
|
||||||
|
|
||||||
class MethodTest extends TestCase
|
class MethodTest extends TestCase
|
||||||
@@ -51,7 +50,7 @@ DOC;
|
|||||||
$this->assertSame(['$last', '$first', '...$middle'], $method->getParams(false));
|
$this->assertSame(['$last', '$first', '...$middle'], $method->getParams(false));
|
||||||
$this->assertSame('$last, $first = \'Barry\', ...$middle', $method->getParamsWithDefault(true));
|
$this->assertSame('$last, $first = \'Barry\', ...$middle', $method->getParamsWithDefault(true));
|
||||||
$this->assertSame(['$last', '$first = \'Barry\'', '...$middle'], $method->getParamsWithDefault(false));
|
$this->assertSame(['$last', '$first = \'Barry\'', '...$middle'], $method->getParamsWithDefault(false));
|
||||||
$this->assertSame(true, $method->shouldReturn());
|
$this->assertTrue($method->shouldReturn());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
@@ -59,10 +58,6 @@ DOC;
|
|||||||
*/
|
*/
|
||||||
public function testEloquentBuilderOutput()
|
public function testEloquentBuilderOutput()
|
||||||
{
|
{
|
||||||
if ((int) Application::VERSION < 8) {
|
|
||||||
$this->markTestSkipped('This test requires Laravel 8.0 or higher');
|
|
||||||
}
|
|
||||||
|
|
||||||
$reflectionClass = new \ReflectionClass(Builder::class);
|
$reflectionClass = new \ReflectionClass(Builder::class);
|
||||||
$reflectionMethod = $reflectionClass->getMethod('with');
|
$reflectionMethod = $reflectionClass->getMethod('with');
|
||||||
|
|
||||||
@@ -85,7 +80,7 @@ DOC;
|
|||||||
$this->assertSame(['$relations', '$callback'], $method->getParams(false));
|
$this->assertSame(['$relations', '$callback'], $method->getParams(false));
|
||||||
$this->assertSame('$relations, $callback = null', $method->getParamsWithDefault(true));
|
$this->assertSame('$relations, $callback = null', $method->getParamsWithDefault(true));
|
||||||
$this->assertSame(['$relations', '$callback = null'], $method->getParamsWithDefault(false));
|
$this->assertSame(['$relations', '$callback = null'], $method->getParamsWithDefault(false));
|
||||||
$this->assertSame(true, $method->shouldReturn());
|
$this->assertTrue($method->shouldReturn());
|
||||||
}
|
}
|
||||||
|
|
||||||
/**
|
/**
|
||||||
|
|||||||
Reference in New Issue
Block a user