@vituum/vite-plugin-latte 1.0.0-alpha.1 → 1.0.0-alpha.10
This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
- package/handler-single.js +10 -0
- package/handler.js +41 -3
- package/index.js +32 -21
- package/index.php +20 -4
- package/package.json +8 -2
- package/types/index.d.ts +13 -0
- package/vendor/composer/autoload_classmap.php +5 -4
- package/vendor/composer/autoload_static.php +5 -4
- package/vendor/composer/installed.json +7 -7
- package/vendor/composer/installed.php +9 -9
- package/vendor/latte/latte/src/Latte/Compiler/Escaper.php +2 -2
- package/vendor/latte/latte/src/Latte/Compiler/ExpressionBuilder.php +2 -2
- package/vendor/latte/latte/src/Latte/Compiler/Node.php +2 -5
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/{Expression/ArrayItemNode.php → ArrayItemNode.php} +13 -3
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/{Expression/ClosureUseNode.php → ClosureUseNode.php} +2 -1
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayNode.php +1 -0
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureNode.php +1 -0
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/{Scalar/EncapsedStringPartNode.php → InterpolatedStringPartNode.php} +10 -4
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/NameNode.php +10 -10
- package/vendor/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/{EncapsedStringNode.php → InterpolatedStringNode.php} +6 -5
- package/vendor/latte/latte/src/Latte/Compiler/TagLexer.php +1 -1
- package/vendor/latte/latte/src/Latte/Compiler/TagParser.php +4 -4
- package/vendor/latte/latte/src/Latte/Compiler/TagParserData.php +127 -127
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParser.php +0 -15
- package/vendor/latte/latte/src/Latte/Compiler/TemplateParserHtml.php +3 -3
- package/vendor/latte/latte/src/Latte/Engine.php +5 -5
- package/vendor/latte/latte/src/Latte/Essential/CachingIterator.php +1 -1
- package/vendor/latte/latte/src/Latte/Essential/Nodes/ParametersNode.php +1 -1
- package/vendor/latte/latte/src/Latte/Essential/Nodes/VarNode.php +1 -1
- package/vendor/latte/latte/src/Latte/Runtime/Filters.php +2 -2
|
@@ -0,0 +1,10 @@
|
|
|
1
|
+
let params = JSON.parse(process.argv[3])
|
|
2
|
+
const path = process.argv[2]
|
|
3
|
+
|
|
4
|
+
params = params.map(value => Buffer.from(value, 'base64').toString('utf-8'))
|
|
5
|
+
|
|
6
|
+
const output = await (await import([path])).default(...params)
|
|
7
|
+
|
|
8
|
+
if (output) {
|
|
9
|
+
console.log(Buffer.from(output.toString(), 'utf-8').toString('base64'))
|
|
10
|
+
}
|
package/handler.js
CHANGED
|
@@ -1,13 +1,51 @@
|
|
|
1
|
-
import { resolve } from 'path'
|
|
1
|
+
import { resolve } from 'node:path'
|
|
2
|
+
import fs from 'node:fs'
|
|
2
3
|
|
|
3
|
-
|
|
4
|
+
function find (obj) {
|
|
5
|
+
if (typeof obj === 'object') {
|
|
6
|
+
if (obj.name === '@vituum/vite-plugin-latte') {
|
|
7
|
+
return obj
|
|
8
|
+
} else {
|
|
9
|
+
for (const key in obj) {
|
|
10
|
+
const result = find(obj[key])
|
|
11
|
+
|
|
12
|
+
if (result !== null) {
|
|
13
|
+
return result
|
|
14
|
+
}
|
|
15
|
+
}
|
|
16
|
+
}
|
|
17
|
+
}
|
|
18
|
+
|
|
19
|
+
return null
|
|
20
|
+
}
|
|
21
|
+
|
|
22
|
+
const DEFAULT_CONFIG_FILES = [
|
|
23
|
+
'vite.config.js',
|
|
24
|
+
'vite.config.mjs',
|
|
25
|
+
'vite.config.ts',
|
|
26
|
+
'vite.config.cjs',
|
|
27
|
+
'vite.config.mts',
|
|
28
|
+
'vite.config.cts'
|
|
29
|
+
]
|
|
30
|
+
|
|
31
|
+
let resolvedPath
|
|
32
|
+
|
|
33
|
+
for (const filename of DEFAULT_CONFIG_FILES) {
|
|
34
|
+
const filePath = resolve(process.cwd(), filename)
|
|
35
|
+
if (!fs.existsSync(filePath)) continue
|
|
36
|
+
|
|
37
|
+
resolvedPath = filePath
|
|
38
|
+
break
|
|
39
|
+
}
|
|
40
|
+
|
|
41
|
+
const vite = (await import(resolvedPath)).default
|
|
4
42
|
let params = JSON.parse(process.argv[4])
|
|
5
43
|
const name = process.argv[2]
|
|
6
44
|
const type = process.argv[3]
|
|
7
45
|
|
|
8
46
|
params = params.map(value => Buffer.from(value, 'base64').toString('utf-8'))
|
|
9
47
|
|
|
10
|
-
const output = await vite.plugins
|
|
48
|
+
const output = await find(vite.plugins)._options[type][name](...params)
|
|
11
49
|
|
|
12
50
|
if (output) {
|
|
13
51
|
console.log(Buffer.from(output.toString(), 'utf-8').toString('base64'))
|
package/index.js
CHANGED
|
@@ -11,7 +11,7 @@ import { renameBuildEnd, renameBuildStart } from 'vituum/utils/build.js'
|
|
|
11
11
|
const { name } = getPackageInfo(import.meta.url)
|
|
12
12
|
|
|
13
13
|
/**
|
|
14
|
-
* @type {import('@vituum/vite-plugin-latte/types
|
|
14
|
+
* @type {import('@vituum/vite-plugin-latte/types').PluginUserConfig} options
|
|
15
15
|
*/
|
|
16
16
|
const defaultOptions = {
|
|
17
17
|
reload: true,
|
|
@@ -19,7 +19,9 @@ const defaultOptions = {
|
|
|
19
19
|
filters: {},
|
|
20
20
|
functions: {},
|
|
21
21
|
tags: {},
|
|
22
|
-
globals: {
|
|
22
|
+
globals: {
|
|
23
|
+
format: 'latte'
|
|
24
|
+
},
|
|
23
25
|
data: ['src/data/**/*.json'],
|
|
24
26
|
formats: ['latte', 'json.latte', 'json'],
|
|
25
27
|
bin: 'php',
|
|
@@ -40,31 +42,31 @@ const execSync = (cmd) => {
|
|
|
40
42
|
}
|
|
41
43
|
}
|
|
42
44
|
|
|
43
|
-
const renderTemplate = ({ path, filename, cwd, packageRoot },
|
|
44
|
-
const renderTransformedHtml =
|
|
45
|
+
const renderTemplate = ({ server, path, filename, cwd, packageRoot }, options, content) => {
|
|
46
|
+
const renderTransformedHtml = options.renderTransformedHtml(server ? filename.replace('.html', '') : filename)
|
|
45
47
|
|
|
46
|
-
if (
|
|
47
|
-
const normalizePaths = Array.isArray(
|
|
48
|
+
if (options.data) {
|
|
49
|
+
const normalizePaths = Array.isArray(options.data) ? options.data.map(path => path.replace(/\\/g, '/')) : options.data.replace(/\\/g, '/')
|
|
48
50
|
|
|
49
|
-
|
|
51
|
+
options.data = FastGlob.sync(normalizePaths).map(entry => resolve(process.cwd(), entry))
|
|
50
52
|
}
|
|
51
53
|
|
|
52
|
-
Object.keys(
|
|
53
|
-
if (typeof
|
|
54
|
-
|
|
54
|
+
Object.keys(options.filters).forEach(key => {
|
|
55
|
+
if (typeof options.filters[key] === 'function') {
|
|
56
|
+
options.filters[key] = options.filters[key].toString().match(/\(\s*([^)]+?)\s*\)/)[1].replace(/\s/g, '').split(',')
|
|
55
57
|
}
|
|
56
58
|
})
|
|
57
59
|
|
|
58
|
-
Object.keys(
|
|
59
|
-
if (typeof
|
|
60
|
-
|
|
60
|
+
Object.keys(options.functions).forEach(key => {
|
|
61
|
+
if (typeof options.functions[key] === 'function') {
|
|
62
|
+
options.functions[key] = options.functions[key].toString().match(/\(\s*([^)]+?)\s*\)/)[1].replace(/\s/g, '').split(',')
|
|
61
63
|
}
|
|
62
64
|
})
|
|
63
65
|
|
|
64
66
|
if (renderTransformedHtml) {
|
|
65
67
|
const timestamp = Math.floor(Date.now() * Math.random())
|
|
66
68
|
|
|
67
|
-
|
|
69
|
+
options.contentTimestamp = timestamp
|
|
68
70
|
|
|
69
71
|
if (!fs.existsSync(resolve(packageRoot, 'temp'))) {
|
|
70
72
|
fs.mkdirSync(resolve(packageRoot, 'temp'))
|
|
@@ -73,11 +75,13 @@ const renderTemplate = ({ path, filename, cwd, packageRoot }, params, content) =
|
|
|
73
75
|
fs.writeFileSync(resolve(packageRoot, `temp/${timestamp}.html`), content)
|
|
74
76
|
}
|
|
75
77
|
|
|
76
|
-
|
|
78
|
+
const data = Object.assign({ packageRoot, cwd, isRenderTransformedHtml: renderTransformedHtml }, options)
|
|
79
|
+
|
|
80
|
+
return execSync(`${options.bin} ${packageRoot}/index.php ${join(options.root, server ? path.replace('.html', '') : path)} ${JSON.stringify(JSON.stringify(data))}`)
|
|
77
81
|
}
|
|
78
82
|
|
|
79
83
|
/**
|
|
80
|
-
* @param {import('@vituum/vite-plugin-latte/types
|
|
84
|
+
* @param {import('@vituum/vite-plugin-latte/types').PluginUserConfig} options
|
|
81
85
|
* @returns [import('vite').Plugin]
|
|
82
86
|
*/
|
|
83
87
|
const plugin = (options = {}) => {
|
|
@@ -127,18 +131,25 @@ const plugin = (options = {}) => {
|
|
|
127
131
|
transformIndexHtml: {
|
|
128
132
|
enforce: 'pre',
|
|
129
133
|
async transform (content, { path, filename, server }) {
|
|
130
|
-
path = path.replace('?raw', '')
|
|
131
|
-
filename = filename.replace('?raw', '')
|
|
132
|
-
|
|
133
134
|
if (options.ignoredPaths.find(ignoredPath => minimatch(path.replace('.html', ''), ignoredPath) === true)) {
|
|
134
135
|
return content
|
|
135
136
|
}
|
|
136
137
|
|
|
137
|
-
if (
|
|
138
|
+
if (
|
|
139
|
+
!options.formats.find(format => filename.replace('.html', '').endsWith(format)) ||
|
|
140
|
+
(filename.replace('.html', '').endsWith('.json') && !content.startsWith('{'))
|
|
141
|
+
) {
|
|
142
|
+
return content
|
|
143
|
+
}
|
|
144
|
+
|
|
145
|
+
if (
|
|
146
|
+
(filename.replace('.html', '').endsWith('.json') && content.startsWith('{')) &&
|
|
147
|
+
(JSON.parse(content)?.format && !options.formats.includes(JSON.parse(content)?.format))
|
|
148
|
+
) {
|
|
138
149
|
return content
|
|
139
150
|
}
|
|
140
151
|
|
|
141
|
-
const render = renderTemplate({ path, filename, cwd, packageRoot }, options, content)
|
|
152
|
+
const render = renderTemplate({ server, path, filename, cwd, packageRoot }, options, content)
|
|
142
153
|
const warningLog = render.output.includes('Warning: Undefined')
|
|
143
154
|
|
|
144
155
|
if (render.error || warningLog) {
|
package/index.php
CHANGED
|
@@ -42,6 +42,14 @@ function NodeHandler($name, $type, ...$params) : string {
|
|
|
42
42
|
return base64_decode($output[0] ?? '') ?? $params[1];
|
|
43
43
|
}
|
|
44
44
|
|
|
45
|
+
function NodeHandlerSingle($path, ...$params) : string {
|
|
46
|
+
$params = array_map(static function($value) { return base64_encode((string)$value); }, $params);
|
|
47
|
+
|
|
48
|
+
exec('node '. PACKAGE_DIR .'/handler-single.js ' . $path . ' ' . json_encode(json_encode($params, JSON_HEX_QUOT | JSON_HEX_TAG), JSON_THROW_ON_ERROR), $output);
|
|
49
|
+
|
|
50
|
+
return base64_decode($output[0] ?? '') ?? $params[1];
|
|
51
|
+
}
|
|
52
|
+
|
|
45
53
|
if (!file_exists(__DIR__ . '/temp') && !mkdir($concurrentDirectory = __DIR__ . '/temp') && !is_dir($concurrentDirectory)) {
|
|
46
54
|
throw new Error(sprintf('Directory "%s" was not created', $concurrentDirectory));
|
|
47
55
|
}
|
|
@@ -124,10 +132,14 @@ foreach (['fetch', 'placeholder', 'randomColor'] as $function) {
|
|
|
124
132
|
}
|
|
125
133
|
|
|
126
134
|
foreach ($config->filters as $filter => $path) {
|
|
127
|
-
if (is_string($path)) {
|
|
135
|
+
if (is_string($path) && str_ends_with($path, '.php')) {
|
|
128
136
|
require ROOT_DIR . $path;
|
|
129
137
|
$latte->addFilter($filter, 'App\Latte\\' . ucfirst($filter) . 'Filter::execute');
|
|
130
|
-
}
|
|
138
|
+
} elseif (!$isDocker && is_string($path) && str_ends_with($path, '.js')) {
|
|
139
|
+
$latte->addFilter($filter, function (...$params) use ($path) : string {
|
|
140
|
+
return NodeHandlerSingle($path, ...$params);
|
|
141
|
+
});
|
|
142
|
+
} elseif (!$isDocker) {
|
|
131
143
|
$latte->addFilter($filter, function (...$params) use ($filter) : string {
|
|
132
144
|
return NodeHandler($filter, 'filters', ...$params);
|
|
133
145
|
});
|
|
@@ -135,9 +147,13 @@ foreach ($config->filters as $filter => $path) {
|
|
|
135
147
|
}
|
|
136
148
|
|
|
137
149
|
foreach ($config->functions as $function => $path) {
|
|
138
|
-
if (is_string($path)) {
|
|
150
|
+
if (is_string($path) && str_ends_with($path, '.php')) {
|
|
139
151
|
require ROOT_DIR . $path;
|
|
140
152
|
$latte->addFunction($function, 'App\Latte\\' . ucfirst($function) . 'Function::execute');
|
|
153
|
+
} elseif (!$isDocker && is_string($path) && str_ends_with($path, '.js')) {
|
|
154
|
+
$latte->addFunction($function, function (...$params) use ($path) : string {
|
|
155
|
+
return NodeHandlerSingle($path, ...$params);
|
|
156
|
+
});
|
|
141
157
|
} elseif (!$isDocker) {
|
|
142
158
|
$latte->addFunction($function, function (...$params) use ($function) : string {
|
|
143
159
|
return NodeHandler($function, 'functions', ...$params);
|
|
@@ -164,7 +180,7 @@ if (!file_exists(str_replace($config->cwd, ROOT_DIR, $params->template))) {
|
|
|
164
180
|
throw new Error('File not found ' . str_replace($config->cwd, ROOT_DIR, $params->template));
|
|
165
181
|
}
|
|
166
182
|
|
|
167
|
-
if (isset($config->
|
|
183
|
+
if (isset($config->isRenderTransformedHtml) && $config->isRenderTransformedHtml) {
|
|
168
184
|
if (isset($config->contentTimestamp)) {
|
|
169
185
|
$content = file_get_contents(__DIR__ . '/temp/' . $config->contentTimestamp . '.html');
|
|
170
186
|
unlink(__DIR__ . '/temp/' . $config->contentTimestamp . '.html');
|
package/package.json
CHANGED
|
@@ -1,6 +1,6 @@
|
|
|
1
1
|
{
|
|
2
2
|
"name": "@vituum/vite-plugin-latte",
|
|
3
|
-
"version": "1.0.0-alpha.
|
|
3
|
+
"version": "1.0.0-alpha.10",
|
|
4
4
|
"type": "module",
|
|
5
5
|
"main": "index.js",
|
|
6
6
|
"scripts": {
|
|
@@ -24,10 +24,16 @@
|
|
|
24
24
|
"files": [
|
|
25
25
|
"index.js",
|
|
26
26
|
"handler.js",
|
|
27
|
+
"handler-single.js",
|
|
27
28
|
"index.php",
|
|
28
29
|
"latte",
|
|
29
|
-
"vendor"
|
|
30
|
+
"vendor",
|
|
31
|
+
"types"
|
|
30
32
|
],
|
|
33
|
+
"exports": {
|
|
34
|
+
".": "./index.js",
|
|
35
|
+
"./types": "./types/*"
|
|
36
|
+
},
|
|
31
37
|
"engines": {
|
|
32
38
|
"node": ">=16.0.0",
|
|
33
39
|
"npm": ">=8.0.0"
|
package/types/index.d.ts
ADDED
|
@@ -0,0 +1,13 @@
|
|
|
1
|
+
export interface PluginUserConfig {
|
|
2
|
+
reload?: boolean | Function
|
|
3
|
+
root?: string
|
|
4
|
+
filters?: Object
|
|
5
|
+
functions?: Object
|
|
6
|
+
tags?: Object
|
|
7
|
+
globals?: Object
|
|
8
|
+
data?: string | string[]
|
|
9
|
+
formats?: string[]
|
|
10
|
+
bin?: string
|
|
11
|
+
renderTransformedHtml?: (filename: string) => boolean
|
|
12
|
+
ignoredPaths?: string[]
|
|
13
|
+
}
|
|
@@ -29,10 +29,12 @@ return array(
|
|
|
29
29
|
'Latte\\Compiler\\Nodes\\Html\\QuotedValue' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Html/QuotedValue.php',
|
|
30
30
|
'Latte\\Compiler\\Nodes\\NopNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/NopNode.php',
|
|
31
31
|
'Latte\\Compiler\\Nodes\\Php\\ArgumentNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArgumentNode.php',
|
|
32
|
+
'Latte\\Compiler\\Nodes\\Php\\ArrayItemNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArrayItemNode.php',
|
|
33
|
+
'Latte\\Compiler\\Nodes\\Php\\ClosureUseNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ClosureUseNode.php',
|
|
32
34
|
'Latte\\Compiler\\Nodes\\Php\\ComplexTypeNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ComplexTypeNode.php',
|
|
33
35
|
'Latte\\Compiler\\Nodes\\Php\\ExpressionNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ExpressionNode.php',
|
|
34
36
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayAccessNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayAccessNode.php',
|
|
35
|
-
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayItemNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/
|
|
37
|
+
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayItemNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArrayItemNode.php',
|
|
36
38
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayNode.php',
|
|
37
39
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\AssignNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignNode.php',
|
|
38
40
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\AssignOpNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignOpNode.php',
|
|
@@ -41,7 +43,6 @@ return array(
|
|
|
41
43
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClassConstantFetchNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClassConstantFetchNode.php',
|
|
42
44
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\CloneNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/CloneNode.php',
|
|
43
45
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClosureNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureNode.php',
|
|
44
|
-
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClosureUseNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureUseNode.php',
|
|
45
46
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ConstantFetchNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ConstantFetchNode.php',
|
|
46
47
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\EmptyNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/EmptyNode.php',
|
|
47
48
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ErrorSuppressNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ErrorSuppressNode.php',
|
|
@@ -67,6 +68,7 @@ return array(
|
|
|
67
68
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\VariableNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/VariableNode.php',
|
|
68
69
|
'Latte\\Compiler\\Nodes\\Php\\FilterNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/FilterNode.php',
|
|
69
70
|
'Latte\\Compiler\\Nodes\\Php\\IdentifierNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/IdentifierNode.php',
|
|
71
|
+
'Latte\\Compiler\\Nodes\\Php\\InterpolatedStringPartNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/InterpolatedStringPartNode.php',
|
|
70
72
|
'Latte\\Compiler\\Nodes\\Php\\IntersectionTypeNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/IntersectionTypeNode.php',
|
|
71
73
|
'Latte\\Compiler\\Nodes\\Php\\MatchArmNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/MatchArmNode.php',
|
|
72
74
|
'Latte\\Compiler\\Nodes\\Php\\ModifierNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ModifierNode.php',
|
|
@@ -75,10 +77,9 @@ return array(
|
|
|
75
77
|
'Latte\\Compiler\\Nodes\\Php\\ParameterNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ParameterNode.php',
|
|
76
78
|
'Latte\\Compiler\\Nodes\\Php\\ScalarNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/ScalarNode.php',
|
|
77
79
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\BooleanNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/BooleanNode.php',
|
|
78
|
-
'Latte\\Compiler\\Nodes\\Php\\Scalar\\EncapsedStringNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/EncapsedStringNode.php',
|
|
79
|
-
'Latte\\Compiler\\Nodes\\Php\\Scalar\\EncapsedStringPartNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/EncapsedStringPartNode.php',
|
|
80
80
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\FloatNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/FloatNode.php',
|
|
81
81
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\IntegerNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/IntegerNode.php',
|
|
82
|
+
'Latte\\Compiler\\Nodes\\Php\\Scalar\\InterpolatedStringNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/InterpolatedStringNode.php',
|
|
82
83
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\NullNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/NullNode.php',
|
|
83
84
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\StringNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/StringNode.php',
|
|
84
85
|
'Latte\\Compiler\\Nodes\\Php\\SuperiorTypeNode' => $vendorDir . '/latte/latte/src/Latte/Compiler/Nodes/Php/SuperiorTypeNode.php',
|
|
@@ -30,10 +30,12 @@ class ComposerStaticInit19cfb30b66a778b432af39bbd1e78bca
|
|
|
30
30
|
'Latte\\Compiler\\Nodes\\Html\\QuotedValue' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Html/QuotedValue.php',
|
|
31
31
|
'Latte\\Compiler\\Nodes\\NopNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/NopNode.php',
|
|
32
32
|
'Latte\\Compiler\\Nodes\\Php\\ArgumentNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArgumentNode.php',
|
|
33
|
+
'Latte\\Compiler\\Nodes\\Php\\ArrayItemNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArrayItemNode.php',
|
|
34
|
+
'Latte\\Compiler\\Nodes\\Php\\ClosureUseNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ClosureUseNode.php',
|
|
33
35
|
'Latte\\Compiler\\Nodes\\Php\\ComplexTypeNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ComplexTypeNode.php',
|
|
34
36
|
'Latte\\Compiler\\Nodes\\Php\\ExpressionNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ExpressionNode.php',
|
|
35
37
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayAccessNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayAccessNode.php',
|
|
36
|
-
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayItemNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/
|
|
38
|
+
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayItemNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ArrayItemNode.php',
|
|
37
39
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ArrayNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ArrayNode.php',
|
|
38
40
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\AssignNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignNode.php',
|
|
39
41
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\AssignOpNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/AssignOpNode.php',
|
|
@@ -42,7 +44,6 @@ class ComposerStaticInit19cfb30b66a778b432af39bbd1e78bca
|
|
|
42
44
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClassConstantFetchNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClassConstantFetchNode.php',
|
|
43
45
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\CloneNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/CloneNode.php',
|
|
44
46
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClosureNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureNode.php',
|
|
45
|
-
'Latte\\Compiler\\Nodes\\Php\\Expression\\ClosureUseNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ClosureUseNode.php',
|
|
46
47
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ConstantFetchNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ConstantFetchNode.php',
|
|
47
48
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\EmptyNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/EmptyNode.php',
|
|
48
49
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\ErrorSuppressNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/ErrorSuppressNode.php',
|
|
@@ -68,6 +69,7 @@ class ComposerStaticInit19cfb30b66a778b432af39bbd1e78bca
|
|
|
68
69
|
'Latte\\Compiler\\Nodes\\Php\\Expression\\VariableNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Expression/VariableNode.php',
|
|
69
70
|
'Latte\\Compiler\\Nodes\\Php\\FilterNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/FilterNode.php',
|
|
70
71
|
'Latte\\Compiler\\Nodes\\Php\\IdentifierNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/IdentifierNode.php',
|
|
72
|
+
'Latte\\Compiler\\Nodes\\Php\\InterpolatedStringPartNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/InterpolatedStringPartNode.php',
|
|
71
73
|
'Latte\\Compiler\\Nodes\\Php\\IntersectionTypeNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/IntersectionTypeNode.php',
|
|
72
74
|
'Latte\\Compiler\\Nodes\\Php\\MatchArmNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/MatchArmNode.php',
|
|
73
75
|
'Latte\\Compiler\\Nodes\\Php\\ModifierNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ModifierNode.php',
|
|
@@ -76,10 +78,9 @@ class ComposerStaticInit19cfb30b66a778b432af39bbd1e78bca
|
|
|
76
78
|
'Latte\\Compiler\\Nodes\\Php\\ParameterNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ParameterNode.php',
|
|
77
79
|
'Latte\\Compiler\\Nodes\\Php\\ScalarNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/ScalarNode.php',
|
|
78
80
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\BooleanNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/BooleanNode.php',
|
|
79
|
-
'Latte\\Compiler\\Nodes\\Php\\Scalar\\EncapsedStringNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/EncapsedStringNode.php',
|
|
80
|
-
'Latte\\Compiler\\Nodes\\Php\\Scalar\\EncapsedStringPartNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/EncapsedStringPartNode.php',
|
|
81
81
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\FloatNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/FloatNode.php',
|
|
82
82
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\IntegerNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/IntegerNode.php',
|
|
83
|
+
'Latte\\Compiler\\Nodes\\Php\\Scalar\\InterpolatedStringNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/InterpolatedStringNode.php',
|
|
83
84
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\NullNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/NullNode.php',
|
|
84
85
|
'Latte\\Compiler\\Nodes\\Php\\Scalar\\StringNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/Scalar/StringNode.php',
|
|
85
86
|
'Latte\\Compiler\\Nodes\\Php\\SuperiorTypeNode' => __DIR__ . '/..' . '/latte/latte/src/Latte/Compiler/Nodes/Php/SuperiorTypeNode.php',
|
|
@@ -2,17 +2,17 @@
|
|
|
2
2
|
"packages": [
|
|
3
3
|
{
|
|
4
4
|
"name": "latte/latte",
|
|
5
|
-
"version": "v3.0.
|
|
6
|
-
"version_normalized": "3.0.
|
|
5
|
+
"version": "v3.0.6",
|
|
6
|
+
"version_normalized": "3.0.6.0",
|
|
7
7
|
"source": {
|
|
8
8
|
"type": "git",
|
|
9
9
|
"url": "https://github.com/nette/latte.git",
|
|
10
|
-
"reference": "
|
|
10
|
+
"reference": "6f66dcfea7ad76f60b8234139161421e9e1e309f"
|
|
11
11
|
},
|
|
12
12
|
"dist": {
|
|
13
13
|
"type": "zip",
|
|
14
|
-
"url": "https://api.github.com/repos/nette/latte/zipball/
|
|
15
|
-
"reference": "
|
|
14
|
+
"url": "https://api.github.com/repos/nette/latte/zipball/6f66dcfea7ad76f60b8234139161421e9e1e309f",
|
|
15
|
+
"reference": "6f66dcfea7ad76f60b8234139161421e9e1e309f",
|
|
16
16
|
"shasum": ""
|
|
17
17
|
},
|
|
18
18
|
"require": {
|
|
@@ -38,7 +38,7 @@
|
|
|
38
38
|
"nette/php-generator": "to use tag {templatePrint}",
|
|
39
39
|
"nette/utils": "to use filter |webalize"
|
|
40
40
|
},
|
|
41
|
-
"time": "2023-
|
|
41
|
+
"time": "2023-03-09T01:34:56+00:00",
|
|
42
42
|
"bin": [
|
|
43
43
|
"bin/latte-lint"
|
|
44
44
|
],
|
|
@@ -84,7 +84,7 @@
|
|
|
84
84
|
],
|
|
85
85
|
"support": {
|
|
86
86
|
"issues": "https://github.com/nette/latte/issues",
|
|
87
|
-
"source": "https://github.com/nette/latte/tree/v3.0.
|
|
87
|
+
"source": "https://github.com/nette/latte/tree/v3.0.6"
|
|
88
88
|
},
|
|
89
89
|
"install-path": "../latte/latte"
|
|
90
90
|
}
|
|
@@ -1,31 +1,31 @@
|
|
|
1
1
|
<?php return array(
|
|
2
2
|
'root' => array(
|
|
3
|
-
'pretty_version' => 'dev-
|
|
4
|
-
'version' => 'dev-
|
|
3
|
+
'pretty_version' => 'dev-next',
|
|
4
|
+
'version' => 'dev-next',
|
|
5
5
|
'type' => 'library',
|
|
6
6
|
'install_path' => __DIR__ . '/../../',
|
|
7
7
|
'aliases' => array(),
|
|
8
|
-
'reference' => '
|
|
8
|
+
'reference' => '713a4283dc3286aa6309d6e931e49e7eeec110da',
|
|
9
9
|
'name' => '__root__',
|
|
10
10
|
'dev' => true,
|
|
11
11
|
),
|
|
12
12
|
'versions' => array(
|
|
13
13
|
'__root__' => array(
|
|
14
|
-
'pretty_version' => 'dev-
|
|
15
|
-
'version' => 'dev-
|
|
14
|
+
'pretty_version' => 'dev-next',
|
|
15
|
+
'version' => 'dev-next',
|
|
16
16
|
'type' => 'library',
|
|
17
17
|
'install_path' => __DIR__ . '/../../',
|
|
18
18
|
'aliases' => array(),
|
|
19
|
-
'reference' => '
|
|
19
|
+
'reference' => '713a4283dc3286aa6309d6e931e49e7eeec110da',
|
|
20
20
|
'dev_requirement' => false,
|
|
21
21
|
),
|
|
22
22
|
'latte/latte' => array(
|
|
23
|
-
'pretty_version' => 'v3.0.
|
|
24
|
-
'version' => '3.0.
|
|
23
|
+
'pretty_version' => 'v3.0.6',
|
|
24
|
+
'version' => '3.0.6.0',
|
|
25
25
|
'type' => 'library',
|
|
26
26
|
'install_path' => __DIR__ . '/../latte/latte',
|
|
27
27
|
'aliases' => array(),
|
|
28
|
-
'reference' => '
|
|
28
|
+
'reference' => '6f66dcfea7ad76f60b8234139161421e9e1e309f',
|
|
29
29
|
'dev_requirement' => false,
|
|
30
30
|
),
|
|
31
31
|
),
|
|
@@ -202,14 +202,14 @@ final class Escaper
|
|
|
202
202
|
'html' => 'escapeHtmlText',
|
|
203
203
|
'html/attr' => 'escapeHtmlAttr',
|
|
204
204
|
'html/attr/js' => 'escapeHtmlAttr',
|
|
205
|
-
'html/js' => '
|
|
205
|
+
'html/js' => 'convertJSToHtmlRawText',
|
|
206
206
|
'html/comment' => 'escapeHtmlComment',
|
|
207
207
|
],
|
|
208
208
|
self::Css => [
|
|
209
209
|
'html' => 'escapeHtmlText',
|
|
210
210
|
'html/attr' => 'escapeHtmlAttr',
|
|
211
211
|
'html/attr/css' => 'escapeHtmlAttr',
|
|
212
|
-
'html/css' => '
|
|
212
|
+
'html/css' => 'convertJSToHtmlRawText',
|
|
213
213
|
'html/comment' => 'escapeHtmlComment',
|
|
214
214
|
],
|
|
215
215
|
'html' => [
|
|
@@ -99,10 +99,10 @@ final class ExpressionBuilder
|
|
|
99
99
|
$lastKey = -1;
|
|
100
100
|
foreach ($arr as $key => $val) {
|
|
101
101
|
if ($lastKey !== null && ++$lastKey === $key) {
|
|
102
|
-
$node->items[] = new
|
|
102
|
+
$node->items[] = new Nodes\Php\ArrayItemNode(self::valueToNode($val));
|
|
103
103
|
} else {
|
|
104
104
|
$lastKey = null;
|
|
105
|
-
$node->items[] = new
|
|
105
|
+
$node->items[] = new Nodes\Php\ArrayItemNode(self::valueToNode($val), self::valueToNode($key));
|
|
106
106
|
}
|
|
107
107
|
}
|
|
108
108
|
|
|
@@ -20,9 +20,6 @@ abstract class Node implements \IteratorAggregate
|
|
|
20
20
|
abstract public function print(PrintContext $context): string;
|
|
21
21
|
|
|
22
22
|
|
|
23
|
-
|
|
24
|
-
|
|
25
|
-
return;
|
|
26
|
-
yield;
|
|
27
|
-
}
|
|
23
|
+
/** @return \Generator<self> */
|
|
24
|
+
abstract public function &getIterator(): \Generator;
|
|
28
25
|
}
|
|
@@ -7,11 +7,9 @@
|
|
|
7
7
|
|
|
8
8
|
declare(strict_types=1);
|
|
9
9
|
|
|
10
|
-
namespace Latte\Compiler\Nodes\Php
|
|
10
|
+
namespace Latte\Compiler\Nodes\Php;
|
|
11
11
|
|
|
12
12
|
use Latte\Compiler\Node;
|
|
13
|
-
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
14
|
-
use Latte\Compiler\Nodes\Php\IdentifierNode;
|
|
15
13
|
use Latte\Compiler\Position;
|
|
16
14
|
use Latte\Compiler\PrintContext;
|
|
17
15
|
|
|
@@ -50,3 +48,15 @@ class ArrayItemNode extends Node
|
|
|
50
48
|
yield $this->value;
|
|
51
49
|
}
|
|
52
50
|
}
|
|
51
|
+
|
|
52
|
+
|
|
53
|
+
class_alias(ArrayItemNode::class, Expression\ArrayItemNode::class);
|
|
54
|
+
|
|
55
|
+
namespace Latte\Compiler\Nodes\Php\Expression;
|
|
56
|
+
|
|
57
|
+
if (false) {
|
|
58
|
+
/** @deprecated use Latte\Compiler\Nodes\Php\ArrayItemNode */
|
|
59
|
+
class ArrayItemNode
|
|
60
|
+
{
|
|
61
|
+
}
|
|
62
|
+
}
|
|
@@ -7,9 +7,10 @@
|
|
|
7
7
|
|
|
8
8
|
declare(strict_types=1);
|
|
9
9
|
|
|
10
|
-
namespace Latte\Compiler\Nodes\Php
|
|
10
|
+
namespace Latte\Compiler\Nodes\Php;
|
|
11
11
|
|
|
12
12
|
use Latte\Compiler\Node;
|
|
13
|
+
use Latte\Compiler\Nodes\Php\Expression\VariableNode;
|
|
13
14
|
use Latte\Compiler\Position;
|
|
14
15
|
use Latte\Compiler\PrintContext;
|
|
15
16
|
|
|
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
|
|
10
10
|
namespace Latte\Compiler\Nodes\Php\Expression;
|
|
11
11
|
|
|
12
12
|
use Latte\Compiler\Nodes\Php\ArgumentNode;
|
|
13
|
+
use Latte\Compiler\Nodes\Php\ArrayItemNode;
|
|
13
14
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
14
15
|
use Latte\Compiler\Nodes\Php\IdentifierNode;
|
|
15
16
|
use Latte\Compiler\Nodes\Php\Scalar;
|
|
@@ -10,6 +10,7 @@ declare(strict_types=1);
|
|
|
10
10
|
namespace Latte\Compiler\Nodes\Php\Expression;
|
|
11
11
|
|
|
12
12
|
use Latte\Compiler\Nodes\Php;
|
|
13
|
+
use Latte\Compiler\Nodes\Php\ClosureUseNode;
|
|
13
14
|
use Latte\Compiler\Nodes\Php\ExpressionNode;
|
|
14
15
|
use Latte\Compiler\Position;
|
|
15
16
|
use Latte\Compiler\PrintContext;
|
|
@@ -7,14 +7,14 @@
|
|
|
7
7
|
|
|
8
8
|
declare(strict_types=1);
|
|
9
9
|
|
|
10
|
-
namespace Latte\Compiler\Nodes\Php
|
|
10
|
+
namespace Latte\Compiler\Nodes\Php;
|
|
11
11
|
|
|
12
|
-
use Latte\Compiler\
|
|
12
|
+
use Latte\Compiler\Node;
|
|
13
13
|
use Latte\Compiler\Position;
|
|
14
14
|
use Latte\Compiler\PrintContext;
|
|
15
15
|
|
|
16
16
|
|
|
17
|
-
class
|
|
17
|
+
class InterpolatedStringPartNode extends Node
|
|
18
18
|
{
|
|
19
19
|
public function __construct(
|
|
20
20
|
public string $value,
|
|
@@ -25,6 +25,12 @@ class EncapsedStringPartNode extends ScalarNode
|
|
|
25
25
|
|
|
26
26
|
public function print(PrintContext $context): string
|
|
27
27
|
{
|
|
28
|
-
throw new \LogicException('Cannot directly print
|
|
28
|
+
throw new \LogicException('Cannot directly print InterpolatedStringPart');
|
|
29
|
+
}
|
|
30
|
+
|
|
31
|
+
|
|
32
|
+
public function &getIterator(): \Generator
|
|
33
|
+
{
|
|
34
|
+
false && yield;
|
|
29
35
|
}
|
|
30
36
|
}
|
|
@@ -52,17 +52,17 @@ class NameNode extends Node
|
|
|
52
52
|
public function isKeyword(): bool
|
|
53
53
|
{
|
|
54
54
|
static $keywords;
|
|
55
|
-
$keywords ??= array_flip([
|
|
56
|
-
'
|
|
57
|
-
'
|
|
58
|
-
'
|
|
59
|
-
'
|
|
60
|
-
'
|
|
61
|
-
'
|
|
62
|
-
'
|
|
55
|
+
$keywords ??= array_flip([ // https://www.php.net/manual/en/reserved.keywords.php
|
|
56
|
+
'__halt_compiler', '__class__', '__dir__', '__file__', '__function__', '__line__', '__method__', '__namespace__', '__trait__',
|
|
57
|
+
'abstract', 'and', 'array', 'as', 'break', 'callable', 'case', 'catch', 'class', 'clone', 'const', 'continue', 'declare',
|
|
58
|
+
'default', 'die', 'do', 'echo', 'else', 'elseif', 'empty', 'enddeclare', 'endfor', 'endforeach', 'endif', 'endswitch',
|
|
59
|
+
'endwhile', 'eval', 'exit', 'extends', 'final', 'finally', 'fn', 'for', 'foreach', 'function', 'global', 'goto', 'if',
|
|
60
|
+
'implements', 'include', 'include_once', 'instanceof', 'insteadof', 'interface', 'isset', 'list', 'match', 'namespace',
|
|
61
|
+
'new', 'or', 'print', 'private', 'protected', 'public', 'readonly', 'require', 'require_once', 'return', 'static',
|
|
62
|
+
'switch', 'throw', 'trait', 'try', 'unset', 'use', 'var', 'while', 'xor', 'yield',
|
|
63
|
+
'parent', 'self', 'mixed', 'void', 'enum', // extra
|
|
63
64
|
]);
|
|
64
|
-
return count($this->parts) === 1
|
|
65
|
-
&& (isset($keywords[strtolower($this->parts[0])]) || str_starts_with($this->parts[0], '__'));
|
|
65
|
+
return count($this->parts) === 1 && isset($keywords[strtolower($this->parts[0])]);
|
|
66
66
|
}
|
|
67
67
|
|
|
68
68
|
|