* Fix exceptions on ReflectionUnionTypes
this commit fixes exceptions thrown on ReflectionUnionType::isBuiltIn() and ReflectionUnionType::getNme() called on php8 union types
* Fix exceptions on ReflectionUnionTypes
this commit fixes exceptions thrown on ReflectionUnionType::isBuiltIn() and ReflectionUnionType::getNme() called on php8 union types
* add check for php8.0
* fix static analysis error
* fix $types variable undefined
* fix failing test
* fix failing test
* fixed style with php-cs-fixer
* add test for union types in parameters and return type
* add test for nullable union types in parameters and return type
* updated CHANGELOG.md
* Fix code that was causing the test to break and fix bug with not built in types
* Run cs fixer
* Remove fetching the doc block type and the putting it as a type hint as a php doc block is sufficient
* Revert doc block type hinting
* Enchance doc block type hinting
* Combine replacements
* Use the full builder class instead of the parsed one after the getClassName function and remove in array check
* Get the builder from the model itself instead of passing a string directly the function
* Use the full builder class to get the builder methods and reflection, but use the parsed builder class after setting its method in the doc
* Add test for fqn support on external eloquent builder
* Use the external builder if necessary when building the magic wheres
* Use the default eloquent builder if the user has disabled the external builder option
* Fix code that was causing the test to break and fix bug with not built in types
* Run cs fixer
* Remove fetching the doc block type and the putting it as a type hint as a php doc block is sufficient
* Revert doc block type hinting
* Enchance doc block type hinting
* Combine replacements
* Add support for generating helpers for external eloquent builders
* Extract external builder methods generator to its own method and add an option to toggle this feature
* Check if we are using the default name of the eloquent builder
* Add tests with snapshots for external eloquent builder feature
* Refactor codegs
* Allow for type hinting
* Update test
* Run cs fix
* Update readme
* Use getName for parameter instead of relying on __toString()
* Do not use str_contains and use built in php method
* gha: run on PHP8 too
The composer.json constraint is unbound, so it's already "allowed" at least.
* gha: remove php-cs-fixer when running unit tests
- not necessary anyway
- not compatible with PHP8 currently
* gha: lumen 6 and 7 don't support PHP8
* composer.json: allow spatie/phpunit-snapshot-assertions 4.* for PHP8 compatibility
* php8-compat: Method ReflectionParameter::getClass() is deprecated
* php8-compat: adapt expected error message depending on PHP version
* composer.json: bump mockery to 1.3.3 minimum
This is the minimum version also supporting PHP8
* gha: disable prefer-lowest for PHP8
Some lower version requirements like doctrone/dbal won't work and
would require at least dbal 2.12.0, which in turn doesn't support PHP 7.2
anymore.
So instead of bumping dbal and excluding PHP 7.2 users, we ignore the
lowest version for PHP 8 for the time being.
* Update CHANGELOG.md
* allow model_locations to have glob patterns
This if statement check for a valid directory was happening to early. It was checking the string that contained the wildcards to see if it is a valid directory and always failing. Need to check after the foreach starts. fixes#1058 .
* test(#1059) Allow glob directories
* Fix tests to chdir() into where to expect the glob to work
* Update CHANGELOG.md
Co-authored-by: Markus Podar <[email protected]>
* New --write-mixin option.
* Keep all tags from the existing docblock.
* Update argument description to be more descriptive
Co-authored-by: Markus Podar <[email protected]>
* Add the new --write-mixin option to the docs
* Add test for the new --write-mixin option
* Update README.md
* composer fix-style
* Adapt test after refactoring recently done
Co-authored-by: Markus Podar <[email protected]>
* Fixes 992 (class names in phpdoc where using imported names incorrectly when writing to external file).
Disabled using imported name in external file, except for the models own name.
* Added missing declare strict types
Ensures they're always ordered / processed independent of the
environment. `ClassMapGenerator::createMap` uses symfony/finder which
itself supports sorting but this isn't used from the `ClassMapGenerator`.
Fixes https://github.com/barryvdh/laravel-ide-helper/issues/885
* Make writing relation count properties optional
* Clean up description
* Add test for write_model_magic_where=false
* Add test for write_model_relation_count_properties=false
* Fixed#565 by using the imported class name if present. Fixed a bug where cast type was not properly added when the return type was found via phpdoc.
* Fixed errors with phpdocumentor/type-resolver:1.0
* Generate noinspections PHPStorm tags
* Add comments about PHPStorm noinspection tags
* Fix line to long warnings
* Add tests for PHPStorm noinspection
Co-authored-by: Michał Zgliński <[email protected]>
These two methods are already regular methods on the trait, there's no
need to add them and additionally they're not static, so their
definition was changed for the worse.
The other methods are magic so it's fine to keep them.
Fixes https://github.com/barryvdh/laravel-ide-helper/issues/917
* Add custom collection support for get and all methods
* Only add get and all when using custom collection
* Use static instead of class name
* Add missing custom collection test with relation
* Use class reference over string
Co-Authored-By: Markus Podar <[email protected]>
* Fix when using class reference
Co-authored-by: Markus Podar <[email protected]>
* Add ignored_models as config option
* Add README.md entry
* Add tests
* Change name of test class
* Add Ignored to the return values from the mocked filesystem
* Improve test speed by adding prestissimo
* Revert "Improve test speed by adding prestissimo"
This reverts commit 246a9f2a78.
If the property name matches the foreign key name
creating a BelongsTo relation triggers an undefined
property error. Disabling constraints prevents
accessing the property and thus prevents the error.
Laravel 5.8 introduced a feature to support a custom date class via
`Date::use()`, see https://github.com/laravel/framework/pull/25320
When e.g. using `Date::use(CarbonImmutable)` in a project, it means
all date casts are not returning `\Illuminate\Support\Carbon` anymore
but `\Carbon\CarbonImmutable`, which means all the generated type hints
for dates are now wrong.
This change tries to be still backwards compatible with Laravel < 5.8
which do not have the Date facade.