Skip to content

docs: adiciona conteúdos de polimorfismo e encapsulamento#108

Open
Washington83 wants to merge 4 commits intodanielhe4rt:masterfrom
Washington83:feature/featureBraba
Open

docs: adiciona conteúdos de polimorfismo e encapsulamento#108
Washington83 wants to merge 4 commits intodanielhe4rt:masterfrom
Washington83:feature/featureBraba

Conversation

@Washington83
Copy link

@Washington83 Washington83 commented Mar 22, 2026

📚 Descrição

Adicionei conteúdos de polimorfismo e encapsulamento em PHP para melhorar a documentação do projeto.

🧠 Conteúdos adicionados

  • Polimorfismo (conceito + exemplos práticos)
  • Encapsulamento (conceito + exemplos práticos)

🎯 Objetivo

Facilitar o entendimento de POO para iniciantes.

Summary by CodeRabbit

  • Documentation
    • Added Portuguese lessons on encapsulation and polymorphism: clear definitions, practical analogies (bank account), illustrative PHP examples demonstrating encapsulated vs direct access and polymorphic dispatch vs conditional branching, coverage of access modifiers and getters/setters, practical usage patterns, concise recaps and memorization aids to help learners grasp and apply these OOP concepts.

@coderabbitai
Copy link

coderabbitai bot commented Mar 22, 2026

📝 Walkthrough

Walkthrough

Added two Portuguese OOP lesson files: 9-Polimorfismo.md (polymorphism with PHP examples: method overriding, polymorphic dispatch vs conditional branching) and 10-Encapsulamento.md (encapsulation, access modifiers, private attributes, getters/setters, validation, bank-account analogy).

Changes

Cohort / File(s) Summary
OOP Concepts Documentation
4-Intermediário/9-Polimorfismo.md, 4-Intermediário/10-Encapsulamento.md
Adds two instructional Markdown files. 9-Polimorfismo.md: explains polymorphism with PHP base/subclass examples (emitirSom, Pagamento/Pix/Cartao), demonstrates polymorphic dispatch and contrasts with if/elseif branching. 10-Encapsulamento.md: defines encapsulation, shows PHP examples with private attributes, depositar/sacar/getSaldo, discusses access modifiers, validation, and a bank-account analogy.

Estimated code review effort

🎯 1 (Trivial) | ⏱️ ~4 minutes

Poem

🐰 I nibble lines and code so bright,

Polymorphism hops in plain sight,
Encapsulation tucks data near,
PHP lessons whispered clear,
I stamp a paw — docs done right. 🥕

🚥 Pre-merge checks | ✅ 3
✅ Passed checks (3 passed)
Check name Status Explanation
Description Check ✅ Passed Check skipped - CodeRabbit’s high-level summary is enabled.
Title check ✅ Passed The title 'docs: adiciona conteúdos de polimorfismo e encapsulamento' clearly and specifically summarizes the main changes: adding documentation about polymorphism and encapsulation concepts, which directly matches the two new lesson files added (9-Polimorfismo.md and 10-Encapsulamento.md).
Docstring Coverage ✅ Passed No functions found in the changed files to evaluate docstring coverage. Skipping docstring coverage check.

✏️ Tip: You can configure your own custom pre-merge checks in the settings.

✨ Finishing Touches
🧪 Generate unit tests (beta)
  • Create PR with unit tests

Thanks for using CodeRabbit! It's free for OSS, and your support helps us grow. If you like it, consider giving us a shout-out.

❤️ Share

Comment @coderabbitai help to get the list of available commands and usage tips.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🧹 Nitpick comments (2)
4-Intermediário/10-Encapsulamento.md (1)

7-7: Pequena padronização de Markdown para evitar ruído de lint.

Line 7 tem indentação sobrando antes de “Ou seja:”, e as headings nas Lines 48 e 95 usam dois espaços após ##.

🧹 Ajuste sugerido
- Ou seja:
+Ou seja:
...
-##  Exemplo com encapsulamento (correto)
+## Exemplo com encapsulamento (correto)
...
-##  Resumão
+## Resumão

