mattiabasone commented on code in PR #3528:
URL: https://github.com/apache/avro/pull/3528#discussion_r2494072741
##########
lang/php/lib/Datum/AvroIODatumReader.php:
##########
@@ -219,28 +214,37 @@ public static function schemasMatch(AvroSchema
$writers_schema, AvroSchema $read
* @param AvroSchema $schema_two
* @param string[] $attribute_names array of string attribute names to
compare
*
- * @return boolean true if the attributes match and false otherwise.
+ * @return bool true if the attributes match and false otherwise.
+ * @throws AvroSchemaParseException
*/
- public static function attributesMatch($schema_one, $schema_two,
$attribute_names)
- {
+ public static function attributesMatch(
+ AvroSchema $schema_one,
+ AvroSchema $schema_two,
+ array $attribute_names
+ ): bool {
foreach ($attribute_names as $attribute_name) {
- if ($schema_one->attribute($attribute_name) !==
$schema_two->attribute($attribute_name)) {
- if ($attribute_name === AvroSchema::FULLNAME_ATTR) {
- foreach ($schema_two->getAliases() as $alias) {
- if (
- $schema_one->attribute($attribute_name) === (new
AvroName(
- $alias,
-
$schema_two->attribute(AvroSchema::NAMESPACE_ATTR),
- null
- ))->fullname()
- ) {
- return true;
- }
+ if ($schema_one->attribute($attribute_name) ===
$schema_two->attribute($attribute_name)) {
+ continue;
+ }
+
+ if (AvroSchema::FULLNAME_ATTR === $attribute_name) {
+ if (!$schema_two instanceof AvroAliasedSchema) {
+ return false;
+ }
+ foreach ($schema_two->getAliases() as $alias) {
+ if (
+ $schema_one->attribute($attribute_name) !== (new
AvroName(
+ $alias,
+ $schema_two->attribute(AvroSchema::NAMESPACE_ATTR),
+ null
+ ))->fullname()
+ ) {
+ return false;
Review Comment:
Thank you Martin, I'm will revert this change
--
This is an automated message from the Apache Git Service.
To respond to the message, please log on to GitHub and use the
URL above to go to the specific comment.
To unsubscribe, e-mail: [email protected]
For queries about this service, please contact Infrastructure at:
[email protected]