Skip to content

Commit ce2185f

Browse files
committed
fix: manually rename class using reserved PHP "object" keyword
1 parent d83775a commit ce2185f

5 files changed

Lines changed: 31 additions & 10 deletions

File tree

SecurityCenter/owlbot.py

Lines changed: 21 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -15,6 +15,7 @@
1515
"""This script is used to synthesize generated parts of this library."""
1616

1717
import logging
18+
import os
1819
from pathlib import Path
1920
import subprocess
2021

@@ -32,6 +33,26 @@
3233

3334
php.owlbot_main(src=src, dest=dest)
3435

36+
# Rename "Object" to "PBObject" because "Object" is a reserved word in PHP
37+
for version in ["V1", "V2"]:
38+
path = f'src/{version}/Kubernetes/Object.php'
39+
if Path(path).exists():
40+
s.replace(
41+
path,
42+
r'class Object',
43+
r'class PBObject'
44+
)
45+
s.move(path, f'src/{version}/Kubernetes/PBObject.php')
46+
if Path(path).exists():
47+
os.remove(path)
48+
49+
# Update typehints
50+
s.replace(
51+
'src/**/*.php',
52+
r'Kubernetes\\Object',
53+
r'Kubernetes\\PBObject'
54+
)
55+
3556
# format generated clients
3657
subprocess.run([
3758
'npm',

SecurityCenter/src/V1/Kubernetes.php

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SecurityCenter/src/V1/Kubernetes/Object.php renamed to SecurityCenter/src/V1/Kubernetes/PBObject.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SecurityCenter/src/V2/Kubernetes.php

Lines changed: 4 additions & 4 deletions
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

SecurityCenter/src/V2/Kubernetes/Object.php renamed to SecurityCenter/src/V2/Kubernetes/PBObject.php

Lines changed: 1 addition & 1 deletion
Some generated files are not rendered by default. Learn more about customizing how changed files appear on GitHub.

0 commit comments

Comments
 (0)