diff --git a/src/Compiler/AppendState.php b/src/Compiler/AppendState.php index 5201480..9c4ae89 100644 --- a/src/Compiler/AppendState.php +++ b/src/Compiler/AppendState.php @@ -13,9 +13,9 @@ class AppendState * @param string $value The node's compiled value. */ public function __construct(public AbstractNode $node, - public int $beforeLineNumber, - public int $afterLineNumber, - public string $value) + public int $beforeLineNumber, + public int $afterLineNumber, + public string $value) { } } diff --git a/src/Compiler/Compiler.php b/src/Compiler/Compiler.php index a8fb793..50614db 100644 --- a/src/Compiler/Compiler.php +++ b/src/Compiler/Compiler.php @@ -49,13 +49,13 @@ class Compiler { - use CompilesEchos, CompilesLayouts, CompilesClasses, - CompilesConditionals, CompilesAuthorizations, CompilesComponents, + use CompilesAuthorizations, CompilesClasses, CompilesComponents, + CompilesConditionals, CompilesCustomDirectives, CompilesEchos, CompilesErrors, CompilesFragments, CompilesHelpers, CompilesIncludes, - CompilesInjections, CompilesJs, CompilesJson, CompilesTranslations, - CompilesStacks, CompilesRawPhp, CompilesLoops, ReflectsClosures, - ManagesCustomDirectives, ManagesCustomConditions, CompilesCustomDirectives, - InteractsWithBladeErrors, CompilesVerbatim, CompilesStyles; + CompilesInjections, CompilesJs, CompilesJson, CompilesLayouts, + CompilesLoops, CompilesRawPhp, CompilesStacks, CompilesStyles, + CompilesTranslations, CompilesVerbatim, InteractsWithBladeErrors, + ManagesCustomConditions, ManagesCustomDirectives, ReflectsClosures; private LoopVariablesExtractor $loopExtractor; @@ -727,7 +727,7 @@ public function compileString(string $template): string } } elseif ($node instanceof PhpTagNode) { $this->appendToBuffer($node, $node->content); - } elseif ($node instanceof PhpBlockNode) { + } elseif ($node instanceof PhpBlockNode) { $this->appendToBuffer($node, 'innerContent).' ?>'); } elseif ($node instanceof VerbatimNode) { $this->appendToBuffer($node, $node->innerContent); diff --git a/src/Document/Document.php b/src/Document/Document.php index 88ebfd3..b763c2c 100644 --- a/src/Document/Document.php +++ b/src/Document/Document.php @@ -29,9 +29,9 @@ class Document { - use Macroable, QueriesGeneralNodes, ManagesDocumentStructures, - ManagesTextExtraction, InteractsWithBladeErrors, - ManagesDocumentValidation; + use InteractsWithBladeErrors, Macroable, ManagesDocumentStructures, + ManagesDocumentValidation, ManagesTextExtraction, + QueriesGeneralNodes; private ?Utf8StringIterator $docString = null; @@ -312,7 +312,7 @@ public function syncFromParser(DocumentParser $parser): Document * @param string[] $customComponentTags A list of custom component tag names. * @param DocumentOptions|null $documentOptions Custom document options, if any. */ - public static function fromText(string $document, ?string $filePath = null, array $customComponentTags = [], ?DocumentOptions $documentOptions = null): Document + public static function fromText(string $document, string $filePath = null, array $customComponentTags = [], DocumentOptions $documentOptions = null): Document { $parser = DocumentParserFactory::makeDocumentParser(); diff --git a/src/Document/NodeUtilities/QueriesGeneralNodes.php b/src/Document/NodeUtilities/QueriesGeneralNodes.php index e822d36..9876491 100644 --- a/src/Document/NodeUtilities/QueriesGeneralNodes.php +++ b/src/Document/NodeUtilities/QueriesGeneralNodes.php @@ -12,8 +12,8 @@ trait QueriesGeneralNodes { - use QueriesComponents, QueriesComponents, - QueriesGenerics, QueriesComments, + use QueriesComments, QueriesComponents, + QueriesComponents, QueriesGenerics, QueriesRelativeNodes, QueriesStructures; private bool $hasResolvedStructures = false; diff --git a/src/Document/Structures/Concerns/ResolvesStructureDocuments.php b/src/Document/Structures/Concerns/ResolvesStructureDocuments.php index f528800..c310a85 100644 --- a/src/Document/Structures/Concerns/ResolvesStructureDocuments.php +++ b/src/Document/Structures/Concerns/ResolvesStructureDocuments.php @@ -10,7 +10,7 @@ trait ResolvesStructureDocuments private function resolveStructureDocuments(array $nodes): void { foreach ($nodes as $node) { - if (! ($node instanceof DirectiveNode || $node instanceof ComponentNode)) { + if (! ($node instanceof DirectiveNode || $node instanceof ComponentNode)) { continue; } if ($node->isClosedBy == null) { diff --git a/src/Document/Structures/StructurePairAnalyzer.php b/src/Document/Structures/StructurePairAnalyzer.php index f44f5d2..6667fd2 100644 --- a/src/Document/Structures/StructurePairAnalyzer.php +++ b/src/Document/Structures/StructurePairAnalyzer.php @@ -17,9 +17,9 @@ class StructurePairAnalyzer { - use ScansForClosingPairs, ManagesDirectiveIndexes, ManagesConditionMetaData, - PairsConditionalStructures, ConstructsConditions, ConstructsForElse, - ConstructsSwitchStatements, ResolvesStructureDocuments, PairsComponentTags; + use ConstructsConditions, ConstructsForElse, ConstructsSwitchStatements, + ManagesConditionMetaData, ManagesDirectiveIndexes, PairsComponentTags, + PairsConditionalStructures, ResolvesStructureDocuments, ScansForClosingPairs; private Document $document; diff --git a/src/Errors/ConstructContext.php b/src/Errors/ConstructContext.php index 4c46996..f148632 100644 --- a/src/Errors/ConstructContext.php +++ b/src/Errors/ConstructContext.php @@ -31,7 +31,7 @@ enum ConstructContext public static function fromNode(AbstractNode $node): ConstructContext { - if ($node instanceof DirectiveNode) { + if ($node instanceof DirectiveNode) { if ($node->getIsConditionDirective()) { return ConstructContext::Condition; } diff --git a/src/Nodes/ArgumentGroupNode.php b/src/Nodes/ArgumentGroupNode.php index 2e01d88..31becb0 100644 --- a/src/Nodes/ArgumentGroupNode.php +++ b/src/Nodes/ArgumentGroupNode.php @@ -96,7 +96,7 @@ public function getArgValues(): Collection return collect((new ArgStringSplitter())->split($this->innerContent)); } - public function clone(?DirectiveNode $newOwner = null): ArgumentGroupNode + public function clone(DirectiveNode $newOwner = null): ArgumentGroupNode { $ownerToSet = $this->owner; diff --git a/src/Nodes/Components/ComponentNode.php b/src/Nodes/Components/ComponentNode.php index fcd8939..7991d0d 100644 --- a/src/Nodes/Components/ComponentNode.php +++ b/src/Nodes/Components/ComponentNode.php @@ -13,7 +13,7 @@ class ComponentNode extends AbstractNode { - use ManagesComponentParameters, ManagesComponentMetaData, ContainsDocumentText; + use ContainsDocumentText, ManagesComponentMetaData, ManagesComponentParameters; public string $componentPrefix = 'x'; diff --git a/src/Validation/PhpSyntaxValidator.php b/src/Validation/PhpSyntaxValidator.php index fc2abf1..7001d53 100644 --- a/src/Validation/PhpSyntaxValidator.php +++ b/src/Validation/PhpSyntaxValidator.php @@ -49,7 +49,7 @@ protected function resetState(): void * @param Document $document The document instance. * @param int|null $originalLine An optional line number that will be used instead of any reported PHP line numbers. */ - public function checkDocument(Document $document, ?int $originalLine = null): PhpSyntaxValidationResult + public function checkDocument(Document $document, int $originalLine = null): PhpSyntaxValidationResult { $this->resetState(); $syntaxResult = new PhpSyntaxValidationResult(); @@ -107,7 +107,7 @@ public function checkDocument(Document $document, ?int $originalLine = null): Ph * @param string $content The value to check. * @param int|null $originalLine An optional line number that will be used instead of any reported PHP line number. */ - public function checkString(string $content, ?int $originalLine = null): PhpSyntaxValidationResult + public function checkString(string $content, int $originalLine = null): PhpSyntaxValidationResult { return $this->checkDocument(Document::fromText($content), $originalLine); } diff --git a/src/Validation/Validators/ComponentShorthandVariableParameterValidator.php b/src/Validation/Validators/ComponentShorthandVariableParameterValidator.php index 6a9b25f..007cf8a 100644 --- a/src/Validation/Validators/ComponentShorthandVariableParameterValidator.php +++ b/src/Validation/Validators/ComponentShorthandVariableParameterValidator.php @@ -23,7 +23,7 @@ class ComponentShorthandVariableParameterValidator extends AbstractNodeValidator */ public function validate(AbstractNode $node): ValidationResult|array|null { - if (! $node instanceof ComponentNode || ! $node->hasParameters()) { + if (! $node instanceof ComponentNode || ! $node->hasParameters()) { return null; } diff --git a/src/Validation/Validators/InconsistentDirectiveCasingValidator.php b/src/Validation/Validators/InconsistentDirectiveCasingValidator.php index e5db3fd..387d710 100644 --- a/src/Validation/Validators/InconsistentDirectiveCasingValidator.php +++ b/src/Validation/Validators/InconsistentDirectiveCasingValidator.php @@ -12,7 +12,7 @@ class InconsistentDirectiveCasingValidator extends AbstractNodeValidator { - use CanIgnoreDirectives, AcceptsCustomDirectives; + use AcceptsCustomDirectives, CanIgnoreDirectives; protected array $coreDirectives = []; diff --git a/src/Validation/Validators/NoArgumentsValidator.php b/src/Validation/Validators/NoArgumentsValidator.php index f7a1589..a9831d8 100644 --- a/src/Validation/Validators/NoArgumentsValidator.php +++ b/src/Validation/Validators/NoArgumentsValidator.php @@ -12,7 +12,7 @@ class NoArgumentsValidator extends AbstractNodeValidator { - use CanIgnoreDirectives, AcceptsCustomDirectives; + use AcceptsCustomDirectives, CanIgnoreDirectives; /** * @var string[] diff --git a/src/Validation/Validators/RequiredArgumentsValidator.php b/src/Validation/Validators/RequiredArgumentsValidator.php index cf03008..4de1e30 100644 --- a/src/Validation/Validators/RequiredArgumentsValidator.php +++ b/src/Validation/Validators/RequiredArgumentsValidator.php @@ -12,7 +12,7 @@ class RequiredArgumentsValidator extends AbstractNodeValidator { - use CanIgnoreDirectives, AcceptsCustomDirectives; + use AcceptsCustomDirectives, CanIgnoreDirectives; /** * @var string[] diff --git a/src/Workspaces/Workspace.php b/src/Workspaces/Workspace.php index cb0469d..e0be560 100644 --- a/src/Workspaces/Workspace.php +++ b/src/Workspaces/Workspace.php @@ -19,8 +19,8 @@ class Workspace { - use ValidatesWorkspaces, ProxiesDocumentCalls, ManagesWorkspaceErrors, - CompilesWorkspace; + use CompilesWorkspace, ManagesWorkspaceErrors, ProxiesDocumentCalls, + ValidatesWorkspaces; /** * Indicates if the workspace should resolve structures on document instances. diff --git a/tests/Compiler/BladeComponentTagCompilerTest.php b/tests/Compiler/BladeComponentTagCompilerTest.php index ccf5479..ec0d6a6 100644 --- a/tests/Compiler/BladeComponentTagCompilerTest.php +++ b/tests/Compiler/BladeComponentTagCompilerTest.php @@ -9,6 +9,7 @@ use Illuminate\View\ComponentAttributeBag; use InvalidArgumentException; use Mockery as m; +use Stillat\BladeParser\Compiler\CompilerServices\StringUtilities; use Stillat\BladeParser\Compiler\ComponentNodeCompiler; use Stillat\BladeParser\Compiler\ComponentTagCompiler; use Stillat\BladeParser\Contracts\CustomComponentTagCompiler; @@ -132,7 +133,7 @@ public function testBasicComponentParsing() 'alert' => TestAlertComponent::class, ])->compileTags($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testBasicComponentWithEmptyAttributesParsing() @@ -154,7 +155,7 @@ public function testBasicComponentWithEmptyAttributesParsing() 'alert' => TestAlertComponent::class, ])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testDataCamelCasing() @@ -173,7 +174,7 @@ public function testDataCamelCasing() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testColonData() @@ -192,7 +193,7 @@ public function testColonData() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testEscapedColonAttribute() @@ -211,7 +212,7 @@ public function testEscapedColonAttribute() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testColonAttributesIsEscapedIfStrings() @@ -230,7 +231,7 @@ public function testColonAttributesIsEscapedIfStrings() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testColonNestedComponentParsing() @@ -249,7 +250,7 @@ public function testColonNestedComponentParsing() $result = $this->compiler(['foo:alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testColonStartingNestedComponentParsing() @@ -268,7 +269,7 @@ public function testColonStartingNestedComponentParsing() $result = $this->compiler(['foo:alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testSelfClosingComponentsCanBeCompiled() @@ -288,7 +289,7 @@ public function testSelfClosingComponentsCanBeCompiled() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClassNamesCanBeGuessed() @@ -338,7 +339,7 @@ public function testComponentsCanBeCompiledWithHyphenAttributes() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testSelfClosingComponentsCanBeCompiledWithDataAndAttributes() @@ -360,7 +361,7 @@ public function testSelfClosingComponentsCanBeCompiledWithDataAndAttributes() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testComponentCanReceiveAttributeBag() @@ -379,7 +380,7 @@ public function testComponentCanReceiveAttributeBag() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testSelfClosingComponentCanReceiveAttributeBag() @@ -399,7 +400,7 @@ public function testSelfClosingComponentCanReceiveAttributeBag() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testComponentsCanHaveAttachedWord() @@ -420,7 +421,7 @@ public function testComponentsCanHaveAttachedWord() $result = $this->compiler(['profile' => TestProfileComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testSelfClosingComponentsCanHaveAttachedWord() @@ -440,7 +441,7 @@ public function testSelfClosingComponentsCanHaveAttachedWord() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testSelfClosingComponentsCanBeCompiledWithBoundData() @@ -462,7 +463,7 @@ public function testSelfClosingComponentsCanBeCompiledWithBoundData() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testPairedComponentTags() @@ -485,7 +486,7 @@ public function testPairedComponentTags() $result = $this->compiler(['alert' => TestAlertComponent::class])->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClasslessComponents() @@ -512,7 +513,7 @@ public function testClasslessComponents() $result = $this->compiler()->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClasslessComponentsWithIndexView() @@ -539,7 +540,7 @@ public function testClasslessComponentsWithIndexView() $result = $this->compiler()->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testPackagesClasslessComponents() @@ -566,7 +567,7 @@ public function testPackagesClasslessComponents() $result = $this->compiler()->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClasslessComponentsWithAnonymousComponentNamespaces() @@ -605,7 +606,7 @@ public function testClasslessComponentsWithAnonymousComponentNamespaces() $result = $compiler->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClasslessComponentsWithAnonymousComponentNamespaceWithIndexView() @@ -644,7 +645,7 @@ public function testClasslessComponentsWithAnonymousComponentNamespaceWithIndexV $result = $compiler->compile($template); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testClasslessComponentsWithAnonymousComponentPath() @@ -678,7 +679,7 @@ public function testClasslessComponentsWithAnonymousComponentPath() $result = $compiler->compileTags(''); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testCompilingRawEchoInsideParameterContent() @@ -697,7 +698,7 @@ public function testCompilingRawEchoInsideParameterContent() @endComponentClass##END-COMPONENT-CLASS## EXPECTED; - $this->assertSame($expected, $this->compiler(['alert' => TestAlertComponent::class])->compile($template)); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($this->compiler(['alert' => TestAlertComponent::class])->compile($template))); } public function testCompilingTripeEchoInsideParameterContent() @@ -716,7 +717,7 @@ public function testCompilingTripeEchoInsideParameterContent() @endComponentClass##END-COMPONENT-CLASS## EXPECTED; - $this->assertSame($expected, $this->compiler(['alert' => TestAlertComponent::class])->compile($template)); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($this->compiler(['alert' => TestAlertComponent::class])->compile($template))); } public function testClasslessIndexComponentsWithAnonymousComponentPath() @@ -750,7 +751,7 @@ public function testClasslessIndexComponentsWithAnonymousComponentPath() $result = $compiler->compileTags(''); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testItThrowsAnExceptionForNonExistingAliases() @@ -829,7 +830,7 @@ public function testCustomComponentTagNamesCanBeCompiled() @endComponentClass##END-COMPONENT-CLASS## EXPECTED; - $this->assertSame($expected, $this->compiler(['alert' => TestAlertComponent::class])->registerCustomComponentTag('custom')->compile($template)); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($this->compiler(['alert' => TestAlertComponent::class])->registerCustomComponentTag('custom')->compile($template))); } public function testCustomComponentsCanBeCompiledWithACustomCompiler() @@ -868,7 +869,7 @@ public function compile(ComponentNode $component): string withAttributes(['attributes' => \Illuminate\View\Compilers\BladeCompiler::sanitizeComponentAttribute($attributes),'wire:model' => 'foo']); ?> @endComponentClass##END-COMPONENT-CLASS## EOT; - $this->assertSame($result, $expected); + $this->assertSame(StringUtilities::normalizeLineEndings($result), StringUtilities::normalizeLineEndings($expected)); } public function testCustomComponentsCanBeCompiledAndCoreComponentsIgnored() @@ -903,7 +904,7 @@ public function compile(ComponentNode $component): ?string EOT; - $this->assertSame($result, $expected); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testReturningNullFromACustomCompilerResultsInDefaultCompilerBehavior() @@ -944,7 +945,7 @@ public function compile(ComponentNode $component): ?string A custom compiler result. EOT; - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testNameAttributeCanBeUsedIfUsingShortSlotNames() @@ -969,7 +970,7 @@ public function testNameAttributeCanBeUsedIfUsingShortSlotNames() 'input-with-slot' => InputWithSlot::class, ])->compile($blade); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testNameAttributeCantBeUsedIfNotUsingShortSlotNames() @@ -994,7 +995,7 @@ public function testNameAttributeCantBeUsedIfNotUsingShortSlotNames() 'input-with-slot' => InputWithSlot::class, ])->compile($blade); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testBoundNameAttributeCanBeUsedIfUsingShortSlotNames() @@ -1019,7 +1020,7 @@ public function testBoundNameAttributeCanBeUsedIfUsingShortSlotNames() 'input-with-slot' => InputWithSlot::class, ])->compile($blade); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } public function testBoundNameAttributeCanBeUsedIfUsingShortSlotNamesAndNotFirstAttribute() @@ -1044,7 +1045,7 @@ public function testBoundNameAttributeCanBeUsedIfUsingShortSlotNamesAndNotFirstA 'input-with-slot' => InputWithSlot::class, ])->compile($blade); - $this->assertSame($expected, $result); + $this->assertSame(StringUtilities::normalizeLineEndings($expected), StringUtilities::normalizeLineEndings($result)); } protected function mockViewFactory($existsSucceeds = true) diff --git a/tests/Compiler/BladePropsTest.php b/tests/Compiler/BladePropsTest.php index bff162a..35e8fe4 100644 --- a/tests/Compiler/BladePropsTest.php +++ b/tests/Compiler/BladePropsTest.php @@ -3,13 +3,14 @@ namespace Stillat\BladeParser\Tests\Compiler; use Illuminate\View\ComponentAttributeBag; +use Stillat\BladeParser\Compiler\CompilerServices\StringUtilities; use Stillat\BladeParser\Tests\ParserTestCase; class BladePropsTest extends ParserTestCase { public function testPropsAreCompiled() { - $this->assertSame(' + $this->assertSame(StringUtilities::normalizeLineEndings(' onlyProps([\'one\' => true, \'two\' => \'string\']) as $__key => $__value) { $$__key = $$__key ?? $__value; } ?> @@ -21,7 +22,7 @@ public function testPropsAreCompiled() $__value) { if (array_key_exists($__key, $__defined_vars)) unset($$__key); } ?> -', $this->compiler->compileString('@props([\'one\' => true, \'two\' => \'string\'])')); +'), StringUtilities::normalizeLineEndings($this->compiler->compileString('@props([\'one\' => true, \'two\' => \'string\'])'))); } public function testPropsAreExtractedFromParentAttributesCorrectly() diff --git a/tests/Validation/InconsistentDirectiveCasingTest.php b/tests/Validation/InconsistentDirectiveCasingTest.php index 99f2d73..d2bf168 100644 --- a/tests/Validation/InconsistentDirectiveCasingTest.php +++ b/tests/Validation/InconsistentDirectiveCasingTest.php @@ -40,8 +40,8 @@ public function testInconsistentDirectiveCasingValidatorDoesNotDetectIssues($dir } $results = Document::fromText("@{$directiveName}") - ->addValidator(new InconsistentDirectiveCasingValidator) - ->validate()->getValidationErrors(); + ->addValidator(new InconsistentDirectiveCasingValidator) + ->validate()->getValidationErrors(); $this->assertCount(0, $results); }