Skip to content
Permalink

Comparing changes

Choose two branches to see what’s changed or to start a new pull request. If you need to, you can also or learn more about diff comparisons.

Open a pull request

Create a new pull request by comparing changes across two branches. If you need to, you can also . Learn more about diff comparisons here.
base repository: barryvdh/laravel-ide-helper
Failed to load repositories. Confirm that selected base ref is valid, then try again.
Loading
base: v2.15.1
Choose a base ref
...
head repository: barryvdh/laravel-ide-helper
Failed to load repositories. Confirm that selected head ref is valid, then try again.
Loading
compare: v3.0.0
Choose a head ref
  • 11 commits
  • 57 files changed
  • 7 contributors

Commits on Feb 16, 2024

  1. [TEST] Show that custom phpdoc tags without space afterwards are unex…

    …pectedly changed (#981)
    
    * tests: show that custom phpdoc tags without space afterwards are unexpectedly changed
    
    This adds a test for the (current bug) behaviour of #666
    
    If this ever gets fixed, this fails and needs to be adapted,
    ensuring it won't break again.
    
    * test: adapt now that #666 has been fixed
    mfn authored Feb 16, 2024
    Copy the full SHA
    bcc2332 View commit details

Commits on Feb 17, 2024

  1. Switch to 3.0 tag (#1519)

    barryvdh authored Feb 17, 2024
    Copy the full SHA
    ed39977 View commit details
  2. Remove doctrine (#1512)

    * Remove doctrine
    
    * Fix tests
    
    * normalize composer.json
    
    * Add back platform
    
    * Bump integration versions
    
    * composer fix-style
    
    * Fix stability
    
    * Bump minimum to 10.36
    
    * Bump minimum to 10.38
    
    * More types
    
    * Fast fail off
    
    * Bump docblock
    
    * composer fix-style
    
    * add bpchar
    
    * Use match for type detection
    
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    
    * Use driverName
    
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    
    * fix match
    
    * TWeak types
    
    * Update snapshots
    
    * Remove testbench 7
    
    * composer fix-style
    
    * Update src/Console/ModelsCommand.php
    
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    
    * Update src/Console/ModelsCommand.php
    
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    
    * Tweak bool
    
    * Update src/Console/ModelsCommand.php
    
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    
    * composer fix-style
    
    * Remove custom types, default to string
    
    ---------
    
    Co-authored-by: barryvdh <barryvdh@users.noreply.github.com>
    Co-authored-by: laravel-ide-helper <laravel-ide-helper@users.noreply.github.com>
    Co-authored-by: Hafez Divandari <hafezdivandari@gmail.com>
    4 people authored Feb 17, 2024
    Copy the full SHA
    6579c03 View commit details
  3. Update CHANGELOG.md

    barryvdh authored Feb 17, 2024
    Copy the full SHA
    8bfe918 View commit details
  4. Add support for Laravel 11 (#1520)

    * update dependencies
    
    * Implement new methods for `Authenticatable` contract
    
    * Added Laravel 11 to CI test target
    
    * normalize composer.json
    
    * Remove obsolete migration method (column type) from test
    
    * Update snapshots
    
    * Add changelog entry
    
    * Update readme
    
    ---------
    
    Co-authored-by: 武田 憲太郎 <takeda@youmind.jp>
    Co-authored-by: barryvdh <barryvdh@users.noreply.github.com>
    3 people authored Feb 17, 2024
    Copy the full SHA
    05259b6 View commit details
  5. Bump minimum PHP version to 8.1 & misc maintenance (#1521)

    * Bump minimum PHP version to 8.1
    
    Laravel 10 doesn't support 8.0 anyway
    
    * Remove phpunit 9
    
    * gha: remove unused matrix dimension
    
    * gha: bump runner os
    
    * tests: remove outdated version checks
    mfn authored Feb 17, 2024
    Copy the full SHA
    9af62e2 View commit details

Commits on Feb 19, 2024

  1. Use int/bool instead of longer variant (#1524)

    * Use int/bool instead of longer variant
    
    * Add changelog
    
    * Update snapshots
    barryvdh authored Feb 19, 2024
    Copy the full SHA
    d7ed749 View commit details
  2. Merge reset/smart reset, don't set class (#1523)

    * Merge reset/smart reset, don't set class
    
    * Add changelog
    barryvdh authored Feb 19, 2024
    Copy the full SHA
    02af2a2 View commit details
  3. Remove --smart-reset completely (#1525)

    * Remove `--smart-reset` completely
    
    See #1523 (comment)
    
    * Update CHANGELOG.md
    
    ---------
    
    Co-authored-by: Barry vd. Heuvel <barryvdh@gmail.com>
    mfn and barryvdh authored Feb 19, 2024
    Copy the full SHA
    49ac75d View commit details
  4. Copy the full SHA
    8eab699 View commit details

Commits on Mar 1, 2024

  1. Prepare 3.0 release (#1530)

    * Prepare 3.0 release
    
    * Update CHANGELOG.md
    
    * Update CHANGELOG.md
    barryvdh authored Mar 1, 2024
    Copy the full SHA
    bc1d67f View commit details
Showing with 621 additions and 736 deletions.
  1. +1 −1 .github/workflows/composer-normalize.yml
  2. +2 −2 .github/workflows/fix-code-style.yml
  3. +6 −7 .github/workflows/run-integration-tests.yml
  4. +3 −3 .github/workflows/run-static-analysis.yml
  5. +8 −9 .github/workflows/run-tests.yml
  6. +18 −1 CHANGELOG.md
  7. +2 −22 README.md
  8. +13 −13 composer.json
  9. +0 −30 config/ide-helper.php
  10. +7 −14 phpunit.xml.dist
  11. +34 −101 src/Console/ModelsCommand.php
  12. +0 −7 tests/Console/ModelsCommand/AdvancedCasts/Test.php
  13. +2 −2 tests/Console/ModelsCommand/AdvancedCasts/__snapshots__/Test__test__1.php
  14. +28 −32 tests/Console/ModelsCommand/AllowGlobDirectory/__snapshots__/Test__test__1.php
  15. +1 −1 tests/Console/ModelsCommand/ArrayCastsWithComment/__snapshots__/Test__test__1.php
  16. +2 −2 tests/Console/ModelsCommand/Attributes/__snapshots__/Test__test__1.php
  17. +2 −2 tests/Console/ModelsCommand/Comment/__snapshots__/Test__test__1.php
  18. +2 −2 tests/Console/ModelsCommand/CustomCollection/__snapshots__/Test__test__1.php
  19. +1 −1 tests/Console/ModelsCommand/CustomDate/__snapshots__/Test__test__1.php
  20. +19 −0 tests/Console/ModelsCommand/CustomPhpdocTags/Models/Simple.php
  21. +30 −0 tests/Console/ModelsCommand/CustomPhpdocTags/Test.php
  22. +24 −0 ...Console/ModelsCommand/CustomPhpdocTags/__snapshots__/Test__testNoSpaceAfterCustomPhpdocTag__1.php
  23. +28 −32 ...le/ModelsCommand/DoesNotGeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php
  24. +1 −1 tests/Console/ModelsCommand/DynamicRelations/__snapshots__/Test__test__1.php
  25. +4 −4 tests/Console/ModelsCommand/Factories/__snapshots__/Test__testFactory__1.php
  26. +0 −6 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/Test.php
  27. +28 −32 tests/Console/ModelsCommand/GenerateBasicPhpDocWithEnumDefaults/__snapshots__/Test__test__1.php
  28. +28 −32 tests/Console/ModelsCommand/GenerateBasicPhpdoc/__snapshots__/Test__test__1.php
  29. +28 −32 tests/Console/ModelsCommand/GenerateBasicPhpdocCamel/__snapshots__/Test__test__1.php
  30. +28 −32 tests/Console/ModelsCommand/GenerateBasicPhpdocFinal/__snapshots__/Test__test__1.php
  31. +28 −32 ...s/Console/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilder/__snapshots__/Test__test__1.php
  32. +28 −32 ...le/ModelsCommand/GeneratePhpdocWithExternalEloquentBuilderWithFqn/__snapshots__/Test__test__1.php
  33. +28 −32 tests/Console/ModelsCommand/GeneratePhpdocWithForcedFqn/__snapshots__/Test__test__1.php
  34. +28 −32 tests/Console/ModelsCommand/GeneratePhpdocWithFqn/__snapshots__/Test__test__1.php
  35. +28 −32 tests/Console/ModelsCommand/GeneratePhpdocWithFqnInExternalFile/__snapshots__/Test__test__1.php
  36. +29 −33 tests/Console/ModelsCommand/GeneratePhpdocWithMixin/__snapshots__/Test__test__1.php
  37. +2 −2 tests/Console/ModelsCommand/GenericsSyntaxDisabled/__snapshots__/Test__test__1.php
  38. +2 −2 tests/Console/ModelsCommand/Getter/__snapshots__/Test__test__1.php
  39. +1 −1 tests/Console/ModelsCommand/Ignored/__snapshots__/Test__test__1.php
  40. +5 −0 tests/Console/ModelsCommand/Interfaces/Models/User.php
  41. +1 −1 tests/Console/ModelsCommand/Interfaces/__snapshots__/Test__test__1.php
  42. +1 −1 tests/Console/ModelsCommand/LaravelCustomCasts/__snapshots__/Test__test__1.php
  43. +28 −30 tests/Console/ModelsCommand/MagicWhere/__snapshots__/Test__test__1.php
  44. +1 −1 tests/Console/ModelsCommand/ModelHooks/Test.php
  45. +2 −2 .../Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionNotPresent__1.php
  46. +2 −2 tests/Console/ModelsCommand/PHPStormNoInspection/__snapshots__/Test__testNoinspectionPresent__1.php
  47. +28 −32 tests/Console/ModelsCommand/RelationCountProperties/__snapshots__/Test__test__1.php
  48. +14 −14 tests/Console/ModelsCommand/Relations/__snapshots__/Test__test__1.php
  49. +0 −14 tests/Console/ModelsCommand/ResetAndSmartReset/Test.php
  50. +1 −1 tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testNoReset__1.php
  51. +2 −2 tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testReset__1.php
  52. +1 −1 tests/Console/ModelsCommand/ResetAndSmartReset/__snapshots__/Test__testSmartReset__1.php
  53. +6 −6 tests/Console/ModelsCommand/SimpleCasts/__snapshots__/Test__test__1.php
  54. +2 −2 tests/Console/ModelsCommand/SoftDeletes/__snapshots__/Test__test__1.php
  55. +1 −1 tests/Console/ModelsCommand/UnionTypes/__snapshots__/Test__test__1.php
  56. +2 −2 tests/Console/ModelsCommand/Variadic/__snapshots__/Test__test__1.php
  57. +0 −3 tests/Console/ModelsCommand/migrations/____posts_table.php
2 changes: 1 addition & 1 deletion .github/workflows/composer-normalize.yml
Original file line number Diff line number Diff line change
@@ -9,7 +9,7 @@ on:
jobs:
normalize:
timeout-minutes: 15
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
steps:
- name: Git checkout
uses: actions/checkout@v4
4 changes: 2 additions & 2 deletions .github/workflows/fix-code-style.yml
Original file line number Diff line number Diff line change
@@ -7,7 +7,7 @@ jobs:
fix-style:
name: Fix Code Style
timeout-minutes: 15
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
env:
COMPOSER_NO_INTERACTION: 1

@@ -18,7 +18,7 @@ jobs:
- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.0
php-version: 8.3
coverage: none

- name: Install dependencies
13 changes: 6 additions & 7 deletions .github/workflows/run-integration-tests.yml
Original file line number Diff line number Diff line change
@@ -12,20 +12,19 @@ on:

jobs:
php-laravel-integration-tests:
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04
timeout-minutes: 15
env:
COMPOSER_NO_INTERACTION: 1
strategy:
fail-fast: false
matrix:
php: [8.3, 8.2, 8.1, 8.0]
laravel: [10.*, 9.*]
php: [8.3, 8.2, 8.1]
laravel: [11.*, 10.*]
exclude:
- php: 8.0
laravel: 10.*
- php: 8.3
laravel: 9.*
- php: 8.1
laravel: 11.*

name: P${{ matrix.php }} - Laravel${{ matrix.laravel }}
steps:
- name: Checkout code
6 changes: 3 additions & 3 deletions .github/workflows/run-static-analysis.yml
Original file line number Diff line number Diff line change
@@ -9,15 +9,15 @@ on:
jobs:
build:
timeout-minutes: 15
runs-on: ubuntu-20.04
runs-on: ubuntu-22.04

steps:
- uses: actions/checkout@v4

- name: Setup PHP
uses: shivammathur/setup-php@v2
with:
php-version: 8.1
php-version: 8.3
coverage: none
extensions: pdo_sqlite

17 changes: 8 additions & 9 deletions .github/workflows/run-tests.yml
Original file line number Diff line number Diff line change
@@ -18,16 +18,15 @@ jobs:
COMPOSER_NO_INTERACTION: 1

strategy:
fail-fast: false
matrix:
os: [ubuntu-20.04, windows-2019]
php: [8.3, 8.2, 8.1, 8.0]
laravel: [9.*, 10.*]
dependency-version: [prefer-lowest, prefer-stable]
os: [ubuntu-22.04, windows-2019]
php: [8.3, 8.2, 8.1]
laravel: [10.*, 11.*]
stability: [prefer-lowest, prefer-stable]
exclude:
- php: 8.0
laravel: 10.*
- php: 8.0
dependency-version: prefer-lowest
- php: 8.1
laravel: 11.*
steps:
- name: Set git to use LF
if: ${{ matrix.os == 'windows-2019' }}
@@ -50,7 +49,7 @@ jobs:
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 update --prefer-dist --no-progress
composer update --prefer-dist --no-progress --${{ matrix.stability }}
- name: Execute Unit Tests
run: composer test-ci
19 changes: 18 additions & 1 deletion CHANGELOG.md
Original file line number Diff line number Diff line change
@@ -2,7 +2,7 @@

All notable changes to this project will be documented in this file.

[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v2.15.0...master)
[Next release](https://github.com/barryvdh/laravel-ide-helper/compare/v3.0.0...master)
--------------

### Fixed
@@ -11,6 +11,23 @@ All notable changes to this project will be documented in this file.

### Added

2024-03-01, 3.0.0
------------------

### Added
- Support for Laravel 11 [#1520 / KentarouTakeda](https://github.com/barryvdh/laravel-ide-helper/pull/1520)

### Changed
- Make `--reset` always keep the text and remove `--smart-reset`. Always skip the classname [#1523 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1523) & [#1525 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1525)
- Use short types (`int` and `bool` instead of `integer` and `boolean`) [#1524 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1524)

### Removed
- Support for Laravel 9 and use of doctrine/dbal [#1512 / barryvdh](https://github.com/barryvdh/laravel-ide-helper/pull/1512)
With this functionality gone, a few changes have been made:
- support for custom datatypes has been dropped (config `custom_db_types`) unknown data types default to `string` now and to fix the type, add a proper cast in Eloquent
- You _might_ have top-level dependency on doctrine/dbal. This may have been in the past due to ide-helper, we suggest to check if you still need it and remove it otherwise
- Minimum PHP version, due to Laravel 10, is now PHP 8.1

2024-02-15, 2.15.1
------------------

24 changes: 2 additions & 22 deletions README.md
Original file line number Diff line number Diff line change
@@ -11,7 +11,7 @@
This package generates helper files that enable your IDE to provide accurate autocompletion.
Generation is done based on the files in your project, so they are always up-to-date.

It supports Laravel 9+ and PHP 8.0+
The 3.x branch supports Laravel 10 and 11. For older version, use the 2.x releases.

- [Installation](#installation)
- [Usage](#usage)
@@ -151,7 +151,7 @@ The class name will be different from the model, avoiding the IDE duplicate anno
Writing to the models should keep the existing comments and only append new properties/methods. It will not update changed properties/methods.

With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made. The `--smart-reset` option will instead keep the 'text' part of the phpdoc comment, and just replace all the property/method defininitions.
With the `--reset (-R)` option, the whole existing PHPDoc is replaced, including any comments that have been made.

```bash
php artisan ide-helper:models "App\Models\Post"
@@ -271,26 +271,6 @@ add support for creating a new dedicated class instead of using local scopes in

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

Common column types (e.g. varchar, integer) are correctly mapped to PHP types (`string`, `int`).

But sometimes you may want to use custom column types in your database like `geography`, `jsonb`, `citext`, `bit`, etc. which may throw an "Unknown database type"-Exception.

For those special cases, you can map them via the config `custom_db_types`. Example:
```php
'custom_db_types' => [
'mysql' => [
'geography' => 'array',
'point' => 'array',
],
'postgresql' => [
'jsonb' => 'string',
'_int4' => 'array',
],
],
```

#### Custom Relationship Types

If you are using relationships not built into Laravel you will need to specify the name and returning class in the config to get proper generation.
26 changes: 13 additions & 13 deletions composer.json
Original file line number Diff line number Diff line change
@@ -20,30 +20,30 @@
}
],
"require": {
"php": "^8.0",
"php": "^8.1",
"ext-json": "*",
"barryvdh/reflection-docblock": "^2.0.6",
"barryvdh/reflection-docblock": "^2.1.1",
"composer/class-map-generator": "^1.0",
"doctrine/dbal": "^2.6 || ^3.1.4",
"illuminate/console": "^9 || ^10",
"illuminate/filesystem": "^9 || ^10",
"illuminate/support": "^9 || ^10",
"illuminate/console": "^10 || ^11",
"illuminate/database": "^10.38 || ^11",
"illuminate/filesystem": "^10 || ^11",
"illuminate/support": "^10 || ^11",
"nikic/php-parser": "^4.18 || ^5",
"phpdocumentor/type-resolver": "^1.1.0"
},
"require-dev": {
"ext-pdo_sqlite": "*",
"friendsofphp/php-cs-fixer": "^3",
"illuminate/config": "^9 || ^10",
"illuminate/view": "^9 || ^10",
"illuminate/config": "^9 || ^10 || ^11",
"illuminate/view": "^9 || ^10 || ^11",
"mockery/mockery": "^1.4",
"orchestra/testbench": "^7 || ^8",
"phpunit/phpunit": "^9",
"spatie/phpunit-snapshot-assertions": "^4",
"orchestra/testbench": "^8 || ^9",
"phpunit/phpunit": "^10.5",
"spatie/phpunit-snapshot-assertions": "^4 || ^5",
"vimeo/psalm": "^5.4"
},
"suggest": {
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10)."
"illuminate/events": "Required for automatic helper generation (^6|^7|^8|^9|^10|^11)."
},
"minimum-stability": "dev",
"prefer-stable": true,
@@ -65,7 +65,7 @@
},
"extra": {
"branch-alias": {
"dev-master": "2.15-dev"
"dev-master": "3.0-dev"
},
"laravel": {
"providers": [
30 changes: 0 additions & 30 deletions config/ide-helper.php
Original file line number Diff line number Diff line change
@@ -200,36 +200,6 @@

],

/*
|--------------------------------------------------------------------------
| Support for custom DB types
|--------------------------------------------------------------------------
|
| This setting allow you to map any custom database type (that you may have
| created using CREATE TYPE statement or imported using database plugin
| / extension to a Doctrine type.
|
| Each key in this array is a name of the Doctrine2 DBAL Platform. Currently valid names are:
| 'postgresql', 'db2', 'drizzle', 'mysql', 'oracle', 'sqlanywhere', 'sqlite', 'mssql'
|
| This name is returned by getName() method of the specific Doctrine/DBAL/Platforms/AbstractPlatform descendant
|
| The value of the array is an array of type mappings. Key is the name of the custom type,
| (for example, "jsonb" from Postgres 9.4) and the value is the name of the corresponding Doctrine2 type (in
| our case it is 'json_array'. Doctrine types are listed here:
| https://www.doctrine-project.org/projects/doctrine-dbal/en/latest/reference/types.html#types
|
| So to support jsonb in your models when working with Postgres, just add the following entry to the array below:
|
| "postgresql" => array(
| "jsonb" => "json_array",
| ),
|
*/
'custom_db_types' => [

],

/*
|--------------------------------------------------------------------------
| Support for camel cased models
21 changes: 7 additions & 14 deletions phpunit.xml.dist
Original file line number Diff line number Diff line change
@@ -1,24 +1,17 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/9.3/phpunit.xsd"
bootstrap="vendor/autoload.php"
backupGlobals="false"
backupStaticAttributes="false"
colors="true"
verbose="true"
convertErrorsToExceptions="true"
convertNoticesToExceptions="true"
convertWarningsToExceptions="true"
processIsolation="false"
stopOnFailure="false">
<phpunit
xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance"
xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/10.5/phpunit.xsd"
cacheDirectory=".phpunit.result.cache"
>
<testsuites>
<testsuite name="Unit Tests">
<directory>tests</directory>
</testsuite>
</testsuites>
<coverage>
<source>
<include>
<directory suffix=".php">src/</directory>
</include>
</coverage>
</source>
</phpunit>
Loading