Skip to content

Commit 4ef3876

Browse files
authored
Fix compatibility with Lumen (#1043)
* Fix compatibility with Lumen Fixes #1042 Got broken by #1026 TL;DR: can't use anything in the `Illuminate\Foundation` namespace without safety check, as it doesn't exist in Lumen. * Add helper to check for Laravel * Use helper to check for Laravel
1 parent 5db6029 commit 4ef3876

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

Lines changed: 3 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -12,6 +12,9 @@ All notable changes to this project will be documented in this file.
1212
### Changed
1313
- Implement DeferrableProvider [\#914 / kon-shou](https://github.com/barryvdh/laravel-ide-helper/pull/914)
1414

15+
### Fixed
16+
- Compatibility with Lumen [\#1043 / mfn](https://github.com/barryvdh/laravel-ide-helper/pull/1043)
17+
1518
2020-09-07, 2.8.1
1619
-----------------
1720
### Added

src/Helpers.php

Lines changed: 13 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,13 @@
1+
<?php
2+
3+
declare(strict_types=1);
4+
5+
namespace Barryvdh\LaravelIdeHelper;
6+
7+
class Helpers
8+
{
9+
public static function isLaravel(): bool
10+
{
11+
return class_exists('Illuminate\Foundation\Application');
12+
}
13+
}

src/IdeHelperServiceProvider.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -110,7 +110,7 @@ private function createLocalViewFactory()
110110
{
111111
$resolver = new EngineResolver();
112112
$resolver->register('php', function () {
113-
if ((int) Application::VERSION < 8) {
113+
if (Helpers::isLaravel() && (int) Application::VERSION < 8) {
114114
return new PhpEngine();
115115
}
116116

0 commit comments

Comments
 (0)