diff --git a/composer.json b/composer.json index aa7d61b..c4bedbd 100644 --- a/composer.json +++ b/composer.json @@ -10,15 +10,15 @@ } ], "require": { - "php": ">=5.5.9", - "illuminate/support": "^5.1 || ^6.0", - "illuminate/filesystem": "^5.1 || ^6.0", + "php": "^7.1", + "illuminate/support": "^5.5 || ^6.0", + "illuminate/filesystem": "^5.5 || ^6.0", "doctrine/annotations": "~1.2", "phpdocumentor/reflection-docblock": "^3.1|^4.1" }, "require-dev": { "squizlabs/php_codesniffer": "~2.0", - "phpunit/phpunit": "~4.0" + "phpunit/phpunit": "^4.8.35 || ^5.4.3 || ^6.5" }, "autoload": { "psr-4": { diff --git a/src/Section.php b/src/Section.php index 4cda714..41c7c71 100644 --- a/src/Section.php +++ b/src/Section.php @@ -2,6 +2,7 @@ namespace Dingo\Blueprint; +use Illuminate\Support\Arr; use Illuminate\Support\Collection; abstract class Section @@ -15,7 +16,7 @@ abstract class Section */ protected function getAnnotationByType($type) { - return array_first($this->annotations, function ($key, $annotation) use ($type) { + return Arr::first($this->annotations, function ($key, $annotation) use ($type) { $type = sprintf('Dingo\\Blueprint\\Annotation\\%s', $type); return is_object($annotation) ? $annotation instanceof $type : $key instanceof $type; diff --git a/tests/BlueprintTest.php b/tests/BlueprintTest.php index 3569222..7381f65 100644 --- a/tests/BlueprintTest.php +++ b/tests/BlueprintTest.php @@ -3,12 +3,12 @@ namespace Dingo\Blueprint\Tests; use Dingo\Blueprint\Blueprint; -use PHPUnit_Framework_TestCase; +use PHPUnit\Framework\TestCase; use Illuminate\Support\Collection; use Illuminate\Filesystem\Filesystem; use Doctrine\Common\Annotations\SimpleAnnotationReader; -class BlueprintTest extends PHPUnit_Framework_TestCase +class BlueprintTest extends TestCase { public function testGeneratingBlueprintForSingleResource() { diff --git a/tests/LaravelIntegrationTest.php b/tests/LaravelIntegrationTest.php index 0e4d3ca..57da07c 100644 --- a/tests/LaravelIntegrationTest.php +++ b/tests/LaravelIntegrationTest.php @@ -1,52 +1,13 @@ $value) { - if (call_user_func($callback, $key, $value)) { - return $value; - } - } - break; - case '5.3': - if (is_null($callback)) { - if (empty($array)) { - return value($default); - } - - foreach ($array as $item) { - return $item; - } - } - foreach ($array as $key => $value) { - if (call_user_func($callback, $value, $key)) { - return $value; - } - } - break; - } - - return value($default); - } - - class LaravelIntegrationTest extends PHPUnit_Framework_TestCase + class LaravelIntegrationTest extends TestCase { protected $simpleExample = <<<'EOT' FORMAT: 1A @@ -60,9 +21,6 @@ class LaravelIntegrationTest extends PHPUnit_Framework_TestCase public function testGetAnnotationByTypeInLaravel52x() { - global $arrayFirstVersion; - $arrayFirstVersion = '5.2'; - $resources = new Collection([new Tests\Stubs\ActivityController]); $blueprint = new Blueprint(new SimpleAnnotationReader, new Filesystem); @@ -72,9 +30,6 @@ public function testGetAnnotationByTypeInLaravel52x() public function testGetAnnotationByTypeInLaravel53x() { - global $arrayFirstVersion; - $arrayFirstVersion = '5.3'; - $resources = new Collection([new Tests\Stubs\ActivityController]); $blueprint = new Blueprint(new SimpleAnnotationReader, new Filesystem);