Also applies to: 48-48, 95-95

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/10-Encapsulamento.md` at line 7, Remove the stray leading
indentation before the "Ou seja:" line and normalize the Markdown headings that
currently have two spaces after the '##' to use a single space; locate the
literal "Ou seja:" string and the headings that start with "##  " (two spaces)
and edit them so "Ou seja:" has no extra leading spaces and each "##" heading
uses exactly one space after the hashes.
4-Intermediário/9-Polimorfismo.md (1)

12-12: Padronizar headings ATX com um único espaço após ##.

As headings nas Lines 12, 33 e 82 usam dois espaços após ##, o que tende a gerar warning de markdownlint (MD019).

🧹 Ajuste sugerido
-##  Por que usar?
+## Por que usar?
...
-##  Exemplo prático
+## Exemplo prático
...
-##  Outro exemplo (mais real)
+## Outro exemplo (mais real)

Also applies to: 33-33, 82-82

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/9-Polimorfismo.md` at line 12, Fix the ATX heading spacing by
replacing double spaces after '##' with a single space for the affected headings
(e.g., the "##  Por que usar?" heading and the other headings flagged around
lines 33 and 82); locate the headings in the "9-Polimorfismo.md" content (search
for "##  ") and ensure each ATX header uses exactly one space after the hashes
(e.g., "## Por que usar?") to satisfy markdownlint MD019.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@4-Intermediário/9-Polimorfismo.md`:
- Around line 76-77: The examples currently concatenate PHP_EOL but do not
output it because the expressions are not echoed; replace the discarded
expressions with proper echo (or print) statements so the newline prints, e.g.
use echo $animal1->emitirSom() . PHP_EOL; and echo $animal2->emitirSom() .
PHP_EOL; and likewise change the expressions around the other example (the block
around lines 125-127) to echo the emitirSom() results with PHP_EOL so the
expected line breaks appear.

---

Nitpick comments:
In `@4-Intermediário/10-Encapsulamento.md`:
- Line 7: Remove the stray leading indentation before the "Ou seja:" line and
normalize the Markdown headings that currently have two spaces after the '##' to
use a single space; locate the literal "Ou seja:" string and the headings that
start with "##  " (two spaces) and edit them so "Ou seja:" has no extra leading
spaces and each "##" heading uses exactly one space after the hashes.

In `@4-Intermediário/9-Polimorfismo.md`:
- Line 12: Fix the ATX heading spacing by replacing double spaces after '##'
with a single space for the affected headings (e.g., the "##  Por que usar?"
heading and the other headings flagged around lines 33 and 82); locate the
headings in the "9-Polimorfismo.md" content (search for "##  ") and ensure each
ATX header uses exactly one space after the hashes (e.g., "## Por que usar?") to
satisfy markdownlint MD019.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 5b39f718-ebd8-4c3d-8665-e0cb753c0fb4

📥 Commits

Reviewing files that changed from the base of the PR and between f305697 and f0ce87d.

📒 Files selected for processing (2)
  • 4-Intermediário/10-Encapsulamento.md
  • 4-Intermediário/9-Polimorfismo.md

Comment on lines +76 to +77
$animal1->emitirSom() . PHP_EOL; // Au au
$animal2->emitirSom() . PHP_EOL; // Miau
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

🧩 Analysis chain

🏁 Script executed:

#!/bin/bash
# Verifica ocorrências do padrão que não imprime newline
rg -nP '\->\w+\(.*\)\s*\.\s*PHP_EOL;' --type md

Repository: danielhe4rt/php4noobs

Length of output: 580


Corrigir exemplo de saída: concatenação com PHP_EOL não imprime nada sozinha.

Nas linhas 76-77 e 126, a expressão ... . PHP_EOL; é descartada—ela não gera quebra de linha no output. Isso é confuso para quem está aprendendo.

Sugestão de ajuste (linhas 76-77)
-$animal1->emitirSom() . PHP_EOL; // Au au
-$animal2->emitirSom() . PHP_EOL; // Miau
+echo $animal1->emitirSom() . PHP_EOL; // Au au
+echo $animal2->emitirSom() . PHP_EOL; // Miau
Sugestão de ajuste (linhas 125-127)
 foreach ($pagamentos as $pagamento) {
-    $pagamento->pagar(100) . PHP_EOL;
+    echo $pagamento->pagar(100) . PHP_EOL;
 }
📝 Committable suggestion

‼️ IMPORTANT
Carefully review the code before committing. Ensure that it accurately replaces the highlighted code, contains no missing lines, and has no issues with indentation. Thoroughly test & benchmark the code to ensure it meets the requirements.

Suggested change
$animal1->emitirSom() . PHP_EOL; // Au au
$animal2->emitirSom() . PHP_EOL; // Miau
echo $animal1->emitirSom() . PHP_EOL; // Au au
echo $animal2->emitirSom() . PHP_EOL; // Miau
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/9-Polimorfismo.md` around lines 76 - 77, The examples
currently concatenate PHP_EOL but do not output it because the expressions are
not echoed; replace the discarded expressions with proper echo (or print)
statements so the newline prints, e.g. use echo $animal1->emitirSom() . PHP_EOL;
and echo $animal2->emitirSom() . PHP_EOL; and likewise change the expressions
around the other example (the block around lines 125-127) to echo the
emitirSom() results with PHP_EOL so the expected line breaks appear.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

Actionable comments posted: 1

🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Inline comments:
In `@4-Intermediário/9-Polimorfismo.md`:
- Line 12: Headings use double spaces after the ATX marker causing MD019
violations; locate the headings like "##  Por que usar?" (and the other ATX
headings at the same file that have two spaces after the hashes) and remove the
extra space so they read "## Por que usar?" (and similarly for the other
headings) to conform to the no-multiple-space-atx rule.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: 7195b8c5-ad04-4fbc-a875-a7f3a63bfae0

