Skip to content

[10.x] Fix model:prune command error with non-class php files#48708

Merged
taylorotwell merged 1 commit into
laravel:10.xfrom
zlodes:patch-1
Oct 11, 2023
Merged

[10.x] Fix model:prune command error with non-class php files#48708
taylorotwell merged 1 commit into
laravel:10.xfrom
zlodes:patch-1

Conversation

@zlodes

@zlodes zlodes commented Oct 11, 2023

Copy link
Copy Markdown
Contributor

It's advisable to first verify if the PHP file contains a class. If not, the isPrunable check will fail as it utilizes the class_uses_recursive function.

Also Prunable trait uses Eloquent methods (like delete). It would be better to check that a class is a Model before checking for used traits (class_uses_recursive).

@zlodes zlodes changed the title [10.x] Fix model:prune error with non-class php files [10.x] Fix model:prune command error with non-class php files Oct 11, 2023
@taylorotwell
taylorotwell merged commit 7966308 into laravel:10.x Oct 11, 2023
timacdonald pushed a commit to timacdonald/framework that referenced this pull request Oct 24, 2023
Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

2 participants