diff --git a/src/Illuminate/View/Compilers/ComponentTagCompiler.php b/src/Illuminate/View/Compilers/ComponentTagCompiler.php index 735d861cc730..3940c3737a75 100644 --- a/src/Illuminate/View/Compilers/ComponentTagCompiler.php +++ b/src/Illuminate/View/Compilers/ComponentTagCompiler.php @@ -127,10 +127,6 @@ protected function compileOpeningTags(string $value) (\:\\\$)(\w+) ) | - (?: - (![\w]+) - ) - | (?: [\w\-:.@%]+ ( @@ -196,10 +192,6 @@ protected function compileSelfClosingTags(string $value) (\:\\\$)(\w+) ) | - (?: - (![\w]+) - ) - | (?: [\w\-:.@%]+ ( @@ -605,7 +597,6 @@ public function compileSlots(string $value) protected function getAttributesFromAttributeString(string $attributeString) { $attributeString = $this->parseShortAttributeSyntax($attributeString); - $attributeString = $this->parseShortFalseSyntax($attributeString); $attributeString = $this->parseAttributeBag($attributeString); $attributeString = $this->parseComponentTagClassStatements($attributeString); $attributeString = $this->parseComponentTagStyleStatements($attributeString); @@ -674,29 +665,6 @@ protected function parseShortAttributeSyntax(string $value) }, $value); } - /** - * Parses a short false syntax like !required into a fully-qualified syntax like :required="false". - * - * @param string $value - * @return string - */ - protected function parseShortFalseSyntax(string $value) - { - $parts = preg_split('/(".*?(?map(function (string $value) { - if (preg_match('/^".*"$/s', $value)) { - return $value; - } - - return preg_replace_callback('/!(\w+)/', function ($matches) { - return " :{$matches[1]}=\"false\""; - }, $value); - }) - ->implode(''); - } - /** * Parse the attribute bag in a given attribute string into its fully-qualified syntax. * diff --git a/tests/View/Blade/BladeComponentTagCompilerTest.php b/tests/View/Blade/BladeComponentTagCompilerTest.php index c07c6e2492d4..488c5d504762 100644 --- a/tests/View/Blade/BladeComponentTagCompilerTest.php +++ b/tests/View/Blade/BladeComponentTagCompilerTest.php @@ -303,81 +303,6 @@ public function testSelfClosingComponentWithColonDataMultipleAttributesAndStatic '@endComponentClass##END-COMPONENT-CLASS##', trim($result)); } - public function testFalseShortSyntax() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => false]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); - } - - public function testFalseShortSyntaxAsValue() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => !false]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); - } - - public function testFalseShortSyntaxWithinValue() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => \$value && !old('value')]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?> @endComponentClass##END-COMPONENT-CLASS##", trim($result)); - } - - public function testSelfClosingComponentWithFalseShortSyntax() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => false]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?>\n". -'@endComponentClass##END-COMPONENT-CLASS##', trim($result)); - } - - public function testSelfClosingComponentWithFalseShortSyntaxAsValue() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => !false]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?>\n". - '@endComponentClass##END-COMPONENT-CLASS##', trim($result)); - } - - public function testSelfClosingComponentWithFalseShortSyntaxWithinValue() - { - $this->mockViewFactory(); - $result = $this->compiler(['bool' => TestBoolComponent::class])->compileTags(''); - - $this->assertSame("##BEGIN-COMPONENT-CLASS##@component('Illuminate\Tests\View\Blade\TestBoolComponent', 'bool', ['bool' => \$value && !old('value')]) - -except(\Illuminate\Tests\View\Blade\TestBoolComponent::ignoredParameterNames()); ?> - -withAttributes([]); ?>\n". - '@endComponentClass##END-COMPONENT-CLASS##', trim($result)); - } - public function testEscapedColonAttribute() { $this->mockViewFactory(); @@ -1085,21 +1010,6 @@ public function render() } } -class TestBoolComponent extends Component -{ - public $bool; - - public function __construct($bool) - { - $this->bool = $bool; - } - - public function render() - { - return 'bool'; - } -} - class TestContainerComponent extends Component { public function render()