laravel / framework

The Laravel Framework.
https://laravel.com
MIT License
32.45k stars 11k forks source link

Illuminate Support Arr class not found. #34292

Closed loduis closed 4 years ago

loduis commented 4 years ago

I can't find this class in the framework in version 8 image previus version exists image

driesvints commented 4 years ago

https://github.com/laravel/framework/blob/8.x/src/Illuminate/Collections/Arr.php

jessarcher commented 4 years ago

I realise this is probably my issue, but I'm getting an error on composer install since this file was moved.

> Illuminate\Foundation\ComposerScripts::postAutoloadDump
Script Illuminate\Foundation\ComposerScripts::postAutoloadDump handling the post-autoload-dump event terminated with an exception
In ClassLoader.php line 444:

  include(/builds/<redacted>/<redacted>/vendor/composer/../laravel/framework/sr  
  c/Illuminate/Support/Arr.php): failed to open stream: No such file or direc  
  tory     
$ php --version
PHP 7.4.10 (cli) (built: Sep  3 2020 19:59:29) ( NTS )
Copyright (c) The PHP Group
Zend Engine v3.4.0, Copyright (c) Zend Technologies
$ composer --version
Composer 1.10.13 2020-09-09 11:46:34

It's only failing in CI (i.e. a fresh build with no cache or anything). On my local machine it's fine. I'll post back if I figure it out.

jessarcher commented 4 years ago

As is often the way, and as I suspected, the issue was mine, and I solved it moments after posting the above :joy:

There was another cache at play - the CI runner cache on GitLab. After clearing that, it built fine.

Hopefully this helps someone else!

LukeTowers commented 3 years ago

@driesvints is this class aliased anywhere? The SupportArr test still references the old path but I can't seem to find any aliasing that would support that.

driesvints commented 3 years ago

Hey @LukeTowers, what do you mean with

The SupportArr test still references the old path

Can you point out where?

LukeTowers commented 3 years ago

@driesvints sure, see https://github.com/laravel/framework/blob/8.x/tests/Support/SupportArrTest.php#L6

driesvints commented 3 years ago

That seems okay to me?

LukeTowers commented 3 years ago

@driesvints it's referencing lluminate\Support\Arr when the actual class is lluminate\Collections\Arr. If lluminate\Support\Arr is expected to work; my question is where is that connection between the non-existent lluminate\Support\Arr class and the actual lluminate\Collections\Arr class set up?

driesvints commented 3 years ago

The Illuminate\Collections namespace doesn't exists?

I do see there's two usages of it that was introduced in this PR but the OP accidentally used it while it should have been Support. I'll send in a PR to fix that.

LukeTowers commented 3 years ago

@driesvints ahh, I see! The collections stuff was split off into its own package but the namespace remained the same; that's the critical piece of information that I was missing. Specifically to answer my own question this line is what makes /src/Illuminate/Collections/Arr.php available as Illuminate\Support\Arr.