Skip to content

Commit 9125a95

Browse files
author
Rena Holmgren
committed
Fix compatibility with Lumen (#1043)
* Fix compatibility with Lumen Fixes barryvdh/laravel-ide-helper#1042 Got broken by barryvdh/laravel-ide-helper#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 cea8f3f commit 9125a95

File tree

3 files changed

+17
-1
lines changed

3 files changed

+17
-1
lines changed

CHANGELOG.md

+3
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

+13
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

+1-1
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)