1
0
mirror of https://github.com/jupeter/clean-code-php.git synced 2025-09-25 21:49:04 +02:00

Merge pull request #166 from peter-gribanov/js_to_php

Rename function parseBetterJSAlternative()
This commit is contained in:
Tomáš Votruba
2019-09-12 10:31:03 +02:00
committed by GitHub

View File

@@ -629,7 +629,7 @@ testing.
**Bad:**
```php
function parseBetterJSAlternative(string $code): void
function parseBetterPHPAlternative(string $code): void
{
$regexes = [
// ...
@@ -656,7 +656,7 @@ function parseBetterJSAlternative(string $code): void
**Bad too:**
We have carried out some of the functionality, but the `parseBetterJSAlternative()` function is still very complex and not testable.
We have carried out some of the functionality, but the `parseBetterPHPAlternative()` function is still very complex and not testable.
```php
function tokenize(string $code): array
@@ -686,7 +686,7 @@ function lexer(array $tokens): array
return $ast;
}
function parseBetterJSAlternative(string $code): void
function parseBetterPHPAlternative(string $code): void
{
$tokens = tokenize($code);
$ast = lexer($tokens);
@@ -698,7 +698,7 @@ function parseBetterJSAlternative(string $code): void
**Good:**
The best solution is move out the dependencies of `parseBetterJSAlternative()` function.
The best solution is move out the dependencies of `parseBetterPHPAlternative()` function.
```php
class Tokenizer
@@ -734,7 +734,7 @@ class Lexer
}
}
class BetterJSAlternative
class BetterPHPAlternative
{
private $tokenizer;
private $lexer;