* 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.
* x to Many relationships are detected via a `Many` keyword in the relationship object class name
* reason: example: `belongsTo` was incorrectly recognized as `belongsToMany`
* adds `@property-read int|null $x2Many_relationship_method_name_count` model class docBlock comment
* when model makes use of `withCount` or `loadCount` there is a property on the resource `$instance->relationship_method_count` that states the count of related models
* can be `NULL` when `withCount` or `loadCount` aren't used
See my comment https://github.com/barryvdh/laravel-ide-helper/pull/765#issuecomment-471014271:
The change in #765 made anonymous functions get reflected with `ReflectionMethod` instead of `ReflectionFunction`, which makes it lose the doc comment. This means that the generated helpers are missing their return types. This is because Closure is also an object and callable.
To fix it, Closure should be excluded from that new condition.
Macros can be used with invokable classes, like so.
```
<?php
namespace App\Providers;
use Illuminate\Support\ServiceProvider;
use Illuminate\Support\Facades\Response;
class ResponseMacroServiceProvider extends ServiceProvider
{
public function boot()
{
Response::macro('foo', new Foo());
}
}
class Foo
{
public function __invoke()
{
return 'foobar';
}
}
```
When running `ide-helper:generate` the following fatal error was thrown.
``` Symfony\Component\Debug\Exception\FatalThrowableError : ReflectionFunction::__construct() expects parameter 1 to be string, object given```
This commit fixes this error.
* Fix missing doc-block.
* Fixes a bug where a missing DocBlock caused errors.
* Change Option Shorthand to W
Because it is not allowed to have two char shorthands for options.
* Revert code refactoring.
* Fix copied config header.
The getMethods function gets called both in the removeDuplicateMethodsFromPhpDoc
function and in helper.php, which causes the method detection to be performed twice.
Parts of the method detection includes a check for duplicate methods, but Macro
methods for example, aren't checked for duplicates.
Instead of checking everywhere if we're not adding duplicates, I've included a
check in the getMethods call to just use the already generated methods
if they have been generated already.
Closures do not have a method name that makes sense to use in the ide_helper
file.
e.g. Illuminate\Foundation\Providers\{closure} would be the real_name instead of
just validate. So for the closure methods, we should just use the provided
methodName instead.
When a method is declared both in the phpdoc and in the class itself,
PhpStorm (2018.3) complains about duplicate function declarations, preventing
correct code hinting.
To solve this, I remove the already declared functions from the generated dockblocks.