Skip to content

Commit

Permalink
Merge pull request #702 from tighten/kdd/illuminate-11
Browse files Browse the repository at this point in the history
Bump dependencies to support Illuminate v11 components
  • Loading branch information
damiani committed Mar 26, 2024
2 parents e43b0ea + 1a2a641 commit 2565738
Show file tree
Hide file tree
Showing 41 changed files with 393 additions and 744 deletions.
2 changes: 1 addition & 1 deletion .github/workflows/test.yml
Original file line number Diff line number Diff line change
Expand Up @@ -11,7 +11,7 @@ jobs:
strategy:
fail-fast: false
matrix:
php: ['8.0', '8.1', '8.2', '8.3']
php: ['8.2', '8.3']
dependencies: [lowest, highest]
include:
- php: '8.3'
Expand Down
2 changes: 1 addition & 1 deletion .gitignore
Original file line number Diff line number Diff line change
@@ -1,4 +1,4 @@
vendor/
.php-cs-fixer.cache
.phpunit.result.cache
.phpunit.cache/
composer.lock
44 changes: 22 additions & 22 deletions composer.json
Original file line number Diff line number Diff line change
Expand Up @@ -18,30 +18,30 @@
}
],
"require": {
"php": "^8.0.2 <8.4",
"illuminate/collections": "^9.0",
"illuminate/console": "^9.21.1",
"illuminate/container": "^9.0",
"illuminate/filesystem": "^9.0",
"illuminate/support": "^9.0",
"illuminate/view": "^9.8",
"php": "^8.2",
"illuminate/collections": "^11.0",
"illuminate/console": "^11.0",
"illuminate/container": "^11.0",
"illuminate/filesystem": "^11.0",
"illuminate/support": "^11.0",
"illuminate/view": "^11.0",
"league/commonmark": "^2.4",
"michelf/php-markdown": "^1.9",
"mnapoli/front-yaml": "^1.5",
"nunomaduro/collision": "^6.0",
"spatie/laravel-ignition": "^1.6",
"symfony/console": "^5.4 || ^6.0",
"symfony/error-handler": "^5.0 || ^6.0",
"symfony/finder": "^5.3.7 || ^6.0",
"symfony/process": "^5.0 || ^6.0",
"symfony/var-dumper": "^5.0 || ^6.0",
"symfony/yaml": "^5.0 || ^6.0",
"vlucas/phpdotenv": "^5.3.1"
"michelf/php-markdown": "^2.0",
"mnapoli/front-yaml": "^2.0",
"nunomaduro/collision": "^8.1",
"spatie/laravel-ignition": "^2.4",
"symfony/console": "^6.0 || ^7.0",
"symfony/error-handler": "^6.0 || ^7.0",
"symfony/finder": "^6.0 || ^7.0",
"symfony/process": "^6.0 || ^7.0",
"symfony/var-dumper": "^6.0 || ^7.0",
"symfony/yaml": "^6.0 || ^7.0",
"vlucas/phpdotenv": "^5.6"
},
"require-dev": {
"friendsofphp/php-cs-fixer": "^3.17",
"mockery/mockery": "^1.4",
"phpunit/phpunit": "^9.3.3"
"friendsofphp/php-cs-fixer": "^3.51",
"mockery/mockery": "^1.6",
"phpunit/phpunit": "^11.0.6"
},
"autoload": {
"psr-4": {
Expand All @@ -60,7 +60,7 @@
"jigsaw"
],
"scripts": {
"format" : "php-cs-fixer fix --verbose"
"format": "php-cs-fixer fix --verbose"
},
"config": {
"sort-packages": true,
Expand Down
12 changes: 6 additions & 6 deletions phpunit.xml
Original file line number Diff line number Diff line change
@@ -1,8 +1,8 @@
<?xml version="1.0" encoding="UTF-8"?>
<phpunit bootstrap="vendor/autoload.php" colors="true" convertDeprecationsToExceptions="true">
<testsuites>
<testsuite name="Jigsaw Tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>
<phpunit xmlns:xsi="http://www.w3.org/2001/XMLSchema-instance" bootstrap="vendor/autoload.php" colors="true" xsi:noNamespaceSchemaLocation="https://schema.phpunit.de/11.0/phpunit.xsd" cacheDirectory=".phpunit.cache">
<testsuites>
<testsuite name="Jigsaw Tests">
<directory>./tests/</directory>
</testsuite>
</testsuites>
</phpunit>
43 changes: 42 additions & 1 deletion src/Bootstrap/HandleExceptions.php
Original file line number Diff line number Diff line change
Expand Up @@ -5,6 +5,7 @@
use ErrorException;
use Exception;
use Illuminate\Contracts\Debug\ExceptionHandler;
use PHPUnit\Runner\ErrorHandler;
use Symfony\Component\Console\Output\ConsoleOutput;
use Symfony\Component\ErrorHandler\Error\FatalError;
use Throwable;
Expand All @@ -17,9 +18,49 @@ class HandleExceptions

protected static ?Container $app;

public static function forgetApp(): void
public static function flushState(): void
{
if (is_null(static::$app)) {
return;
}

static::flushHandlersState();
static::$app = null;
static::$reservedMemory = null;
}

public static function flushHandlersState(): void
{
while (true) {
$previousHandler = set_exception_handler(static fn () => null);
restore_exception_handler();

if ($previousHandler === null) {
break;
}

restore_exception_handler();
}

while (true) {
$previousHandler = set_error_handler(static fn () => null);
restore_error_handler();

if ($previousHandler === null) {
break;
}

restore_error_handler();
}

if (class_exists(ErrorHandler::class)) {
$instance = ErrorHandler::instance();

if ((fn () => $this->enabled ?? false)->call($instance)) {
$instance->disable();
$instance->enable();
}
}
}

public function bootstrap(Container $app): void
Expand Down
6 changes: 3 additions & 3 deletions src/Console/Command.php
Original file line number Diff line number Diff line change
Expand Up @@ -8,11 +8,11 @@

abstract class Command extends SymfonyCommand
{
protected $input;
protected $output;
protected InputInterface $input;
protected OutputInterface $output;
protected $console;

public function execute(InputInterface $input, OutputInterface $output)
public function execute(InputInterface $input, OutputInterface $output): int
{
$this->input = $input;
$this->output = $output;
Expand Down
2 changes: 2 additions & 0 deletions src/IterableObject.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,12 +2,14 @@

namespace TightenCo\Jigsaw;

use AllowDynamicProperties;
use ArrayAccess;
use Exception;
use Illuminate\Support\Arr;
use Illuminate\Support\Collection as BaseCollection;
use Illuminate\Support\HigherOrderCollectionProxy;

#[AllowDynamicProperties]
class IterableObject extends BaseCollection implements ArrayAccess
{
public function __get($key)
Expand Down
2 changes: 1 addition & 1 deletion src/Parsers/MarkdownParser.php
Original file line number Diff line number Diff line change
Expand Up @@ -23,7 +23,7 @@ public function __set($property, $value)
$this->parser->$property = $value;
}

public function parse($markdown)
public function parse($markdown): string
{
return $this->parser->parse($markdown);
}
Expand Down
22 changes: 7 additions & 15 deletions tests/AtSymbolInMarkdownTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -2,11 +2,11 @@

namespace Tests;

use PHPUnit\Framework\Attributes\Test;

class AtSymbolInMarkdownTest extends TestCase
{
/**
* @test
*/
#[Test]
public function mailto_link_in_markdown_is_parsed_and_obfuscated()
{
$files = $this->setupSource([
Expand All @@ -24,9 +24,7 @@ public function mailto_link_in_markdown_is_parsed_and_obfuscated()
);
}

/**
* @test
*/
#[Test]
public function mailto_link_in_blade_markdown_is_parsed()
{
$files = $this->setupSource([
Expand All @@ -44,9 +42,7 @@ public function mailto_link_in_blade_markdown_is_parsed()
);
}

/**
* @test
*/
#[Test]
public function at_symbol_after_closing_bracket_is_unchanged_in_markdown()
{
$files = $this->setupSource([
Expand All @@ -64,9 +60,7 @@ public function at_symbol_after_closing_bracket_is_unchanged_in_markdown()
);
}

/**
* @test
*/
#[Test]
public function double_at_symbol_in_fenced_code_block_is_parsed_to_single_at_symbol_in_blade_markdown()
{
$files = $this->setupSource([
Expand All @@ -84,9 +78,7 @@ public function double_at_symbol_in_fenced_code_block_is_parsed_to_single_at_sym
);
}

/**
* @test
*/
#[Test]
public function double_at_symbol_in_inline_code_block_is_parsed_to_single_at_symbol_in_blade_markdown()
{
$files = $this->setupSource([
Expand Down
25 changes: 7 additions & 18 deletions tests/BladeComponentTest.php
Original file line number Diff line number Diff line change
Expand Up @@ -4,12 +4,11 @@

use Illuminate\Container\Container;
use Illuminate\View\Component;
use PHPUnit\Framework\Attributes\Test;

class BladeComponentTest extends TestCase
{
/**
* @test
*/
#[Test]
public function can_include_blade_component_with_at_syntax()
{
$files = $this->setupSource([
Expand Down Expand Up @@ -42,9 +41,7 @@ public function can_include_blade_component_with_at_syntax()
);
}

/**
* @test
*/
#[Test]
public function can_include_blade_component_with_x_tag_syntax_using_underscore_components_directory()
{
$files = $this->setupSource([
Expand All @@ -64,9 +61,7 @@ public function can_include_blade_component_with_x_tag_syntax_using_underscore_c
);
}

/**
* @test
*/
#[Test]
public function can_include_blade_component_with_x_tag_syntax_using_aliased_component_with_view()
{
$this->app['bladeCompiler']->component('alert', AlertComponent::class);
Expand All @@ -88,9 +83,7 @@ public function can_include_blade_component_with_x_tag_syntax_using_aliased_comp
);
}

/**
* @test
*/
#[Test]
public function can_include_blade_component_with_x_tag_syntax_using_aliased_component_with_inline_render()
{
$this->app['bladeCompiler']->component('inline', InlineAlertComponent::class);
Expand All @@ -109,9 +102,7 @@ public function can_include_blade_component_with_x_tag_syntax_using_aliased_comp
);
}

/**
* @test
*/
#[Test]
public function can_include_blade_component_with_x_tag_syntax_using_namespaced_component_with_inline_render()
{
class_alias('Tests\InlineAlertComponent', 'Components\InlineClassComponent');
Expand All @@ -130,9 +121,7 @@ class_alias('Tests\InlineAlertComponent', 'Components\InlineClassComponent');
);
}

/**
* @test
*/
#[Test]
public function can_include_blade_component_with_x_tag_syntax_using_namespaced_component_with_view()
{
class_alias('Tests\\AlertComponent', 'Components\\ClassComponent');
Expand Down
Loading

0 comments on commit 2565738

Please sign in to comment.