Skip to content

Commit c13e0e3

Browse files
authored
Release 23.7.1 (#56)
* Add deprecation warnings * Update version to 23.7.1
1 parent a8b11d0 commit c13e0e3

File tree

7 files changed

+89
-2
lines changed

7 files changed

+89
-2
lines changed

Makefile

Lines changed: 4 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -21,3 +21,7 @@ init:
2121
update:
2222
composer update
2323
composer validate
24+
25+
.PHONY: after-gen
26+
after-gen: format
27+
./scripts/add-deprecation-warnings.bash

README.md

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -6,7 +6,7 @@
66
[![Supported PHP Versions](https://img.shields.io/packagist/dependency-v/aspose/barcode-cloud-php/php)](https://packagist.org/packages/aspose/barcode-cloud-php)
77

88
- API version: 3.0
9-
- Package version: 23.7.0
9+
- Package version: 23.7.1
1010
- Supported PHP versions: ">=7.4 || >=8.0"
1111

1212
## Demo applications

scripts/add-deprecation-warning.py

Lines changed: 72 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,72 @@
1+
from __future__ import division, print_function
2+
3+
import argparse
4+
import re
5+
6+
COMMENT_SECTION_START_RE = re.compile(r"^\s+/\*\*$") # /**
7+
DEPRECATED_RE = re.compile( # * @param type $name DEPRECATED: Message
8+
r"^\s*\*\s+@param\s+(?P<type>\S+)\s+(?P<property_name>\S+)\s+DEPRECATED:\s+(?P<message>.+)$"
9+
)
10+
SETTER_FUNCTION_RE = re.compile(r"^\s*public\s+function\s+set\S+") # public function setSomething(value)
11+
FUNCTION_BODY_STARTED_RE = re.compile(r"^(?P<indent>\s*){$") # {
12+
13+
14+
def main(input_file):
15+
filename = input_file.name
16+
content = [line.rstrip() for line in input_file.readlines()]
17+
input_file.close()
18+
19+
with open(filename, "wt", newline="\n") as result:
20+
comment_section_started = False
21+
deprecation_message = None
22+
setter_function_declaration = False
23+
24+
for line in content:
25+
if COMMENT_SECTION_START_RE.match(line):
26+
comment_section_started = True
27+
28+
deprecated_match = DEPRECATED_RE.match(line)
29+
if comment_section_started and deprecated_match:
30+
# deprecation message found
31+
deprecation_message = deprecated_match.groupdict()["message"].strip()
32+
property_name = deprecated_match.groupdict()["property_name"]
33+
34+
if comment_section_started and deprecation_message and SETTER_FUNCTION_RE.match(line):
35+
setter_function_declaration = True
36+
37+
match_with_indent = FUNCTION_BODY_STARTED_RE.match(line)
38+
if match_with_indent:
39+
# Function body started
40+
if setter_function_declaration and deprecation_message:
41+
result.write(line + "\n")
42+
43+
indent = match_with_indent.groupdict()["indent"]
44+
escaped_message = "".join(r"\'" if c == "'" else c for c in deprecation_message)
45+
result.write(
46+
f"{indent}{(' ' * 4)}"
47+
f"trigger_error('Property {property_name} is deprecated. {escaped_message}'"
48+
", E_USER_DEPRECATED);\n"
49+
)
50+
51+
comment_section_started = False
52+
setter_function_declaration = False
53+
deprecation_message = None
54+
55+
continue
56+
57+
comment_section_started = False
58+
setter_function_declaration = False
59+
deprecation_message = None
60+
61+
result.write(line + "\n")
62+
63+
64+
def parse_args():
65+
parser = argparse.ArgumentParser()
66+
parser.add_argument("input_file", type=argparse.FileType("rt"))
67+
args = parser.parse_args()
68+
return vars(args)
69+
70+
71+
if __name__ == "__main__":
72+
main(**parse_args())
Lines changed: 7 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -0,0 +1,7 @@
1+
#!/bin/bash
2+
set -euo pipefail
3+
4+
SCRIPT_DIR="$( cd "$( dirname "${BASH_SOURCE[0]}" )" &> /dev/null && pwd )"
5+
SRC_DIR="$( cd "${SCRIPT_DIR}/../src" &> /dev/null && pwd )"
6+
7+
find "${SRC_DIR}" -name "*.php" -exec python "${SCRIPT_DIR}/add-deprecation-warning.py" "{}" \;

src/Aspose/BarCode/Configuration.php

Lines changed: 1 addition & 1 deletion
Original file line numberDiff line numberDiff line change
@@ -23,7 +23,7 @@ class Configuration implements JsonSerializable
2323
*
2424
* @var string
2525
*/
26-
protected $clientVersion = '23.7.0';
26+
protected $clientVersion = '23.7.1';
2727

2828
/**
2929
* ClientId for API

src/Aspose/BarCode/Model/DataMatrixParams.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -309,6 +309,7 @@ public function getColumns()
309309
*/
310310
public function setColumns($columns)
311311
{
312+
trigger_error('Property $columns is deprecated. Will be replaced with \'DataMatrix.Version\' in the next release Columns count.', E_USER_DEPRECATED);
312313
$this->container['columns'] = $columns;
313314

314315
return $this;
@@ -381,6 +382,7 @@ public function getRows()
381382
*/
382383
public function setRows($rows)
383384
{
385+
trigger_error('Property $rows is deprecated. Will be replaced with \'DataMatrix.Version\' in the next release Rows count.', E_USER_DEPRECATED);
384386
$this->container['rows'] = $rows;
385387

386388
return $this;

src/Aspose/BarCode/Model/GeneratorParams.php

Lines changed: 2 additions & 0 deletions
Original file line numberDiff line numberDiff line change
@@ -807,6 +807,7 @@ public function getResolutionX()
807807
*/
808808
public function setResolutionX($resolution_x)
809809
{
810+
trigger_error('Property $resolution_x is deprecated. Use \'Resolution\' instead.', E_USER_DEPRECATED);
810811
$this->container['resolution_x'] = $resolution_x;
811812

812813
return $this;
@@ -831,6 +832,7 @@ public function getResolutionY()
831832
*/
832833
public function setResolutionY($resolution_y)
833834
{
835+
trigger_error('Property $resolution_y is deprecated. Use \'Resolution\' instead.', E_USER_DEPRECATED);
834836
$this->container['resolution_y'] = $resolution_y;
835837

836838
return $this;

0 commit comments

Comments
 (0)