Skip to content

Commit

Permalink
Merge pull request #324 from lptn/require-new-laravel-ide-helper
Browse files Browse the repository at this point in the history
Use stable laravel-ide-helper version
  • Loading branch information
lptn authored Feb 4, 2023
2 parents 8c40894 + f548ebb commit 2e5beae
Show file tree
Hide file tree
Showing 8 changed files with 18 additions and 19 deletions.
2 changes: 1 addition & 1 deletion composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -13,7 +13,7 @@
"require": {
"php": "^8.0.2",
"ext-simplexml": "*",
"barryvdh/laravel-ide-helper": "dev-master as 2.12.4",
"barryvdh/laravel-ide-helper": "^2.12",
"illuminate/config": "^9.48 || ^10.0.0",
"illuminate/container": "^9.48 || ^10.0.0",
"illuminate/contracts": "^9.48 || ^10.0.0",
Expand Down
14 changes: 7 additions & 7 deletions src/Fakes/FakeModelsCommand.php
Original file line number Diff line number Diff line change
Expand Up @@ -72,9 +72,9 @@ public function getPropertiesFromTable($model): void
$columns = $this->schema->tables[$table_name]->columns;

foreach ($columns as $column) {
$name = $column->name;
$column_name = $column->name;

if (in_array($name, $model->getDates())) {
if (in_array($column_name, $model->getDates(), true)) {
$get_type = $set_type = '\Illuminate\Support\Carbon';
} else {
switch ($column->type) {
Expand Down Expand Up @@ -115,19 +115,19 @@ public function getPropertiesFromTable($model): void

if ($column->nullable) {
/** @psalm-suppress MixedArrayAssignment */
$this->nullableColumns[$name] = true;
$this->nullableColumns[$column_name] = true;
}

if ($get_type === $set_type) {
$this->setProperty($name, $get_type, true, true, '', $column->nullable);
$this->setProperty($column_name, $get_type, true, true, '', $column->nullable);
} else {
$this->setProperty($name, $get_type, true, null, '', $column->nullable);
$this->setProperty($name, $set_type, null, true, '', $column->nullable);
$this->setProperty($column_name, $get_type, true, null, '', $column->nullable);
$this->setProperty($column_name, $set_type, null, true, '', $column->nullable);
}

if ($this->write_model_magic_where) {
$this->setMethod(
Str::camel("where_" . $name),
Str::camel("where_" . $column_name),
'\Illuminate\Database\Eloquent\Builder|\\' . get_class($model),
array('$value')
);
Expand Down
5 changes: 2 additions & 3 deletions src/Handlers/Application/ContainerHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -61,13 +61,12 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)
{
// lumen doesn't have the likes of makeWith, so we will ensure these methods actually exist on the underlying
// app contract
$methods = array_filter(['make', 'makewith'], function (string $methodName) use ($event) {

$methods = array_filter(['make', 'makewith'], static function (string $methodName) use ($event) {
$methodId = new MethodIdentifier($event->getFqClasslikeName(), $methodName);
return $event->getSource()->getCodebase()->methodExists($methodId);
});

if (!in_array($event->getMethodNameLowercase(), $methods)) {
if (!in_array($event->getMethodNameLowercase(), $methods, true)) {
return null;
}

Expand Down
2 changes: 1 addition & 1 deletion src/Handlers/Application/OffsetHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -84,6 +84,6 @@ private static function isOffsetMethod(string $methodName): bool
return in_array($methodName, [
'offsetget',
'offsetset',
]);
], true);
}
}
2 changes: 1 addition & 1 deletion src/Handlers/Eloquent/ModelRelationshipPropertyHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -141,7 +141,7 @@ public static function getPropertyType(PropertyTypeProviderEvent $event): ?Union
MorphToMany::class,
];

if ($modelType && $relationType && in_array($relationType->value, $relationsThatReturnACollection)) {
if ($modelType && $relationType && in_array($relationType->value, $relationsThatReturnACollection, true)) {
$returnType = new Union([
new TGenericObject(Collection::class, [
new Union([new TInt()]),
Expand Down
2 changes: 1 addition & 1 deletion src/Handlers/Helpers/PathHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -74,7 +74,7 @@ public static function getMethodReturnType(MethodReturnTypeProviderEvent $event)

$method_name_lowercase = $event->getMethodNameLowercase();

if (!in_array($method_name_lowercase, $methods)) {
if (!in_array($method_name_lowercase, $methods, true)) {
return null;
}

Expand Down
6 changes: 3 additions & 3 deletions src/Handlers/SuppressHandler.php
Original file line number Diff line number Diff line change
Expand Up @@ -81,7 +81,7 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event)
$class = $event->getStorage();

foreach (self::BY_CLASS as $issue => $class_names) {
if (in_array($class->name, $class_names)) {
if (in_array($class->name, $class_names, true)) {
self::suppress($issue, $class);
}
}
Expand Down Expand Up @@ -126,7 +126,7 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event)

foreach (self::BY_PARENT_CLASS_PROPERTY as $issue => $properties_by_parent_class) {
foreach ($properties_by_parent_class as $parent_class => $property_names) {
if (!in_array($parent_class, $class->parent_classes)) {
if (!in_array($parent_class, $class->parent_classes, true)) {
continue;
}

Expand All @@ -151,7 +151,7 @@ public static function afterClassLikeVisit(AfterClassLikeVisitEvent $event)
*/
private static function suppress(string $issue, $storage): void
{
if ($storage && !in_array($issue, $storage->suppressed_issues)) {
if ($storage && !in_array($issue, $storage->suppressed_issues, true)) {
$storage->suppressed_issues[] = $issue;
}
}
Expand Down
4 changes: 2 additions & 2 deletions src/Util/ContainerResolver.php
Original file line number Diff line number Diff line change
Expand Up @@ -62,7 +62,7 @@ private static function resolveFromApplicationContainer(string $abstract): ?stri
}

/**
* @param array<Arg> $call_args
* @param list<Arg> $call_args
*/
public static function resolvePsalmTypeFromApplicationContainerViaArgs(NodeTypeProvider $nodeTypeProvider, array $call_args): ?Union
{
Expand All @@ -74,7 +74,7 @@ public static function resolvePsalmTypeFromApplicationContainerViaArgs(NodeTypeP

if ($firstArgType && $firstArgType->isSingleStringLiteral()) {
$abstract = $firstArgType->getSingleStringLiteral()->value;
$concrete = static::resolveFromApplicationContainer($abstract);
$concrete = self::resolveFromApplicationContainer($abstract);

if (is_null($concrete)) {
return null;
Expand Down

0 comments on commit 2e5beae

Please sign in to comment.