From 26fc0053d2a0e3b9d2e9478d10d8bb1ab1d83e28 Mon Sep 17 00:00:00 2001 From: ordago Date: Wed, 8 Feb 2023 23:52:44 +0000 Subject: [PATCH] :pencil2: Fixing typos. --- src/Traits/PHPParserClassMap.php | 196 +++++++++--------- .../Endpoints/PHP/PHPFileQueryBuilderTest.php | 12 +- tests/Feature/PrettyPrintTest.php | 4 +- tests/Unit/Facades/PHPFileTest.php | 14 +- .../Unit/Support/AST/ASTQueryBuilderTest.php | 10 +- tests/Unit/Support/URITest.php | 4 +- 6 files changed, 120 insertions(+), 120 deletions(-) diff --git a/src/Traits/PHPParserClassMap.php b/src/Traits/PHPParserClassMap.php index f89d328..0711c91 100644 --- a/src/Traits/PHPParserClassMap.php +++ b/src/Traits/PHPParserClassMap.php @@ -29,7 +29,7 @@ trait PHPParserClassMap 'closure' => \PhpParser\Node\Expr\Closure::class, 'closureUse' => \PhpParser\Node\Expr\ClosureUse::class, 'const' => \PhpParser\Node\Const_::class, // one of potentially many consts in the same declaration - 'constStmt' => \PhpParser\Node\Stmt\Const_::class, // a node statement ouside of a class. NOTE NAME CHANGE! + 'constStmt' => \PhpParser\Node\Stmt\Const_::class, // a node statement outside of a class. NOTE NAME CHANGE! 'constFetch' => \PhpParser\Node\Expr\ConstFetch::class, 'continue' => \PhpParser\Node\Stmt\Continue_::class, 'declare' => \PhpParser\Node\Stmt\Declare_::class, @@ -113,7 +113,7 @@ public function arg($path = ''): self $path ); } - + public function array($path = ''): self { return $this->traverseIntoClass( @@ -121,7 +121,7 @@ public function array($path = ''): self $path ); } - + public function arrayDimFetch($path = ''): self { return $this->traverseIntoClass( @@ -129,7 +129,7 @@ public function arrayDimFetch($path = ''): self $path ); } - + public function arrayItem($path = ''): self { return $this->traverseIntoClass( @@ -137,7 +137,7 @@ public function arrayItem($path = ''): self $path ); } - + public function arrowFunction($path = ''): self { return $this->traverseIntoClass( @@ -145,7 +145,7 @@ public function arrowFunction($path = ''): self $path ); } - + public function assign($path = ''): self { return $this->traverseIntoClass( @@ -153,7 +153,7 @@ public function assign($path = ''): self $path ); } - + public function assignOp($path = ''): self { return $this->traverseIntoClass( @@ -161,7 +161,7 @@ public function assignOp($path = ''): self $path ); } - + public function assignRef($path = ''): self { return $this->traverseIntoClass( @@ -169,7 +169,7 @@ public function assignRef($path = ''): self $path ); } - + public function binaryOp($path = ''): self { return $this->traverseIntoClass( @@ -177,7 +177,7 @@ public function binaryOp($path = ''): self $path ); } - + public function bitwiseNot($path = ''): self { return $this->traverseIntoClass( @@ -185,7 +185,7 @@ public function bitwiseNot($path = ''): self $path ); } - + public function booleanNot($path = ''): self { return $this->traverseIntoClass( @@ -193,7 +193,7 @@ public function booleanNot($path = ''): self $path ); } - + public function break($path = ''): self { return $this->traverseIntoClass( @@ -201,7 +201,7 @@ public function break($path = ''): self $path ); } - + public function case($path = ''): self { return $this->traverseIntoClass( @@ -209,7 +209,7 @@ public function case($path = ''): self $path ); } - + public function cast($path = ''): self { return $this->traverseIntoClass( @@ -217,7 +217,7 @@ public function cast($path = ''): self $path ); } - + public function catch($path = ''): self { return $this->traverseIntoClass( @@ -225,7 +225,7 @@ public function catch($path = ''): self $path ); } - + public function class($path = ''): self { return $this->traverseIntoClass( @@ -233,7 +233,7 @@ public function class($path = ''): self $path ); } - + public function classConst($path = ''): self { return $this->traverseIntoClass( @@ -241,7 +241,7 @@ public function classConst($path = ''): self $path ); } - + public function classConstFetch($path = ''): self { return $this->traverseIntoClass( @@ -249,7 +249,7 @@ public function classConstFetch($path = ''): self $path ); } - + public function classLike($path = ''): self { return $this->traverseIntoClass( @@ -257,7 +257,7 @@ public function classLike($path = ''): self $path ); } - + public function classMethod($path = ''): self { return $this->traverseIntoClass( @@ -265,7 +265,7 @@ public function classMethod($path = ''): self $path ); } - + public function clone($path = ''): self { return $this->traverseIntoClass( @@ -273,7 +273,7 @@ public function clone($path = ''): self $path ); } - + public function closure($path = ''): self { return $this->traverseIntoClass( @@ -281,7 +281,7 @@ public function closure($path = ''): self $path ); } - + public function closureUse($path = ''): self { return $this->traverseIntoClass( @@ -289,7 +289,7 @@ public function closureUse($path = ''): self $path ); } - + public function const($path = ''): self { return $this->traverseIntoClass( @@ -305,7 +305,7 @@ public function constStmt($path = ''): self $path ); } - // a node statement ouside of a class. NOTE NAME CHANGE! + // a node statement outside of a class. NOTE NAME CHANGE! public function constFetch($path = ''): self { return $this->traverseIntoClass( @@ -313,7 +313,7 @@ public function constFetch($path = ''): self $path ); } - + public function continue($path = ''): self { return $this->traverseIntoClass( @@ -321,7 +321,7 @@ public function continue($path = ''): self $path ); } - + public function declare($path = ''): self { return $this->traverseIntoClass( @@ -329,7 +329,7 @@ public function declare($path = ''): self $path ); } - + public function declareDeclare($path = ''): self { return $this->traverseIntoClass( @@ -337,7 +337,7 @@ public function declareDeclare($path = ''): self $path ); } - + public function dNumber($path = ''): self { return $this->traverseIntoClass( @@ -345,7 +345,7 @@ public function dNumber($path = ''): self $path ); } - + public function do($path = ''): self { return $this->traverseIntoClass( @@ -353,7 +353,7 @@ public function do($path = ''): self $path ); } - + public function echo($path = ''): self { return $this->traverseIntoClass( @@ -361,7 +361,7 @@ public function echo($path = ''): self $path ); } - + public function else($path = ''): self { return $this->traverseIntoClass( @@ -369,7 +369,7 @@ public function else($path = ''): self $path ); } - + public function elseIf($path = ''): self { return $this->traverseIntoClass( @@ -377,7 +377,7 @@ public function elseIf($path = ''): self $path ); } - + public function empty($path = ''): self { return $this->traverseIntoClass( @@ -385,7 +385,7 @@ public function empty($path = ''): self $path ); } - + public function encapsed($path = ''): self { return $this->traverseIntoClass( @@ -393,7 +393,7 @@ public function encapsed($path = ''): self $path ); } - + public function encapsedStringPart($path = ''): self { return $this->traverseIntoClass( @@ -401,7 +401,7 @@ public function encapsedStringPart($path = ''): self $path ); } - + public function error($path = ''): self { return $this->traverseIntoClass( @@ -409,7 +409,7 @@ public function error($path = ''): self $path ); } - + public function errorSuppress($path = ''): self { return $this->traverseIntoClass( @@ -417,7 +417,7 @@ public function errorSuppress($path = ''): self $path ); } - + public function eval($path = ''): self { return $this->traverseIntoClass( @@ -425,7 +425,7 @@ public function eval($path = ''): self $path ); } - + public function exit($path = ''): self { return $this->traverseIntoClass( @@ -433,7 +433,7 @@ public function exit($path = ''): self $path ); } - + public function expression($path = ''): self { return $this->traverseIntoClass( @@ -441,7 +441,7 @@ public function expression($path = ''): self $path ); } - + public function finally($path = ''): self { return $this->traverseIntoClass( @@ -449,7 +449,7 @@ public function finally($path = ''): self $path ); } - + public function for($path = ''): self { return $this->traverseIntoClass( @@ -457,7 +457,7 @@ public function for($path = ''): self $path ); } - + public function foreach($path = ''): self { return $this->traverseIntoClass( @@ -465,7 +465,7 @@ public function foreach($path = ''): self $path ); } - + public function fullyQualified($path = ''): self { return $this->traverseIntoClass( @@ -473,7 +473,7 @@ public function fullyQualified($path = ''): self $path ); } - + public function funcCall($path = ''): self { return $this->traverseIntoClass( @@ -481,7 +481,7 @@ public function funcCall($path = ''): self $path ); } - + public function function($path = ''): self { return $this->traverseIntoClass( @@ -489,7 +489,7 @@ public function function($path = ''): self $path ); } - + public function global($path = ''): self { return $this->traverseIntoClass( @@ -497,7 +497,7 @@ public function global($path = ''): self $path ); } - + public function goto($path = ''): self { return $this->traverseIntoClass( @@ -505,7 +505,7 @@ public function goto($path = ''): self $path ); } - + public function groupUse($path = ''): self { return $this->traverseIntoClass( @@ -513,7 +513,7 @@ public function groupUse($path = ''): self $path ); } - + public function haltCompiler($path = ''): self { return $this->traverseIntoClass( @@ -521,7 +521,7 @@ public function haltCompiler($path = ''): self $path ); } - + public function if($path = ''): self { return $this->traverseIntoClass( @@ -529,7 +529,7 @@ public function if($path = ''): self $path ); } - + public function include($path = ''): self { return $this->traverseIntoClass( @@ -537,7 +537,7 @@ public function include($path = ''): self $path ); } - + public function inlineHTML($path = ''): self { return $this->traverseIntoClass( @@ -545,7 +545,7 @@ public function inlineHTML($path = ''): self $path ); } - + public function instanceof($path = ''): self { return $this->traverseIntoClass( @@ -553,7 +553,7 @@ public function instanceof($path = ''): self $path ); } - + public function interface($path = ''): self { return $this->traverseIntoClass( @@ -561,7 +561,7 @@ public function interface($path = ''): self $path ); } - + public function isset($path = ''): self { return $this->traverseIntoClass( @@ -569,7 +569,7 @@ public function isset($path = ''): self $path ); } - + public function label($path = ''): self { return $this->traverseIntoClass( @@ -577,7 +577,7 @@ public function label($path = ''): self $path ); } - + public function list($path = ''): self { return $this->traverseIntoClass( @@ -585,7 +585,7 @@ public function list($path = ''): self $path ); } - + public function lNumber($path = ''): self { return $this->traverseIntoClass( @@ -593,7 +593,7 @@ public function lNumber($path = ''): self $path ); } - + public function magicConst($path = ''): self { return $this->traverseIntoClass( @@ -601,7 +601,7 @@ public function magicConst($path = ''): self $path ); } - + public function methodCall($path = ''): self { return $this->traverseIntoClass( @@ -609,7 +609,7 @@ public function methodCall($path = ''): self $path ); } - + public function name($path = ''): self { return $this->traverseIntoClass( @@ -617,7 +617,7 @@ public function name($path = ''): self $path ); } - + public function namespace($path = ''): self { return $this->traverseIntoClass( @@ -625,7 +625,7 @@ public function namespace($path = ''): self $path ); } - + public function new($path = ''): self { return $this->traverseIntoClass( @@ -633,7 +633,7 @@ public function new($path = ''): self $path ); } - + public function nop($path = ''): self { return $this->traverseIntoClass( @@ -641,7 +641,7 @@ public function nop($path = ''): self $path ); } - + public function postDec($path = ''): self { return $this->traverseIntoClass( @@ -649,7 +649,7 @@ public function postDec($path = ''): self $path ); } - + public function postInc($path = ''): self { return $this->traverseIntoClass( @@ -657,7 +657,7 @@ public function postInc($path = ''): self $path ); } - + public function preDec($path = ''): self { return $this->traverseIntoClass( @@ -665,7 +665,7 @@ public function preDec($path = ''): self $path ); } - + public function preInc($path = ''): self { return $this->traverseIntoClass( @@ -673,7 +673,7 @@ public function preInc($path = ''): self $path ); } - + public function print($path = ''): self { return $this->traverseIntoClass( @@ -681,7 +681,7 @@ public function print($path = ''): self $path ); } - + public function property($path = ''): self { return $this->traverseIntoClass( @@ -689,7 +689,7 @@ public function property($path = ''): self $path ); } - + public function propertyFetch($path = ''): self { return $this->traverseIntoClass( @@ -697,7 +697,7 @@ public function propertyFetch($path = ''): self $path ); } - + public function propertyProperty($path = ''): self { return $this->traverseIntoClass( @@ -705,7 +705,7 @@ public function propertyProperty($path = ''): self $path ); } - + public function relative($path = ''): self { return $this->traverseIntoClass( @@ -713,7 +713,7 @@ public function relative($path = ''): self $path ); } - + public function return($path = ''): self { return $this->traverseIntoClass( @@ -721,7 +721,7 @@ public function return($path = ''): self $path ); } - + public function shellExec($path = ''): self { return $this->traverseIntoClass( @@ -729,7 +729,7 @@ public function shellExec($path = ''): self $path ); } - + public function static($path = ''): self { return $this->traverseIntoClass( @@ -737,7 +737,7 @@ public function static($path = ''): self $path ); } - + public function staticCall($path = ''): self { return $this->traverseIntoClass( @@ -745,7 +745,7 @@ public function staticCall($path = ''): self $path ); } - + public function staticPropertyFetch($path = ''): self { return $this->traverseIntoClass( @@ -753,7 +753,7 @@ public function staticPropertyFetch($path = ''): self $path ); } - + public function staticVar($path = ''): self { return $this->traverseIntoClass( @@ -761,7 +761,7 @@ public function staticVar($path = ''): self $path ); } - + public function string($path = ''): self { return $this->traverseIntoClass( @@ -769,7 +769,7 @@ public function string($path = ''): self $path ); } - + public function switch($path = ''): self { return $this->traverseIntoClass( @@ -777,7 +777,7 @@ public function switch($path = ''): self $path ); } - + public function ternary($path = ''): self { return $this->traverseIntoClass( @@ -785,7 +785,7 @@ public function ternary($path = ''): self $path ); } - + public function throw($path = ''): self { return $this->traverseIntoClass( @@ -793,7 +793,7 @@ public function throw($path = ''): self $path ); } - + public function trait($path = ''): self { return $this->traverseIntoClass( @@ -801,7 +801,7 @@ public function trait($path = ''): self $path ); } - + public function traitUse($path = ''): self { return $this->traverseIntoClass( @@ -809,7 +809,7 @@ public function traitUse($path = ''): self $path ); } - + public function traitUseAdaptation($path = ''): self { return $this->traverseIntoClass( @@ -817,7 +817,7 @@ public function traitUseAdaptation($path = ''): self $path ); } - + public function tryCatch($path = ''): self { return $this->traverseIntoClass( @@ -825,7 +825,7 @@ public function tryCatch($path = ''): self $path ); } - + public function unaryMinus($path = ''): self { return $this->traverseIntoClass( @@ -833,7 +833,7 @@ public function unaryMinus($path = ''): self $path ); } - + public function unaryPlus($path = ''): self { return $this->traverseIntoClass( @@ -841,7 +841,7 @@ public function unaryPlus($path = ''): self $path ); } - + public function unset($path = ''): self { return $this->traverseIntoClass( @@ -849,7 +849,7 @@ public function unset($path = ''): self $path ); } - + public function use($path = ''): self { return $this->traverseIntoClass( @@ -857,7 +857,7 @@ public function use($path = ''): self $path ); } - + public function useUse($path = ''): self { return $this->traverseIntoClass( @@ -865,7 +865,7 @@ public function useUse($path = ''): self $path ); } - + public function variable($path = ''): self { return $this->traverseIntoClass( @@ -873,7 +873,7 @@ public function variable($path = ''): self $path ); } - + public function while($path = ''): self { return $this->traverseIntoClass( @@ -881,7 +881,7 @@ public function while($path = ''): self $path ); } - + public function yield($path = ''): self { return $this->traverseIntoClass( @@ -889,7 +889,7 @@ public function yield($path = ''): self $path ); } - + public function yieldFrom($path = ''): self { return $this->traverseIntoClass( diff --git a/tests/Feature/Endpoints/PHP/PHPFileQueryBuilderTest.php b/tests/Feature/Endpoints/PHP/PHPFileQueryBuilderTest.php index 3439d1e..b6e2191 100644 --- a/tests/Feature/Endpoints/PHP/PHPFileQueryBuilderTest.php +++ b/tests/Feature/Endpoints/PHP/PHPFileQueryBuilderTest.php @@ -5,7 +5,7 @@ use Illuminate\Support\Collection; use function PHPUnit\Framework\assertInstanceOf; -it('can instanciate via php or laravel file with in method', function() { +it('can instantiate via php or laravel file with in method', function() { PHPFile::in('app') ->assertInstanceOf(TestablePHPFileQueryBuilder::class); }); @@ -16,7 +16,7 @@ PHPFile::in('app')->get() ); }); - + it('can filter with in method', function() { PHPFile::in('app/Http/Middleware')->assertMatchCount(8); }); @@ -82,12 +82,12 @@ return preg_match('/^.*Kernel$/', $file->extends()); })->assertMatchCount(2); }); - + it('can query all files in application root including non classes without extend', function() { PHPFile::where('extends', 'Authenticatable') ->assertMatchCount(1); }); - + it('can chain multiple where clauses', function() { PHPFile::where('extends', 'ServiceProvider') ->where('methodNames', 'contains', 'boot') @@ -95,7 +95,7 @@ return $file->className() === 'AuthServiceProvider'; })->assertMatchCount(1); }); - + it('can get first match', function() { PHPFile::in('public') ->first() @@ -106,4 +106,4 @@ PHPFile::in('vendor/ajthinking/archetype/src/snippets') ->first() ->assertInstanceOf(\Archetype\Tests\Support\TestablePHPFile::class); -}); \ No newline at end of file +}); diff --git a/tests/Feature/PrettyPrintTest.php b/tests/Feature/PrettyPrintTest.php index e5e3d49..9f57b81 100644 --- a/tests/Feature/PrettyPrintTest.php +++ b/tests/Feature/PrettyPrintTest.php @@ -3,12 +3,12 @@ use Archetype\Tests\Support\Facades\TestablePHPFile as PHPFile; use PhpParser\BuilderFactory; -test('arrays are beutiful when loaded and rendered', function() { +test('arrays are beautiful when loaded and rendered', function() { PHPFile::load('app/Models/User.php') ->assertMultilineArray('fillable'); }); -test('arrays are beutiful when loaded modified and rendered', function() { +test('arrays are beautiful when loaded modified and rendered', function() { PHPFile::load('app/Models/User.php') ->add('also')->to()->property('fillable') ->assertMultilineArray('fillable'); diff --git a/tests/Unit/Facades/PHPFileTest.php b/tests/Unit/Facades/PHPFileTest.php index 271c15e..98fd1b9 100644 --- a/tests/Unit/Facades/PHPFileTest.php +++ b/tests/Unit/Facades/PHPFileTest.php @@ -18,17 +18,17 @@ base_path('app/Models/User.php') )->assertValidPhp(); }); - + it('can load files outside default root using an absolute path', function() { PHPFile::load( __DIR__."/../../TestCase.php" )->assertValidPhp(); }); - + it('can load using namespaced class', function() { PHPFile::load(App\Models\User::class) ->assertValidPhp(); - }); + }); }); describe('#save', function() { @@ -40,7 +40,7 @@ it('can write to a debug location', function() { PHPFile::load('app/Models/User.php')->debug(); assertTrue(is_file(Config::get('archetype.roots.debug.root') . '/app/Models/User.php')); - }); + }); }); describe('#directive', function() { @@ -78,7 +78,7 @@ }); describe('#fromString', function() { - it('can instanciate using a php string', function() { + it('can instantiate using a php string', function() { PHPFile::fromString('assertValidPhp(); }); @@ -86,7 +86,7 @@ it('allows missing php tag and end semicolon when testing', function() { PHPFile::fromString('1337') ->assertValidPhp(); - }); + }); it('will interpret content as html if opening php tag is missing', function() { assertInstanceOf( @@ -103,4 +103,4 @@ PHPFile::addMissingTags(true)->fromString('1337') ->assertValidPhp(); }); -}); \ No newline at end of file +}); diff --git a/tests/Unit/Support/AST/ASTQueryBuilderTest.php b/tests/Unit/Support/AST/ASTQueryBuilderTest.php index 25b54ce..8813fe9 100644 --- a/tests/Unit/Support/AST/ASTQueryBuilderTest.php +++ b/tests/Unit/Support/AST/ASTQueryBuilderTest.php @@ -7,7 +7,7 @@ use function PHPUnit\Framework\assertEquals; -it('can be instanciated using an ast object', function() { +it('can be instantiated using an ast object', function() { $ast = LaravelFile::load('public/index.php')->ast(); (new ASTQueryBuilder($ast))->assertInstanceOf(ASTQueryBuilder::class); }); @@ -41,7 +41,7 @@ }); it('can query with explicit class names', function() { - // Short node names may be amgigious. If needed, refer to explicit class names + // Short node names may be ambiguous. If needed, refer to explicit class names PHPFile::fromString('CONST CHANNEL = "tv4", TIME = "20:00"') ->astQuery() ->traverseIntoClass(\PhpParser\Node\Stmt\Const_::class) // const declaration outside of class @@ -92,7 +92,7 @@ ->value ->assertMatchCount(1) ->assertMatches(collect('3h')); - }); + }); }); test('resolved where closures with matches are considered truthy', function() { @@ -201,7 +201,7 @@ ->commit() ->end() ->render(); - + assertEquals($original, $after); }); @@ -215,4 +215,4 @@ ->commit() ->end() ->assertContains('public $someProperty'); -}); \ No newline at end of file +}); diff --git a/tests/Unit/Support/URITest.php b/tests/Unit/Support/URITest.php index 2309659..eb2b1cb 100644 --- a/tests/Unit/Support/URITest.php +++ b/tests/Unit/Support/URITest.php @@ -4,14 +4,14 @@ use function PHPUnit\Framework\assertEquals; use function PHPUnit\Framework\assertTrue; -it('can enterpret input as path or name', function() { +it('can interpret input as path or name', function() { assertTrue(URI::make('')->isPath()); assertTrue(URI::make('car')->isPath()); assertTrue(URI::make('car.php')->isPath()); assertTrue(URI::make('Car.php')->isPath()); assertTrue(URI::make('app/Car')->isPath()); assertTrue(URI::make('/Car')->isPath()); - + assertTrue(URI::make('Car')->isName()); assertTrue(URI::make('\\Car')->isName()); assertTrue(URI::make('App\\Car')->isName());