Skip to content

Commit

Permalink
Dropped PHP 7.1 & 7.2, Laravel 5; added PHP 8 support
Browse files Browse the repository at this point in the history
  • Loading branch information
fulopattila122 committed Nov 28, 2020
1 parent ef916a5 commit 1434036
Show file tree
Hide file tree
Showing 4 changed files with 17 additions and 65 deletions.
7 changes: 7 additions & 0 deletions Changelog.md
Original file line number Diff line number Diff line change
@@ -1,6 +1,13 @@
# Changelog
### Konekt Enum Eloquent

## Unreleased
##### 2020-XX-YY

- Dropped PHP 7.1 & PHP 7.2 support
- Dropped Laravel 5 support
- Added PHP 8 support

## 1.6.1
##### 2020-11-04

Expand Down
13 changes: 5 additions & 8 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -22,19 +22,16 @@
}
],
"require": {
"php": "^7.1.3",
"php": "^7.3 | ^8.0",
"konekt/enum": "^2.0.2 || ^3.0.0",
"illuminate/database": "5.*|6.*|7.*|8.*"
"illuminate/database": "6.*|7.*|8.*"
},
"require-dev": {
"phpunit/phpunit": "6.3 - 7.5|~8.0",
"illuminate/events": "5.*|6.*|7.*|8.*"
"phpunit/phpunit": "8 - 9",
"illuminate/events": "6.*|7.*|8.*"
},
"autoload": {
"psr-4": { "Konekt\\Enum\\Eloquent\\": "src/" },
"files": [
"src/functions.php"
]
"psr-4": { "Konekt\\Enum\\Eloquent\\": "src/" }
},
"autoload-dev": {
"psr-4": {
Expand Down
8 changes: 5 additions & 3 deletions src/CastsEnums.php
Original file line number Diff line number Diff line change
Expand Up @@ -12,6 +12,8 @@

namespace Konekt\Enum\Eloquent;

use Illuminate\Support\Str;

trait CastsEnums
{
/**
Expand Down Expand Up @@ -114,15 +116,15 @@ private function getEnumClass($key)
{
$result = $this->enums[$key];
if (strpos($result, '@')) {
$class = str_before($result, '@');
$method = str_after($result, '@');
$class = Str::before($result, '@');
$method = Str::after($result, '@');

// If no namespace was set, prepend the Model's namespace to the
// class that resolves the enum class. Prevent this behavior,
// by setting the resolver class with a leading backslash
if (class_basename($class) == $class) {
$class =
str_replace_last(
Str::replaceLast(
class_basename(get_class($this)),
$class,
self::class
Expand Down
54 changes: 0 additions & 54 deletions src/functions.php

This file was deleted.

0 comments on commit 1434036

Please sign in to comment.