📥 Commits

Reviewing files that changed from the base of the PR and between f0ce87d and 8503a08.

📒 Files selected for processing (1)
  • 4-Intermediário/9-Polimorfismo.md


---

## Por que usar?
Copy link

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

⚠️ Potential issue | 🟡 Minor

Padronize os headings ATX para remover espaço duplo após ##.

As linhas 12, 33 e 82 violam a regra MD019 (no-multiple-space-atx).

💡 Ajuste sugerido
-##  Por que usar?
+## Por que usar?

-##  Exemplo prático
+## Exemplo prático

-##  Outro exemplo (mais real)
+## Outro exemplo (mais real)

Also applies to: 33-33, 82-82

🧰 Tools
🪛 markdownlint-cli2 (0.21.0)

[warning] 12-12: Multiple spaces after hash on atx style heading

(MD019, no-multiple-space-atx)

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/9-Polimorfismo.md` at line 12, Headings use double spaces
after the ATX marker causing MD019 violations; locate the headings like "##  Por
que usar?" (and the other ATX headings at the same file that have two spaces
after the hashes) and remove the extra space so they read "## Por que usar?"
(and similarly for the other headings) to conform to the no-multiple-space-atx
rule.

Copy link

@coderabbitai coderabbitai bot left a comment

Choose a reason for hiding this comment

The reason will be displayed to describe this comment to others. Learn more.

♻️ Duplicate comments (2)
4-Intermediário/9-Polimorfismo.md (2)

125-127: ⚠️ Potential issue | 🟡 Minor

PHP_EOL está sendo descartado no loop de pagamentos.

Na Line 126, a expressão concatena PHP_EOL, mas sem echo o newline não é impresso.

Diff sugerido
 foreach ($pagamentos as $pagamento) {
-    $pagamento->pagar(100) . PHP_EOL;
+    echo $pagamento->pagar(100) . PHP_EOL;
 }
🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/9-Polimorfismo.md` around lines 125 - 127, The loop is
calling $pagamento->pagar(100) and concatenating PHP_EOL but never printing it;
change the loop so the result is output (e.g., use echo or print) — locate the
foreach over $pagamentos and update the body to output the return of pagar(100)
with PHP_EOL (for example: echo $pagamento->pagar(100) . PHP_EOL) so newlines
are actually printed.

33-33: ⚠️ Potential issue | 🟡 Minor

Corrija o espaçamento duplo nos headings ATX (MD019).

Nas Lines 33 e 82 há dois espaços após ##, o que viola no-multiple-space-atx.

Diff sugerido
-##  Exemplo prático
+## Exemplo prático
...
-##  Outro exemplo (mais real)
+## Outro exemplo (mais real)

Also applies to: 82-82

🤖 Prompt for AI Agents
Verify each finding against the current code and only fix it if needed.

In `@4-Intermediário/9-Polimorfismo.md` at line 33, O heading ATX "##  Exemplo
prático" (e outro similar na mesma seção) tem dois espaços após o marcador "##",
violando a regra no-multiple-space-atx; corrija retirando o espaço extra para
usar um único espaço após "##" (por exemplo "## Exemplo prático") em ambas
ocorrências mencionadas para normalizar todos os headings ATX no arquivo
4-Intermediário/9-Polimorfismo.md.
🤖 Prompt for all review comments with AI agents
Verify each finding against the current code and only fix it if needed.

Duplicate comments:
In `@4-Intermediário/9-Polimorfismo.md`:
- Around line 125-127: The loop is calling $pagamento->pagar(100) and
concatenating PHP_EOL but never printing it; change the loop so the result is
output (e.g., use echo or print) — locate the foreach over $pagamentos and
update the body to output the return of pagar(100) with PHP_EOL (for example:
echo $pagamento->pagar(100) . PHP_EOL) so newlines are actually printed.
- Line 33: O heading ATX "##  Exemplo prático" (e outro similar na mesma seção)
tem dois espaços após o marcador "##", violando a regra no-multiple-space-atx;
corrija retirando o espaço extra para usar um único espaço após "##" (por
exemplo "## Exemplo prático") em ambas ocorrências mencionadas para normalizar
todos os headings ATX no arquivo 4-Intermediário/9-Polimorfismo.md.

ℹ️ Review info
⚙️ Run configuration

Configuration used: defaults

Review profile: CHILL

Plan: Pro

Run ID: f10899de-ef7c-4797-9764-f8f82e253255

📥 Commits

Reviewing files that changed from the base of the PR and between 8503a08 and 247981e.

📒 Files selected for processing (1)
  • 4-Intermediário/9-Polimorfismo.md

Sign up for free to join this conversation on GitHub. Already have an account? Sign in to comment

Labels

None yet

Projects

None yet

Development

Successfully merging this pull request may close these issues.

1 participant